Re: [Qemu-devel] [PATCH] ivshmem: fix guest unable to start with ioeventfd

2011-12-02 Thread Cam Macdonell
2011/11/30 Cam Macdonell :
> 2011/11/30 Zang Hongyong :
>> Can this bug fix patch be applied yet?
>
> Sorry, for not replying yet.  I'll test your patch within the next day.

Have you confirmed the proper receipt of interrupts in the receiving guests?

I can confirm the bug occurs with ioeventfd enabled and that the
patches fixes it, but sometime after 15.1, I no longer see interrupts
(MSI or regular) being delivered in the guest.

I will bisect tomorrow.

Cam

>
>> With this bug, guest os cannot successfully boot with ioeventfd.
>> Thus the new PIO DoorBell patch cannot be posted.
>
> Well, you can certainly post the new patch, just clarify that it's
> dependent on this patch.
>
> Sincerely,
> Cam
>
>>
>> Thanks,
>> Hongyong
>>
>> 于 2011/11/24,星期四 18:05, zanghongy...@huawei.com 写道:
>>> From: Hongyong Zang 
>>>
>>> When a guest boots with ioeventfd, an error (by gdb) occurs:
>>>   Program received signal SIGSEGV, Segmentation fault.
>>>   0x006009cc in setup_ioeventfds (s=0x171dc40)
>>>   at /home/louzhengwei/git_source/qemu-kvm/hw/ivshmem.c:363
>>>   363 for (j = 0; j < s->peers[i].nb_eventfds; j++) {
>>> The bug is due to accessing s->peers which is NULL.
>>>
>>> This patch uses the memory region API to replace the old one 
>>> kvm_set_ioeventfd_mmio_long().
>>> And this patch makes memory_region_add_eventfd() called in ivshmem_read() 
>>> when qemu receives
>>> eventfd information from ivshmem_server.
>>>
>>> Signed-off-by: Hongyong Zang 
>>> ---
>>>  hw/ivshmem.c |   41 ++---
>>>  1 files changed, 14 insertions(+), 27 deletions(-)
>>>
>>> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
>>> index 242fbea..be26f03 100644
>>> --- a/hw/ivshmem.c
>>> +++ b/hw/ivshmem.c
>>> @@ -58,7 +58,6 @@ typedef struct IVShmemState {
>>>  CharDriverState *server_chr;
>>>  MemoryRegion ivshmem_mmio;
>>>
>>> -pcibus_t mmio_addr;
>>>  /* We might need to register the BAR before we actually have the 
>>> memory.
>>>   * So prepare a container MemoryRegion for the BAR immediately and
>>>   * add a subregion when we have the memory.
>>> @@ -346,8 +345,14 @@ static void close_guest_eventfds(IVShmemState *s, int 
>>> posn)
>>>  guest_curr_max = s->peers[posn].nb_eventfds;
>>>
>>>  for (i = 0; i < guest_curr_max; i++) {
>>> -kvm_set_ioeventfd_mmio_long(s->peers[posn].eventfds[i],
>>> -s->mmio_addr + DOORBELL, (posn << 16) | i, 0);
>>> +if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) {
>>> +memory_region_del_eventfd(&s->ivshmem_mmio,
>>> + DOORBELL,
>>> + 4,
>>> + true,
>>> + (posn << 16) | i,
>>> + s->peers[posn].eventfds[i]);
>>> +}
>>>  close(s->peers[posn].eventfds[i]);
>>>  }
>>>
>>> @@ -355,22 +360,6 @@ static void close_guest_eventfds(IVShmemState *s, int 
>>> posn)
>>>  s->peers[posn].nb_eventfds = 0;
>>>  }
>>>
>>> -static void setup_ioeventfds(IVShmemState *s) {
>>> -
>>> -int i, j;
>>> -
>>> -for (i = 0; i <= s->max_peer; i++) {
>>> -for (j = 0; j < s->peers[i].nb_eventfds; j++) {
>>> -memory_region_add_eventfd(&s->ivshmem_mmio,
>>> -  DOORBELL,
>>> -  4,
>>> -  true,
>>> -  (i << 16) | j,
>>> -  s->peers[i].eventfds[j]);
>>> -}
>>> -}
>>> -}
>>> -
>>>  /* this function increase the dynamic storage need to store data about 
>>> other
>>>   * guests */
>>>  static void increase_dynamic_storage(IVShmemState *s, int new_min_size) {
>>> @@ -491,10 +480,12 @@ static void ivshmem_read(void *opaque, const uint8_t 
>>> * buf, int flags)
>>>  }
>>>
>>>  if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) {
>>> -if (kvm_set_ioeventfd_mmio_long(incoming_fd, s->mmio_addr + 
>>> DOORBELL,
>>> -(incoming_posn << 16) | guest_max_eventfd, 1) < 0) 
>>> {
>>> -fprintf(stderr, "ivshmem: ioeventfd not available\n");
>>> -}
>>> +memory_region_add_eventfd(&s->ivshmem_mmio,
>>> +  DOORBELL,
>>> +  4,
>>> +  true,
>>> +  (incoming_posn << 16) | 
>>> guest_max_eventfd,
>>> +  incoming_fd);
>>>  }
>>>
>>>  return;
>>> @@ -659,10 +650,6 @@ static int pci_ivshmem_init(PCIDevice *dev)
>>>  memory_region_init_io(&s->ivshmem_mmio, &ivshmem_mmio_ops, s,
>>>"ivshmem-mmio", IVSHMEM_REG_BAR_SIZE);
>>>
>>> -if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) {
>>> -setup_ioeventfds(s);
>>> -}
>>> -
>>>  /* region for registers*/
>>> 

Re: [Qemu-devel] [PATCH] qed: add qed-tool.py image manipulation utility

2011-12-02 Thread Kevin Wolf
Am 01.12.2011 18:00, schrieb Stefan Hajnoczi:
> The qed-tool.py utility can inspect and manipulate QED image files.  It
> can be used for testing to see the state of image metadata and also to
> inject corruptions into the image file.  It also has a scrubbing feature
> to copy just the metadata out of an image file, allowing users to share
> broken image files without revealing data in bug reports.
> 
> This has lived in my local repo for a long time but could be useful to
> others.
> 
> Signed-off-by: Stefan Hajnoczi 

For most of the commands, I think qemu-img/qemu-io should be extended
instead of creating scripts for one or two formats and lacking the
functionality for the rest.

Kevin



[Qemu-devel] [PATCH] Convert source files to UTF-8 encoding

2011-12-02 Thread Stefan Weil
Most QEMU files either are pure ASCII or use UTF-8.
Convert some files which still used ISO-8859-1 to UTF-8.

Signed-off-by: Stefan Weil 
---
 hw/ds1225y.c   |2 +-
 hw/fdc.c   |2 +-
 hw/jazz_led.c  |2 +-
 hw/tc6393xb_template.h |2 +-
 hw/vmport.c|2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/ds1225y.c b/hw/ds1225y.c
index 6852a61..5da2d68 100644
--- a/hw/ds1225y.c
+++ b/hw/ds1225y.c
@@ -1,7 +1,7 @@
 /*
  * QEMU NVRAM emulation for DS1225Y chip
  *
- * Copyright (c) 2007-2008 Herv� Poussineau
+ * Copyright (c) 2007-2008 Hervé Poussineau
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
diff --git a/hw/fdc.c b/hw/fdc.c
index ecaad09..531a34e 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -2,7 +2,7 @@
  * QEMU Floppy disk emulator (Intel 82078)
  *
  * Copyright (c) 2003, 2007 Jocelyn Mayer
- * Copyright (c) 2008 Herv� Poussineau
+ * Copyright (c) 2008 Hervé Poussineau
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
diff --git a/hw/jazz_led.c b/hw/jazz_led.c
index eb472a0..c75aef7 100644
--- a/hw/jazz_led.c
+++ b/hw/jazz_led.c
@@ -1,7 +1,7 @@
 /*
  * QEMU JAZZ LED emulator.
  *
- * Copyright (c) 2007 Herv� Poussineau
+ * Copyright (c) 2007 Hervé Poussineau
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
diff --git a/hw/tc6393xb_template.h b/hw/tc6393xb_template.h
index 1ccf6e8..4cbbad5 100644
--- a/hw/tc6393xb_template.h
+++ b/hw/tc6393xb_template.h
@@ -5,7 +5,7 @@
  *
  * FB support code. Based on G364 fb emulator
  *
- * Copyright (c) 2007 Herv� Poussineau
+ * Copyright (c) 2007 Hervé Poussineau
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
diff --git a/hw/vmport.c b/hw/vmport.c
index b5c6fa1..0a3dbc5 100644
--- a/hw/vmport.c
+++ b/hw/vmport.c
@@ -1,7 +1,7 @@
 /*
  * QEMU VMPort emulation
  *
- * Copyright (C) 2007 Herv� Poussineau
+ * Copyright (C) 2007 Hervé Poussineau
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
-- 
1.7.2.5




Re: [Qemu-devel] [PATCH 01/18] qom: add new dynamic property infrastructure based on Visitors

2011-12-02 Thread Kevin Wolf
Am 02.12.2011 02:08, schrieb Anthony Liguori:
> On 12/01/2011 09:52 AM, Kevin Wolf wrote:
>> Am 30.11.2011 22:03, schrieb Anthony Liguori:
>>> qdev properties are settable only during construction and static to classes.
>>> This isn't flexible enough for QOM.
>>>
>>> This patch introduces a property interface for qdev that provides dynamic
>>> properties that are tied to objects, instead of classes.  These properties 
>>> are
>>> Visitor based instead of string based too.
>>>
>>> Signed-off-by: Anthony Liguori
>>> ---
>>>   hw/qdev.c |   99 +++
>>>   hw/qdev.h |  118 
>>> +
>>>   qerror.c  |4 ++
>>>   qerror.h  |3 ++
>>>   4 files changed, 224 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/hw/qdev.c b/hw/qdev.c
>>> index 106407f..ad2d44f 100644
>>> --- a/hw/qdev.c
>>> +++ b/hw/qdev.c
>>> @@ -390,12 +390,33 @@ void qdev_init_nofail(DeviceState *dev)
>>>   }
>>>   }
>>>
>>> +static void qdev_property_del_all(DeviceState *dev)
>>> +{
>>> +while (dev->properties) {
>>> +GSList *i = dev->properties;
>>> +DeviceProperty *prop = i->data;
>>> +
>>> +dev->properties = i->next;
>>> +
>>> +if (prop->release) {
>>> +prop->release(dev, prop->name, prop->opaque);
>>> +}
>>> +
>>> +g_free(prop->name);
>>> +g_free(prop->type);
>>> +g_free(prop);
>>> +g_free(i);
>>> +}
>>> +}
>>> +
>>>   /* Unlink device from bus and free the structure.  */
>>>   void qdev_free(DeviceState *dev)
>>>   {
>>>   BusState *bus;
>>>   Property *prop;
>>>
>>> +qdev_property_del_all(dev);
>>> +
>>>   if (dev->state == DEV_STATE_INITIALIZED) {
>>>   while (dev->num_child_bus) {
>>>   bus = QLIST_FIRST(&dev->child_bus);
>>> @@ -962,3 +983,81 @@ char* qdev_get_fw_dev_path(DeviceState *dev)
>>>
>>>   return strdup(path);
>>>   }
>>> +
>>> +void qdev_property_add(DeviceState *dev, const char *name, const char 
>>> *type,
>>> +   DevicePropertyEtter *get, DevicePropertyEtter *set,
>>> +   DevicePropertyRelease *release, void *opaque,
>>> +   Error **errp)
>>
>> How about letting the caller pass in a DeviceProperty for improved
>> readability and usability? Instead of memorizing the order of currently
>> eight parameters (could probably become more in the future) you can use
>> proper C99 initializers then.
> 
> Yeah, instead of taking a void *opaque, it could then just take the 
> DeviceProperty and use container_of adding a good bit more type safety.  I 
> like 
> it, thanks for the suggestion.
> 
>>
>>> @@ -45,6 +82,7 @@ struct DeviceState {
>>>   QTAILQ_ENTRY(DeviceState) sibling;
>>>   int instance_id_alias;
>>>   int alias_required_for_version;
>>> +GSList *properties;
>>>   };
>>
>> Why GSList instead of qemu-queue.h macros that would provide type safety?
> 
> You're clearly thwarting my attempts at slowly introducing GSList as a 
> replacement for qemu-queue ;-)
> 
> I really dislike qemu-queue.  I think it's a whole lot more difficult to use 
> in 
> practice.  The glib data structures are much more rich than qemu-queue.

qemu-queue.h is type safe, GSList is not. IMO that's a show stopper and
I can't understand why we even need to talk about it.

If you want to convince me of the opposite, it certainly needs more than
vague "easier to use" hand waving.

Kevin



Re: [Qemu-devel] [PATCH] qed: add qed-tool.py image manipulation utility

2011-12-02 Thread Stefan Hajnoczi
On Fri, Dec 2, 2011 at 9:15 AM, Kevin Wolf  wrote:
> Am 01.12.2011 18:00, schrieb Stefan Hajnoczi:
>> The qed-tool.py utility can inspect and manipulate QED image files.  It
>> can be used for testing to see the state of image metadata and also to
>> inject corruptions into the image file.  It also has a scrubbing feature
>> to copy just the metadata out of an image file, allowing users to share
>> broken image files without revealing data in bug reports.
>>
>> This has lived in my local repo for a long time but could be useful to
>> others.
>>
>> Signed-off-by: Stefan Hajnoczi 
>
> For most of the commands, I think qemu-img/qemu-io should be extended
> instead of creating scripts for one or two formats and lacking the
> functionality for the rest.

I have mixed feelings about that because I don't think a common
interface will ever live up to its promise.  We will have an interface
that no two file formats implement much of (i.e. lots of NULL function
pointers).  The user experience will be that these commands don't work
("Operation not supported") and it's more flexible (and less code) to
write a format-specific script like this.

Also, usually before I use any of these potentially destructive
commands I review the script's code to double-check exactly what the
impact on the file will be.  It's nice to have a concise Python script
that can be reviewed easily rather than looking through layers of
production C code.

Do you really think there is much worth making common here?

Stefan



Re: [Qemu-devel] [PATCH] qemu-nbd.c : fix memory leak

2011-12-02 Thread Stefan Hajnoczi
On Fri, Dec 02, 2011 at 08:48:50AM +0100, Paolo Bonzini wrote:
> On 12/02/2011 08:42 AM, Stefan Weil wrote:
> >>>
> >>>-if (sharing_fds[0] == -1)
> >>>+if (sharing_fds[0] == -1) {
> >>>+g_free(sharing_fds);
> >>>  return 1;
> >>>+}
> >>>
> >>>  if (device) {
> >>>  int ret;
> >>Zhihui,
> >>
> >>Kernel should free all memory used by the process after it exits.  So
> >>there's no memory leak even without explicit free.
> >
> >That's correct. Nevertheless fixing this helps to find other more important
> >memory leaks with static or dynamic code analyzers like cppcheck or
> >valgrind.
> >
> >Reviewed-by: Stefan Weil 
> 
> Please hold off, I'm about to introduce large changes to qemu-nbd
> for asynchronous I/O (including getting rid of sharing_fds in favor
> of the main loop) and and I'd rather avoid gratuitous conflicts.

Okay, let's wait for Paolo's changes.

Stefan



Re: [Qemu-devel] [PATCH] qed: add qed-tool.py image manipulation utility

2011-12-02 Thread Kevin Wolf
Am 02.12.2011 11:23, schrieb Stefan Hajnoczi:
> On Fri, Dec 2, 2011 at 9:15 AM, Kevin Wolf  wrote:
>> Am 01.12.2011 18:00, schrieb Stefan Hajnoczi:
>>> The qed-tool.py utility can inspect and manipulate QED image files.  It
>>> can be used for testing to see the state of image metadata and also to
>>> inject corruptions into the image file.  It also has a scrubbing feature
>>> to copy just the metadata out of an image file, allowing users to share
>>> broken image files without revealing data in bug reports.
>>>
>>> This has lived in my local repo for a long time but could be useful to
>>> others.
>>>
>>> Signed-off-by: Stefan Hajnoczi 
>>
>> For most of the commands, I think qemu-img/qemu-io should be extended
>> instead of creating scripts for one or two formats and lacking the
>> functionality for the rest.
> 
> I have mixed feelings about that because I don't think a common
> interface will ever live up to its promise.  We will have an interface
> that no two file formats implement much of (i.e. lots of NULL function
> pointers).  The user experience will be that these commands don't work
> ("Operation not supported") and it's more flexible (and less code) to
> write a format-specific script like this.
> 
> Also, usually before I use any of these potentially destructive
> commands I review the script's code to double-check exactly what the
> impact on the file will be.  It's nice to have a concise Python script
> that can be reviewed easily rather than looking through layers of
> production C code.
> 
> Do you really think there is much worth making common here?

Ok, I had another, closer look and there are two functions that I would
prefer to see in qemu-img info, namely fragmentation and dirty flag
status. For the rest you're probably right that an external script makes
more sense.

Kevin



Re: [Qemu-devel] [PATCH] Convert source files to UTF-8 encoding

2011-12-02 Thread Peter Maydell
On 2 December 2011 09:30, Stefan Weil  wrote:
> Most QEMU files either are pure ASCII or use UTF-8.
> Convert some files which still used ISO-8859-1 to UTF-8.

Looks good. It looks like with these done there are only
two more files which have non-UTF-8 in them:
./linux-user/cpu-uname.c
./linux-user/arm/nwfpe/fpopcode.h

We can deal with those in separate patches I guess.

(I checked with this command:

for f in $(find . -name '*.[ch]'); do iconv -f UTF-8 -t UTF-8 -o
/dev/null "$f" 2>/dev/null || echo "$f"; done

)

-- PMM



Re: [Qemu-devel] [PATCH 06/18] qom: add child properties (composition)

2011-12-02 Thread Kevin Wolf
Am 30.11.2011 22:03, schrieb Anthony Liguori:
> Child properties express a relationship of composition.
> 
> Signed-off-by: Anthony Liguori 

Do we have a flag or something that makes sure that a child is never
removed without its parent? The code assumes that child stays valid as
long as the parent lives.

> @@ -499,4 +499,24 @@ gchar *qdev_get_canonical_path(DeviceState *dev);
>   */
>  DeviceState *qdev_resolve_path(const char *path, bool *ambiguous);
>  
> +/**
> + * @qdev_property_add_child - Add a child property to a device
> + *
> + * Child properties form the composition tree.  All devices need to be a 
> child
> + * of another device.  Devices can only be a child of one device.
> + *
> + * There is no way for a child to determine what it's parent is.  It is not

s/it's/its/

Kevin



Re: [Qemu-devel] [PATCH 07/18] qom: add link properties

2011-12-02 Thread Kevin Wolf
Am 30.11.2011 22:03, schrieb Anthony Liguori:
> Links represent an ephemeral relationship between devices.  They are meant to
> replace the qdev concept of busses by allowing more informal relationships
> between devices.
> 
> Links are fairly limited in their usefulness without implementing QOM-style
> subclassing and interfaces.
> 
> Signed-off-by: Anthony Liguori 

Same thing as in the previous patch: The code doesn't seem to be
prepared for the case that the "child" (this is not a tree, so there are
no children...) is removed. While you could say that devices used for
composition just shouldn't be unpluggable, I don't think you can require
this for links.

Kevin



Re: [Qemu-devel] [PATCH 02/18] qom: register legacy properties as new style properties

2011-12-02 Thread Gerd Hoffmann
  Hi,

>>> +prop->info->print(dev, prop, buffer, sizeof(buffer));
>>> +visit_type_str(v,&ptr, name, errp);
>>
>> I think you can look at prop->info->type here and do something more
>> clever at least for the bool + integer properties.
> 
> That might get a little tough because I want legacy<> types to be
> handled as strings.  I guess we could promote bool/int to non-legacy types.

Indeed.  For chardev and drive properties which will be some kind of
link<..> in the new world (correct?) it probably makes sense to keep
them as legacy<...>.

While being at it:  bus properties might need some more thinking here
too.  Partly they are used for physical addressing, so they will be
replaced by link<...> too I guess?  Some of them have special parsing
and will end up in legacy<...> anyway.  Some are plain integers though
(hda for example) ...

cheers,
  Gerd




Re: [Qemu-devel] [PATCH 14/18] rtc: add a dynamic property for retrieving the date

2011-12-02 Thread Gerd Hoffmann
  Hi,

> https://github.com/aliguori/qidl/
> 
> In your example:
> 
> struct SomeDev {
>DeviceState _immutable dev;
>Chardev _immutable *chr;
>uint32_t   reg1;
>uint32_t   reg2;
>[ ... ]
> };
> 
>>
>> ... instead of the vmstate structs we create manually today.  Likewise
>> for properties.  And probably we can even generate different visitors
>> for different "views" at the same struct.
> 
> qc generates a json description of the struct.  You can then use a
> generate to take that json and generate code for VMState, QAPI, etc.
> 
> The readme has quite a lot of detail about the syntax.  The parser is
> pretty complete already.
> 
> https://github.com/aliguori/qidl/blob/master/qc.md

Ah, nice.  Any plans to support lists there, so it is possible to save
the state of (multiple) in-flight transactions?

> But I want to get us moving on QOM first before I go any further with
> this.  We can always go back and remove the manually written visit
> functions.

Sure, one step at a time.  It helps when reviewing to have a rough idea
of the big pixture though ...

cheers,
  Gerd




Re: [Qemu-devel] Boot from disk problem

2011-12-02 Thread Ignacio Geli

  
  
El 01/12/11 07:29, Artyom Tarasenko escribió:

  On Sat, Nov 26, 2011 at 9:01 AM, Blue Swirl  wrote:

  
On Fri, Nov 25, 2011 at 18:24, Ignacio Geli  wrote:


  
El 25/11/11 13:01, Andreas Färber escribió:

Hi,

Am 25.11.2011 16:23, schrieb Ignacio Geli:

Im trying to run a solaris 2.5.1 vm acording the instructions of i found
in this blog:
http://tyom.blogspot.com/2009/12/solaris-under-qemu-how-to.html#uds-search-results



I'm not sure if Artyom has submitted all his patches to QEMU yet.

  
  

This stuff is in. Definitely worked at 0.13 - 0.14 times, but I never
had time to check 0.15+.


  

  compile my qemu with:
git clone git://git.savannah.nongnu.org/qemu.git
cd qemu
./configure --target-list=sparc-softmmu
make
(version 0.13.50)

That 2009 blog is outdated: QEMU now lives in
git://git.qemu.org/qemu.git
and should be at 0.15.93 (1.0-rc3). Compare http://qemu.org for details.

CC'ed sparc maintainer and Artyom.

Andreas

Andesas tks for the info.
upgrading to 0.15.1 did not solve the issue.

Adding some info:

QEMU emulator version 0.15.1, Copyright (c) 2003-2008 Fabrice Bellard
Linux ws2132 2.6.32-5-openvz-amd64 #1 SMP Mon Oct 3 05:12:50 UTC 2011 x86_64 GNU/Linux
Debian squeeze


Regards!

Ive downloaded the ss5.bin bios (sparc station 5)) I have the solaris
disk and i can do the installation but can't get the disk to boot.

I can boot from the cd, mount and check the /etc/system file it has the
"set scsi_options=0x58" option i set to make it work, still not working:

Here is the output:

/ok boot disk0:d
Boot device: /iommu/sbus/espdma@5,840/esp@5,880/sd@0,0:d  File
and args:
SunOS Release 5.5.1 Version Generic [UNIX(R) System V Release 4.0]
Copyright (c) 1983-1996, Sun Microsystems, Inc.
WARNING:
/iommu@0,1000/sbus@0,10001000/espdma@5,840/esp@5,880/sd@1,0
(sd1):
    corrupt label - bad geometry

    Label says 1310720 blocks, Drive says 883120 blocks
Cannot mount root on
/iommu@0,1000/sbus@0,10001000/espdma@5,840/esp@5,880/sd@0,0:d fstype
ufs
panic: vfs_mountroot: cannot mount root
rebooting...
Resetting ... /

maybe the disk is wrong
ive try several disk one following these instructions:
1) qemu-img create -f qcow2 file.qcow2 12G
2) Add -drive file=file.qcow2,unit=3 to your qemu startup
3) Boot single user
4) echo
'disk_type="QEMU12.0G":ctlr=SCSI:ncyl=49152:acyl=0:pcyl=49152:nhead=16:nsect=32:rpm=7200'

/etc/format.dat



I'd guess these geometry parameters are not correct for your 12G disk.
It's strange though that the installer kernel sees different geometry
from the normal boot kernel.



  5) echo
'partition="QEMU12.0G":disk="QEMU12.0G":ctlr=SCSI:2=0,25165824:0=0,20971520:6=40960,4194304'

/etc/format.dat



These could also be wrong, but I have no idea what the numbers mean.

  
  
In order not to mess with all this numbers I used a pre-defined 1.3G
disk in the Solaris format utility and created it with dd:
dd if=/dev/zero of=$1  bs=10k count=133756


Otherwise, Ignacio, are you sure that disk0 is your root FS disk and
not something else? Can you post your qemu command line?



qemu-system-sparc -M SS-5 -startdate "2009-12-13" -bios
/root/ss5.bin -nographic -hda /root/imagenes/solaris.disk -hdb
/root/solaris_2.5.1_1197.iso

Thks for your help Artyom. I'll try with a dd, and solaris format
utility and I'll let u know

Ignacio

-- 
  
  
  
        Simplicity is the ultimate sophistication
  
        Ignacio Geli
        Implementación y Soporte
   
  

  



[Qemu-devel] [Bug 899140] [NEW] Problem with Linux Kernel Traffic Control

2011-12-02 Thread Vincent Autefage
Public bug reported:

Hi,

The two last main versions of QEMU (0.15 and 1.0) have an important problem 
when running on a Linux distribution which running itself a Traffic Control 
(TC) instance.
Indeed, when TC is configured with a Token Bucket Filter (TBF) with a 
particular rate, the effective rate is very slower than the desired one.

For instance, lets consider the following configuration :

# tc qdisc add dev eth0 root tbf rate 20mbit burst 20k latency 50ms

The effective rate will be about 100kbit/s ! (verified with iperf)
I've encountered this problem on versions 0.15 and 1.0 but not with the 0.14...
In the 0.14, we have a rate of 19.2 mbit/s which is quiet normal.

I've done the experimentation on several hosts :
 
- Debian 32bit core i7, 4GB RAM
- Debian 64bit core i7, 8GB RAM
- 3 different high performance servers : Ubuntu 64 bits, 48 AMD Opteron, 128GB 
of RAM

The problem is always the same... The problem is also seen with a Class
Based Queuing (CBQ) in TC.

Thanks

** Affects: qemu
 Importance: Undecided
 Status: New

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

Title:
  Problem with Linux Kernel Traffic Control

Status in QEMU:
  New

Bug description:
  Hi,

  The two last main versions of QEMU (0.15 and 1.0) have an important problem 
when running on a Linux distribution which running itself a Traffic Control 
(TC) instance.
  Indeed, when TC is configured with a Token Bucket Filter (TBF) with a 
particular rate, the effective rate is very slower than the desired one.

  For instance, lets consider the following configuration :

  # tc qdisc add dev eth0 root tbf rate 20mbit burst 20k latency 50ms

  The effective rate will be about 100kbit/s ! (verified with iperf)
  I've encountered this problem on versions 0.15 and 1.0 but not with the 
0.14...
  In the 0.14, we have a rate of 19.2 mbit/s which is quiet normal.

  I've done the experimentation on several hosts :
   
  - Debian 32bit core i7, 4GB RAM
  - Debian 64bit core i7, 8GB RAM
  - 3 different high performance servers : Ubuntu 64 bits, 48 AMD Opteron, 
128GB of RAM

  The problem is always the same... The problem is also seen with a
  Class Based Queuing (CBQ) in TC.

  Thanks

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



[Qemu-devel] [Bug 899143] [NEW] Raw img not recognized by Windows

2011-12-02 Thread Vincent Autefage
Public bug reported:

Hi,

The installation process of Windows (XP/Vista/7) doesn’t seem to recognize a 
raw img generated by qemu-img.
The installer does not see any hard drive...

The problem exists only with a raw img but not with a vmdk for instance.

Thanks

** Affects: qemu
 Importance: Undecided
 Status: New

** Description changed:

  Hi,
  
  The installation process of Windows (XP/Vista/7) doesn’t seem to recognize a 
raw img generated by qemu-img.
- The installer do not see any hard drive...
+ The installer does not see any hard drive...
  
  The problem exists only with a raw img but not with a vmdk for instance.
  
  Thanks

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

Title:
  Raw img not recognized by Windows

Status in QEMU:
  New

Bug description:
  Hi,

  The installation process of Windows (XP/Vista/7) doesn’t seem to recognize a 
raw img generated by qemu-img.
  The installer does not see any hard drive...

  The problem exists only with a raw img but not with a vmdk for
  instance.

  Thanks

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



[Qemu-devel] [Bug 899140] Re: Problem with Linux Kernel Traffic Control

2011-12-02 Thread Vincent Autefage
** Description changed:

  Hi,
  
- The two last main versions of QEMU (0.15 and 1.0) have an important problem 
when running on a Linux distribution which running itself a Traffic Control 
(TC) instance.
+ The last main versions of QEMU (0.14.1, 0.15 and 1.0) have an important 
problem when running on a Linux distribution which running itself a Traffic 
Control (TC) instance.
  Indeed, when TC is configured with a Token Bucket Filter (TBF) with a 
particular rate, the effective rate is very slower than the desired one.
  
  For instance, lets consider the following configuration :
  
  # tc qdisc add dev eth0 root tbf rate 20mbit burst 20k latency 50ms
  
  The effective rate will be about 100kbit/s ! (verified with iperf)
- I've encountered this problem on versions 0.15 and 1.0 but not with the 
0.14...
- In the 0.14, we have a rate of 19.2 mbit/s which is quiet normal.
+ I've encountered this problem on versions 0.14.1, 0.15 and 1.0 but not with 
the 0.14.0...
+ In the 0.14.0, we have a rate of 19.2 mbit/s which is quiet normal.
  
  I've done the experimentation on several hosts :
-  
+ 
  - Debian 32bit core i7, 4GB RAM
  - Debian 64bit core i7, 8GB RAM
  - 3 different high performance servers : Ubuntu 64 bits, 48 AMD Opteron, 
128GB of RAM
  
  The problem is always the same... The problem is also seen with a Class
  Based Queuing (CBQ) in TC.
  
  Thanks

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

Title:
  Problem with Linux Kernel Traffic Control

Status in QEMU:
  New

Bug description:
  Hi,

  The last main versions of QEMU (0.14.1, 0.15 and 1.0) have an important 
problem when running on a Linux distribution which running itself a Traffic 
Control (TC) instance.
  Indeed, when TC is configured with a Token Bucket Filter (TBF) with a 
particular rate, the effective rate is very slower than the desired one.

  For instance, lets consider the following configuration :

  # tc qdisc add dev eth0 root tbf rate 20mbit burst 20k latency 50ms

  The effective rate will be about 100kbit/s ! (verified with iperf)
  I've encountered this problem on versions 0.14.1, 0.15 and 1.0 but not with 
the 0.14.0...
  In the 0.14.0, we have a rate of 19.2 mbit/s which is quiet normal.

  I've done the experimentation on several hosts :

  - Debian 32bit core i7, 4GB RAM
  - Debian 64bit core i7, 8GB RAM
  - 3 different high performance servers : Ubuntu 64 bits, 48 AMD Opteron, 
128GB of RAM

  The problem is always the same... The problem is also seen with a
  Class Based Queuing (CBQ) in TC.

  Thanks

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



Re: [Qemu-devel] [PATCH 14/18] rtc: add a dynamic property for retrieving the date

2011-12-02 Thread Anthony Liguori

On 12/02/2011 06:35 AM, Gerd Hoffmann wrote:

The readme has quite a lot of detail about the syntax.  The parser is
pretty complete already.

https://github.com/aliguori/qidl/blob/master/qc.md


Ah, nice.  Any plans to support lists there, so it is possible to save
the state of (multiple) in-flight transactions?


I had support for lists locally and just pushed it.  It is based on GSList and 
uses a marker to indicate the type.  So:


struct MyDevice {
  int32_t reg1;
  int32_t reg2;

  GSList _type_is(MyRequest) *pending_requests;
};

This is nice and works and extends to any list type but the syntax is awkward. 
So I also swizzled things so that we run through the preprocessor first such 
that we can do:


#define QSList(a) GSList _type_is(MyRequest)

struct MyDevice {
  int32_t reg1;
  int32_t reg2;

  QSList(MyRequest) *pending_requests;
};

Regards,

Anthony Liguori


But I want to get us moving on QOM first before I go any further with
this.  We can always go back and remove the manually written visit
functions.


Sure, one step at a time.  It helps when reviewing to have a rough idea
of the big pixture though ...

cheers,
   Gerd







[Qemu-devel] Still build failure for qemu-1.0

2011-12-02 Thread erik . rull
Hi all,

there was the promise to test the build failure from rc4 with the released
version and that it should work.

Its still present :-( please assist me here:

  CClibhw64/9pfs/coxattr.o
  CClibhw64/9pfs/virtio-9p-handle.o
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function
'handle_update_file_cred':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:95: warning: implicit
declaration of function 'openat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:95: warning: nested extern
declaration of 'openat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:103: warning: implicit
declaration of function 'fchownat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:103: warning: nested extern
declaration of 'fchownat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_lstat':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:120: warning: implicit
declaration of function 'fstatat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:120: warning: nested extern
declaration of 'fstatat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_readlink':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:135: warning: implicit
declaration of function 'readlinkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:135: warning: nested extern
declaration of 'readlinkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_opendir':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:167: warning: implicit
declaration of function 'fdopendir'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:167: warning: nested extern
declaration of 'fdopendir'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:167: warning: assignment
makes pointer from integer without a cast
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_mknod':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:265: warning: implicit
declaration of function 'mknodat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:265: warning: nested extern
declaration of 'mknodat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_mkdir':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:283: warning: implicit
declaration of function 'mkdirat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:283: warning: nested extern
declaration of 'mkdirat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_symlink':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:333: warning: implicit
declaration of function 'symlinkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:333: warning: nested extern
declaration of 'symlinkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_link':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:363: warning: implicit
declaration of function 'linkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:363: warning: nested extern
declaration of 'linkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_renameat':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:570: warning: implicit
declaration of function 'renameat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:570: warning: nested extern
declaration of 'renameat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function 'handle_unlinkat':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:593: warning: implicit
declaration of function 'unlinkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:593: warning: nested extern
declaration of 'unlinkat'
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c: In function
'handle_ioc_getversion':
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:616: error:
'FS_IOC_GETVERSION' undeclared (first use in this function)
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:616: error: (Each undeclared
identifier is reported only once
/home/erik/qemu-1.0/hw/9pfs/virtio-9p-handle.c:616: error: for each
function it appears in.)
make[2]: *** [9pfs/virtio-9p-handle.o] Error 1
make[1]: *** [subdir-libhw64] Error 2
make[1]: Leaving directory `/home/erik/qemu-1.0'
make: *** [qemu-build] Error 2
erik@debian:~$





Re: [Qemu-devel] [Qemu-trivial] [PATCH] configure: Pull linux-headers/asm symlink creation out of loop

2011-12-02 Thread Stefan Hajnoczi
On Wed, Nov 30, 2011 at 11:59:04AM +, Peter Maydell wrote:
> Pull the creation of the linux-headers/asm symlink out of the loop
> so we don't pointlessly delete and recreate it once for each target.
> Also move the setting of the includes variable up so that it is
> in the same place as the other code which sets this variable.
> 
> Signed-off-by: Peter Maydell 
> ---
>  configure |   37 -
>  1 files changed, 20 insertions(+), 17 deletions(-)

Thanks, applied to the trivial patches -next tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches-next

Stefan



Re: [Qemu-devel] [PATCH] qed: add qed-tool.py image manipulation utility

2011-12-02 Thread Stefan Hajnoczi
On Fri, Dec 2, 2011 at 11:13 AM, Kevin Wolf  wrote:
> Am 02.12.2011 11:23, schrieb Stefan Hajnoczi:
>> On Fri, Dec 2, 2011 at 9:15 AM, Kevin Wolf  wrote:
>>> Am 01.12.2011 18:00, schrieb Stefan Hajnoczi:
 The qed-tool.py utility can inspect and manipulate QED image files.  It
 can be used for testing to see the state of image metadata and also to
 inject corruptions into the image file.  It also has a scrubbing feature
 to copy just the metadata out of an image file, allowing users to share
 broken image files without revealing data in bug reports.

 This has lived in my local repo for a long time but could be useful to
 others.

 Signed-off-by: Stefan Hajnoczi 
>>>
>>> For most of the commands, I think qemu-img/qemu-io should be extended
>>> instead of creating scripts for one or two formats and lacking the
>>> functionality for the rest.
>>
>> I have mixed feelings about that because I don't think a common
>> interface will ever live up to its promise.  We will have an interface
>> that no two file formats implement much of (i.e. lots of NULL function
>> pointers).  The user experience will be that these commands don't work
>> ("Operation not supported") and it's more flexible (and less code) to
>> write a format-specific script like this.
>>
>> Also, usually before I use any of these potentially destructive
>> commands I review the script's code to double-check exactly what the
>> impact on the file will be.  It's nice to have a concise Python script
>> that can be reviewed easily rather than looking through layers of
>> production C code.
>>
>> Do you really think there is much worth making common here?
>
> Ok, I had another, closer look and there are two functions that I would
> prefer to see in qemu-img info, namely fragmentation and dirty flag
> status. For the rest you're probably right that an external script makes
> more sense.

Okay, I will resubmit with patches to implement those two and a
cut-down qed-tool.py.

Stefan



Re: [Qemu-devel] [Bug 899140] Re: Problem with Linux Kernel Traffic Control

2011-12-02 Thread Stefan Hajnoczi
Hi Vincent,
Please give steps to reproduce the problem including the QEMU
command-lines you used and what commands need to be run inside the
guest and on the host.

Stefan



Re: [Qemu-devel] [PATCH 14/18] rtc: add a dynamic property for retrieving the date

2011-12-02 Thread Gerd Hoffmann
On 12/02/11 14:20, Anthony Liguori wrote:
> On 12/02/2011 06:35 AM, Gerd Hoffmann wrote:
>>> The readme has quite a lot of detail about the syntax.  The parser is
>>> pretty complete already.
>>>
>>> https://github.com/aliguori/qidl/blob/master/qc.md
>>
>> Ah, nice.  Any plans to support lists there, so it is possible to save
>> the state of (multiple) in-flight transactions?
> 
> I had support for lists locally and just pushed it.  It is based on
> GSList and uses a marker to indicate the type.  So:

We have qemu-queue.h, which unlike GSList is typesafe ...

cheers,
  Gerd



Re: [Qemu-devel] [Bug 899143] [NEW] Raw img not recognized by Windows

2011-12-02 Thread Stefan Hajnoczi
On Fri, Dec 2, 2011 at 1:00 PM, Vincent Autefage
<899...@bugs.launchpad.net> wrote:
> The installation process of Windows (XP/Vista/7) doesn’t seem to recognize a 
> raw img generated by qemu-img.
> The installer does not see any hard drive...
>
> The problem exists only with a raw img but not with a vmdk for instance.

Please post your QEMU command-line so it is possible to reproduce this
and see which emulated devices you have configured.

Stefan



[Qemu-devel] [PATCH 02/15] qxl: Don't convert from size_t to int and back in qxl_cursor()

2011-12-02 Thread Stefan Hajnoczi
From: Markus Armbruster 

Just for cleanliness; it would take a truly gigantic cursor to break.

Signed-off-by: Markus Armbruster 
Signed-off-by: Stefan Hajnoczi 
---
 hw/qxl-render.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index 2c51ba9..133d093 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -157,7 +157,7 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor 
*cursor)
 {
 QEMUCursor *c;
 uint8_t *image, *mask;
-int size;
+size_t size;
 
 c = cursor_alloc(cursor->header.width, cursor->header.height);
 c->hot_x = cursor->header.hot_spot_x;
-- 
1.7.7.3




[Qemu-devel] [PATCH 03/15] MAINTAINERS: Delete spurious '.'

2011-12-02 Thread Stefan Hajnoczi
From: Peter Maydell 

Signed-off-by: Peter Maydell 
Signed-off-by: Stefan Hajnoczi 
---
 MAINTAINERS |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 06df70c..e22bfa1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20,7 +20,7 @@ Descriptions of section entries:
   Supported:   Someone is actually paid to look after this.
   Maintained:  Someone actually looks after it.
   Odd Fixes:   It has a maintainer but they don't have time to do
-   much other than throw the odd patch in. See below..
+   much other than throw the odd patch in. See below.
   Orphan:  No current maintainer [but maybe you could take the
role as you write your new code].
   Obsolete:Old code. Something tagged obsolete generally means
-- 
1.7.7.3




[Qemu-devel] [PATCH 01/15] sonic: fix typo

2011-12-02 Thread Stefan Hajnoczi
From: Hervé Poussineau 

Reviewed-by: Andreas Färber 
Signed-off-by: Hervé Poussineau 
Signed-off-by: Stefan Hajnoczi 
---
 hw/dp8393x.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/dp8393x.c b/hw/dp8393x.c
index f66844b..cfec4cb 100644
--- a/hw/dp8393x.c
+++ b/hw/dp8393x.c
@@ -515,7 +515,7 @@ static void write_register(dp8393xState *s, int reg, 
uint16_t val)
 switch (reg) {
 /* Command register */
 case SONIC_CR:
-do_command(s, val);;
+do_command(s, val);
 break;
 /* Prevent write to read-only registers */
 case SONIC_CAP2:
-- 
1.7.7.3




[Qemu-devel] [PULL 00/15] Trivial patches for 24 November to 2 December 2011

2011-12-02 Thread Stefan Hajnoczi
First post-1.0 trivial-patches pull request.  We should get through the backlog
within 2 weeks.

The following changes since commit 1c8a881daaca6fe0646a425b0970fb3ad25f6732:

  Update version for 1.0 release (2011-12-01 14:04:21 -0600)

are available in the git repository at:
  ssh://repo.or.cz/srv/git/qemu/stefanha.git trivial-patches

Dong Xu Wang (11):
  fix spelling in darwin-user sub directory
  fix spelling in linux-user sub directory
  fix spelling in libcacard sub directory
  fix spelling in QMP sub directory
  fix spelling in scripts sub directory
  fix spelling in target sub directory
  fix spelling in tcg sub directory
  fix spelling in tests sub directory
  fix spelling in ui sub directory
  fix spelling in block sub directory
  fix spelling in main directory

Hervé Poussineau (1):
  sonic: fix typo

Markus Armbruster (1):
  qxl: Don't convert from size_t to int and back in qxl_cursor()

Peter Maydell (1):
  MAINTAINERS: Delete spurious '.'

Stefan Weil (1):
  darwin-user: Fix format string in debug message

 MAINTAINERS|2 +-
 QMP/qmp-events.txt |2 +-
 arm-dis.c  |6 +++---
 block/cow.c|2 +-
 block/qcow2.c  |4 ++--
 block/raw-posix.c  |4 ++--
 cpu-all.h  |2 +-
 cpu-common.h   |2 +-
 cpus.c |2 +-
 darwin-user/machload.c |6 +++---
 darwin-user/main.c |2 +-
 darwin-user/signal.c   |3 +--
 darwin-user/syscall.c  |2 +-
 exec-memory.h  |2 +-
 hppa-dis.c |2 +-
 hw/dp8393x.c   |2 +-
 hw/qxl-render.c|2 +-
 libcacard/card_7816.c  |4 ++--
 libcacard/card_7816.h  |2 +-
 libcacard/vcard_emul_nss.c |2 +-
 libcacard/vscard_common.h  |2 +-
 linux-user/elfload.c   |2 +-
 linux-user/flatload.c  |2 +-
 linux-user/main.c  |4 ++--
 linux-user/signal.c|2 +-
 linux-user/syscall_defs.h  |6 +++---
 m68k-dis.c |2 +-
 main-loop.h|2 +-
 nbd.c  |4 ++--
 qemu-io.c  |2 +-
 qemu-option.c  |2 +-
 qerror.c   |2 +-
 savevm.c   |2 +-
 scripts/checkpatch.pl  |2 +-
 target-alpha/STATUS|2 +-
 target-microblaze/cpu.h|2 +-
 target-microblaze/translate.c  |4 ++--
 target-mips/cpu.h  |2 +-
 target-mips/machine.c  |2 +-
 target-ppc/cpu.h   |4 ++--
 target-ppc/mfrom_table_gen.c   |2 +-
 target-ppc/op_helper.c |4 ++--
 target-sh4/helper.c|2 +-
 target-sparc/TODO  |2 +-
 tcg/tcg.c  |2 +-
 tcg/tcg.h  |2 +-
 test-visitor.c |   10 +-
 tests/cris/check_glibc_kernelversion.c |2 +-
 tests/cris/check_moveq.c   |4 ++--
 ui/vnc.c   |4 ++--
 vl.c   |2 +-
 51 files changed, 71 insertions(+), 72 deletions(-)

-- 
1.7.7.3




[Qemu-devel] [PATCH 04/15] darwin-user: Fix format string in debug message

2011-12-02 Thread Stefan Hajnoczi
From: Stefan Weil 

This was spotted by cppcheck.

Reviewed-by: Peter Maydell 
Signed-off-by: Stefan Weil 
Signed-off-by: Stefan Hajnoczi 
---
 darwin-user/signal.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/darwin-user/signal.c b/darwin-user/signal.c
index c530227..317ef92 100644
--- a/darwin-user/signal.c
+++ b/darwin-user/signal.c
@@ -270,8 +270,7 @@ int do_sigaction(int sig, const struct sigaction *act,
 host_sig = target_to_host_signal(sig);
 if (host_sig != SIGSEGV && host_sig != SIGBUS) {
 #if defined(DEBUG_SIGNAL)
-fprintf(stderr, "sigaction handler going to call sigaction\n",
-act->sa_handler, act->sa_flags, act->sa_mask);
+fprintf(stderr, "sigaction handler going to call sigaction\n");
 #endif
 
 sigfillset(&act1.sa_mask);
-- 
1.7.7.3




[Qemu-devel] [PATCH 05/15] fix spelling in darwin-user sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 darwin-user/machload.c |6 +++---
 darwin-user/main.c |2 +-
 darwin-user/syscall.c  |2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/darwin-user/machload.c b/darwin-user/machload.c
index 0aa8282..26dd293 100644
--- a/darwin-user/machload.c
+++ b/darwin-user/machload.c
@@ -460,7 +460,7 @@ int load_object(const char *filename, struct target_pt_regs 
* regs, void ** mh)
 int mach_hdr_pos = 0;
 struct mach_header mach_hdr;
 
-/* for symbol lookup whith -d flag. */
+/* for symbol lookup with -d flag. */
 struct symtab_command *symtabcmd = 0;
 struct nlist_extended *symtab, *sym;
 struct nlist *symtab_std, *syment;
@@ -645,7 +645,7 @@ int load_object(const char *filename, struct target_pt_regs 
* regs, void ** mh)
 case LC_PREBIND_CKSUM:
 case LC_SUB_LIBRARY:
 break;
-default: fprintf(stderr, "warning: unkown command 0x%x in '%s'\n", 
lc->cmd, filename);
+default: fprintf(stderr, "warning: unknown command 0x%x in 
'%s'\n", lc->cmd, filename);
 }
 lc = (struct load_command*)((int)(lc)+(lc->cmdsize));
 }
@@ -809,7 +809,7 @@ unsigned long setup_arg_pages(void * mh, char ** argv, char 
** env)
 page_set_flags((int)env[i], (int)(env[i]+strlen(env[i])), PROT_READ | 
PAGE_VALID);
 }
 
-/* Add on the stack the interp_prefix choosen if so */
+/* Add on the stack the interp_prefix chosen if so */
 if(interp_prefix[0])
 {
 char *dyld_root;
diff --git a/darwin-user/main.c b/darwin-user/main.c
index c0f14f8..9b57c20 100644
--- a/darwin-user/main.c
+++ b/darwin-user/main.c
@@ -394,7 +394,7 @@ void cpu_loop(CPUPPCState *env)
 queue_signal(info.si_signo, &info);
 break;
 case POWERPC_EXCP_PIT:  /* Programmable interval timer IRQ   */
-cpu_abort(env, "Programable interval timer interrupt "
+cpu_abort(env, "Programmable interval timer interrupt "
   "while in user mode. Aborting\n");
 break;
 case POWERPC_EXCP_IO:   /* IO error exception*/
diff --git a/darwin-user/syscall.c b/darwin-user/syscall.c
index f3cc1f83..8a16883 100644
--- a/darwin-user/syscall.c
+++ b/darwin-user/syscall.c
@@ -755,7 +755,7 @@ struct attrbuf_header {
 
 static inline void byteswap_attrbuf(struct attrbuf_header *attrbuf, struct 
attrlist *attrlist)
 {
-DPRINTF("attrBuf.lenght %lx\n", attrbuf->length);
+DPRINTF("attrBuf.length %lx\n", attrbuf->length);
 }
 
 static inline void byteswap_statfs(struct statfs *s)
-- 
1.7.7.3




[Qemu-devel] [PATCH 07/15] fix spelling in libcacard sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 libcacard/card_7816.c  |4 ++--
 libcacard/card_7816.h  |2 +-
 libcacard/vcard_emul_nss.c |2 +-
 libcacard/vscard_common.h  |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libcacard/card_7816.c b/libcacard/card_7816.c
index 6fe27d5..8d06326 100644
--- a/libcacard/card_7816.c
+++ b/libcacard/card_7816.c
@@ -125,7 +125,7 @@ vcard_response_new_bytes(VCard *card, unsigned char *buf, 
int len, int Le,
 }
 
 /*
- * get a new Reponse buffer that only has a status.
+ * get a new Response buffer that only has a status.
  */
 static VCardResponse *
 vcard_response_new_status(vcard_7816_status_t status)
@@ -239,7 +239,7 @@ vcard_apdu_set_class(VCardAPDU *apdu) {
 }
 
 /*
- * set the Le and Lc fiels according to table 5 of the
+ * set the Le and Lc fields according to table 5 of the
  * 7816-4 part 4 spec
  */
 static vcard_7816_status_t
diff --git a/libcacard/card_7816.h b/libcacard/card_7816.h
index 2bb2a0d..4a01993 100644
--- a/libcacard/card_7816.h
+++ b/libcacard/card_7816.h
@@ -23,7 +23,7 @@ VCardResponse *vcard_response_new_bytes(VCard *card, unsigned 
char *buf,
 /* response from just status bytes */
 VCardResponse *vcard_response_new_status_bytes(unsigned char sw1,
unsigned char sw2);
-/* response from just status: NOTE this cannot fail, it will alwyas return a
+/* response from just status: NOTE this cannot fail, it will always return a
  * valid response, if it can't allocate memory, the response will be
  * VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE */
 VCardResponse *vcard_make_response(vcard_7816_status_t status);
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index 397485c..bdc3c79 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -1250,7 +1250,7 @@ vcard_emul_usage(void)
 "  {card_type_to_emulate}  What card interface to present to the guest\n"
 "  {param_for_card}Card interface specific parameters\n"
 "  {slot_name} NSS slot that contains the certs\n"
-"  {vreader_name}  Virutal reader name to present to the guest\n"
+"  {vreader_name}  Virtual reader name to present to the guest\n"
 "  {certN} Nickname of the certificate n on the virtual card\n"
 "\n"
 "These parameters come as a single string separated by blanks or newlines."
diff --git a/libcacard/vscard_common.h b/libcacard/vscard_common.h
index 609ae98..08f68e4 100644
--- a/libcacard/vscard_common.h
+++ b/libcacard/vscard_common.h
@@ -44,7 +44,7 @@
  * to the existing messages, addition of fields.
  *
  * The major digit is for a breaking change of protocol, presumably
- * something that cannot be accomodated with the existing protocol.
+ * something that cannot be accommodated with the existing protocol.
  */
 
 #define VSCARD_VERSION MAKE_VERSION(0, 0, 2)
-- 
1.7.7.3




[Qemu-devel] [PATCH 06/15] fix spelling in linux-user sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Cc: Riku Voipio 
Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 linux-user/elfload.c  |2 +-
 linux-user/flatload.c |2 +-
 linux-user/main.c |4 ++--
 linux-user/signal.c   |2 +-
 linux-user/syscall_defs.h |6 +++---
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4635bb2..ea61d0d 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2339,7 +2339,7 @@ static void fill_auxv_note(struct memelfnote *note, const 
TaskState *ts)
  * strictly necessary but we do it here for sake of completeness.
  */
 
-/* find out lenght of the vector, AT_NULL is terminator */
+/* find out length of the vector, AT_NULL is terminator */
 i = len = 0;
 do {
 get_user_ual(val, auxv);
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index 1062da3..be79496 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -575,7 +575,7 @@ static int load_flat_file(struct linux_binprm * bprm,
  * help simplify all this mumbo jumbo
  *
  * We've got two different sections of relocation entries.
- * The first is the GOT which resides at the begining of the data segment
+ * The first is the GOT which resides at the beginning of the data segment
  * and is terminated with a -1.  This one can be relocated in place.
  * The second is the extra relocation entries tacked after the image's
  * data segment. These require a little more processing as the entry is
diff --git a/linux-user/main.c b/linux-user/main.c
index d1bbc57..64d2208 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1638,7 +1638,7 @@ void cpu_loop(CPUPPCState *env)
 queue_signal(env, info.si_signo, &info);
 break;
 case POWERPC_EXCP_PIT:  /* Programmable interval timer IRQ   */
-cpu_abort(env, "Programable interval timer interrupt "
+cpu_abort(env, "Programmable interval timer interrupt "
   "while in user mode. Aborting\n");
 break;
 case POWERPC_EXCP_IO:   /* IO error exception*/
@@ -2434,7 +2434,7 @@ void cpu_loop (CPUState *env)
 if (env->iflags & D_FLAG) {
 env->sregs[SR_ESR] |= 1 << 12;
 env->sregs[SR_PC] -= 4;
-/* FIXME: if branch was immed, replay the imm aswell.  */
+/* FIXME: if branch was immed, replay the imm as well.  */
 }
 
 env->iflags &= ~(IMM_FLAG | D_FLAG);
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 78e3380..ded12ca 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -80,7 +80,7 @@ static uint8_t host_to_target_signal_table[_NSIG] = {
 [SIGSYS] = TARGET_SIGSYS,
 /* next signals stay the same */
 /* Nasty hack: Reverse SIGRTMIN and SIGRTMAX to avoid overlap with
-   host libpthread signals.  This assumes noone actually uses SIGRTMAX :-/
+   host libpthread signals.  This assumes no one actually uses SIGRTMAX :-/
To fix this properly we need to do manual signal delivery multiplexed
over a single host signal.  */
 [__SIGRTMIN] = __SIGRTMAX,
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 9dd1b8e..2857805 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1,7 +1,7 @@
 /* common syscall defines for all architectures */
 
 /* Note: although the syscall numbers change between architectures,
-   most of them stay the same, so we handle it by puting ifdefs if
+   most of them stay the same, so we handle it by putting ifdefs if
necessary */
 
 #include "syscall_nr.h"
@@ -669,7 +669,7 @@ typedef struct target_siginfo {
  * SIGBUS si_codes
  */
 #define TARGET_BUS_ADRALN   (1)/* invalid address alignment */
-#define TARGET_BUS_ADRERR   (2)/* non-existant physical address */
+#define TARGET_BUS_ADRERR   (2)/* non-existent physical address */
 #define TARGET_BUS_OBJERR   (3)/* object specific hardware error */
 
 /*
@@ -868,7 +868,7 @@ struct target_pollfd {
 #define TARGET_CDROM_GET_MCN   0x5311 /* Obtain the "Universal Product 
Code"
if available (struct cdrom_mcn) */
 #define TARGET_CDROM_GET_UPC   TARGET_CDROM_GET_MCN  /* This one is 
depricated,
-  but here anyway for compatability */
+  but here anyway for compatibility */
 #define TARGET_CDROMRESET  0x5312 /* hard-reset the drive */
 #define TARGET_CDROMVOLREAD0x5313 /* Get the drive's volume setting
   (struct cdrom_volctrl) */
-- 
1.7.7.3




[Qemu-devel] [PATCH 13/15] fix spelling in ui sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Cc: Anthony Liguori 
Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 ui/vnc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 40018f7..e85ee66 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1732,7 +1732,7 @@ static void set_encodings(VncState *vs, int32_t 
*encodings, size_t n_encodings)
 
 /*
  * Start from the end because the encodings are sent in order of 
preference.
- * This way the prefered encoding (first encoding defined in the array)
+ * This way the preferred encoding (first encoding defined in the array)
  * will be set at the end of the loop.
  */
 for (i = n_encodings - 1; i >= 0; i--) {
@@ -2117,7 +2117,7 @@ static int protocol_client_auth_vnc(VncState *vs, uint8_t 
*data, size_t len)
 
 /* Compare expected vs actual challenge response */
 if (memcmp(response, data, VNC_AUTH_CHALLENGE_SIZE) != 0) {
-VNC_DEBUG("Client challenge reponse did not match\n");
+VNC_DEBUG("Client challenge response did not match\n");
 goto reject;
 } else {
 VNC_DEBUG("Accepting VNC challenge response\n");
-- 
1.7.7.3




[Qemu-devel] [PATCH 14/15] fix spelling in block sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Cc: Kevin Wolf 
Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 block/cow.c   |2 +-
 block/qcow2.c |4 ++--
 block/raw-posix.c |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block/cow.c b/block/cow.c
index 089d395..3448296 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -92,7 +92,7 @@ static int cow_open(BlockDriverState *bs, int flags)
 }
 
 /*
- * XXX(hch): right now these functions are extremly ineffcient.
+ * XXX(hch): right now these functions are extremely ineffcient.
  * We should just read the whole bitmap we'll need in one go instead.
  */
 static inline int cow_set_bit(BlockDriverState *bs, int64_t bitnum)
diff --git a/block/qcow2.c b/block/qcow2.c
index d7805ce..9e1b1eb 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -92,7 +92,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, 
uint64_t start_offset,
 if (offset > s->cluster_size)
 printf("qcow2_read_extension: suspicious offset %lu\n", offset);
 
-printf("attemting to read extended header in offset %lu\n", offset);
+printf("attempting to read extended header in offset %lu\n", offset);
 #endif
 
 if (bdrv_pread(bs->file, offset, &ext, sizeof(ext)) != sizeof(ext)) {
@@ -821,7 +821,7 @@ static int qcow2_create2(const char *filename, int64_t 
total_size,
  int flags, size_t cluster_size, int prealloc,
  QEMUOptionParameter *options)
 {
-/* Calulate cluster_bits */
+/* Calculate cluster_bits */
 int cluster_bits;
 cluster_bits = ffs(cluster_size) - 1;
 if (cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS ||
diff --git a/block/raw-posix.c b/block/raw-posix.c
index a3de373..2ee5d69 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1153,7 +1153,7 @@ static int cdrom_open(BlockDriverState *bs, const char 
*filename, int flags)
 if (ret)
 return ret;
 
-/* make sure the door isnt locked at this time */
+/* make sure the door isn't locked at this time */
 ioctl(s->fd, CDIOCALLOW);
 return 0;
 }
@@ -1184,7 +1184,7 @@ static int cdrom_reopen(BlockDriverState *bs)
 }
 s->fd = fd;
 
-/* make sure the door isnt locked at this time */
+/* make sure the door isn't locked at this time */
 ioctl(s->fd, CDIOCALLOW);
 return 0;
 }
-- 
1.7.7.3




[Qemu-devel] [PATCH 08/15] fix spelling in QMP sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Cc: Markus Armbruster 
Acked-by: Luiz Capitulino 
Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 QMP/qmp-events.txt |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
index 0ce5d4e..af586ec 100644
--- a/QMP/qmp-events.txt
+++ b/QMP/qmp-events.txt
@@ -126,7 +126,7 @@ the authentication ID is not provided.
 VNC_DISCONNECTED
 
 
-Emitted when the conection is closed.
+Emitted when the connection is closed.
 
 Data:
 
-- 
1.7.7.3




[Qemu-devel] [PATCH 12/15] fix spelling in tests sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 tests/cris/check_glibc_kernelversion.c |2 +-
 tests/cris/check_moveq.c   |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/cris/check_glibc_kernelversion.c 
b/tests/cris/check_glibc_kernelversion.c
index fcbc7b0..0744872 100644
--- a/tests/cris/check_glibc_kernelversion.c
+++ b/tests/cris/check_glibc_kernelversion.c
@@ -70,7 +70,7 @@
   \
 /* Now we can test with the required version.  */ \
 if (version < __LINUX_KERNEL_VERSION) \
-  /* Not sufficent.  */   \
+  /* Not sufficient.  */   
\
   FATAL ("FATAL: kernel too old\n");  \
   \
 _dl_osversion = version;  \
diff --git a/tests/cris/check_moveq.c b/tests/cris/check_moveq.c
index 9f71194..80f2dff 100644
--- a/tests/cris/check_moveq.c
+++ b/tests/cris/check_moveq.c
@@ -20,7 +20,7 @@ int main(void)
if (t != 10)
err();
 
-   /* make sure moveq doesnt clobber the zflag.  */
+   /* make sure moveq doesn't clobber the zflag.  */
cris_tst_cc_init();
asm volatile ("setf vnc\n");
asm volatile ("clearf z\n");
@@ -29,7 +29,7 @@ int main(void)
if (t != 0)
err();
 
-   /* make sure moveq doesnt clobber the nflag.
+   /* make sure moveq doesn't clobber the nflag.
   Also check large immediates  */
cris_tst_cc_init();
asm volatile ("setf zvc\n");
-- 
1.7.7.3




[Qemu-devel] libvirt doesn't work with qemu 1.0

2011-12-02 Thread Gerd Hoffmann
  Hi,

$subject says all.  The error message is:

error: internal error cannot parse /home/kraxel/bin/qemu-default version
number in 'QEMU emulator version 1.0, Copyright (c) 2003-2008 Fabrice
Bellard'

cheers,
  Gerd

PS: libvirt-0.9.4-23.el6.x86_64



[Qemu-devel] [PATCH 11/15] fix spelling in tcg sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 tcg/tcg.c |2 +-
 tcg/tcg.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 77bd6ef..d43fa4a 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1555,7 +1555,7 @@ static void temp_save(TCGContext *s, int temp, TCGRegSet 
allocated_regs)
 }
 }
 
-/* save globals to their cannonical location and assume they can be
+/* save globals to their canonical location and assume they can be
modified be the following code. 'allocated_regs' is used in case a
temporary registers needs to be allocated to store a constant. */
 static void save_globals(TCGContext *s, TCGRegSet allocated_regs)
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 755a8b3..175000f 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -178,7 +178,7 @@ typedef tcg_target_ulong TCGArg;
 /* Define a type and accessor macros for variables.  Using a struct is
nice because it gives some level of type safely.  Ideally the compiler
be able to see through all this.  However in practice this is not true,
-   expecially on targets with braindamaged ABIs (e.g. i386).
+   especially on targets with braindamaged ABIs (e.g. i386).
We use plain int by default to avoid this runtime overhead.
Users of tcg_gen_* don't need to know about any of this, and should
treat TCGv as an opaque type.
-- 
1.7.7.3




[Qemu-devel] [PATCH 15/15] fix spelling in main directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 arm-dis.c  |6 +++---
 cpu-all.h  |2 +-
 cpu-common.h   |2 +-
 cpus.c |2 +-
 exec-memory.h  |2 +-
 hppa-dis.c |2 +-
 m68k-dis.c |2 +-
 main-loop.h|2 +-
 nbd.c  |4 ++--
 qemu-io.c  |2 +-
 qemu-option.c  |2 +-
 qerror.c   |2 +-
 savevm.c   |2 +-
 test-visitor.c |   10 +-
 vl.c   |2 +-
 15 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arm-dis.c b/arm-dis.c
index 3ece02c..6bc4d71 100644
--- a/arm-dis.c
+++ b/arm-dis.c
@@ -1624,7 +1624,7 @@ arm_decode_shift (long given, fprintf_function func, void 
*stream,
 }
 
 /* Print one coprocessor instruction on INFO->STREAM.
-   Return true if the instuction matched, false if this is not a
+   Return true if the instruction matched, false if this is not a
recognised coprocessor instruction.  */
 
 static bfd_boolean
@@ -2214,7 +2214,7 @@ print_arm_address (bfd_vma pc, struct disassemble_info 
*info, long given)
 }
 
 /* Print one neon instruction on INFO->STREAM.
-   Return true if the instuction matched, false if this is not a
+   Return true if the instruction matched, false if this is not a
recognised neon instruction.  */
 
 static bfd_boolean
@@ -3927,7 +3927,7 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info)
n = last_mapping_sym - 1;
 
  /* No mapping symbol found at this address.  Look backwards
-for a preceeding one.  */
+for a preceding one.  */
  for (; n >= 0; n--)
{
  if (get_sym_code_type (info, n, &type))
diff --git a/cpu-all.h b/cpu-all.h
index 5f47ab8..7246a67 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -368,7 +368,7 @@ DECLARE_TLS(CPUState *,cpu_single_env);
 #define CPU_INTERRUPT_TGT_EXT_4   0x1000
 
 /* Several target-specific internal interrupts.  These differ from the
-   preceeding target-specific interrupts in that they are intended to
+   preceding target-specific interrupts in that they are intended to
originate from within the cpu itself, typically in response to some
instruction being executed.  These, therefore, are not masked while
single-stepping within the debugger.  */
diff --git a/cpu-common.h b/cpu-common.h
index c9878ba..7c9cef8 100644
--- a/cpu-common.h
+++ b/cpu-common.h
@@ -1,7 +1,7 @@
 #ifndef CPU_COMMON_H
 #define CPU_COMMON_H 1
 
-/* CPU interfaces that are target indpendent.  */
+/* CPU interfaces that are target independent.  */
 
 #ifdef TARGET_PHYS_ADDR_BITS
 #include "targphys.h"
diff --git a/cpus.c b/cpus.c
index 82530c4..9d2a2cb 100644
--- a/cpus.c
+++ b/cpus.c
@@ -281,7 +281,7 @@ void qemu_clock_warp(QEMUClock *clock)
  * (related to the time left until the next event) has passed.  This
  * rt_clock timer will do this.  This avoids that the warps are too
  * visible externally---for example, you will not be sending network
- * packets continously instead of every 100ms.
+ * packets continuously instead of every 100ms.
  */
 qemu_mod_timer(icount_warp_timer, vm_clock_warp_start + deadline);
 } else {
diff --git a/exec-memory.h b/exec-memory.h
index 334219f..1cd92ee 100644
--- a/exec-memory.h
+++ b/exec-memory.h
@@ -1,5 +1,5 @@
 /*
- * Internal memory managment interfaces
+ * Internal memory management interfaces
  *
  * Copyright 2011 Red Hat, Inc. and/or its affiliates
  *
diff --git a/hppa-dis.c b/hppa-dis.c
index 435da73..420a7d2 100644
--- a/hppa-dis.c
+++ b/hppa-dis.c
@@ -564,7 +564,7 @@ If not, see . */
  */
 
 /* There are two kinds of delay slot nullification: normal which is
- * controled by the nullification bit, and conditional, which depends
+ * controlled by the nullification bit, and conditional, which depends
  * on the direction of the branch and its success or failure.
  *
  * NONE is unfortunately #defined in the hiux system include files.
diff --git a/m68k-dis.c b/m68k-dis.c
index 04f837a..2b155de 100644
--- a/m68k-dis.c
+++ b/m68k-dis.c
@@ -3518,7 +3518,7 @@ const struct m68k_opcode m68k_opcodes[] =
 
 /* NOTE: The mcf5200 family programmer's reference manual does not
indicate the byte form of the movea instruction is invalid (as it
-   is on 68000 family cpus).  However, experiments on the 5202 yeild
+   is on 68000 family cpus).  However, experiments on the 5202 yield
unexpected results.  The value is copied, but it is not sign extended
(as is done with movea.w) and the top three bytes in the address
register are not disturbed.  I don't know if this is the intended
diff --git a/main-loop.h b/main-loop.h
index 8a716b1..876092d 100644
--- a/main-loop.h
+++ b/main-loop.h
@@ -111,7 +111,7 @@ typedef int PollingFunc(void *opaque);
  * qemu_add_wait_object.
  *
  * Polling callbacks really have nothing Windows specific in them, but
- * as they are a hack and are currenly not nece

[Qemu-devel] [PATCH 10/15] fix spelling in target sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Cc: Richard Henderson 
Cc: Edgar E. Iglesias 
Cc: Aurelien Jarno 
Cc: Alexander Graf 
Cc: Aurelien Jarno 
Cc: Blue Swirl 
Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 target-alpha/STATUS   |2 +-
 target-microblaze/cpu.h   |2 +-
 target-microblaze/translate.c |4 ++--
 target-mips/cpu.h |2 +-
 target-mips/machine.c |2 +-
 target-ppc/cpu.h  |4 ++--
 target-ppc/mfrom_table_gen.c  |2 +-
 target-ppc/op_helper.c|4 ++--
 target-sh4/helper.c   |2 +-
 target-sparc/TODO |2 +-
 10 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/target-alpha/STATUS b/target-alpha/STATUS
index 353d543..742e370 100644
--- a/target-alpha/STATUS
+++ b/target-alpha/STATUS
@@ -18,7 +18,7 @@ Linux user mode emulation status:
 a few programs start to run. Most crash at a certain point, dereferencing a
 NULL pointer. It seems that the UNIQUE register is not initialized properly.
 It may appear that old executables, not relying on TLS support, run but
-this is to be prooved...
+this is to be proved...
 
 Full system emulation status:
 * Alpha PALCode emulation is in a very early stage and is not sufficient
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 3530286..1a307e3 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -243,7 +243,7 @@ typedef struct CPUMBState {
 #define DRTE_FLAG  (1 << 17)
 #define DRTB_FLAG  (1 << 18)
 #define D_FLAG (1 << 19)  /* Bit in ESR.  */
-/* TB dependant CPUState.  */
+/* TB dependent CPUState.  */
 #define IFLAGS_TB_MASK  (D_FLAG | IMM_FLAG | DRTI_FLAG | DRTE_FLAG | DRTB_FLAG)
 uint32_t iflags;
 
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index 366fd3e..d7f513d 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -120,7 +120,7 @@ static inline int sign_extend(unsigned int val, unsigned 
int width)
 
 static inline void t_sync_flags(DisasContext *dc)
 {
-/* Synch the tb dependant flags between translator and runtime.  */
+/* Synch the tb dependent flags between translator and runtime.  */
 if (dc->tb_flags != dc->synced_flags) {
 tcg_gen_movi_tl(env_iflags, dc->tb_flags);
 dc->synced_flags = dc->tb_flags;
@@ -1122,7 +1122,7 @@ static void dec_store(DisasContext *dc)
 if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) {
 tcg_gen_movi_tl(cpu_SR[SR_PC], dc->pc);
 /* FIXME: if the alignment is wrong, we should restore the value
- *in memory. One possible way to acheive this is to probe
+ *in memory. One possible way to achieve this is to probe
  *the MMU prior to the memaccess, thay way we could put
  *the alignment checks in between the probe and the mem
  *access.
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 79e2558..71cb4e8 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -678,7 +678,7 @@ static inline int mips_vpe_active(CPUState *env)
 if (!(env->mvp->CP0_MVPControl & (1 << CP0MVPCo_EVP))) {
 active = 0;
 }
-/* Check that the VPE is actived.  */
+/* Check that the VPE is activated.  */
 if (!(env->CP0_VPEConf0 & (1 << CP0VPEC0_VPA))) {
 active = 0;
 }
diff --git a/target-mips/machine.c b/target-mips/machine.c
index be72b36..a506ee0 100644
--- a/target-mips/machine.c
+++ b/target-mips/machine.c
@@ -302,7 +302,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
 for (i = 0; i < MIPS_FPU_MAX; i++)
 load_fpu(f, &env->fpus[i]);
 
-/* XXX: ensure compatiblity for halted bit ? */
+/* XXX: ensure compatibility for halted bit ? */
 tlb_flush(env, 1);
 return 0;
 }
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index e84108c..2d67d1f 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1004,7 +1004,7 @@ struct CPUPPCState {
 int error_code;
 uint32_t pending_interrupts;
 #if !defined(CONFIG_USER_ONLY)
-/* This is the IRQ controller, which is implementation dependant
+/* This is the IRQ controller, which is implementation dependent
  * and only relevant when emulating a complete machine.
  */
 uint32_t irq_input_state;
@@ -1024,7 +1024,7 @@ struct CPUPPCState {
 
 /* Those resources are used only in Qemu core */
 target_ulong hflags;  /* hflags is a MSR & HFLAGS_MASK */
-target_ulong hflags_nmsr; /* specific hflags, not comming from MSR */
+target_ulong hflags_nmsr; /* specific hflags, not coming from MSR */
 int mmu_idx; /* precomputed MMU index to speed up mem accesses */
 
 /* Power management */
diff --git a/target-ppc/mfrom_table_gen.c b/target-ppc/mfrom_table_gen.c
index 4c06aa4..a140ded 100644
--- a/target-ppc/mfrom_table_gen.c
+++ b/target-ppc/mfrom_table_gen.c
@@ -11,7 +11,7 @@ int main (void)
 
 printf("static con

[Qemu-devel] [PATCH 09/15] fix spelling in scripts sub directory

2011-12-02 Thread Stefan Hajnoczi
From: Dong Xu Wang 

Signed-off-by: Dong Xu Wang 
Signed-off-by: Stefan Hajnoczi 
---
 scripts/checkpatch.pl |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 04ab990..cce8f86 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1901,7 +1901,7 @@ sub process {
 # printk should use KERN_* levels.  Note that follow on printk's on the
 # same line do not need a level, so we use the current block context
 # to try and find and validate the current printk.  In summary the current
-# printk includes all preceeding printk's which have no newline on the end.
+# printk includes all preceding printk's which have no newline on the end.
 # we assume the first bad printk is the one to report.
if ($line =~ /\bprintk\((?!KERN_)\s*"/) {
my $ok = 0;
-- 
1.7.7.3




Re: [Qemu-devel] [PATCH 10/15] fix spelling in target sub directory

2011-12-02 Thread Alexander Graf

On 02.12.2011, at 14:50, Stefan Hajnoczi wrote:

> From: Dong Xu Wang 
> 
> Cc: Richard Henderson 
> Cc: Edgar E. Iglesias 
> Cc: Aurelien Jarno 
> Cc: Alexander Graf 
> Cc: Aurelien Jarno 
> Cc: Blue Swirl 
> Signed-off-by: Dong Xu Wang 
> Signed-off-by: Stefan Hajnoczi 
> ---
> target-alpha/STATUS   |2 +-
> target-microblaze/cpu.h   |2 +-
> target-microblaze/translate.c |4 ++--
> target-mips/cpu.h |2 +-
> target-mips/machine.c |2 +-
> target-ppc/cpu.h  |4 ++--
> target-ppc/mfrom_table_gen.c  |2 +-
> target-ppc/op_helper.c|4 ++--

Always those french ... :)

PPC parts are:

Acked-by: Alexander Graf 


Alex




Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework

2011-12-02 Thread Stuart Yoder
On Thu, Dec 1, 2011 at 3:25 PM, Alex Williamson
 wrote:
> On Thu, 2011-12-01 at 14:58 -0600, Stuart Yoder wrote:
>> One other mechanism we need as well is the ability to
>> enable/disable a domain.
>>
>> For example-- suppose a device is assigned to a VM, the
>> device is in use when the VM is abruptly terminated.  The
>> VM terminate would shut off DMA at the IOMMU, but now
>> the device is in an indeterminate state.   Some devices
>> have no simple reset bit and getting the device back into
>> a sane state could be complicated-- something the hypervisor
>> doesn't want to do.
>>
>> So now KVM restarts the VM, vfio init happens for the device
>> and  the IOMMU for that device is re-configured,
>> etc, but we really can't re-enable DMA until the guest OS tells us
>> (via an hcall) that it is ready.   The guest needs to get the
>> assigned device in a sane state before DMA is enabled.
>
> Giant red flag.  We need to paravirtualize the guest?  Not on x86.

It's the reality we have to deal with, but doing this would obviously
only apply to platforms that need it.

> Some
> devices are better for assignment than others.  PCI devices are moving
> towards supporting standard reset mechanisms.
>
>> Does this warrant a new domain enable/disable API, or should
>> we make this part of the setup API we are discussing
>> here?
>
> What's wrong with simply not adding any DMA mapping entries until you
> think your guest is ready?  Isn't that effectively the same thing?
> Unmap ~= disable.  If the IOMMU API had a mechanism to toggle the iommu
> domain on and off, I wouldn't be opposed to adding an ioctl to do it,
> but it really seems like just a shortcut vs map/unmap.  Thanks,

Yes, we could do something like that I guess.

Stuart



[Qemu-devel] sub-page-sized mmio regions and address passed to read/write fns

2011-12-02 Thread Peter Maydell
Hi; I was working on a refactoring of the ARM 11MPCore/A9MP private
peripherals and encountered something odd. Rather than having a single
large mmio region, I tried splitting into several regions, like this:

memory_region_init(&s->container, "a9mp-priv-container", 0x2000);
memory_region_init_io(&s->scu_iomem, &a9_scu_ops, s, "a9mp-scu", 0x100);
memory_region_init_io(&s->gic_cpu_iomem, &a9_gic_cpu_ops, s,
  "a9mp-gic-cpu", 0x100);
memory_region_init_io(&s->ptimer_iomem, &a9_ptimer_ops, s,
  "a9mp-ptimer", 0x100);
memory_region_add_subregion(&s->container, 0, &s->scu_iomem);
memory_region_add_subregion(&s->container, 0x100, &s->gic_cpu_iomem);
memory_region_add_subregion(&s->container, 0x600, &s->ptimer_iomem);
memory_region_add_subregion(&s->container, 0x1000, &s->gic.iomem);
sysbus_init_mmio_region(dev, &s->container);

However what I found is that the addresses passed to the read/write
functions aren't what I would expect. For instance if the board
maps the container at address 0x1e00, then a read from 0x1e000100
goes to the functions given by a9_gic_cpu_ops, as it should. However,
the offset parameter that the read function is passed is not 0x0
(offset from the start of the a9mp-gic-cpu region) but 0x100 (offset
from the start of the page, I think).

Is this expected behaviour? I certainly wasn't expecting it...

I looked through the code that's getting called for reads, and
it looks to me like exec.c:subpage_readlen() is causing this.
We look up the subpage_t based on the address within the page,
but we don't then adjust the address we pass to io_mem_read
(except by region_offset, which I take from the comment at the
top of cpu_register_physical_memory_log() to be for something
else.)

-- PMM



Re: [Qemu-devel] libvirt doesn't work with qemu 1.0

2011-12-02 Thread Anthony Liguori

On 12/02/2011 08:21 AM, Gerd Hoffmann wrote:

   Hi,

$subject says all.  The error message is:

error: internal error cannot parse /home/kraxel/bin/qemu-default version
number in 'QEMU emulator version 1.0, Copyright (c) 2003-2008 Fabrice
Bellard'


Parsing help output for the version number is a really bad idea.  query-version 
in QMP does the right thing:


(QEMU) query-version
{u'return': {u'qemu': {u'micro': 0, u'major': 1, u'minor': 0}, u'package': ''}}

This is the supported way of figuring out the version number and it's what 
libvirt should be using.


Regards,

Anthony Liguori



cheers,
   Gerd

PS: libvirt-0.9.4-23.el6.x86_64






[Qemu-devel] [PATCH 3/3] sysbus: remove sysbus_init_mmio_cb2

2011-12-02 Thread Benoît Canet
This function is not longer in use so remove it.

Signed-off-by: Benoît Canet 
---
 hw/sysbus.c |   16 
 hw/sysbus.h |5 -
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/hw/sysbus.c b/hw/sysbus.c
index b315a8c..81a57bd 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -53,8 +53,6 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, 
target_phys_addr_t addr)
 if (dev->mmio[n].memory) {
 memory_region_del_subregion(get_system_memory(),
 dev->mmio[n].memory);
-} else if (dev->mmio[n].unmap) {
-dev->mmio[n].unmap(dev, dev->mmio[n].addr);
 }
 }
 dev->mmio[n].addr = addr;
@@ -62,8 +60,6 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, 
target_phys_addr_t addr)
 memory_region_add_subregion(get_system_memory(),
 addr,
 dev->mmio[n].memory);
-} else if (dev->mmio[n].cb) {
-dev->mmio[n].cb(dev, addr);
 }
 }
 
@@ -89,18 +85,6 @@ void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target)
 }
 }
 
-void sysbus_init_mmio_cb2(SysBusDevice *dev,
-  mmio_mapfunc cb, mmio_mapfunc unmap)
-{
-int n;
-
-assert(dev->num_mmio < QDEV_MAX_MMIO);
-n = dev->num_mmio++;
-dev->mmio[n].addr = -1;
-dev->mmio[n].cb = cb;
-dev->mmio[n].unmap = unmap;
-}
-
 void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory)
 {
 int n;
diff --git a/hw/sysbus.h b/hw/sysbus.h
index 9bac582..2f4025b 100644
--- a/hw/sysbus.h
+++ b/hw/sysbus.h
@@ -11,7 +11,6 @@
 #define QDEV_MAX_IRQ 256
 
 typedef struct SysBusDevice SysBusDevice;
-typedef void (*mmio_mapfunc)(SysBusDevice *dev, target_phys_addr_t addr);
 
 struct SysBusDevice {
 DeviceState qdev;
@@ -21,8 +20,6 @@ struct SysBusDevice {
 int num_mmio;
 struct {
 target_phys_addr_t addr;
-mmio_mapfunc cb;
-mmio_mapfunc unmap;
 MemoryRegion *memory;
 } mmio[QDEV_MAX_MMIO];
 int num_pio;
@@ -43,8 +40,6 @@ typedef struct {
 void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init);
 void sysbus_register_withprop(SysBusDeviceInfo *info);
 void *sysbus_new(void);
-void sysbus_init_mmio_cb2(SysBusDevice *dev,
-  mmio_mapfunc cb, mmio_mapfunc unmap);
 void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
 MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
-- 
1.7.7.3




[Qemu-devel] [PATCH 1/3] sh_pci: remove sysbus_init_mmio_cb2 usage

2011-12-02 Thread Benoît Canet
The isa region is not exposed as a sysbus region because the iobr
register contains its address and use it to remap dynamically
the region. (Peter Maydell's idea)

Signed-off-by: Benoît Canet 
---
 hw/r2d.c|   14 --
 hw/sh_pci.c |   29 -
 2 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/hw/r2d.c b/hw/r2d.c
index 9b6fcba..6e1f71c 100644
--- a/hw/r2d.c
+++ b/hw/r2d.c
@@ -231,6 +231,8 @@ static void r2d_init(ram_addr_t ram_size,
 qemu_irq *irq;
 DriveInfo *dinfo;
 int i;
+DeviceState *dev;
+SysBusDevice *busdev;
 MemoryRegion *address_space_mem = get_system_memory();
 
 if (!cpu_model)
@@ -252,8 +254,16 @@ static void r2d_init(ram_addr_t ram_size,
 /* Register peripherals */
 s = sh7750_init(env, address_space_mem);
 irq = r2d_fpga_init(address_space_mem, 0x0400, sh7750_irl(s));
-sysbus_create_varargs("sh_pci", 0x1e20, irq[PCI_INTA], irq[PCI_INTB],
-  irq[PCI_INTC], irq[PCI_INTD], NULL);
+
+dev = qdev_create(NULL, "sh_pci");
+busdev = sysbus_from_qdev(dev);
+qdev_init_nofail(dev);
+sysbus_mmio_map(busdev, 0, P4ADDR(0x1e20));
+sysbus_mmio_map(busdev, 1, A7ADDR(0x1e20));
+sysbus_connect_irq(busdev, 0, irq[PCI_INTA]);
+sysbus_connect_irq(busdev, 1, irq[PCI_INTB]);
+sysbus_connect_irq(busdev, 2, irq[PCI_INTC]);
+sysbus_connect_irq(busdev, 3, irq[PCI_INTD]);
 
 sm501_init(address_space_mem, 0x1000, SM501_VRAM_SIZE,
irq[SM501], serial_hds[2]);
diff --git a/hw/sh_pci.c b/hw/sh_pci.c
index 86f468e..d4d028d 100644
--- a/hw/sh_pci.c
+++ b/hw/sh_pci.c
@@ -110,29 +110,6 @@ static void sh_pci_set_irq(void *opaque, int irq_num, int 
level)
 qemu_set_irq(pic[irq_num], level);
 }
 
-static void sh_pci_map(SysBusDevice *dev, target_phys_addr_t base)
-{
-SHPCIState *s = FROM_SYSBUS(SHPCIState, dev);
-
-memory_region_add_subregion(get_system_memory(),
-P4ADDR(base),
-&s->memconfig_p4);
-memory_region_add_subregion(get_system_memory(),
-A7ADDR(base),
-&s->memconfig_a7);
-s->iobr = 0xfe24;
-memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
-}
-
-static void sh_pci_unmap(SysBusDevice *dev, target_phys_addr_t base)
-{
-SHPCIState *s = FROM_SYSBUS(SHPCIState, dev);
-
-memory_region_del_subregion(get_system_memory(), &s->memconfig_p4);
-memory_region_del_subregion(get_system_memory(), &s->memconfig_a7);
-memory_region_del_subregion(get_system_memory(), &s->isa);
-}
-
 static int sh_pci_init_device(SysBusDevice *dev)
 {
 SHPCIState *s;
@@ -153,9 +130,11 @@ static int sh_pci_init_device(SysBusDevice *dev)
 memory_region_init_alias(&s->memconfig_a7, "sh_pci.2", &s->memconfig_p4,
  0, 0x224);
 isa_mmio_setup(&s->isa, 0x4);
-sysbus_init_mmio_cb2(dev, sh_pci_map, sh_pci_unmap);
+sysbus_init_mmio(dev, &s->memconfig_p4);
 sysbus_init_mmio(dev, &s->memconfig_a7);
-sysbus_init_mmio(dev, &s->isa);
+s->iobr = 0xfe24;
+memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
+
 s->dev = pci_create_simple(s->bus, PCI_DEVFN(0, 0), "sh_pci_host");
 return 0;
 }
-- 
1.7.7.3




[Qemu-devel] [PATCH 0/3] remove sysbus_init_mmio_cb2

2011-12-02 Thread Benoît Canet
Remove the last two users of this function then
remove the function's code from sysbus.

Tested with Renesas r2d image and buildroot for
the ppc board.

Benoît Canet (3):
  sh_pci: remove sysbus_init_mmio_cb2 usage
  ppce500_pci: remove sysbus_init_mmio_cb2 usage
  sysbus: remove sysbus_init_mmio_cb2

 hw/ppce500_mpc8544ds.c |   14 ++
 hw/ppce500_pci.c   |   27 ++-
 hw/r2d.c   |   14 --
 hw/sh_pci.c|   29 -
 hw/sysbus.c|   16 
 hw/sysbus.h|5 -
 6 files changed, 32 insertions(+), 73 deletions(-)

-- 
1.7.7.3




Re: [Qemu-devel] [PATCH 06/18] qom: add child properties (composition)

2011-12-02 Thread Anthony Liguori

On 12/02/2011 05:54 AM, Kevin Wolf wrote:

Am 30.11.2011 22:03, schrieb Anthony Liguori:

Child properties express a relationship of composition.

Signed-off-by: Anthony Liguori


Do we have a flag or something that makes sure that a child is never
removed without its parent? The code assumes that child stays valid as
long as the parent lives.


Good question.  This is an interesting issue with qdev.

The child property is not writable so you cannot detach a child.  That's because 
the child's life cycle is supposed to be tied to the parents.


qdev doesn't have the right bits to handle this right now.  I think that's 
fixable by just adding a new flag to DeviceState.





@@ -499,4 +499,24 @@ gchar *qdev_get_canonical_path(DeviceState *dev);
   */
  DeviceState *qdev_resolve_path(const char *path, bool *ambiguous);

+/**
+ * @qdev_property_add_child - Add a child property to a device
+ *
+ * Child properties form the composition tree.  All devices need to be a child
+ * of another device.  Devices can only be a child of one device.
+ *
+ * There is no way for a child to determine what it's parent is.  It is not


s/it's/its/


Ack.

Regards,

Anthony Liguori


Kevin






Re: [Qemu-devel] [PATCH 07/18] qom: add link properties

2011-12-02 Thread Anthony Liguori

On 12/02/2011 06:15 AM, Kevin Wolf wrote:

Am 30.11.2011 22:03, schrieb Anthony Liguori:

Links represent an ephemeral relationship between devices.  They are meant to
replace the qdev concept of busses by allowing more informal relationships
between devices.

Links are fairly limited in their usefulness without implementing QOM-style
subclassing and interfaces.

Signed-off-by: Anthony Liguori


Same thing as in the previous patch: The code doesn't seem to be
prepared for the case that the "child" (this is not a tree, so there are
no children...) is removed. While you could say that devices used for
composition just shouldn't be unpluggable, I don't think you can require
this for links.


I think we need reference counts to handle this appropriately.

Regards,

Anthony Liguori



Kevin






Re: [Qemu-devel] [Bug 899140] Re: Problem with Linux Kernel Traffic Control

2011-12-02 Thread Vincent Autefage
Hi,

So, the host command lines are :
*$ qemu -name A -sdl -m 512 -enable-kvm -localtime -k fr -hda 
debian1.img -net nic,macaddr=a0:00:00:00:00:01 -net 
socket,mcast=230.0.0.1:7000*

The second is
*$ qemu -name B -sdl -m 512 -enable-kvm -localtime -k fr -hda 
debian2.img -net nic,macaddr=a0:00:00:00:00:02 -net 
socket,mcast=230.0.0.1:7000*

On virual machines :

*root@A# ifconfig eth0 192.168.0.1*
*root@A# tc qdisc add dev eth0 root tbf rate 20mbit burst 20480 latency 
50ms*

*root@B# **ifconfig eth0 192.168.0.2*

Then if we check with /Iperf/, the real rate will be about 100kbit/s :

*root@B# iperf -s*

*root@A# iperf -c 192.168.0.1*

Vincent


Le 02/12/2011 14:34, Stefan Hajnoczi a écrit :
> Hi Vincent,
> Please give steps to reproduce the problem including the QEMU
> command-lines you used and what commands need to be run inside the
> guest and on the host.
>
> Stefan
>

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

Title:
  Problem with Linux Kernel Traffic Control

Status in QEMU:
  New

Bug description:
  Hi,

  The last main versions of QEMU (0.14.1, 0.15 and 1.0) have an important 
problem when running on a Linux distribution which running itself a Traffic 
Control (TC) instance.
  Indeed, when TC is configured with a Token Bucket Filter (TBF) with a 
particular rate, the effective rate is very slower than the desired one.

  For instance, lets consider the following configuration :

  # tc qdisc add dev eth0 root tbf rate 20mbit burst 20k latency 50ms

  The effective rate will be about 100kbit/s ! (verified with iperf)
  I've encountered this problem on versions 0.14.1, 0.15 and 1.0 but not with 
the 0.14.0...
  In the 0.14.0, we have a rate of 19.2 mbit/s which is quiet normal.

  I've done the experimentation on several hosts :

  - Debian 32bit core i7, 4GB RAM
  - Debian 64bit core i7, 8GB RAM
  - 3 different high performance servers : Ubuntu 64 bits, 48 AMD Opteron, 
128GB of RAM

  The problem is always the same... The problem is also seen with a
  Class Based Queuing (CBQ) in TC.

  Thanks

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



Re: [Qemu-devel] [Bug 899143] [NEW] Raw img not recognized by Windows

2011-12-02 Thread Vincent Autefage
Hi,*

$ qemu-img create -f raw root.img 100GB
$ mkntfs -F root.img
$ qemu -name W -sdl -m 2048 -enable-kvm -localtime -k fr -hda root.img 
-cdrom windows7.iso -boot d -net nic,macaddr=a0:00:00:00:00:01 -net 
user,vlan=0
*

Vincent Autefage


Le 02/12/2011 14:35, Stefan Hajnoczi a écrit :
> On Fri, Dec 2, 2011 at 1:00 PM, Vincent Autefage
> <899...@bugs.launchpad.net>  wrote:
>> The installation process of Windows (XP/Vista/7) doesn’t seem to recognize a 
>> raw img generated by qemu-img.
>> The installer does not see any hard drive...
>>
>> The problem exists only with a raw img but not with a vmdk for instance.
> Please post your QEMU command-line so it is possible to reproduce this
> and see which emulated devices you have configured.
>
> Stefan
>

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

Title:
  Raw img not recognized by Windows

Status in QEMU:
  New

Bug description:
  Hi,

  The installation process of Windows (XP/Vista/7) doesn’t seem to recognize a 
raw img generated by qemu-img.
  The installer does not see any hard drive...

  The problem exists only with a raw img but not with a vmdk for
  instance.

  Thanks

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



Re: [Qemu-devel] [PATCH 14/18] rtc: add a dynamic property for retrieving the date

2011-12-02 Thread Anthony Liguori

On 12/02/2011 07:34 AM, Gerd Hoffmann wrote:

On 12/02/11 14:20, Anthony Liguori wrote:

On 12/02/2011 06:35 AM, Gerd Hoffmann wrote:

The readme has quite a lot of detail about the syntax.  The parser is
pretty complete already.

https://github.com/aliguori/qidl/blob/master/qc.md


Ah, nice.  Any plans to support lists there, so it is possible to save
the state of (multiple) in-flight transactions?


I had support for lists locally and just pushed it.  It is based on
GSList and uses a marker to indicate the type.  So:


We have qemu-queue.h, which unlike GSList is typesafe ...


qemu-queue would be extremely difficult to use because you need to encode 
information about how to walk the structure in the type.


Otherwise, you can't generate code to walk the structure.

Regards,

Anthony Liguori



cheers,
   Gerd






Re: [Qemu-devel] [PATCH 2/3] ppce500_pci: remove sysbus_init_mmio_cb2 usage

2011-12-02 Thread Peter Maydell
On 2 December 2011 14:51, Benoît Canet  wrote:
> @@ -320,10 +321,15 @@ static void mpc8544ds_init(ram_addr_t ram_size,
>     sysbus_create_simple("mpc8544-guts", MPC8544_UTIL_BASE, NULL);
>
>     /* PCI */
> -    dev = sysbus_create_varargs("e500-pcihost", MPC8544_PCI_REGS_BASE,
> -                                mpic[pci_irq_nrs[0]], mpic[pci_irq_nrs[1]],
> -                                mpic[pci_irq_nrs[2]], mpic[pci_irq_nrs[3]],
> -                                NULL);
> +    dev = qdev_create(NULL, "e500-pcihost");
> +    busdev = sysbus_from_qdev(dev);
> +    qdev_init_nofail(dev);
> +    sysbus_mmio_map(busdev, 0, MPC8544_PCI_REGS_BASE);
> +    sysbus_connect_irq(busdev, 0, mpic[pci_irq_nrs[0]]);
> +    sysbus_connect_irq(busdev, 1, mpic[pci_irq_nrs[1]]);
> +    sysbus_connect_irq(busdev, 2, mpic[pci_irq_nrs[2]]);
> +    sysbus_connect_irq(busdev, 3, mpic[pci_irq_nrs[3]]);
> +

Is this change actually necessary? If we only have one MMIO region
to map then sysbus_create_varargs() suffices.

How much did you test this patch, by the way? I've been running into
some odd behaviour with sub-page-sized memory regions which I'm
wondering if you hit here...

-- PMM



Re: [Qemu-devel] libvirt doesn't work with qemu 1.0

2011-12-02 Thread Jiri Denemark
On Fri, Dec 02, 2011 at 08:50:11 -0600, Anthony Liguori wrote:
> On 12/02/2011 08:21 AM, Gerd Hoffmann wrote:
> >Hi,
> >
> > $subject says all.  The error message is:
> >
> > error: internal error cannot parse /home/kraxel/bin/qemu-default version
> > number in 'QEMU emulator version 1.0, Copyright (c) 2003-2008 Fabrice
> > Bellard'
> 
> Parsing help output for the version number is a really bad idea.  
> query-version 
> in QMP does the right thing:
> 
> (QEMU) query-version
> {u'return': {u'qemu': {u'micro': 0, u'major': 1, u'minor': 0}, u'package': 
> ''}}

Which of course only works with new enough QEMU that is known to support QMP
(which BTW we detect by checking the version number). Anyway, the fix is easy,
we just need to assume micro is 0 if it's missing instead of requiring it to
be present. A fix will come soon.

Jirka



Re: [Qemu-devel] [PATCH RFC for-1.0] Update copyright info

2011-12-02 Thread Andreas Färber
Gerd just reminded me that we did ship 1.0 with a 2008 copyright notice.

Am 04.11.2011 18:56, schrieb Andreas Färber:
> Judging by -version output, one could get the impression that QEMU was
> last modified in 2008. Therefore extend the copyright statement to
> cover other contributors so that it can be updated to the current year.
> 
> Signed-off-by: Andreas Färber 

Is my text change okay, so that I should extend the patch to cover
*-user as pointed out by Peter? Or is the change a no-go for legal or
libvirt reasons?

An alternative mentioned in this thread was:
Copyright (c) 2003-2008 Fabrice Bellard, Copyright (c) 200x-2011 s.o.

The former was intended as a short-term fix for 1.0.
I would prefer the latter mid-term since Fabrice doesn't hold any
copyright/IPR in the code after he left, but what year and what someone?

Opinions please,

Andreas

> ---
>  vl.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index 624da0f..47e0ae0 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1484,7 +1484,7 @@ static void main_loop(void)
>  
>  static void version(void)
>  {
> -printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", 
> Copyright (c) 2003-2008 Fabrice Bellard\n");
> +printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", 
> Copyright (c) 2003-2011 Fabrice Bellard and contributors\n");
>  }
>  
>  static void help(int exitcode)

-- 
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] libvirt doesn't work with qemu 1.0

2011-12-02 Thread Anthony Liguori

On 12/02/2011 09:08 AM, Jiri Denemark wrote:

On Fri, Dec 02, 2011 at 08:50:11 -0600, Anthony Liguori wrote:

On 12/02/2011 08:21 AM, Gerd Hoffmann wrote:

Hi,

$subject says all.  The error message is:

error: internal error cannot parse /home/kraxel/bin/qemu-default version
number in 'QEMU emulator version 1.0, Copyright (c) 2003-2008 Fabrice
Bellard'


Parsing help output for the version number is a really bad idea.  query-version
in QMP does the right thing:

(QEMU) query-version
{u'return': {u'qemu': {u'micro': 0, u'major': 1, u'minor': 0}, u'package': ''}}


Which of course only works with new enough QEMU that is known to support QMP
(which BTW we detect by checking the version number).


Or you could just try the -qmp option and if QEMU exits, it doesn't support it. 
 That's going to be a lot more reliable than checking a version number.


Regards,

Anthony Liguori


Anyway, the fix is easy,
we just need to assume micro is 0 if it's missing instead of requiring it to
be present. A fix will come soon.

Jirka






Re: [Qemu-devel] [PATCH 2/3] ppce500_pci: remove sysbus_init_mmio_cb2 usage

2011-12-02 Thread Benoît Canet
>
> Is this change actually necessary? If we only have one MMIO region
> to map then sysbus_create_varargs() suffices.
>
> Ack,


> How much did you test this patch, by the way? I've been running into
> some odd behaviour with sub-page-sized memory regions which I'm
> wondering if you hit here...
>
> I build a kernel and an initrd with buildroot and do some pci enumerations.
I'll check if the pci ethernet controller works.

> -- PMM
>


[Qemu-devel] [PATCH 2/3] ppce500_pci: remove sysbus_init_mmio_cb2 usage

2011-12-02 Thread Benoît Canet
Expose only one container MemoryRegion to sysbus.
(Peter Maydell's idea)

Signed-off-by: Benoît Canet 
---
 hw/ppce500_mpc8544ds.c |   14 ++
 hw/ppce500_pci.c   |   27 ++-
 2 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index 51b6abd..66c935e 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -244,6 +244,7 @@ static void mpc8544ds_init(ram_addr_t ram_size,
 unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
 qemu_irq **irqs, *mpic;
 DeviceState *dev;
+SysBusDevice *busdev;
 CPUState *firstenv = NULL;
 
 /* Setup CPUs */
@@ -320,10 +321,15 @@ static void mpc8544ds_init(ram_addr_t ram_size,
 sysbus_create_simple("mpc8544-guts", MPC8544_UTIL_BASE, NULL);
 
 /* PCI */
-dev = sysbus_create_varargs("e500-pcihost", MPC8544_PCI_REGS_BASE,
-mpic[pci_irq_nrs[0]], mpic[pci_irq_nrs[1]],
-mpic[pci_irq_nrs[2]], mpic[pci_irq_nrs[3]],
-NULL);
+dev = qdev_create(NULL, "e500-pcihost");
+busdev = sysbus_from_qdev(dev);
+qdev_init_nofail(dev);
+sysbus_mmio_map(busdev, 0, MPC8544_PCI_REGS_BASE);
+sysbus_connect_irq(busdev, 0, mpic[pci_irq_nrs[0]]);
+sysbus_connect_irq(busdev, 1, mpic[pci_irq_nrs[1]]);
+sysbus_connect_irq(busdev, 2, mpic[pci_irq_nrs[2]]);
+sysbus_connect_irq(busdev, 3, mpic[pci_irq_nrs[3]]);
+
 pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
 if (!pci_bus)
 printf("couldn't create PCI controller!\n");
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index 6232af1..b606206 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -79,6 +79,7 @@ struct PPCE500PCIState {
 uint32_t gasket_time;
 qemu_irq irq[4];
 /* mmio maps */
+MemoryRegion container;
 MemoryRegion iomem;
 };
 
@@ -298,26 +299,6 @@ static const VMStateDescription vmstate_ppce500_pci = {
 }
 };
 
-static void e500_pci_map(SysBusDevice *dev, target_phys_addr_t base)
-{
-PCIHostState *h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev));
-PPCE500PCIState *s = DO_UPCAST(PPCE500PCIState, pci_state, h);
-
-sysbus_add_memory(dev, base + PCIE500_CFGADDR, &h->conf_mem);
-sysbus_add_memory(dev, base + PCIE500_CFGDATA, &h->data_mem);
-sysbus_add_memory(dev, base + PCIE500_REG_BASE, &s->iomem);
-}
-
-static void e500_pci_unmap(SysBusDevice *dev, target_phys_addr_t base)
-{
-PCIHostState *h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev));
-PPCE500PCIState *s = DO_UPCAST(PPCE500PCIState, pci_state, h);
-
-sysbus_del_memory(dev, &h->conf_mem);
-sysbus_del_memory(dev, &h->data_mem);
-sysbus_del_memory(dev, &s->iomem);
-}
-
 #include "exec-memory.h"
 
 static int e500_pcihost_initfn(SysBusDevice *dev)
@@ -343,13 +324,17 @@ static int e500_pcihost_initfn(SysBusDevice *dev)
 
 pci_create_simple(b, 0, "e500-host-bridge");
 
+memory_region_init(&s->container, "pci-container", PCIE500_ALL_SIZE);
 memory_region_init_io(&h->conf_mem, &pci_host_conf_be_ops, h,
   "pci-conf-idx", 4);
 memory_region_init_io(&h->data_mem, &pci_host_data_le_ops, h,
   "pci-conf-data", 4);
 memory_region_init_io(&s->iomem, &e500_pci_reg_ops, s,
   "pci.reg", PCIE500_REG_SIZE);
-sysbus_init_mmio_cb2(dev, e500_pci_map, e500_pci_unmap);
+memory_region_add_subregion(&s->container, PCIE500_CFGADDR, &h->conf_mem);
+memory_region_add_subregion(&s->container, PCIE500_CFGDATA, &h->data_mem);
+memory_region_add_subregion(&s->container, PCIE500_REG_BASE, &s->iomem);
+sysbus_init_mmio(dev, &s->container);
 
 return 0;
 }
-- 
1.7.7.3




Re: [Qemu-devel] [PATCH RFC for-1.0] Update copyright info

2011-12-02 Thread Natalia Portillo
My suggestion is to put (c) 2003-2011 Fabrice and contributors until we have a 
foundation and then put (c) 2003-201x qemu foundation.

Fabrice by the european copyright laws still have copyright and ipr in any code 
he generated whatever we have changed as per the "multiple contributors" 
section of the european laws.
(that is unless we did a svn/git delete file.c if that file was started, or 
based on one started, by Fabrice, it's still partly (c) Fabrice even if no 
single line remains of his code)

El 02/12/2011, a las 15:11, Andreas Färber escribió:

> Gerd just reminded me that we did ship 1.0 with a 2008 copyright notice.
> 
> Am 04.11.2011 18:56, schrieb Andreas Färber:
>> Judging by -version output, one could get the impression that QEMU was
>> last modified in 2008. Therefore extend the copyright statement to
>> cover other contributors so that it can be updated to the current year.
>> 
>> Signed-off-by: Andreas Färber 
> 
> Is my text change okay, so that I should extend the patch to cover
> *-user as pointed out by Peter? Or is the change a no-go for legal or
> libvirt reasons?
> 
> An alternative mentioned in this thread was:
> Copyright (c) 2003-2008 Fabrice Bellard, Copyright (c) 200x-2011 s.o.
> 
> The former was intended as a short-term fix for 1.0.
> I would prefer the latter mid-term since Fabrice doesn't hold any
> copyright/IPR in the code after he left, but what year and what someone?
> 
> Opinions please,
> 
> Andreas
> 
>> ---
>> vl.c |2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/vl.c b/vl.c
>> index 624da0f..47e0ae0 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -1484,7 +1484,7 @@ static void main_loop(void)
>> 
>> static void version(void)
>> {
>> -printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", 
>> Copyright (c) 2003-2008 Fabrice Bellard\n");
>> +printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", 
>> Copyright (c) 2003-2011 Fabrice Bellard and contributors\n");
>> }
>> 
>> static void help(int exitcode)
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
> 




[Qemu-devel] [Bug 883136] Re: qemu on ARM hosts aborts on startup because makecontext() always fails

2011-12-02 Thread Natalia Portillo
** Also affects: qemu
   Importance: Undecided
   Status: New

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

Title:
  qemu on ARM hosts aborts on startup because makecontext() always fails

Status in QEMU:
  New
Status in Linaro QEMU:
  New

Bug description:
  qemu has recently grown a coroutines implementation. There are two
  versions, one using the makecontext/setcontext/swapcontext functions
  from ucontext.h, and one falling back to implementing coroutines as
  separate glib threads. configure chooses the former if the platform
  has a makecontext().

  Unfortunately ARM eglibc provides a makecontext() which always fails
  ENOSYS, which means the configure check passes but when qemu starts it
  abort()s.

  The best fix for this is probably going to involve making the
  coroutine implementation runtime-selectable.

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



[Qemu-devel] [PATCH v4 1/3] Update ioctl order in nbd_init() to detect EBUSY

2011-12-02 Thread Chunyan Liu
Update ioctl(s) in nbd_init() to detect device busy early.

Current nbd_init() issues NBD_CLEAR_SOCKET before NBD_SET_SOCKET, if issuing
"qemu-nbd -c /dev/nbd0 disk.img" twice, the second time won't detect EBUSY in
nbd_init(), but in nbd_client will report EBUSY and do clear socket (the 1st
time command will be affacted too because of no socket any more.)

No change to previous version.

Signed-off-by: Chunyan Liu 
---
 nbd.c |   27 +--
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/nbd.c b/nbd.c
index e6c931c..4184614 100644
--- a/nbd.c
+++ b/nbd.c
@@ -348,6 +348,15 @@ int nbd_receive_negotiate(int csock, const char *name, 
uint32_t *flags,
 #ifdef __linux__
 int nbd_init(int fd, int csock, uint32_t flags, off_t size, size_t blocksize)
 {
+TRACE("Setting NBD socket");
+
+if (ioctl(fd, NBD_SET_SOCK, csock) == -1) {
+int serrno = errno;
+LOG("Failed to set NBD socket");
+errno = serrno;
+return -1;
+}
+
 TRACE("Setting block size to %lu", (unsigned long)blocksize);
 
 if (ioctl(fd, NBD_SET_BLKSIZE, blocksize) == -1) {
@@ -386,24 +395,6 @@ int nbd_init(int fd, int csock, uint32_t flags, off_t 
size, size_t blocksize)
 return -1;
 }
 
-TRACE("Clearing NBD socket");
-
-if (ioctl(fd, NBD_CLEAR_SOCK) == -1) {
-int serrno = errno;
-LOG("Failed clearing NBD socket");
-errno = serrno;
-return -1;
-}
-
-TRACE("Setting NBD socket");
-
-if (ioctl(fd, NBD_SET_SOCK, csock) == -1) {
-int serrno = errno;
-LOG("Failed to set NBD socket");
-errno = serrno;
-return -1;
-}
-
 TRACE("Negotiation ended");
 
 return 0;
-- 
1.7.3.4




[Qemu-devel] [PATCH v4 2/3] Extract code to nbd_setup function to be used for many purposes

2011-12-02 Thread Chunyan Liu
According to Stefan's suggestion, will loop over /dev/nbd%d to do "qemu-nbd -f
disk.img", if fails, try next device. To make "qemu-nbd -c" and "qemu-nbd -f"
share codes as more as possible, extract the shared codes to a function
nbd_setup(). Current qemu-nbd functions work well still. 

Signed-off-by: Chunyan Liu 
---
 qemu-nbd.c |  300 
 1 files changed, 159 insertions(+), 141 deletions(-)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index 291cba2..83ae30f 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -42,6 +42,18 @@ static int verbose;
 static char *device;
 static char *srcpath;
 static char *sockpath;
+static int is_sockpath_option;
+static int sigterm_fd[2];
+static off_t dev_offset;
+static uint32_t nbdflags;
+static bool disconnect;
+static const char *bindto = "0.0.0.0";
+static int port = NBD_DEFAULT_PORT;
+static int li;
+static int flags = BDRV_O_RDWR;
+static int partition = -1;
+static int shared = 1;
+static int persistent;
 
 static void usage(const char *name)
 {
@@ -171,9 +183,7 @@ static int find_partition(BlockDriverState *bs, int 
partition,
 static void termsig_handler(int signum)
 {
 static int sigterm_reported;
-if (!sigterm_reported) {
-sigterm_reported = (write(sigterm_wfd, "", 1) == 1);
-}
+sigterm_reported = (write(sigterm_wfd, "", 1) == 1);
 }
 
 static void *show_parts(void *arg)
@@ -244,18 +254,152 @@ out:
 return (void *) EXIT_FAILURE;
 }
 
-int main(int argc, char **argv)
+static int nbd_setup(void)
 {
 BlockDriverState *bs;
-off_t dev_offset = 0;
 off_t offset = 0;
-uint32_t nbdflags = 0;
-bool disconnect = false;
-const char *bindto = "0.0.0.0";
-int port = NBD_DEFAULT_PORT;
 struct sockaddr_in addr;
 socklen_t addr_len = sizeof(addr);
 off_t fd_size;
+uint8_t *data;
+fd_set fds;
+int *sharing_fds;
+int fd;
+int i;
+int nb_fds = 0;
+int max_fd;
+pthread_t client_thread;
+int ret;
+
+if (device) {
+/* Open before spawning new threads.  In the future, we may
+ * drop privileges after opening.
+ */
+fd = open(device, O_RDWR);
+if (fd == -1) {
+err(EXIT_FAILURE, "Failed to open %s", device);
+}
+
+if (sockpath == NULL) {
+sockpath = g_malloc(128);
+snprintf(sockpath, 128, SOCKET_PATH, basename(device));
+}
+}
+
+bs = bdrv_new("hda");
+if ((ret = bdrv_open(bs, srcpath, flags, NULL)) < 0) {
+errno = -ret;
+err(EXIT_FAILURE, "Failed to bdrv_open '%s'", srcpath);
+}
+
+fd_size = bs->total_sectors * 512;
+
+if (partition != -1 &&
+find_partition(bs, partition, &dev_offset, &fd_size)) {
+err(EXIT_FAILURE, "Could not find partition %d", partition);
+}
+
+sharing_fds = g_malloc((shared + 1) * sizeof(int));
+
+if (sockpath) {
+sharing_fds[0] = unix_socket_incoming(sockpath);
+} else {
+sharing_fds[0] = tcp_socket_incoming(bindto, port);
+}
+
+if (sharing_fds[0] == -1)
+return 1;
+
+if (device) {
+int ret;
+
+ret = pthread_create(&client_thread, NULL, nbd_client_thread, &fd);
+if (ret != 0) {
+errx(EXIT_FAILURE, "Failed to create client thread: %s",
+ strerror(ret));
+}
+} else {
+/* Shut up GCC warnings.  */
+memset(&client_thread, 0, sizeof(client_thread));
+}
+
+max_fd = sharing_fds[0];
+nb_fds++;
+
+data = qemu_blockalign(bs, NBD_BUFFER_SIZE);
+if (data == NULL) {
+errx(EXIT_FAILURE, "Cannot allocate data buffer");
+}
+
+do {
+FD_ZERO(&fds);
+FD_SET(sigterm_fd[0], &fds);
+for (i = 0; i < nb_fds; i++)
+FD_SET(sharing_fds[i], &fds);
+
+do {
+ret = select(max_fd + 1, &fds, NULL, NULL, NULL);
+} while (ret == -1 && errno == EINTR);
+if (ret == -1 || FD_ISSET(sigterm_fd[0], &fds)) {
+int sigbuf[1];
+read(sigterm_fd[0], sigbuf, 1);
+break;
+}
+
+if (FD_ISSET(sharing_fds[0], &fds))
+ret--;
+for (i = 1; i < nb_fds && ret; i++) {
+if (FD_ISSET(sharing_fds[i], &fds)) {
+if (nbd_trip(bs, sharing_fds[i], fd_size, dev_offset,
+&offset, nbdflags, data, NBD_BUFFER_SIZE) != 0) {
+close(sharing_fds[i]);
+nb_fds--;
+sharing_fds[i] = sharing_fds[nb_fds];
+i--;
+}
+ret--;
+}
+}
+/* new connection ? */
+if (FD_ISSET(sharing_fds[0], &fds)) {
+if (nb_fds < shared + 1) {
+sharing_fds[nb_fds] = accept(sharing_fds[0],
+ (struct sockaddr *)&addr,
+ &addr_len);
+if (sharing

[Qemu-devel] [PATCH v4 3/3] Add -f option to qemu-nbd

2011-12-02 Thread Chunyan Liu
Add -f option to qemu-nbd so that it can find a free nbd device and connect
disk.img to that device.

Changes to v3:
a. According to Stefan's suggestion, loop over /dev/nbd%d to do "qemu-nbd -f
disk.img", if fails, try next device.
b. syntax "qemu-nbd -f disk.img" only 

Signed-off-by: Chunyan Liu 
---
 qemu-nbd.c |   25 ++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index 83ae30f..431373d 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -400,7 +400,7 @@ static int nbd_setup(void)
 
 int main(int argc, char **argv)
 {
-const char *sopt = "hVb:o:p:rsnP:c:dvk:e:t";
+const char *sopt = "hVb:o:p:rsnP:c:dvk:e:tf";
 struct option lopt[] = {
 { "help", 0, NULL, 'h' },
 { "version", 0, NULL, 'V' },
@@ -417,12 +417,14 @@ int main(int argc, char **argv)
 { "shared", 1, NULL, 'e' },
 { "persistent", 0, NULL, 't' },
 { "verbose", 0, NULL, 'v' },
+{ "find", 0, NULL, 'f' },
 { NULL, 0, NULL, 0 }
 };
 int ch;
 int opt_ind = 0;
 char *end;
 int ret = 0;
+int find = 0;
 
 /* The client thread uses SIGTERM to interrupt the server.  A signal
  * handler ensures that "qemu-nbd -v -c" exits with a nice status code.
@@ -491,6 +493,9 @@ int main(int argc, char **argv)
 case 'c':
 device = optarg;
 break;
+case 'f':
+find = 1;
+break;
 case 'e':
 shared = strtol(optarg, &end, 0);
 if (*end) {
@@ -541,7 +546,7 @@ int main(int argc, char **argv)
return 0;
 }
 
-if (device && !verbose) {
+if ((device || find) && !verbose) {
 int stderr_fd[2];
 pid_t pid;
 
@@ -596,7 +601,21 @@ int main(int argc, char **argv)
 atexit(bdrv_close_all);
 srcpath = argv[optind];
 
-ret = nbd_setup();
+if (!find) {
+ret = nbd_setup();
+} else {
+int max_nbd = 16;
+int i;
+for (i = 0; i < max_nbd; i++) {
+if (!asprintf(&device, "/dev/nbd%d", i))
+continue;
+ret = nbd_setup();
+if (ret != EXIT_SUCCESS) {
+free(device);
+continue;
+}
+}
+}
 
 exit(ret);
 }
-- 
1.7.3.4




Re: [Qemu-devel] [PATCH V3 2/2] Add -f option to qemu-nbd

2011-12-02 Thread Chunyan Liu
2011/11/29 Stefan Hajnoczi 

> On Fri, Nov 25, 2011 at 10:19 AM, Chunyan Liu  wrote:
> >
> >
> > 2011/11/24 Stefan Hajnoczi 
> >>
> >> On Thu, Nov 24, 2011 at 3:38 AM, Chunyan Liu  wrote:
> >> >
> >> >
> >> > 2011/11/23 Stefan Hajnoczi 
> >> >>
> >> >> On Wed, Nov 23, 2011 at 10:14 AM, Chunyan Liu 
> wrote:
> >> >> > V3:
> >> >> > Remove file lock in main().
> >> >> > Try to find new free nbd device and connect to it if connecting to
> >> >> > the
> >> >> > first
> >> >> > first found free nbd device failed.
> >> >> >
> >> >> > Signed-off-by: Chunyan Liu 
> >> >> > ---
> >> >> >  qemu-nbd.c |   80
> >> >> > +++-
> >> >> >  1 files changed, 79 insertions(+), 1 deletions(-)
> >> >>
> >> >> I not seeing the part where you adjusted the ioctl order.
> >> >>
> >> >> The /proc/partitions scanning is unnecessary since we can just loop
> >> >> over /dev/ndb%d and try to initialize.  If a device is in use then
> >> >> init will fail and we need to try the next one.  If a device is free
> >> >> we can continue with normal operation.  I guess I'm saying that once
> >> >> you fix the ioctl order then there's no need for another mechanism to
> >> >> test whether or not a device is in use.
> >> >
> >> > The way of scanning /proc/partitions to find an unused nbd device
> first
> >> > can
> >> > borrow the code for "qemu-nbd -c" to do the left things. .
> >> > The way of loop over /dev/nbd%d and try to initialize, from the first
> >> > thought, needs do all things in the loop, including handling -v,
> >> > nbd_init,
> >> > nbd_client, etc. That part of code is quite similar to "qemu-nbd -c".
> I
> >> > don't know if that is better?
> >>
> >> This might be a chance to refactor the code slightly, that would also
> >> avoid you having to introduce a goto retry.
> >>
> > About detail implementation of the loop over /dev/nbd%d way, have done
> some
> > coding and testing. I'm afraid the reorganization work is not very
> slight,
> > not sure how do you think.
> > First, through nbd_init() success or fail to check if the device is in
> use,
> > at least nbd_init() and operations before nbd_init() but device relative
> > should be in the loop. Usually, there are two ways to be considered:
> > 1. Try to divide current "qemu-nbd -c" processing code into two parts (
> > nbd_init() and before, and operations after nbd_init()), 1st part put
> into
> > the loop, 2nd part outside loop. This way is hard to achieve. nbd_init()
> > should be in client thread, but the loop is outside that thread, it's not
> > proper to drag out nbd_init() from client thread and put it into the
> loop.
> > 2. Put all "qemu-nbd -c" processing code (device relative) in the loop,
> > directly check the "qemu-nbd -c /dev/nbd%d disk.img" result, if fail, try
> > next nbd device. In this way, will adjust current code order and extract
> > device related codes to a new function so that both "qemu-nbd -c" and
> > "qemu-nbd -f" can use.(some initialization work and cleanup work to be
> > cared)
> >
> > A draft is in attachment. qemu-nbd -f is working, since I'm not sure such
> > change is acceptable or not, not extract code in the loop into a function
> > yet.
>
> I think a common function makes sense.  This may be nicest in two
> patches, Patch 1 moves the code into a function, Patch 2 implements
> -f/find.
>
>
Just sent the patch sets according to above suggestion. Please review.
1/3-Update-ioctl-order-in-nbd_init-to-detect-EBUSY
2/3-Extract-code-to-nbd_setup-function-to-be-used-for-mamy-purposes
3/3-Add-f-option-to-qemu-nbd

Stefan
>
>


Re: [Qemu-devel] [PATCH 2/3] ppce500_pci: remove sysbus_init_mmio_cb2 usage

2011-12-02 Thread Benoît Canet
>
> How much did you test this patch, by the way? I've been running into
> some odd behaviour with sub-page-sized memory regions which I'm
> wondering if you hit here...


An e1000 attached as a pci card works fine. (ping and wget www.google.com)


Re: [Qemu-devel] [PATCH 2/2] ppc_prep: convert ioport to memory API

2011-12-02 Thread Andreas Färber
Benoît,

Just spotted this.

Am 01.12.2011 17:57, schrieb Benoît Canet:
> Signed-off-by: Benoît Canet 

You should've cc'ed me here as maintainer. As indicated to you, I have
pending patches for PReP (e.g., moving io800 and dropping speaker in
favor of qdev), which this conflicts with once again. I'm in favor of
merging your conversions as a short-term solution though, so that it can
go through Avi's tree.

The patch itself looks okay on brief look, except that io_fake and
prep-fake should better be io_fakeio and prep-fakeio respectively (still
ugly as hell, but the real Super I/O we prepared for 40P turned out
incompatible somehow).

I'll test later. Did you in some way?

Regards,
Andreas

> ---
>  hw/ppc_prep.c |   80 
> -
>  1 files changed, 62 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
> index f22d5b9..299305b 100644
> --- a/hw/ppc_prep.c
> +++ b/hw/ppc_prep.c
> @@ -94,7 +94,8 @@ static int speaker_data_on;
>  static int dummy_refresh_clock;
>  #endif
>  
> -static void speaker_ioport_write (void *opaque, uint32_t addr, uint32_t val)
> +static void speaker_ioport_write(void *opaque, target_phys_addr_t addr,
> + uint64_t val, unsigned size)
>  {
>  #if 0
>  speaker_data_on = (val >> 1) & 1;
> @@ -102,7 +103,8 @@ static void speaker_ioport_write (void *opaque, uint32_t 
> addr, uint32_t val)
>  #endif
>  }
>  
> -static uint32_t speaker_ioport_read (void *opaque, uint32_t addr)
> +static uint64_t speaker_ioport_read(void *opaque, target_phys_addr_t addr,
> +unsigned size)
>  {
>  #if 0
>  int out;
> @@ -114,6 +116,16 @@ static uint32_t speaker_ioport_read (void *opaque, 
> uint32_t addr)
>  return 0;
>  }
>  
> +static const MemoryRegionOps speaker_ioport_ops = {
> +.read = speaker_ioport_read,
> +.write = speaker_ioport_write,
> +.endianness = DEVICE_LITTLE_ENDIAN,
> +.valid = {
> +.min_access_size = 1,
> +.max_access_size = 1,
> +},
> +};
> +
>  /* PCI intack register */
>  /* Read-only register (?) */
>  static void PPC_intack_write (void *opaque, target_phys_addr_t addr,
> @@ -251,7 +263,8 @@ enum {
>  
>  static sysctrl_t *sysctrl;
>  
> -static void PREP_io_write (void *opaque, uint32_t addr, uint32_t val)
> +static void PREP_io_write(void *opaque, target_phys_addr_t addr,
> +  uint64_t val, unsigned size)
>  {
>  sysctrl_t *sysctrl = opaque;
>  
> @@ -260,7 +273,8 @@ static void PREP_io_write (void *opaque, uint32_t addr, 
> uint32_t val)
>  sysctrl->fake_io[addr - 0x0398] = val;
>  }
>  
> -static uint32_t PREP_io_read (void *opaque, uint32_t addr)
> +static uint64_t PREP_io_read(void *opaque, target_phys_addr_t addr,
> + unsigned size)
>  {
>  sysctrl_t *sysctrl = opaque;
>  
> @@ -269,7 +283,18 @@ static uint32_t PREP_io_read (void *opaque, uint32_t 
> addr)
>  return sysctrl->fake_io[addr - 0x0398];
>  }
>  
> -static void PREP_io_800_writeb (void *opaque, uint32_t addr, uint32_t val)
> +static const MemoryRegionOps PREP_io_ops = {
> +.read = PREP_io_read,
> +.write = PREP_io_write,
> +.endianness = DEVICE_LITTLE_ENDIAN,
> +.valid = {
> +.min_access_size = 1,
> +.max_access_size = 1,
> +},
> +};
> +
> +static void PREP_io_800_writeb(void *opaque, target_phys_addr_t addr,
> +   uint64_t val, unsigned size)
>  {
>  sysctrl_t *sysctrl = opaque;
>  
> @@ -330,13 +355,14 @@ static void PREP_io_800_writeb (void *opaque, uint32_t 
> addr, uint32_t val)
>  sysctrl->contiguous_map = val & 0x01;
>  break;
>  default:
> -printf("ERROR: unaffected IO port write: %04" PRIx32
> -   " => %02" PRIx32"\n", addr, val);
> +printf("ERROR: unaffected IO port write: %04" PRIx64
> +   " => %02" PRIx64 "\n", addr, val);
>  break;
>  }
>  }
>  
> -static uint32_t PREP_io_800_readb (void *opaque, uint32_t addr)
> +static uint64_t PREP_io_800_readb(void *opaque, target_phys_addr_t addr,
> +  unsigned size)
>  {
>  sysctrl_t *sysctrl = opaque;
>  uint32_t retval = 0xFF;
> @@ -393,15 +419,25 @@ static uint32_t PREP_io_800_readb (void *opaque, 
> uint32_t addr)
>  retval = sysctrl->contiguous_map;
>  break;
>  default:
> -printf("ERROR: unaffected IO port: %04" PRIx32 " read\n", addr);
> +printf("ERROR: unaffected IO port: %04" PRIx64 " read\n", addr);
>  break;
>  }
> -PPC_IO_DPRINTF("0x%08" PRIx32 " <= 0x%02" PRIx32 "\n",
> +PPC_IO_DPRINTF("0x%08" PRIx64 " <= 0x%02" PRIx64 "\n",
> addr - PPC_IO_BASE, retval);
>  
>  return retval;
>  }
>  
> +static const MemoryRegionOps PREP_io_800_ops = {
> +.read = PREP_io_800_readb,
> +.write = PREP_io_800_writeb,
> +.endianness = DEVICE_LITTLE_E

Re: [Qemu-devel] [PATCH v2 0/8] [RFC] vmstate: Add copyrights for all cpus

2011-12-02 Thread Andreas Färber
Am 27.11.2011 14:30, schrieb Juan Quintela:
> Andreas Färber  wrote:
>> Hi Juan,
>>
>> Am 23.11.2011 16:44, schrieb Juan Quintela:
>>> [ Resnd this time also ading fabrice address, sorry ]
>>>
>>> v2:
>>> - split patches by file, make easier to add "acked-by" notices.
>>> - cc'd fabrice
>>> - everybody (except for Thiemo for ovbious reasons) answered.
>>> - move ppc/sparc/i386 to BSD like license from vl.c at Blue
>>>   suggestion. 
>>>
>>> - move all other licenses to GPL v2 or later (notice that I had forget
>>>   the later part on the 1st submission).  Notice this change for the
>>>   people that acked previous version.
>>>
>>> Any other comments?
>>
>> I did have another comment regarding the "Based on" part that you
>> haven't responded to yet.
> 
> Sorry, forgot about that one.  What text do you propose?
> 
> * Based on serialization based on QEMUFile done by:
> 
> 
> 
> Any other proposal?

Keep it short and simple. Off the top of my head:

* Based on serialization code by:

(don't see what qemu-file / QEMUFile has to do with it?)

* Based on savevm code by:

(yeah, it's not just that but still a better keyword than qemu-file IMO)

But maybe I'm just misunderstanding something here?

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 v4 2/3] Extract code to nbd_setup function to be used for many purposes

2011-12-02 Thread Paolo Bonzini

On 12/02/2011 04:27 PM, Chunyan Liu wrote:

@@ -42,6 +42,18 @@ static int verbose;
  static char *device;
  static char *srcpath;
  static char *sockpath;
+static int is_sockpath_option;
+static int sigterm_fd[2];
+static off_t dev_offset;
+static uint32_t nbdflags;
+static bool disconnect;
+static const char *bindto = "0.0.0.0";
+static int port = NBD_DEFAULT_PORT;
+static int li;
+static int flags = BDRV_O_RDWR;
+static int partition = -1;
+static int shared = 1;
+static int persistent;


A lot of statics... "li" seems unused.

I took patch 1/3 in my tree (git://github.com/bonzini/qemu.git branch 
nbd-server).  I'll post it together with my patches next week.


Paolo



Re: [Qemu-devel] [PATCH 1.0] disable automatic loading of sgabios when -nographic

2011-12-02 Thread Paolo Bonzini

On 11/08/2011 06:23 PM, Anthony Liguori wrote:

On 11/03/2011 10:00 AM, Paolo Bonzini wrote:

sgabios hasn't gotten a lot of coverage since it was not shipped. For
1.0,
let's disable the automatic loading of the option ROM in -nographic
mode. We can put it back for 1.1.

Signed-off-by: Paolo Bonzini


Applied. Thanks.


Can you please revert it for 1.1?  Thanks!

Paolo


---
Requested by Anthony on IRC.

hw/pc.c | 9 -
1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index eb4c2d8..1024465 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1104,15 +1104,6 @@ void pc_vga_init(PCIBus *pci_bus)
isa_vga_init();
}
}
-
- /*
- * sga does not suppress normal vga output. So a machine can have both a
- * vga card and sga manually enabled. Output will be seen on both.
- * For nographic case, sga is enabled at all times
- */
- if (display_type == DT_NOGRAPHIC) {
- isa_create_simple("sga");
- }
}

static void cpu_request_exit(void *opaque, int irq, int level)









Re: [Qemu-devel] [PATCH 1.0] disable automatic loading of sgabios when -nographic

2011-12-02 Thread Anthony Liguori

On 12/02/2011 10:33 AM, Paolo Bonzini wrote:

On 11/08/2011 06:23 PM, Anthony Liguori wrote:

On 11/03/2011 10:00 AM, Paolo Bonzini wrote:

sgabios hasn't gotten a lot of coverage since it was not shipped. For
1.0,
let's disable the automatic loading of the option ROM in -nographic
mode. We can put it back for 1.1.

Signed-off-by: Paolo Bonzini


Applied. Thanks.


Can you please revert it for 1.1? Thanks!


Can you send a patch?

Regards,

Anthony Liguori



Paolo


---
Requested by Anthony on IRC.

hw/pc.c | 9 -
1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index eb4c2d8..1024465 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1104,15 +1104,6 @@ void pc_vga_init(PCIBus *pci_bus)
isa_vga_init();
}
}
-
- /*
- * sga does not suppress normal vga output. So a machine can have both a
- * vga card and sga manually enabled. Output will be seen on both.
- * For nographic case, sga is enabled at all times
- */
- if (display_type == DT_NOGRAPHIC) {
- isa_create_simple("sga");
- }
}

static void cpu_request_exit(void *opaque, int irq, int level)











Re: [Qemu-devel] [PATCH 2/2] ppc_prep: convert ioport to memory API

2011-12-02 Thread Benoît Canet
>
> The patch itself looks okay on brief look, except that io_fake and
> prep-fake should better be io_fakeio and prep-fakeio respectively (still
> ugly as hell, but the real Super I/O we prepared for 40P turned out
> incompatible somehow).
>

I'll make the required changes and test them with buildroot (just a few
compilation time).

Regards

Benoît

> > ---
> >  hw/ppc_prep.c |   80
> -
> >  1 files changed, 62 insertions(+), 18 deletions(-)
> >
> > diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
> > index f22d5b9..299305b 100644
> > --- a/hw/ppc_prep.c
> > +++ b/hw/ppc_prep.c
> > @@ -94,7 +94,8 @@ static int speaker_data_on;
> >  static int dummy_refresh_clock;
> >  #endif
> >
> > -static void speaker_ioport_write (void *opaque, uint32_t addr, uint32_t
> val)
> > +static void speaker_ioport_write(void *opaque, target_phys_addr_t addr,
> > + uint64_t val, unsigned size)
> >  {
> >  #if 0
> >  speaker_data_on = (val >> 1) & 1;
> > @@ -102,7 +103,8 @@ static void speaker_ioport_write (void *opaque,
> uint32_t addr, uint32_t val)
> >  #endif
> >  }
> >
> > -static uint32_t speaker_ioport_read (void *opaque, uint32_t addr)
> > +static uint64_t speaker_ioport_read(void *opaque, target_phys_addr_t
> addr,
> > +unsigned size)
> >  {
> >  #if 0
> >  int out;
> > @@ -114,6 +116,16 @@ static uint32_t speaker_ioport_read (void *opaque,
> uint32_t addr)
> >  return 0;
> >  }
> >
> > +static const MemoryRegionOps speaker_ioport_ops = {
> > +.read = speaker_ioport_read,
> > +.write = speaker_ioport_write,
> > +.endianness = DEVICE_LITTLE_ENDIAN,
> > +.valid = {
> > +.min_access_size = 1,
> > +.max_access_size = 1,
> > +},
> > +};
> > +
> >  /* PCI intack register */
> >  /* Read-only register (?) */
> >  static void PPC_intack_write (void *opaque, target_phys_addr_t addr,
> > @@ -251,7 +263,8 @@ enum {
> >
> >  static sysctrl_t *sysctrl;
> >
> > -static void PREP_io_write (void *opaque, uint32_t addr, uint32_t val)
> > +static void PREP_io_write(void *opaque, target_phys_addr_t addr,
> > +  uint64_t val, unsigned size)
> >  {
> >  sysctrl_t *sysctrl = opaque;
> >
> > @@ -260,7 +273,8 @@ static void PREP_io_write (void *opaque, uint32_t
> addr, uint32_t val)
> >  sysctrl->fake_io[addr - 0x0398] = val;
> >  }
> >
> > -static uint32_t PREP_io_read (void *opaque, uint32_t addr)
> > +static uint64_t PREP_io_read(void *opaque, target_phys_addr_t addr,
> > + unsigned size)
> >  {
> >  sysctrl_t *sysctrl = opaque;
> >
> > @@ -269,7 +283,18 @@ static uint32_t PREP_io_read (void *opaque,
> uint32_t addr)
> >  return sysctrl->fake_io[addr - 0x0398];
> >  }
> >
> > -static void PREP_io_800_writeb (void *opaque, uint32_t addr, uint32_t
> val)
> > +static const MemoryRegionOps PREP_io_ops = {
> > +.read = PREP_io_read,
> > +.write = PREP_io_write,
> > +.endianness = DEVICE_LITTLE_ENDIAN,
> > +.valid = {
> > +.min_access_size = 1,
> > +.max_access_size = 1,
> > +},
> > +};
> > +
> > +static void PREP_io_800_writeb(void *opaque, target_phys_addr_t addr,
> > +   uint64_t val, unsigned size)
> >  {
> >  sysctrl_t *sysctrl = opaque;
> >
> > @@ -330,13 +355,14 @@ static void PREP_io_800_writeb (void *opaque,
> uint32_t addr, uint32_t val)
> >  sysctrl->contiguous_map = val & 0x01;
> >  break;
> >  default:
> > -printf("ERROR: unaffected IO port write: %04" PRIx32
> > -   " => %02" PRIx32"\n", addr, val);
> > +printf("ERROR: unaffected IO port write: %04" PRIx64
> > +   " => %02" PRIx64 "\n", addr, val);
> >  break;
> >  }
> >  }
> >
> > -static uint32_t PREP_io_800_readb (void *opaque, uint32_t addr)
> > +static uint64_t PREP_io_800_readb(void *opaque, target_phys_addr_t addr,
> > +  unsigned size)
> >  {
> >  sysctrl_t *sysctrl = opaque;
> >  uint32_t retval = 0xFF;
> > @@ -393,15 +419,25 @@ static uint32_t PREP_io_800_readb (void *opaque,
> uint32_t addr)
> >  retval = sysctrl->contiguous_map;
> >  break;
> >  default:
> > -printf("ERROR: unaffected IO port: %04" PRIx32 " read\n", addr);
> > +printf("ERROR: unaffected IO port: %04" PRIx64 " read\n", addr);
> >  break;
> >  }
> > -PPC_IO_DPRINTF("0x%08" PRIx32 " <= 0x%02" PRIx32 "\n",
> > +PPC_IO_DPRINTF("0x%08" PRIx64 " <= 0x%02" PRIx64 "\n",
> > addr - PPC_IO_BASE, retval);
> >
> >  return retval;
> >  }
> >
> > +static const MemoryRegionOps PREP_io_800_ops = {
> > +.read = PREP_io_800_readb,
> > +.write = PREP_io_800_writeb,
> > +.endianness = DEVICE_LITTLE_ENDIAN,
> > +.valid = {
> > +.min_access_size = 1,
> > +.max_access_size = 1,
> > +},
> > +};
> > +
> >  sta

Re: [Qemu-devel] [PATCH RFC for-1.0] Update copyright info

2011-12-02 Thread Andreas Färber
Thanks for your comment.

>>> Copyright (c) 2003-2011 Fabrice Bellard and contributors
>> Copyright (c) 2003-2008 Fabrice Bellard, Copyright (c) 200x-2011 s.o.

Am 02.12.2011 16:25, schrieb Natalia Portillo:
> Fabrice by the european copyright laws still have copyright and ipr in any 
> code he generated whatever we have changed as per the "multiple contributors" 
> section of the european laws.

No one suggested removing his copyright. But to my understanding Fabrice
has no 2009+ copyright on derived works. That's why the copyright wasn't
updated all those years, I guess.

Andreas

> El 02/12/2011, a las 15:11, Andreas Färber escribió:
> 
>> Gerd just reminded me that we did ship 1.0 with a 2008 copyright notice.
>>
>> Am 04.11.2011 18:56, schrieb Andreas Färber:
>>> Judging by -version output, one could get the impression that QEMU was
>>> last modified in 2008. Therefore extend the copyright statement to
>>> cover other contributors so that it can be updated to the current year.
>>>
>>> Signed-off-by: Andreas Färber 
>>
>> Is my text change okay, so that I should extend the patch to cover
>> *-user as pointed out by Peter? Or is the change a no-go for legal or
>> libvirt reasons?
>>
>> An alternative mentioned in this thread was:
>> Copyright (c) 2003-2008 Fabrice Bellard, Copyright (c) 200x-2011 s.o.
>>
>> The former was intended as a short-term fix for 1.0.
>> I would prefer the latter mid-term since Fabrice doesn't hold any
>> copyright/IPR in the code after he left, but what year and what someone?
>>
>> Opinions please,
>>
>> Andreas
>>
>>> ---
>>> vl.c |2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/vl.c b/vl.c
>>> index 624da0f..47e0ae0 100644
>>> --- a/vl.c
>>> +++ b/vl.c
>>> @@ -1484,7 +1484,7 @@ static void main_loop(void)
>>>
>>> static void version(void)
>>> {
>>> -printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", 
>>> Copyright (c) 2003-2008 Fabrice Bellard\n");
>>> +printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", 
>>> Copyright (c) 2003-2011 Fabrice Bellard and contributors\n");
>>> }
>>>
>>> static void help(int exitcode)

-- 
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 v4 7/8] block: core copy-on-read logic

2011-12-02 Thread Marcelo Tosatti
On Wed, Nov 23, 2011 at 11:47:57AM +, Stefan Hajnoczi wrote:
> Signed-off-by: Stefan Hajnoczi 
> ---
>  block.c  |   72 
> ++
>  trace-events |1 +
>  2 files changed, 73 insertions(+), 0 deletions(-)
> 
> diff --git a/block.c b/block.c
> index c30c8f2..a598a19 100644
> --- a/block.c
> +++ b/block.c
> @@ -1469,6 +1469,61 @@ int bdrv_pwrite_sync(BlockDriverState *bs, int64_t 
> offset,
>  return 0;
>  }
>  
> +static int coroutine_fn bdrv_co_copy_on_readv(BlockDriverState *bs,
> +int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
> +{
> +/* Perform I/O through a temporary buffer so that users who scribble over
> + * their read buffer while the operation is in progress do not end up
> + * modifying the image file.  This is critical for zero-copy guest I/O
> + * where anything might happen inside guest memory.
> + */
> +void *bounce_buffer;
> +
> +struct iovec iov;
> +QEMUIOVector bounce_qiov;
> +int64_t cluster_sector_num;
> +int cluster_nb_sectors;
> +size_t skip_bytes;
> +int ret;
> +
> +/* Cover entire cluster so no additional backing file I/O is required 
> when
> + * allocating cluster in the image file.
> + */
> +round_to_clusters(bs, sector_num, nb_sectors,
> +  &cluster_sector_num, &cluster_nb_sectors);
> +
> +trace_bdrv_co_copy_on_readv(bs, sector_num, nb_sectors,
> +cluster_sector_num, cluster_nb_sectors);
> +
> +iov.iov_len = cluster_nb_sectors * BDRV_SECTOR_SIZE;
> +iov.iov_base = bounce_buffer = qemu_blockalign(bs, iov.iov_len);
> +qemu_iovec_init_external(&bounce_qiov, &iov, 1);
> +
> +ret = bs->drv->bdrv_co_readv(bs, cluster_sector_num, cluster_nb_sectors,
> + &bounce_qiov);
> +if (ret < 0) {
> +goto err;
> +}
> +
> +ret = bs->drv->bdrv_co_writev(bs, cluster_sector_num, cluster_nb_sectors,
> +  &bounce_qiov);
> +if (ret < 0) {
> +/* It might be okay to ignore write errors for guest requests.  If 
> this
> + * is a deliberate copy-on-read then we don't want to ignore the 
> error.
> + * Simply report it in all cases.
> + */
> +goto err;
> +}
> +
> +skip_bytes = (sector_num - cluster_sector_num) * BDRV_SECTOR_SIZE;
> +qemu_iovec_from_buffer(qiov, bounce_buffer + skip_bytes,
> +   nb_sectors * BDRV_SECTOR_SIZE);
> +
> +err:
> +qemu_vfree(bounce_buffer);
> +return ret;
> +}
> +
>  /*
>   * Handle a read request in coroutine context
>   */
> @@ -1496,7 +1551,24 @@ static int coroutine_fn 
> bdrv_co_do_readv(BlockDriverState *bs,
>  }
>  
>  tracked_request_begin(&req, bs, sector_num, nb_sectors, false);
> +
> +if (bs->copy_on_read) {
> +int pnum;
> +
> +ret = bdrv_co_is_allocated(bs, sector_num, nb_sectors, &pnum);
> +if (ret < 0) {
> +goto out;
> +}

Stefan,

It is not clear where support for shared backing files would fit.
Let us consider the following block copy example:

1) Original chain:
[ BASE ] -> [ IMAGE-1 ] -> [ IMAGE-2 ] -> [ IMAGE-3 ]

2) Final chain:
[ BASE ] -> [ IMAGE-3 ]

I was talking to Kevin and we don't have code/monitor command to the
switch from 1) to 2). But that is a separate issue.

Question is, how do you plan to stream the contents of IMAGE-1 and
IMAGE-2 (but not BASE), into IMAGE-3 ? That is an important use case.

Also, do you have status on the external COW file work, for raw images?

Thanks




Re: [Qemu-devel] [ICON] Quinn the Qemu emu gazes ahead thoughtfully, considering what the future holds

2011-12-02 Thread Andreas Färber
Am 30.11.2011 15:41, schrieb Alex Bradbury:
> Qemu

The correct spelling for any logo is "QEMU".

Cf. http://wiki.qemu.org/License

Regards,
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] [RFC v2 6/6] Add C version of rtc-test

2011-12-02 Thread Kevin Wolf
Am 01.12.2011 19:43, schrieb Anthony Liguori:
> ---
>  Makefile   |4 +
>  rtc-test.c |  201 
> 
>  2 files changed, 205 insertions(+), 0 deletions(-)
>  create mode 100644 rtc-test.c
> 
> diff --git a/Makefile b/Makefile
> index 301c75e..838cb01 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -215,6 +215,10 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) 
> $(GENERATED_HEADERS)
>  
>  qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(tools-obj-y) 
> $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)
>  
> +libqtest.o: libqtest.c

Did you forget to commit libqtest.c?

I think your series is a good start, but the examples only use port I/O.
Most other tests would probably need to access RAM (not sure if it's
convenient to do explicit read/write commands for that), interrupts and
some even QMP.

Should the framework and the tests live in the tests/ directory?

Kevin



[Qemu-devel] [Bug 723871] Re: qemu-kvm-0.14.0 Aborts with -vga qxl

2011-12-02 Thread Serge Hallyn
** Changed in: libvirt (Ubuntu)
   Status: Triaged => Fix Released

** Changed in: libvirt (Ubuntu)
   Status: Fix Released => Invalid

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

Title:
  qemu-kvm-0.14.0 Aborts with -vga qxl

Status in QEMU:
  Invalid
Status in “libvirt” package in Ubuntu:
  Invalid
Status in “qemu-kvm” package in Ubuntu:
  Fix Released

Bug description:
  Host CPU is Core i7 Q820.  KVM is from 2.6.35-gentoo-r5 kernel (x86_64).
  Host has spice-0.7.2 and spice-protocol-0.7.0.
  Guest is Windows XP SP3 with qxl driver 0.6.1, virtio-serial 1.1.6 and 
vdagent 0.6.3.

  qemu-kvm is started like so:
  qemu-system-x86_64 -cpu host -enable-kvm -pidfile /home/rick/qemu/hds/wxp.pid 
-drive 
file=/home/rick/qemu/hds/wxp.raw,if=virtio,media=disk,aio=native,snapshot=on -m 
768 -name WinXP -net nic,model=virtio -net user -localtime -usb -vga qxl 
-device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent -device 
virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice 
port=1234,disable-ticketing -monitor stdio
  and crashes with:
  qemu-system-x86_64: /home/rick/qemu/src/qemu-kvm-0.14.0/qemu-kvm.c:1724: 
kvm_mutex_unlock: Assertion `!cpu_single_env' failed.
  Aborted

  If I use -no-kvm, it works fine.  If I use -vga std, it works fine.
  -enable-kvm and -vga qxl crashes.

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



Re: [Qemu-devel] [RFC v2 6/6] Add C version of rtc-test

2011-12-02 Thread Anthony Liguori

On 12/02/2011 11:25 AM, Kevin Wolf wrote:

Am 01.12.2011 19:43, schrieb Anthony Liguori:

---
  Makefile   |4 +
  rtc-test.c |  201 
  2 files changed, 205 insertions(+), 0 deletions(-)
  create mode 100644 rtc-test.c

diff --git a/Makefile b/Makefile
index 301c75e..838cb01 100644
--- a/Makefile
+++ b/Makefile
@@ -215,6 +215,10 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) $(GENERATED_HEADERS)

  qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(tools-obj-y) 
$(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)

+libqtest.o: libqtest.c


Did you forget to commit libqtest.c?


Probably, sorry about that.


I think your series is a good start, but the examples only use port I/O.
Most other tests would probably need to access RAM (not sure if it's
convenient to do explicit read/write commands for that), interrupts and
some even QMP.


libqtest.h has:

bool qtest_get_irq(QTestState *s, int num);

void qtest_outb(QTestState *s, uint16_t addr, uint8_t value);

void qtest_outw(QTestState *s, uint16_t addr, uint16_t value);

void qtest_outl(QTestState *s, uint16_t addr, uint32_t value);

uint8_t qtest_inb(QTestState *s, uint16_t addr);

uint16_t qtest_inw(QTestState *s, uint16_t addr);

uint32_t qtest_inl(QTestState *s, uint16_t addr);

void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size);

void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t 
size);

So that's how you read/write memory.  Likewise, for IRQs, you can poll the 
status of a given IRQ.  I thought about doing some sort of signal magic around 
but when writing tests, polling the IRQ seems easier to deal with.



Should the framework and the tests live in the tests/ directory?


Probably, except that tests/ has it's own Makefile which is sort of awkward. 
Any objections to moving tests/* to tests/tcg-test and then moving all of the 
various gtest/check tests to tests/ along with qtest?


Regards,

Anthony Liguori


Kevin






Re: [Qemu-devel] [RFC v2 6/6] Add C version of rtc-test

2011-12-02 Thread Kevin Wolf
Am 02.12.2011 18:26, schrieb Anthony Liguori:
> On 12/02/2011 11:25 AM, Kevin Wolf wrote:
>> Am 01.12.2011 19:43, schrieb Anthony Liguori:
>>> ---
>>>   Makefile   |4 +
>>>   rtc-test.c |  201 
>>> 
>>>   2 files changed, 205 insertions(+), 0 deletions(-)
>>>   create mode 100644 rtc-test.c
>>>
>>> diff --git a/Makefile b/Makefile
>>> index 301c75e..838cb01 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -215,6 +215,10 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) 
>>> $(GENERATED_HEADERS)
>>>
>>>   qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(tools-obj-y) 
>>> $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)
>>>
>>> +libqtest.o: libqtest.c
>>
>> Did you forget to commit libqtest.c?
> 
> Probably, sorry about that.
> 
>> I think your series is a good start, but the examples only use port I/O.
>> Most other tests would probably need to access RAM (not sure if it's
>> convenient to do explicit read/write commands for that), interrupts and
>> some even QMP.
> 
> libqtest.h has:
> 
> bool qtest_get_irq(QTestState *s, int num);
> 
> void qtest_outb(QTestState *s, uint16_t addr, uint8_t value);
> 
> void qtest_outw(QTestState *s, uint16_t addr, uint16_t value);
> 
> void qtest_outl(QTestState *s, uint16_t addr, uint32_t value);
> 
> uint8_t qtest_inb(QTestState *s, uint16_t addr);
> 
> uint16_t qtest_inw(QTestState *s, uint16_t addr);
> 
> uint32_t qtest_inl(QTestState *s, uint16_t addr);
> 
> void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size);
> 
> void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t 
> size);
> 
> So that's how you read/write memory.  Likewise, for IRQs, you can poll the 
> status of a given IRQ.  I thought about doing some sort of signal magic 
> around 
> but when writing tests, polling the IRQ seems easier to deal with.

Okay, polling interrupts should be good enough for tests.

I guess the test still needs to do everything that a guest OS would have
to do, for example send an EOI to the PIC? We'll probably want to have a
library for such things then, but we can add it with the first test that
uses interrupts.

>> Should the framework and the tests live in the tests/ directory?
> 
> Probably, except that tests/ has it's own Makefile which is sort of awkward. 
> Any objections to moving tests/* to tests/tcg-test and then moving all of the 
> various gtest/check tests to tests/ along with qtest?

No objection, I think this is exactly what we should do.

Kevin



[Qemu-devel] [Bug 897771] Re: qemu 1.0-rc4 no longer able to boot NetBSD-current/i386

2011-12-02 Thread Andreas Gustafsson
> Please try to find what is the last major release of qemu that did
boot this correctly.

I assume this is unecessary because Stefan Weil already identified the
excact commit where the problem appeared.

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

Title:
  qemu 1.0-rc4 no longer able to boot NetBSD-current/i386

Status in QEMU:
  Confirmed

Bug description:
  Booting a NetBSD-current/i386 install CD using qemu 1.0-rc4 fails. The
  same CD does boot in earlier versions of qemu, for example, 0.11.0.

  To reproduce, download the

http://www.gson.org/netbsd/bugs/qemu/boot-com-20270050Z.iso

  and attempt to boot it with:

qemu -nographic -cdrom boot-com-20270050Z.iso

  This fails with a guest kernel panic:

NetBSD 5.99.57 (GENERIC) #0: Sun Nov 27 07:41:56 UTC 2011

bui...@b8.netbsd.org:/home/builds/ab/HEAD/i386/20270050Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC
total memory = 127 MB
avail memory = 112 MB
cprng kernel: WARNING insufficient entropy at creation.
mainbus0 (root)
cpu0 at mainbus0 apid 0: QEMU Virtual CPU version 0.15.93, id 0x633
ioapic0 at mainbus0 apid 1
acpi0 at mainbus0: Intel ACPICA 20110623
panic: pci_make_tag: bad request
fatal breakpoint trap in supervisor mode
trap type 1 code 0 eip c0269b04 cs 8 eflags 282 cr2 0 ilevel 8
Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x4:  popl%ebp
db{0}>  t

breakpoint(c0c04c75,c0cc2f80,c0bc91a4,c0e358e4,2,c11b70d6,c0e35908,c053999d,c0cdef20,0)
 at netbsd:breakpoint+0x4

vpanic(c0bc91a4,c0e358e4,c117d068,f,c11e6fcc,0,c0e35918,c0665969,c0bc91a4,c0b1bf4c)
 at netbsd:vpanic+0x1e2
printf_nolog(c0bc91a4,c0b1bf4c,c0e35908,c010d957,8,c0c1f2c0,0,0,c0d08e20,0) 
at netbsd:printf_nolog
pci_decompose_tag(c0e3599c,0,0,10,0,ca675898,c0e35988,c0d08e20,c11b9200,0) 
at netbsd:pci_decompose_tag
acpi_pci_link_add_reference(c12011c0,0,0,10,0,ca41eb90,0,3,0,4) at 
netbsd:acpi_pci_link_add_reference+0xb2

mpacpi_find_interrupts(ca41eb90,c0116a4a,c0116a5e,0,ca41eb90,c0e35b50,c0e35aa8,c01180c7,c,c0116a4a)
 at netbsd:mpacpi_find_interrupts+0x5ea

acpi_md_callback(c,c0116a4a,c0116a5e,0,1,ca3fd7cc,1,c078e2e4,c0cb6ce0,ca435ea0) 
at netbsd:acpi_md_callback+0x1c

acpi_attach(ca660500,ca660d00,c0e35b50,0,c0e35b50,80,f,10,c0b5dcd9,c0e35b42) at 
netbsd:acpi_attach+0x14a

config_attach_loc(ca660500,c0c1d7a0,0,c0e35b50,0,0,2589,58421301,4350,53445842) 
at netbsd:config_attach_loc+0x176

config_found_ia(ca660500,c0b59f3c,c0e35b50,0,4f424101,20534843,80,f,c0c2bbe0,c0c2bc00)
 at netbsd:config_found_ia+0x36

mainbus_rescan(ca660500,c0b59f3c,0,ca660500,c0cb6ce0,c0bd71ce,c0e35bd8,c093575c,ca437f28,c0b8e0a1)
 at netbsd:mainbus_rescan+0x1c2

mainbus_attach(0,ca660500,0,c078f4b7,c0b59187,c0b59187,636f4200,7368,3001403,101)
 at netbsd:mainbus_attach+0xb4
config_attach_loc(0,c0c1bbb0,0,0,0,7368,f10,0,c0b59187,e3b000) at 
netbsd:config_attach_loc+0x176
config_attach(0,c0c1bbb0,0,0,1984,c0cc5680,c0e35cd8,c01f224e,c0b59187,0) at 
netbsd:config_attach+0x2e
config_rootfound(c0b59187,0,0,8,1984,1984,c0e35d40,c04b78d8,c0ba59a1,6) at 
netbsd:config_rootfound+0x42
cpu_configure(c0ba59a1,6,3,0,,f9b00,,f9300,0,0) at 
netbsd:cpu_configure+0x2a
main(0,0,0,0,0,0,0,0,0,0) at netbsd:main+0x2ba
db{0}>

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



Re: [Qemu-devel] [RFC v2 6/6] Add C version of rtc-test

2011-12-02 Thread Luiz Capitulino
On Fri, 02 Dec 2011 18:45:27 +0100
Kevin Wolf  wrote:

> Am 02.12.2011 18:26, schrieb Anthony Liguori:
> > On 12/02/2011 11:25 AM, Kevin Wolf wrote:
> >> Am 01.12.2011 19:43, schrieb Anthony Liguori:
> >>> ---
> >>>   Makefile   |4 +
> >>>   rtc-test.c |  201 
> >>> 
> >>>   2 files changed, 205 insertions(+), 0 deletions(-)
> >>>   create mode 100644 rtc-test.c
> >>>
> >>> diff --git a/Makefile b/Makefile
> >>> index 301c75e..838cb01 100644
> >>> --- a/Makefile
> >>> +++ b/Makefile
> >>> @@ -215,6 +215,10 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) 
> >>> $(GENERATED_HEADERS)
> >>>
> >>>   qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(tools-obj-y) 
> >>> $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)
> >>>
> >>> +libqtest.o: libqtest.c
> >>
> >> Did you forget to commit libqtest.c?
> > 
> > Probably, sorry about that.
> > 
> >> I think your series is a good start, but the examples only use port I/O.
> >> Most other tests would probably need to access RAM (not sure if it's
> >> convenient to do explicit read/write commands for that), interrupts and
> >> some even QMP.
> > 
> > libqtest.h has:
> > 
> > bool qtest_get_irq(QTestState *s, int num);
> > 
> > void qtest_outb(QTestState *s, uint16_t addr, uint8_t value);
> > 
> > void qtest_outw(QTestState *s, uint16_t addr, uint16_t value);
> > 
> > void qtest_outl(QTestState *s, uint16_t addr, uint32_t value);
> > 
> > uint8_t qtest_inb(QTestState *s, uint16_t addr);
> > 
> > uint16_t qtest_inw(QTestState *s, uint16_t addr);
> > 
> > uint32_t qtest_inl(QTestState *s, uint16_t addr);
> > 
> > void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size);
> > 
> > void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t 
> > size);
> > 
> > So that's how you read/write memory.  Likewise, for IRQs, you can poll the 
> > status of a given IRQ.  I thought about doing some sort of signal magic 
> > around 
> > but when writing tests, polling the IRQ seems easier to deal with.
> 
> Okay, polling interrupts should be good enough for tests.
> 
> I guess the test still needs to do everything that a guest OS would have
> to do, for example send an EOI to the PIC? We'll probably want to have a
> library for such things then, but we can add it with the first test that
> uses interrupts.
> 
> >> Should the framework and the tests live in the tests/ directory?
> > 
> > Probably, except that tests/ has it's own Makefile which is sort of 
> > awkward. 
> > Any objections to moving tests/* to tests/tcg-test and then moving all of 
> > the 
> > various gtest/check tests to tests/ along with qtest?
> 
> No objection, I think this is exactly what we should do.

I fully agree.



Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework

2011-12-02 Thread Scott Wood
On 12/02/2011 12:11 PM, Bhushan Bharat-R65777 wrote:
> How do we determine whether guest is ready or not? There can be multiple 
> device get ready at different time.

The guest makes a hypercall with a device handle -- at least that's how
we do it in Topaz.

> Further if guest have given the device to it user level process or its guest. 
> Should not there be some mechanism for a guest to enable/disable on per 
> device or group?

Yes, the same mechanism can be used for that -- though in that case
we'll also want the ability for the guest to be able to control another
layer of mapping (which will get quite tricky with PAMU's limitations).
 This isn't really VFIO's concern, though (unless you're talking about
the VFIO implementation in the guest).

-Scott




Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework

2011-12-02 Thread Bhushan Bharat-R65777


> -Original Message-
> From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On
> Behalf Of Stuart Yoder
> Sent: Friday, December 02, 2011 8:11 PM
> To: Alex Williamson
> Cc: Alexey Kardashevskiy; aafab...@cisco.com; k...@vger.kernel.org;
> p...@au1.ibm.com; qemu-devel@nongnu.org; joerg.roe...@amd.com;
> konrad.w...@oracle.com; ag...@suse.de; d...@au1.ibm.com; chrisw@sous-
> sol.org; Yoder Stuart-B08248; io...@lists.linux-foundation.org;
> a...@redhat.com; linux-...@vger.kernel.org; Wood Scott-B07421;
> be...@cisco.com
> Subject: Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework
> 
> On Thu, Dec 1, 2011 at 3:25 PM, Alex Williamson
>  wrote:
> > On Thu, 2011-12-01 at 14:58 -0600, Stuart Yoder wrote:
> >> One other mechanism we need as well is the ability to enable/disable
> >> a domain.
> >>
> >> For example-- suppose a device is assigned to a VM, the device is in
> >> use when the VM is abruptly terminated.  The VM terminate would shut
> >> off DMA at the IOMMU, but now the device is in an indeterminate
> >> state.   Some devices have no simple reset bit and getting the device
> >> back into a sane state could be complicated-- something the
> >> hypervisor doesn't want to do.
> >>
> >> So now KVM restarts the VM, vfio init happens for the device and  the
> >> IOMMU for that device is re-configured, etc, but we really can't
> >> re-enable DMA until the guest OS tells us (via an hcall) that it is
> >> ready.   The guest needs to get the assigned device in a sane state
> >> before DMA is enabled.
> >
> > Giant red flag.  We need to paravirtualize the guest?  Not on x86.
> 
> It's the reality we have to deal with, but doing this would obviously
> only apply to platforms that need it.
> 
> > Some
> > devices are better for assignment than others.  PCI devices are moving
> > towards supporting standard reset mechanisms.
> >
> >> Does this warrant a new domain enable/disable API, or should we make
> >> this part of the setup API we are discussing here?
> >
> > What's wrong with simply not adding any DMA mapping entries until you
> > think your guest is ready?  Isn't that effectively the same thing?
> > Unmap ~= disable.  If the IOMMU API had a mechanism to toggle the
> > iommu domain on and off, I wouldn't be opposed to adding an ioctl to
> > do it, but it really seems like just a shortcut vs map/unmap.  Thanks,
> 
> Yes, we could do something like that I guess.

How do we determine whether guest is ready or not? There can be multiple device 
get ready at different time.
Further if guest have given the device to it user level process or its guest. 
Should not there be some mechanism for a guest to enable/disable on per device 
or group?

Thanks
-Bharat






Re: [Qemu-devel] [RFC v2 6/6] Add C version of rtc-test

2011-12-02 Thread Anthony Liguori

On 12/02/2011 11:45 AM, Kevin Wolf wrote:

Am 02.12.2011 18:26, schrieb Anthony Liguori:

On 12/02/2011 11:25 AM, Kevin Wolf wrote:
So that's how you read/write memory.  Likewise, for IRQs, you can poll the
status of a given IRQ.  I thought about doing some sort of signal magic around
but when writing tests, polling the IRQ seems easier to deal with.


Okay, polling interrupts should be good enough for tests.

I guess the test still needs to do everything that a guest OS would have
to do, for example send an EOI to the PIC? We'll probably want to have a
library for such things then, but we can add it with the first test that
uses interrupts.


No, right now we more or less create a fake I/O APIC.  We don't have to deal 
with masking in the local APIC, boot strapping, or anything like that.


It makes writing tests easier but I think it makes supporting MSI a bit more 
challenging.  I'm not sure how well it will generalize to other platforms either.


That's one of the reasons I wanted to get an early version out to get some 
feedback on this.


Regards,

Anthony Liguori


Should the framework and the tests live in the tests/ directory?


Probably, except that tests/ has it's own Makefile which is sort of awkward.
Any objections to moving tests/* to tests/tcg-test and then moving all of the
various gtest/check tests to tests/ along with qtest?


No objection, I think this is exactly what we should do.

Kevin






Re: [Qemu-devel] [PATCH 01/18] qom: add new dynamic property infrastructure based on Visitors

2011-12-02 Thread Anthony Liguori

On 12/01/2011 09:52 AM, Kevin Wolf wrote:

Am 30.11.2011 22:03, schrieb Anthony Liguori:

+
+void qdev_property_add(DeviceState *dev, const char *name, const char *type,
+   DevicePropertyEtter *get, DevicePropertyEtter *set,
+   DevicePropertyRelease *release, void *opaque,
+   Error **errp)


How about letting the caller pass in a DeviceProperty for improved
readability and usability? Instead of memorizing the order of currently
eight parameters (could probably become more in the future) you can use
proper C99 initializers then.


This ends up making the code much more complex for the client if you try to 
eliminate the opaque and replace it with the structure.  It becomes necessary to 
do a dynamic allocation of the structure and then you also have to add a release 
function.


We could make the structure just contain the function pointers and not the 
opaque but that doesn't seem very helpful to me.  It just adds a few extra lines 
to the client code without a lot of gain.


Regards,

Anthony Liguori




@@ -45,6 +82,7 @@ struct DeviceState {
  QTAILQ_ENTRY(DeviceState) sibling;
  int instance_id_alias;
  int alias_required_for_version;
+GSList *properties;
  };


Why GSList instead of qemu-queue.h macros that would provide type safety?

I don't think a property can belong to multiple devices, can it?
qdev_property_add only refers to a single device, and nothing else adds
elements to the list.

Kevin






Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework

2011-12-02 Thread Scott Wood
On 12/02/2011 08:40 AM, Stuart Yoder wrote:
> On Thu, Dec 1, 2011 at 3:25 PM, Alex Williamson
>  wrote:
>> On Thu, 2011-12-01 at 14:58 -0600, Stuart Yoder wrote:
>>> One other mechanism we need as well is the ability to
>>> enable/disable a domain.
>>>
>>> For example-- suppose a device is assigned to a VM, the
>>> device is in use when the VM is abruptly terminated.  The
>>> VM terminate would shut off DMA at the IOMMU, but now
>>> the device is in an indeterminate state.   Some devices
>>> have no simple reset bit and getting the device back into
>>> a sane state could be complicated-- something the hypervisor
>>> doesn't want to do.
>>>
>>> So now KVM restarts the VM, vfio init happens for the device
>>> and  the IOMMU for that device is re-configured,
>>> etc, but we really can't re-enable DMA until the guest OS tells us
>>> (via an hcall) that it is ready.   The guest needs to get the
>>> assigned device in a sane state before DMA is enabled.
>>
>> Giant red flag.  We need to paravirtualize the guest?  Not on x86.
> 
> It's the reality we have to deal with, but doing this would obviously
> only apply to platforms that need it.

By "x86" I assume you mean "PCI" and thus a bus-master enable flag that
you rely on the guest not setting until the device has been reset or
otherwise quiesced from any previous activity, in the absence of
function-level reset.

We don't have such a thing on our non-PCI devices.

>> Some
>> devices are better for assignment than others.  PCI devices are moving
>> towards supporting standard reset mechanisms.
>>
>>> Does this warrant a new domain enable/disable API, or should
>>> we make this part of the setup API we are discussing
>>> here?
>>
>> What's wrong with simply not adding any DMA mapping entries until you
>> think your guest is ready?  Isn't that effectively the same thing?
>> Unmap ~= disable.  If the IOMMU API had a mechanism to toggle the iommu
>> domain on and off, I wouldn't be opposed to adding an ioctl to do it,
>> but it really seems like just a shortcut vs map/unmap.  Thanks,
> 
> Yes, we could do something like that I guess.

It would mean that we don't see any errors relating to impossible map
requests until after the guest is running and decides to enable DMA.
Depending on how PAMU table allocation is handled, it could introduce a
risk of failing even later when a guest reboots and we need to
temporarily disable DMA (e.g. if another vfio user consumes the same
table space for another group in the meantime).

It would add latency to failovers -- some customers have somewhat tight
requirements there.

-Scott




Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework

2011-12-02 Thread Scott Wood
On 12/02/2011 12:45 PM, Bhushan Bharat-R65777 wrote:
> Scott, I am not sure if there is any real use case where device needed to 
> assigned beyond 2 level (host + immediate guest) in nested virtualization.

Userspace drivers in the guest is a more likely scenario than nested
virtualization, at least for us.  Our hardware doesn't support nested
virtualization, so it would have to be some slow emulation-based
approach (worse than e500v2, since we don't have multiple PID registers).

> But if there any exists then will not it be better to virtualizes the iommu 
> (PAMU for Freescale)?

We can't virtualize the PAMU in any sort of transparent manner.  It's
not flexible enough to handle arbitrary mappings.  The guest will need
to cooperate with the host to figure out what mappings it can do.

-Scott




Re: [Qemu-devel] [libvirt] libvirt doesn't work with qemu 1.0

2011-12-02 Thread Dave Allan
On Fri, Dec 02, 2011 at 03:21:54PM +0100, Gerd Hoffmann wrote:
>   Hi,
> 
> $subject says all.  The error message is:

Thanks for the heads up.

Dave

> error: internal error cannot parse /home/kraxel/bin/qemu-default version
> number in 'QEMU emulator version 1.0, Copyright (c) 2003-2008 Fabrice
> Bellard'
> 
> cheers,
>   Gerd
> 
> PS: libvirt-0.9.4-23.el6.x86_64
> 
> --
> libvir-list mailing list
> libvir-l...@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list



Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework

2011-12-02 Thread Bhushan Bharat-R65777


> -Original Message-
> From: Wood Scott-B07421
> Sent: Friday, December 02, 2011 11:57 PM
> To: Bhushan Bharat-R65777
> Cc: Stuart Yoder; Alex Williamson; Alexey Kardashevskiy;
> aafab...@cisco.com; k...@vger.kernel.org; p...@au1.ibm.com; qemu-
> de...@nongnu.org; joerg.roe...@amd.com; konrad.w...@oracle.com;
> ag...@suse.de; d...@au1.ibm.com; chr...@sous-sol.org; Yoder Stuart-B08248;
> io...@lists.linux-foundation.org; a...@redhat.com; linux-
> p...@vger.kernel.org; Wood Scott-B07421; be...@cisco.com
> Subject: Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework
> 
> On 12/02/2011 12:11 PM, Bhushan Bharat-R65777 wrote:
> > How do we determine whether guest is ready or not? There can be
> multiple device get ready at different time.
> 
> The guest makes a hypercall with a device handle -- at least that's how
> we do it in Topaz.
> 
> > Further if guest have given the device to it user level process or its
> guest. Should not there be some mechanism for a guest to enable/disable
> on per device or group?
> 
> Yes, the same mechanism can be used for that -- though in that case we'll
> also want the ability for the guest to be able to control another layer
> of mapping (which will get quite tricky with PAMU's limitations).
>  This isn't really VFIO's concern, though (unless you're talking about
> the VFIO implementation in the guest).

Scott, I am not sure if there is any real use case where device needed to 
assigned beyond 2 level (host + immediate guest) in nested virtualization.

But if there any exists then will not it be better to virtualizes the iommu 
(PAMU for Freescale)?

Thanks
-Bharat 






Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework

2011-12-02 Thread Bhushan Bharat-R65777


> -Original Message-
> From: Wood Scott-B07421
> Sent: Friday, December 02, 2011 11:57 PM
> To: Bhushan Bharat-R65777
> Cc: Stuart Yoder; Alex Williamson; Alexey Kardashevskiy;
> aafab...@cisco.com; k...@vger.kernel.org; p...@au1.ibm.com; qemu-
> de...@nongnu.org; joerg.roe...@amd.com; konrad.w...@oracle.com;
> ag...@suse.de; d...@au1.ibm.com; chr...@sous-sol.org; Yoder Stuart-B08248;
> io...@lists.linux-foundation.org; a...@redhat.com; linux-
> p...@vger.kernel.org; Wood Scott-B07421; be...@cisco.com
> Subject: Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework
> 
> On 12/02/2011 12:11 PM, Bhushan Bharat-R65777 wrote:
> > How do we determine whether guest is ready or not? There can be
> multiple device get ready at different time.
> 
> The guest makes a hypercall with a device handle -- at least that's how
> we do it in Topaz.

Yes, it is ok from hcall with device handle perspective.
But I could not understood how cleanly this can be handled with the idea of 
enabling iommu when guest is ready.

Thanks
-Bharat

> 
> > Further if guest have given the device to it user level process or its
> guest. Should not there be some mechanism for a guest to enable/disable
> on per device or group?
> 
> Yes, the same mechanism can be used for that -- though in that case we'll
> also want the ability for the guest to be able to control another layer
> of mapping (which will get quite tricky with PAMU's limitations).
>  This isn't really VFIO's concern, though (unless you're talking about
> the VFIO implementation in the guest).

May be thinking too ahead, but will not something like this will be needed for 
nested virtualization?

Thanks
-Bharat




[Qemu-devel] [PATCH V3] Guest stop notification

2011-12-02 Thread Eric B Munson
Often when a guest is stopped from the qemu console, it will report spurious
soft lockup warnings on resume.  There are kernel patches being discussed that
will give the host the ability to tell the guest that it is being stopped and
should ignore the soft lockup warning that generates.

Signed-off-by: Eric B Munson 
Cc: Avi Kivity 
Cc: Marcelo Tosatti 
Cc: Jan Kiszka 
Cc: ry...@linux.vnet.ibm.com
Cc: aligu...@us.ibm.com
Cc: k...@vger.kernel.org

---
Changes from V2:
 Move ioctl into hw/kvmclock.c so as other arches can use it as it is
implemented

Changes from V1:
 Remove unnecessary encapsulating function

 hw/kvmclock.c |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/hw/kvmclock.c b/hw/kvmclock.c
index 5388bc4..756839f 100644
--- a/hw/kvmclock.c
+++ b/hw/kvmclock.c
@@ -16,6 +16,7 @@
 #include "sysbus.h"
 #include "kvm.h"
 #include "kvmclock.h"
+#include "cpu-all.h"
 
 #include 
 #include 
@@ -69,11 +70,34 @@ static void kvmclock_vm_state_change(void *opaque, int 
running,
 }
 }
 
+static void kvmclock_vm_state_change_vcpu(void *opaque, int running,
+  RunState state)
+{
+int ret;
+CPUState *penv = first_cpu;
+
+if (running) {
+   while (penv) {
+ret = kvm_vcpu_ioctl(penv, KVM_GUEST_PAUSED, 0);
+if (ret) {
+if (ret != ENOSYS) {
+fprintf(stderr,
+"kvmclock_vm_state_change_vcpu: %s\n",
+strerror(-ret));
+}
+return;
+}
+penv = (CPUState *)penv->next_cpu;
+}
+}
+}
+
 static int kvmclock_init(SysBusDevice *dev)
 {
 KVMClockState *s = FROM_SYSBUS(KVMClockState, dev);
 
 qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
+qemu_add_vm_change_state_handler(kvmclock_vm_state_change_vcpu, NULL);
 return 0;
 }
 
-- 
1.7.5.4




Re: [Qemu-devel] [libvirt] libvirt doesn't work with qemu 1.0

2011-12-02 Thread Eric Blake
On 12/02/2011 08:15 AM, Anthony Liguori wrote:
>> Which of course only works with new enough QEMU that is known to
>> support QMP
>> (which BTW we detect by checking the version number).
> 
> Or you could just try the -qmp option and if QEMU exits, it doesn't
> support it.  That's going to be a lot more reliable than checking a
> version number.

But we already have to call 'qemu -h' for other reasons; so we might as
well be efficient and learn as much as possible from that result than by
calling both 'qemu -h' and 'qemu -qmp ...', in order to probe what qemu
supports.

Also, 'qemu -qmp' doesn't work.  What's the proper syntax for invoking
qemu in order to query QMP capabilities, but without also starting up a
guest?

At any rate, yes, we want to improve libvirt to cache qemu capabilities,
to do the probing once at startup and then again any time the mtime of
the qemu binary changes, rather than the current policy of doing it on
every VM startup; once we cache information, making multiple probes will
still be more efficient in the long ran than the current probe per guest.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH 1/2] linux-user/cpu-uname.c: Convert to UTF-8

2011-12-02 Thread Peter Maydell
Convert comment from ISO-8859-1 encoding to UTF-8 to match the rest
of QEMU's source code.

Signed-off-by: Peter Maydell 
---
 linux-user/cpu-uname.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/linux-user/cpu-uname.c b/linux-user/cpu-uname.c
index 23afede..ddc37be 100644
--- a/linux-user/cpu-uname.c
+++ b/linux-user/cpu-uname.c
@@ -1,7 +1,7 @@
 /*
  *  cpu to uname machine name map
  *
- *  Copyright (c) 2009 Lo�c Minier
+ *  Copyright (c) 2009 Loïc Minier
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
-- 
1.7.1




[Qemu-devel] [PATCH 2/2] linux-user/arm/nwfpe/fpopcode.h: Fix non-UTF-8 characters

2011-12-02 Thread Peter Maydell
Fix some stray non-UTF-8 characters used in some ASCII art tables
by converting them to plain ASCII '|' instead.

Signed-off-by: Peter Maydell 
---
 linux-user/arm/nwfpe/fpopcode.h |   34 +-
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/linux-user/arm/nwfpe/fpopcode.h b/linux-user/arm/nwfpe/fpopcode.h
index e7d1009..1b1137f 100644
--- a/linux-user/arm/nwfpe/fpopcode.h
+++ b/linux-user/arm/nwfpe/fpopcode.h
@@ -75,11 +75,11 @@ TABLE 1
 +-+---+---+-+-+
 |  Precision  | u | v | FPSR.EP | length  |
 +-+---+---+-+-+
-| Single  | 0 � 0 |x| 1 words |
-| Double  | 1 � 1 |x| 2 words |
-| Extended| 1 � 1 |x| 3 words |
-| Packed decimal  | 1 � 1 |0| 3 words |
-| Expanded packed decimal | 1 � 1 |1| 4 words |
+| Single  | 0 | 0 |x| 1 words |
+| Double  | 1 | 1 |x| 2 words |
+| Extended| 1 | 1 |x| 3 words |
+| Packed decimal  | 1 | 1 |0| 3 words |
+| Expanded packed decimal | 1 | 1 |1| 4 words |
 +-+---+---+-+-+
 Note: x = don't care
 */
@@ -89,10 +89,10 @@ TABLE 2
 +---+---+-+
 | w | x | Number of registers to transfer |
 +---+---+-+
-| 0 � 1 |  1  |
-| 1 � 0 |  2  |
-| 1 � 1 |  3  |
-| 0 � 0 |  4  |
+| 0 | 1 |  1  |
+| 1 | 0 |  2  |
+| 1 | 1 |  3  |
+| 0 | 0 |  4  |
 +---+---+-+
 */
 
@@ -153,10 +153,10 @@ TABLE 5
 +-+---+---+
 |  Rounding Precision | e | f |
 +-+---+---+
-| IEEE Single precision   | 0 � 0 |
-| IEEE Double precision   | 0 � 1 |
-| IEEE Extended precision | 1 � 0 |
-| undefined (trap)| 1 � 1 |
+| IEEE Single precision   | 0 | 0 |
+| IEEE Double precision   | 0 | 1 |
+| IEEE Extended precision | 1 | 0 |
+| undefined (trap)| 1 | 1 |
 +-+---+---+
 */
 
@@ -165,10 +165,10 @@ TABLE 5
 +-+---+---+
 |  Rounding Mode  | g | h |
 +-+---+---+
-| Round to nearest (default)  | 0 � 0 |
-| Round toward plus infinity  | 0 � 1 |
-| Round toward negative infinity  | 1 � 0 |
-| Round toward zero   | 1 � 1 |
+| Round to nearest (default)  | 0 | 0 |
+| Round toward plus infinity  | 0 | 1 |
+| Round toward negative infinity  | 1 | 0 |
+| Round toward zero   | 1 | 1 |
 +-+---+---+
 */
 
-- 
1.7.1




[Qemu-devel] [PATCH 0/2] linux-user: Fix non-UTF-8 characters

2011-12-02 Thread Peter Maydell
These two patches fix some non-UTF-8 characters in linux-user/
source files. Other than the five files Stefan Weil recently sent
a patch to fix, these are the only remaining non-UTF-8 characters
in the source tree.

Since I don't entirely trust the email path for sending patches
to files where the diffs include non-UTF-8, I've also put the
changes up in a git repo, so you may prefer to pull from there:

The following changes since commit 1c8a881daaca6fe0646a425b0970fb3ad25f6732:

  Update version for 1.0 release (2011-12-01 14:04:21 -0600)

are available in the git repository at:
  git://git.linaro.org/people/pmaydell/qemu-arm.git non-utf-fixes

Peter Maydell (2):
  linux-user/cpu-uname.c: Convert to UTF-8
  linux-user/arm/nwfpe/fpopcode.h: Fix non-UTF-8 characters

 linux-user/arm/nwfpe/fpopcode.h |   34 +-
 linux-user/cpu-uname.c  |2 +-
 2 files changed, 18 insertions(+), 18 deletions(-)



[Qemu-devel] [PATCH] Adapt libvirt's Qemu version parser for Qemu 1.0

2011-12-02 Thread Stefan Berger

Qemu 1.0 does not show a micro version like 0.15.50 did. Adapt the
Qemu version parser to handle this.

---
 src/qemu/qemu_capabilities.c |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Index: libvirt-tpm/src/qemu/qemu_capabilities.c
===
--- libvirt-tpm.orig/src/qemu/qemu_capabilities.c
+++ libvirt-tpm/src/qemu/qemu_capabilities.c
@@ -1147,15 +1147,24 @@ int qemuCapsParseHelpStr(const char *qem
 ++p;

 minor = virParseNumber(&p);
-if (minor == -1 || *p != '.')
+if (minor == -1)
 goto fail;

+if (major == 0 && *p != '.')
+goto fail;
+
+if (major > 0 && *p != '.') {
+micro = 0;
+goto skip_micro;
+}
+
 ++p;

 micro = virParseNumber(&p);
 if (micro == -1)
 goto fail;

+skip_micro:
 SKIP_BLANKS(p);

 if (STRPREFIX(p, QEMU_KVM_VER_PREFIX)) {




Re: [Qemu-devel] [PATCH V3] Guest stop notification

2011-12-02 Thread Jan Kiszka
On 2011-12-02 20:19, Eric B Munson wrote:
> Often when a guest is stopped from the qemu console, it will report spurious
> soft lockup warnings on resume.  There are kernel patches being discussed that
> will give the host the ability to tell the guest that it is being stopped and
> should ignore the soft lockup warning that generates.
> 
> Signed-off-by: Eric B Munson 
> Cc: Avi Kivity 
> Cc: Marcelo Tosatti 
> Cc: Jan Kiszka 
> Cc: ry...@linux.vnet.ibm.com
> Cc: aligu...@us.ibm.com
> Cc: k...@vger.kernel.org
> 
> ---
> Changes from V2:
>  Move ioctl into hw/kvmclock.c so as other arches can use it as it is
> implemented
> 
> Changes from V1:
>  Remove unnecessary encapsulating function
> 
>  hw/kvmclock.c |   24 
>  1 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/kvmclock.c b/hw/kvmclock.c
> index 5388bc4..756839f 100644
> --- a/hw/kvmclock.c
> +++ b/hw/kvmclock.c
> @@ -16,6 +16,7 @@
>  #include "sysbus.h"
>  #include "kvm.h"
>  #include "kvmclock.h"
> +#include "cpu-all.h"
>  
>  #include 
>  #include 
> @@ -69,11 +70,34 @@ static void kvmclock_vm_state_change(void *opaque, int 
> running,
>  }
>  }
>  
> +static void kvmclock_vm_state_change_vcpu(void *opaque, int running,
> +  RunState state)
> +{
> +int ret;
> +CPUState *penv = first_cpu;
> +
> +if (running) {
> + while (penv) {

or: for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {

> +ret = kvm_vcpu_ioctl(penv, KVM_GUEST_PAUSED, 0);
> +if (ret) {
> +if (ret != ENOSYS) {
> +fprintf(stderr,
> +"kvmclock_vm_state_change_vcpu: %s\n",
> +strerror(-ret));
> +}
> +return;
> +}
> +penv = (CPUState *)penv->next_cpu;

Unneeded cast.

> +}
> +}
> +}
> +

Again: please use checkpatch.pl.

>  static int kvmclock_init(SysBusDevice *dev)
>  {
>  KVMClockState *s = FROM_SYSBUS(KVMClockState, dev);
>  
>  qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
> +qemu_add_vm_change_state_handler(kvmclock_vm_state_change_vcpu, NULL);
>  return 0;
>  }
>  

Why not extend the existing handler?

I still wonder if the IOCTL interface is actually kvmclock specific. But
Marcello asked for this, and we could still change it when some arch
comes around that provides it independent of kvmclock.

Jan



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH v2 01/18] qom: add a reference count to qdev objects

2011-12-02 Thread Anthony Liguori
To ensure that a device isn't removed from the graph until all of its links are
broken.

Signed-off-by: Anthony Liguori 
---
 hw/qdev.c |   16 
 hw/qdev.h |   26 ++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 106407f..fdc9843 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -323,6 +323,11 @@ int qdev_unplug(DeviceState *dev)
 }
 assert(dev->info->unplug != NULL);
 
+if (dev->ref != 0) {
+qerror_report(QERR_DEVICE_IN_USE, dev->id?:"");
+return -1;
+}
+
 qdev_hot_removed = true;
 
 return dev->info->unplug(dev);
@@ -962,3 +967,14 @@ char* qdev_get_fw_dev_path(DeviceState *dev)
 
 return strdup(path);
 }
+
+void qdev_ref(DeviceState *dev)
+{
+dev->ref++;
+}
+
+void qdev_unref(DeviceState *dev)
+{
+g_assert(dev->ref > 0);
+dev->ref--;
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index 36a4198..2397b4e 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -45,6 +45,12 @@ struct DeviceState {
 QTAILQ_ENTRY(DeviceState) sibling;
 int instance_id_alias;
 int alias_required_for_version;
+
+/**
+ * This tracks the number of references between devices.  See @qdev_ref for
+ * more information.
+ */
+uint32_t ref;
 };
 
 typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent);
@@ -329,4 +335,24 @@ char *qdev_get_fw_dev_path(DeviceState *dev);
 /* This is a nasty hack to allow passing a NULL bus to qdev_create.  */
 extern struct BusInfo system_bus_info;
 
+/**
+ * @qdev_ref
+ *
+ * Increase the reference count of a device.  A device cannot be freed as long
+ * as its reference count is greater than zero.
+ *
+ * @dev - the device
+ */
+void qdev_ref(DeviceState *dev);
+
+/**
+ * @qdef_unref
+ *
+ * Decrease the reference count of a device.  A device cannot be freed as long
+ * as its reference count is greater than zero.
+ *
+ * @dev - the device
+ */
+void qdev_unref(DeviceState *dev);
+
 #endif
-- 
1.7.4.1




[Qemu-devel] [PATCH v2 02/18] qom: add new dynamic property infrastructure based on Visitors (v2)

2011-12-02 Thread Anthony Liguori
qdev properties are settable only during construction and static to classes.
This isn't flexible enough for QOM.

This patch introduces a property interface for qdev that provides dynamic
properties that are tied to objects, instead of classes.  These properties are
Visitor based instead of string based too.

Signed-off-by: Anthony Liguori 
---
v1 -> v2
 - Etter -> Accessor (Stefan)
 - spelling mistakes (Stefan)
 - switch to qemu-queue (Kevin/Gerd)
---
 hw/qdev.c |   97 +
 hw/qdev.h |  120 +
 qerror.c  |4 ++
 qerror.h  |3 ++
 4 files changed, 224 insertions(+), 0 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index fdc9843..94f14c1 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -98,6 +98,7 @@ static DeviceState *qdev_create_from_info(BusState *bus, 
DeviceInfo *info)
 qdev_hot_added = true;
 }
 dev->instance_id_alias = -1;
+QTAILQ_INIT(&dev->properties);
 dev->state = DEV_STATE_CREATED;
 return dev;
 }
@@ -395,12 +396,31 @@ void qdev_init_nofail(DeviceState *dev)
 }
 }
 
+static void qdev_property_del_all(DeviceState *dev)
+{
+while (!QTAILQ_EMPTY(&dev->properties)) {
+DeviceProperty *prop = QTAILQ_FIRST(&dev->properties);
+
+QTAILQ_REMOVE(&dev->properties, prop, node);
+
+if (prop->release) {
+prop->release(dev, prop->name, prop->opaque);
+}
+
+g_free(prop->name);
+g_free(prop->type);
+g_free(prop);
+}
+}
+
 /* Unlink device from bus and free the structure.  */
 void qdev_free(DeviceState *dev)
 {
 BusState *bus;
 Property *prop;
 
+qdev_property_del_all(dev);
+
 if (dev->state == DEV_STATE_INITIALIZED) {
 while (dev->num_child_bus) {
 bus = QLIST_FIRST(&dev->child_bus);
@@ -978,3 +998,80 @@ void qdev_unref(DeviceState *dev)
 g_assert(dev->ref > 0);
 dev->ref--;
 }
+
+void qdev_property_add(DeviceState *dev, const char *name, const char *type,
+   DevicePropertyAccessor *get, DevicePropertyAccessor 
*set,
+   DevicePropertyRelease *release,
+   void *opaque, Error **errp)
+{
+DeviceProperty *prop = g_malloc0(sizeof(*prop));
+
+prop->name = g_strdup(name);
+prop->type = g_strdup(type);
+
+prop->get = get;
+prop->set = set;
+prop->release = release;
+prop->opaque = opaque;
+
+QTAILQ_INSERT_TAIL(&dev->properties, prop, node);
+}
+
+static DeviceProperty *qdev_property_find(DeviceState *dev, const char *name)
+{
+DeviceProperty *prop;
+
+QTAILQ_FOREACH(prop, &dev->properties, node) {
+if (strcmp(prop->name, name) == 0) {
+return prop;
+}
+}
+
+return NULL;
+}
+
+void qdev_property_get(DeviceState *dev, Visitor *v, const char *name,
+   Error **errp)
+{
+DeviceProperty *prop = qdev_property_find(dev, name);
+
+if (prop == NULL) {
+error_set(errp, QERR_PROPERTY_NOT_FOUND, dev->id?:"", name);
+return;
+}
+
+if (!prop->get) {
+error_set(errp, QERR_PERMISSION_DENIED);
+} else {
+prop->get(dev, v, prop->opaque, name, errp);
+}
+}
+
+void qdev_property_set(DeviceState *dev, Visitor *v, const char *name,
+   Error **errp)
+{
+DeviceProperty *prop = qdev_property_find(dev, name);
+
+if (prop == NULL) {
+error_set(errp, QERR_PROPERTY_NOT_FOUND, dev->id?:"", name);
+return;
+}
+
+if (!prop->set) {
+error_set(errp, QERR_PERMISSION_DENIED);
+} else {
+prop->set(dev, prop->opaque, v, name, errp);
+}
+}
+
+const char *qdev_property_get_type(DeviceState *dev, const char *name, Error 
**errp)
+{
+DeviceProperty *prop = qdev_property_find(dev, name);
+
+if (prop == NULL) {
+error_set(errp, QERR_PROPERTY_NOT_FOUND, dev->id?:"", name);
+return NULL;
+}
+
+return prop->type;
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index 2397b4e..2df3bb7 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -5,6 +5,7 @@
 #include "qemu-queue.h"
 #include "qemu-char.h"
 #include "qemu-option.h"
+#include "qapi/qapi-visit-core.h"
 
 typedef struct Property Property;
 
@@ -27,6 +28,44 @@ enum {
 DEV_NVECTORS_UNSPECIFIED = -1,
 };
 
+/**
+ * @DevicePropertyAccessor - called when trying to get/set a property
+ *
+ * @dev the device that owns the property
+ * @v the visitor that contains the property data
+ * @opaque the device property opaque
+ * @name the name of the property
+ * @errp a pointer to an Error that is filled if getting/setting fails.
+ */
+typedef void (DevicePropertyAccessor)(DeviceState *dev,
+  Visitor *v,
+  void *opaque,
+  const char *name,
+  Error **errp);
+
+/**
+ * @DevicePropertyRelease - called when a property is removed

[Qemu-devel] [PATCH v2 03/18] qom: register legacy properties as new style properties (v2)

2011-12-02 Thread Anthony Liguori
Expose all legacy properties through the new QOM property mechanism.  The qdev
property types are exposed through the 'legacy<>' namespace.  They are always
visited as strings since they do their own string parsing.

Signed-off-by: Anthony Liguori 
---
v1 -> v2
 - add bus properties (Gerd)
---
 hw/qdev.c |   86 +
 hw/qdev.h |7 +
 2 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 94f14c1..6f77af9 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -83,6 +83,7 @@ static DeviceInfo *qdev_find_info(BusInfo *bus_info, const 
char *name)
 static DeviceState *qdev_create_from_info(BusState *bus, DeviceInfo *info)
 {
 DeviceState *dev;
+Property *prop;
 
 assert(bus->info == info->bus_info);
 dev = g_malloc0(info->size);
@@ -100,6 +101,15 @@ static DeviceState *qdev_create_from_info(BusState *bus, 
DeviceInfo *info)
 dev->instance_id_alias = -1;
 QTAILQ_INIT(&dev->properties);
 dev->state = DEV_STATE_CREATED;
+
+for (prop = dev->info->props; prop && prop->name; prop++) {
+qdev_property_add_legacy(dev, prop, NULL);
+}
+
+for (prop = dev->info->bus_info->props; prop && prop->name; prop++) {
+qdev_property_add_legacy(dev, prop, NULL);
+}
+
 return dev;
 }
 
@@ -1075,3 +1085,79 @@ const char *qdev_property_get_type(DeviceState *dev, 
const char *name, Error **e
 
 return prop->type;
 }
+
+/**
+ * Legacy property handling
+ */
+
+static void qdev_get_legacy_property(DeviceState *dev, Visitor *v, void 
*opaque,
+ const char *name, Error **errp)
+{
+Property *prop = opaque;
+
+if (prop->info->print) {
+char buffer[1024];
+char *ptr = buffer;
+
+prop->info->print(dev, prop, buffer, sizeof(buffer));
+visit_type_str(v, &ptr, name, errp);
+} else {
+error_set(errp, QERR_PERMISSION_DENIED);
+}
+}
+
+static void qdev_set_legacy_property(DeviceState *dev, Visitor *v, void 
*opaque,
+ const char *name, Error **errp)
+{
+Property *prop = opaque;
+
+if (dev->state != DEV_STATE_CREATED) {
+error_set(errp, QERR_PERMISSION_DENIED);
+return;
+}
+
+if (prop->info->parse) {
+Error *local_err = NULL;
+char *ptr = NULL;
+
+visit_type_str(v, &ptr, name, &local_err);
+if (!local_err) {
+int ret;
+ret = prop->info->parse(dev, prop, ptr);
+if (ret != 0) {
+error_set(errp, QERR_INVALID_PARAMETER_VALUE,
+  name, prop->info->name);
+}
+g_free(ptr);
+} else {
+error_propagate(errp, local_err);
+}
+} else {
+error_set(errp, QERR_PERMISSION_DENIED);
+}
+}
+
+/**
+ * @qdev_add_legacy_property - adds a legacy property
+ *
+ * Do not use this is new code!  Properties added through this interface will
+ * be given types in the "legacy<>" type namespace.
+ *
+ * Legacy properties are always processed as strings.  The format of the string
+ * depends on the property type.
+ */
+void qdev_property_add_legacy(DeviceState *dev, Property *prop,
+  Error **errp)
+{
+gchar *type;
+
+type = g_strdup_printf("legacy<%s>", prop->info->name);
+
+qdev_property_add(dev, prop->name, type,
+  qdev_get_legacy_property,
+  qdev_set_legacy_property,
+  NULL,
+  prop, errp);
+
+g_free(type);
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index 2df3bb7..3b629d4 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -475,4 +475,11 @@ void qdev_property_set(DeviceState *dev, Visitor *v, const 
char *name,
 const char *qdev_property_get_type(DeviceState *dev, const char *name,
Error **errp);
 
+/**
+ * @qdev_property_add_legacy - add a legacy @Property to a device
+ *
+ * DO NOT USE THIS IN NEW CODE!
+ */
+void qdev_property_add_legacy(DeviceState *dev, Property *prop, Error **errp);
+
 #endif
-- 
1.7.4.1




[Qemu-devel] [PATCH v2 05/18] qdev: provide an interface to return canonical path from root (v2)

2011-12-02 Thread Anthony Liguori
The canonical path is the path in the composition tree from the root to the
device.  This is effectively the name of the device.

This is an incredibly unefficient implementation that will be optimized in
a future patch.

Signed-off-by: Anthony Liguori 
---
v1 -> v2
 - change from gslist to qemu-queue (Kevin/Gerd)
---
 hw/qdev.c |   48 
 hw/qdev.h |9 +
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index bb0b9f7..79849c9 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -1173,3 +1173,51 @@ DeviceState *qdev_get_root(void)
 
 return qdev_root;
 }
+
+static gchar *qdev_get_path_in(DeviceState *parent, DeviceState *dev)
+{
+DeviceProperty *prop;
+
+if (parent == dev) {
+return g_strdup("");
+}
+
+QTAILQ_FOREACH(prop, &parent->properties, node) {
+gchar *subpath;
+
+if (!strstart(prop->type, "child<", NULL)) {
+continue;
+}
+
+/* Check to see if the device is one of parent's children */
+if (prop->opaque == dev) {
+return g_strdup(prop->name);
+}
+
+/* Check to see if the device is a child of our child */
+subpath = qdev_get_path_in(prop->opaque, dev);
+if (subpath) {
+gchar *path;
+
+path = g_strdup_printf("%s/%s", prop->name, subpath);
+g_free(subpath);
+
+return path;
+}
+}
+
+return NULL;
+}
+
+gchar *qdev_get_canonical_path(DeviceState *dev)
+{
+gchar *path, *newpath;
+
+path = qdev_get_path_in(qdev_get_root(), dev);
+g_assert(path != NULL);
+
+newpath = g_strdup_printf("/%s", path);
+g_free(path);
+
+return newpath;
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index 52aadd2..0f00497 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -490,4 +490,13 @@ void qdev_property_add_legacy(DeviceState *dev, Property 
*prop, Error **errp);
  */
 DeviceState *qdev_get_root(void);
 
+/**
+ * @qdev_get_canonical_path - returns the canonical path for a device.  This
+ * is the path within the composition tree starting from the root.
+ *
+ * Returns:
+ *   The canonical path in the composition tree.
+ */
+gchar *qdev_get_canonical_path(DeviceState *dev);
+
 #endif
-- 
1.7.4.1




  1   2   >