]> git.proxmox.com Git - qemu.git/log
qemu.git
14 years agolsi53c895a: Fix message code of DISCONNECT
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Fix message code of DISCONNECT

See SCSI-2, 6.5 Message system description/message codes.

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi53c895a: Add support for LSI53C700 Family Compatibility bit
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Add support for LSI53C700 Family Compatibility bit

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi53c895a: Whitespace and typo fixes
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Whitespace and typo fixes

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: add read/write 16 commands.
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:16 +0000 (15:34 +0100)]
scsi: add read/write 16 commands.

Add READ_16 + friends to scsi-defs.h, scsi_command_name() and the
request parsing helper functions.

Use them in scsi-disk.c too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: VERIFY
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:15 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: VERIFY

Move VERIFY emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: REPORT_LUNS
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:14 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: REPORT_LUNS

Move REPORT_LUNS emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add REPORT_LUNS to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: SERVICE_ACTION_IN
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:13 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: SERVICE_ACTION_IN

Move SERVICE_ACTION_IN emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add SERVICE_ACTION_IN to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: GET_CONFIGURATION
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:12 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: GET_CONFIGURATION

Move GET_CONFIGURATION emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add GET_CONFIGURATION to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: READ_TOC
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:11 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: READ_TOC

Move READ_TOC emulation from scsi_send_command() to
scsi_disk_emulate_command().  Add scsi_disk_emulate_read_toc() function
which holds the longisch READ_TOC emulation code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: SYNCHRONIZE_CACHE
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:10 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: SYNCHRONIZE_CACHE

Move SYNCHRONIZE_CACHE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: READ_CAPACITY
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:09 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: READ_CAPACITY

Move READ_CAPACITY emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:08 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL

Move ALLOW_MEDIUM_REMOVAL emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: START_STOP
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:07 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: START_STOP

Move START_STOP emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: MODE_SENSE
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:06 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: MODE_SENSE

Move MODE_SENSE emulation from scsi_send_command() to
scsi_disk_emulate_command().  Create two helper functions:
mode_sense_page() which writes the actual mode pages and
scsi_disk_emulate_mode_sense() which holds the longish MODE_SENSE
emulation code, calling into mode_sense_page() as needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: RESERVE+RELEASE
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:05 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: RESERVE+RELEASE

Move RESERVE+RELEASE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: INQUIRY
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:04 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: INQUIRY

Move INQUIRY emulation from scsi_send_command() to
scsi_disk_emulate_command().  Also split the longish INQUITY emulation
code into the new scsi_disk_emulate_inquiry() function.  Serial number
handling is slightly changed, we don't copy it any more but look it up
directly in DriveInfo which we have at hand anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: REQUEST_SENSE
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:03 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: REQUEST_SENSE

Move REQUEST_SENSE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: restruct emulation: core + TEST_UNIT_READY.
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:02 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: core + TEST_UNIT_READY.

Add new scsi_disk_emulate_command() function, which will -- when
finished -- handle all scsi disk command emulation except actual I/O
(READ+WRITE commands) which goes to the block layer.  The function
builds on top of the new SCSIRequest struct.

SCSI command emulation code is moved over from scsi_send_command() in
steps to ease review and make it easier to pin down regressions (if any)
using bisect.  This patch moves over TEST_UNIT_READY only.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: add scsi_req_print()
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:01 +0000 (15:34 +0100)]
scsi: add scsi_req_print()

Handy for debugging.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move status to SCSIRequest.
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:00 +0000 (15:34 +0100)]
scsi: move status to SCSIRequest.

Also add and use the scsi_req_complete() helper function for calling the
completion callback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move dinfo to SCSIDevice
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:59 +0000 (15:33 +0100)]
scsi: move dinfo to SCSIDevice

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move sense to SCSIDevice, create SCSISense struct.
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:58 +0000 (15:33 +0100)]
scsi: move sense to SCSIDevice, create SCSISense struct.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: add xfer mode
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:57 +0000 (15:33 +0100)]
scsi: add xfer mode

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: use command defines in scsi-disk.c
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:56 +0000 (15:33 +0100)]
scsi: use command defines in scsi-disk.c

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: add request parsing helpers to common code.
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:55 +0000 (15:33 +0100)]
scsi: add request parsing helpers to common code.

Add helper functions for scsi request parsing to common code.  Getting
command length, transfer size, and linear block address is handled.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move type from SCSIGenericState to SCSIDevice
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:54 +0000 (15:33 +0100)]
scsi: move type from SCSIGenericState to SCSIDevice

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: add scsi-defs.h
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:53 +0000 (15:33 +0100)]
scsi: add scsi-defs.h

Largely based on <scsi/scsi.h> from linux.  Added into the tree so we
can use the defines everywhere, not just in scsi-generic.c (which is
linux-specific).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move blocksize from SCSIGenericState to SCSIDevice
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:52 +0000 (15:33 +0100)]
scsi: move blocksize from SCSIGenericState to SCSIDevice

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move scsi command buffer from SCSIGenericReq to SCSIRequest.
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:51 +0000 (15:33 +0100)]
scsi: move scsi command buffer from SCSIGenericReq to SCSIRequest.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move SCSIRequest management to common code.
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:50 +0000 (15:33 +0100)]
scsi: move SCSIRequest management to common code.

Create generic functions to allocate, find and release SCSIRequest
structs.  Make scsi-disk and scsi-generic use them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move request lists to QTAILQ.
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:49 +0000 (15:33 +0100)]
scsi: move request lists to QTAILQ.

Changes:
 * Move from open-coded lists to QTAILQ macros.
 * Move the struct elements to the common data structures
   (SCSIDevice + SCSIRequest).
 * Drop free request pools.
 * Fix request cleanup in the destroy callback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: create common SCSIRequest structure.
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:48 +0000 (15:33 +0100)]
scsi: create common SCSIRequest structure.

Rename the SCSIRequest structs in scsi-disk.c and scsi-generic.c to
SCSIDiskReq and SCSIGenericReq.  Create a SCSIRequest struct and move
the common elements over.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: add/fix header protection.
Gerd Hoffmann [Thu, 26 Nov 2009 14:33:47 +0000 (15:33 +0100)]
scsi: add/fix header protection.

Also delete the leftover and unused scsi-disk.h file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: fix vnet_hdr handling in solaris tap code
Mark McLoughlin [Wed, 25 Nov 2009 18:49:37 +0000 (18:49 +0000)]
net: fix vnet_hdr handling in solaris tap code

Print an error if the user specifies vnet_hdr=1 on the cmdline.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: initialize vnet_hdr in net_init_tap()
Mark McLoughlin [Wed, 25 Nov 2009 18:49:36 +0000 (18:49 +0000)]
net: initialize vnet_hdr in net_init_tap()

net_tap_init() always sets vnet_hdr using qemu_opt_get_bool(), but
initialize it in net_init_tap() just to reduce confusion.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: check for TUNSETOFFLOAD support before trying to enable offload features
Pierre Riteau [Wed, 25 Nov 2009 18:49:35 +0000 (18:49 +0000)]
net: check for TUNSETOFFLOAD support before trying to enable offload features

This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message
on kernels without TUNSETOFFLOAD support.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: fix TAP networking on host kernels without IFF_VNET_HDR support
Pierre Riteau [Wed, 25 Nov 2009 18:49:34 +0000 (18:49 +0000)]
net: fix TAP networking on host kernels without IFF_VNET_HDR support

vnet_hdr is initialized at 1 by default. We need to reset it to 0 if
the kernel doesn't support IFF_VNET_HDR.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: print correct error for '-netdev ""'
Mark McLoughlin [Wed, 25 Nov 2009 18:49:33 +0000 (18:49 +0000)]
net: print correct error for '-netdev ""'

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: fix qemu_announce_self()
Mark McLoughlin [Wed, 25 Nov 2009 18:49:32 +0000 (18:49 +0000)]
net: fix qemu_announce_self()

Now that we have a way to iterate NICs.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: add qemu_foreach_nic()
Mark McLoughlin [Wed, 25 Nov 2009 18:49:31 +0000 (18:49 +0000)]
net: add qemu_foreach_nic()

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: remove VLANClientState members now in NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:30 +0000 (18:49 +0000)]
net: remove VLANClientState members now in NetClientInfo

Add a NetClientInfo pointer to VLANClientState and use that
for the typecode and function pointers.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: remove qemu_new_vlan_client()
Mark McLoughlin [Wed, 25 Nov 2009 18:49:29 +0000 (18:49 +0000)]
net: remove qemu_new_vlan_client()

... and VLANClientState::opaque and qemu_find_vlan_client().

All of these are now unused

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert xen to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:28 +0000 (18:49 +0000)]
net: convert xen to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move parse_macaddr() to net/util.[ch]
Mark McLoughlin [Wed, 25 Nov 2009 18:49:27 +0000 (18:49 +0000)]
net: move parse_macaddr() to net/util.[ch]

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert xilinx_ethlite to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:26 +0000 (18:49 +0000)]
net: convert xilinx_ethlite to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert usb-net to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:25 +0000 (18:49 +0000)]
net: convert usb-net to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert stellaris to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:24 +0000 (18:49 +0000)]
net: convert stellaris to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert smc91c111 to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:23 +0000 (18:49 +0000)]
net: convert smc91c111 to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert musicpal to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:22 +0000 (18:49 +0000)]
net: convert musicpal to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert mipsnet to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:21 +0000 (18:49 +0000)]
net: convert mipsnet to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert mcf_fec to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:20 +0000 (18:49 +0000)]
net: convert mcf_fec to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert LAN9118 to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:19 +0000 (18:49 +0000)]
net: convert LAN9118 to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert etrax to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:18 +0000 (18:49 +0000)]
net: convert etrax to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert dp8393x to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:17 +0000 (18:49 +0000)]
net: convert dp8393x to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert eepro100 to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:16 +0000 (18:49 +0000)]
net: convert eepro100 to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert pcnet to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:15 +0000 (18:49 +0000)]
net: convert pcnet to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert ne2000 to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:14 +0000 (18:49 +0000)]
net: convert ne2000 to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert rtl8139 to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:13 +0000 (18:49 +0000)]
net: convert rtl8139 to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert e1000 to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:12 +0000 (18:49 +0000)]
net: convert e1000 to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert virtio to NICState
Mark McLoughlin [Wed, 25 Nov 2009 18:49:11 +0000 (18:49 +0000)]
net: convert virtio to NICState

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: introduce NICState and qemu_new_nic()
Mark McLoughlin [Wed, 25 Nov 2009 18:49:10 +0000 (18:49 +0000)]
net: introduce NICState and qemu_new_nic()

Common state for all NICs.

The opaque member will replace the opaque member in VLANClientState
since only NICs need it.

The conf member will allow us to iterate over NICs, access the MAC
addr for the NIC and send a packet from each NIC in qemu_announce_self().

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert dump to NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:09 +0000 (18:49 +0000)]
net: convert dump to NetClientInfo

aliguori: fix uninitialized use of pcap_len

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert socket to NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:08 +0000 (18:49 +0000)]
net: convert socket to NetClientInfo

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert vde to NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:07 +0000 (18:49 +0000)]
net: convert vde to NetClientInfo

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert slirp to NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:06 +0000 (18:49 +0000)]
net: convert slirp to NetClientInfo

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert tap-win32 to NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:05 +0000 (18:49 +0000)]
net: convert tap-win32 to NetClientInfo

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: convert tap to NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:04 +0000 (18:49 +0000)]
net: convert tap to NetClientInfo

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: move DO_UPCAST() into osdep.h
Mark McLoughlin [Wed, 25 Nov 2009 18:49:03 +0000 (18:49 +0000)]
qdev: move DO_UPCAST() into osdep.h

Nothing qdev specific about this, make it available throughtout.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: introduce qemu_new_net_client()
Mark McLoughlin [Wed, 25 Nov 2009 18:49:02 +0000 (18:49 +0000)]
net: introduce qemu_new_net_client()

A replacement for qemu_new_vlan_client(), using NetClientInfo to
replace most arguments.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: introduce NetClientInfo
Mark McLoughlin [Wed, 25 Nov 2009 18:49:01 +0000 (18:49 +0000)]
net: introduce NetClientInfo

This structure holds data which is common to all instances of a given
net client type/model.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: remove NICInfo::private
Mark McLoughlin [Wed, 25 Nov 2009 18:49:00 +0000 (18:49 +0000)]
net: remove NICInfo::private

Was used by hot-unplug, but not anymore.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: remove NICInfo::vc
Mark McLoughlin [Wed, 25 Nov 2009 18:48:59 +0000 (18:48 +0000)]
net: remove NICInfo::vc

Since 1cc33683, this field is not set for most devices, so just
remove it and its remaining few uses.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: clean up includes in net.c
Mark McLoughlin [Wed, 25 Nov 2009 18:48:58 +0000 (18:48 +0000)]
net: clean up includes in net.c

This is probably a little drastic, but the includes in this file are
now totally out of control when compared with what includes are
actually needed.

This may break the build on e.g. *BSD, but it will be easily fixed by
re-instating an include.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move dump backend code from net.c to net/dump.c
Mark McLoughlin [Wed, 25 Nov 2009 18:48:57 +0000 (18:48 +0000)]
net: move dump backend code from net.c to net/dump.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move socket backend code from net.c to net/socket.c
Mark McLoughlin [Wed, 25 Nov 2009 18:48:56 +0000 (18:48 +0000)]
net: move socket backend code from net.c to net/socket.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move vde code from net.c to net/vde.c
Mark McLoughlin [Wed, 25 Nov 2009 18:48:55 +0000 (18:48 +0000)]
net: move vde code from net.c to net/vde.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move slirp code from net.c to net/slirp.c
Mark McLoughlin [Wed, 25 Nov 2009 18:48:54 +0000 (18:48 +0000)]
net: move slirp code from net.c to net/slirp.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoac97: port to vmstate
Juan Quintela [Wed, 2 Dec 2009 10:49:42 +0000 (11:49 +0100)]
ac97: port to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoac97: up savevm version and remove active from state
Juan Quintela [Wed, 2 Dec 2009 10:49:41 +0000 (11:49 +0100)]
ac97: up savevm version and remove active from state

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoac97: recalculate active after loadvm
Juan Quintela [Wed, 2 Dec 2009 10:49:40 +0000 (11:49 +0100)]
ac97: recalculate active after loadvm

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoac97: sizeof needs %zd
Juan Quintela [Wed, 2 Dec 2009 10:49:39 +0000 (11:49 +0100)]
ac97: sizeof needs %zd

This change makes DEBUG_AC97 to compile again

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agogus: port to vmstate
Juan Quintela [Wed, 2 Dec 2009 10:49:38 +0000 (11:49 +0100)]
gus: port to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoc4231a: port to vmstate
Juan Quintela [Wed, 2 Dec 2009 10:49:37 +0000 (11:49 +0100)]
c4231a: port to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoes1370: port to vmstate
Juan Quintela [Wed, 2 Dec 2009 10:49:36 +0000 (11:49 +0100)]
es1370: port to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosb16: port to vmstate
Juan Quintela [Wed, 2 Dec 2009 10:49:35 +0000 (11:49 +0100)]
sb16: port to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoaudio: port to vmstate
Juan Quintela [Wed, 2 Dec 2009 10:49:34 +0000 (11:49 +0100)]
audio: port to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoaudio: fix compilation of DEBUG_PLIVE
Juan Quintela [Wed, 2 Dec 2009 10:49:33 +0000 (11:49 +0100)]
audio: fix compilation of DEBUG_PLIVE

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce vm-info
Luiz Capitulino [Fri, 27 Nov 2009 00:59:10 +0000 (22:59 -0200)]
QMP: Introduce vm-info

A Python script which uses qmp.py to print some simple VM info.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce qmp-shell
Luiz Capitulino [Fri, 27 Nov 2009 00:59:09 +0000 (22:59 -0200)]
QMP: Introduce qmp-shell

This is a very simple shell written in Python for demonstration
purposes.

Unfortunately it's a bit awkward right now, as the user has
to specify the arguments names and the printed data can be
a raw dictionary or list, like the following example:

(QEMU) pci_add pci_addr=auto type=nic
{u'slot': 5, u'bus': 0, u'domain': 0, u'function': 0}
(QEMU)

It's worth to note that the shell is broken into two files.
One is the shell itself, the other is the QMP class which
handles the communication with QEMU.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce qmp-events.txt
Luiz Capitulino [Fri, 27 Nov 2009 00:59:08 +0000 (22:59 -0200)]
QMP: Introduce qmp-events.txt

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce specification
Luiz Capitulino [Fri, 27 Nov 2009 00:59:07 +0000 (22:59 -0200)]
QMP: Introduce specification

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce README file
Luiz Capitulino [Fri, 27 Nov 2009 00:59:06 +0000 (22:59 -0200)]
QMP: Introduce README file

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Disable monitor print functions
Luiz Capitulino [Fri, 27 Nov 2009 00:59:05 +0000 (22:59 -0200)]
QMP: Disable monitor print functions

We still have handlers which will call monitor print functions
in several places. Usually to report errors.

If they do this when we are in control mode, we will be emitting
garbage to our clients.

To avoid this problem, this commit adds a way to disable those
functions. If any of them is called when in control mode, we will
emit a generic error.

Although this is far from the perfect solution, it guarantees
that only JSON is sent to Clients.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce basic asynchronous events
Luiz Capitulino [Fri, 27 Nov 2009 00:59:04 +0000 (22:59 -0200)]
QMP: Introduce basic asynchronous events

Debug, shutdown, reset, powerdown and stop are all basic events,
as they are very simple they can be added in the same commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Asynchronous events infrastructure
Luiz Capitulino [Fri, 27 Nov 2009 00:59:03 +0000 (22:59 -0200)]
QMP: Asynchronous events infrastructure

Asynchronous events are generated with a call to
monitor_protocol_event().

This function builds the right data-type and emit the event
right away. The emitted data is always a JSON object and its
format is as follows:

{ "event": json-string,
  "timestamp": { "seconds": json-number, "microseconds": json-number },
  "data": json-value }

This design is based on ideas by Amit Shah <amit.shah@redhat.com>.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Allow 'query-' commands
Luiz Capitulino [Fri, 27 Nov 2009 00:59:02 +0000 (22:59 -0200)]
QMP: Allow 'query-' commands

The 'info' command makes sense for the user protocol, but for QMP
it doesn't, as its return data is not well defined. That is, it
can return anything.

To fix this Avi proposes having 'query-' commands when in protocol
mode. For example, 'info balloon' would become 'query-balloon'.

The right way of supporting this would probably be to move all
info handlers to qemu-monitor.hx, add a flags field to mon_cmd_t
to identify them and then modify do_info() to do its search based
on that flag.

Unfortunately, this would require a big change in the Monitor.

To make things simpler for now, this commit takes a different
approach: a check for commands starting with "query-" is added to
toplevel QMP code, if it's true we setup things so that do_info()
is called with the appropriate arguments.

This is a hack, but is a temporary one and guarantees that query-
commands will work from the first day.

Also note that 'info' is not allowed in protocol mode.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Input support
Luiz Capitulino [Fri, 27 Nov 2009 00:59:01 +0000 (22:59 -0200)]
QMP: Input support

The JSON stream parser is used to do QMP input. When there
are enough characters to be parsed it calls Monitor's
handle_qmp_command() function to handle the input.

This function's job is to check if the input is correct and
call the appropriate handler. In other words, it does for QMP
what handle_user_command() does for the user protocol.

This means that handle_qmp_command() also has to parse the
(ugly) "args_type" format to able to get the arguments names
and types expected by the handler.

The format to input commands in QMP is as follows:

{ "execute": json-string,
  "id": json-value, "arguments": json-object }

Please, note that this commit also adds "id" support.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: do_info() checks
Luiz Capitulino [Fri, 27 Nov 2009 00:59:00 +0000 (22:59 -0200)]
QMP: do_info() checks

This commit adds specific QMP checks to do_info(), so that
it behaves as expected in QMP mode.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Output support
Luiz Capitulino [Fri, 27 Nov 2009 00:58:59 +0000 (22:58 -0200)]
QMP: Output support

In the new Monitor output is always performed by only two
functions: do_info() and monitor_call_handler().

To support QMP output, we modify those functions to check if we
are in control mode. If so, we call monitor_protocol_emitter()
to emit QMP output, otherwise we do regular output.

QMP has two types of responses to issued commands: success and
error. The outputed data is always a JSON object.

Success responses have the following format:

{ "return": json-value, "id": json-value }

Error responses have the following format:

{ "error": { "class": json-string,
             "desc": json-string,
             "data": json-value } "id": json-value }

Please, note that the "id" key is part of the input code, and
thus is not added in this commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Initial support
Luiz Capitulino [Fri, 27 Nov 2009 00:58:58 +0000 (22:58 -0200)]
QMP: Initial support

This commit adds initial QMP support in QEMU. It's important
to notice that most QMP code will be part of the Monitor.

Input will be read by monitor_control_read(). Currently it
does nothing but next patches will add proper input support.

The function monitor_json_emitter(), as its name implies, is
used by the Monitor to emit JSON output. In this commit it's
used by monitor_control_event() to print our greeting message.

Finally, control mode support is also added to monitor_init(),
allowing QMP to be really enabled.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>