2012-10-24 01:41:52 +02:00
|
|
|
#ifndef QEMU_TYPEDEFS_H
|
|
|
|
#define QEMU_TYPEDEFS_H
|
|
|
|
|
|
|
|
/* A load of opaque types so that device init declarations don't have to
|
|
|
|
pull in all the real definitions. */
|
|
|
|
|
2018-11-15 22:17:51 +01:00
|
|
|
/* Please keep this list in case-insensitive alphabetical order */
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct AdapterInfo AdapterInfo;
|
2013-04-09 11:10:27 +02:00
|
|
|
typedef struct AddressSpace AddressSpace;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct AioContext AioContext;
|
2019-02-27 14:24:05 +01:00
|
|
|
typedef struct AnnounceTimer AnnounceTimer;
|
2016-03-08 05:44:54 +01:00
|
|
|
typedef struct BdrvDirtyBitmap BdrvDirtyBitmap;
|
2016-10-13 23:58:21 +02:00
|
|
|
typedef struct BdrvDirtyBitmapIter BdrvDirtyBitmapIter;
|
block: New BlockBackend
A block device consists of a frontend device model and a backend.
A block backend has a tree of block drivers doing the actual work.
The tree is managed by the block layer.
We currently use a single abstraction BlockDriverState both for tree
nodes and the backend as a whole. Drawbacks:
* Its API includes both stuff that makes sense only at the block
backend level (root of the tree) and stuff that's only for use
within the block layer. This makes the API bigger and more complex
than necessary. Moreover, it's not obvious which interfaces are
meant for device models, and which really aren't.
* Since device models keep a reference to their backend, the backend
object can't just be destroyed. But for media change, we need to
replace the tree. Our solution is to make the BlockDriverState
generic, with actual driver state in a separate object, pointed to
by member opaque. That lets us replace the tree by deinitializing
and reinitializing its root. This special need of the root makes
the data structure awkward everywhere in the tree.
The general plan is to separate the APIs into "block backend", for use
by device models, monitor and whatever other code dealing with block
backends, and "block driver", for use by the block layer and whatever
other code (if any) dealing with trees and tree nodes.
Code dealing with block backends, device models in particular, should
become completely oblivious of BlockDriverState. This should let us
clean up both APIs, and the tree data structures.
This commit is a first step. It creates a minimal "block backend"
API: type BlockBackend and functions to create, destroy and find them.
BlockBackend objects are created and destroyed exactly when root
BlockDriverState objects are created and destroyed. "Root" in the
sense of "in bdrv_states". They're not yet used for anything; that'll
come shortly.
A root BlockDriverState is created with bdrv_new_root(), so where to
create a BlockBackend is obvious. Where these roots get destroyed
isn't always as obvious.
It is obvious in qemu-img.c, qemu-io.c and qemu-nbd.c, and in error
paths of blockdev_init(), blk_connect(). That leaves destruction of
objects successfully created by blockdev_init() and blk_connect().
blockdev_init() is used only by drive_new() and qmp_blockdev_add().
Objects created by the latter are currently indestructible (see commit
48f364d "blockdev: Refuse to drive_del something added with
blockdev-add" and commit 2d246f0 "blockdev: Introduce
DriveInfo.enable_auto_del"). Objects created by the former get
destroyed by drive_del().
Objects created by blk_connect() get destroyed by blk_disconnect().
BlockBackend is reference-counted. Its reference count never exceeds
one so far, but that's going to change.
In drive_del(), the BB's reference count is surely one now. The BDS's
reference count is greater than one when something else is holding a
reference, such as a block job. In this case, the BB is destroyed
right away, but the BDS lives on until all extra references get
dropped.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-07 13:59:04 +02:00
|
|
|
typedef struct BlockBackend BlockBackend;
|
2015-10-19 17:53:24 +02:00
|
|
|
typedef struct BlockBackendRootState BlockBackendRootState;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct BlockDriverState BlockDriverState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct BusClass BusClass;
|
|
|
|
typedef struct BusState BusState;
|
2016-12-07 14:20:22 +01:00
|
|
|
typedef struct Chardev Chardev;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct CompatProperty CompatProperty;
|
2018-02-03 16:39:32 +01:00
|
|
|
typedef struct CoMutex CoMutex;
|
2015-10-01 16:29:50 +02:00
|
|
|
typedef struct CPUAddressSpace CPUAddressSpace;
|
2016-02-25 17:43:32 +01:00
|
|
|
typedef struct CPUState CPUState;
|
2015-01-20 12:05:07 +01:00
|
|
|
typedef struct DeviceListener DeviceListener;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct DeviceState DeviceState;
|
2017-04-21 11:16:25 +02:00
|
|
|
typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct DisplayChangeListener DisplayChangeListener;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct DriveInfo DriveInfo;
|
include/qemu/osdep.h: Don't include qapi/error.h
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.
Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.
Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.
This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-14 09:01:28 +01:00
|
|
|
typedef struct Error Error;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct EventNotifier EventNotifier;
|
2017-09-21 12:34:00 +02:00
|
|
|
typedef struct FlatView FlatView;
|
2017-07-14 11:40:08 +02:00
|
|
|
typedef struct FWCfgEntry FWCfgEntry;
|
2014-12-22 13:11:35 +01:00
|
|
|
typedef struct FWCfgIoState FWCfgIoState;
|
|
|
|
typedef struct FWCfgMemState FWCfgMemState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct FWCfgState FWCfgState;
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 11:05:09 +02:00
|
|
|
typedef struct HVFX86EmulatorState HVFX86EmulatorState;
|
2013-08-03 00:18:51 +02:00
|
|
|
typedef struct I2CBus I2CBus;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct I2SCodec I2SCodec;
|
2018-11-15 22:17:51 +01:00
|
|
|
typedef struct IOMMUMemoryRegion IOMMUMemoryRegion;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct ISABus ISABus;
|
|
|
|
typedef struct ISADevice ISADevice;
|
2016-02-03 17:28:57 +01:00
|
|
|
typedef struct IsaDma IsaDma;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct MACAddr MACAddr;
|
|
|
|
typedef struct MachineClass MachineClass;
|
|
|
|
typedef struct MachineState MachineState;
|
|
|
|
typedef struct MemoryListener MemoryListener;
|
|
|
|
typedef struct MemoryMappingList MemoryMappingList;
|
|
|
|
typedef struct MemoryRegion MemoryRegion;
|
2016-11-22 12:04:52 +01:00
|
|
|
typedef struct MemoryRegionCache MemoryRegionCache;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct MemoryRegionSection MemoryRegionSection;
|
2015-05-21 14:24:14 +02:00
|
|
|
typedef struct MigrationIncomingState MigrationIncomingState;
|
2015-11-05 19:10:40 +01:00
|
|
|
typedef struct MigrationState MigrationState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct Monitor Monitor;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct MonitorDef MonitorDef;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct MSIMessage MSIMessage;
|
|
|
|
typedef struct NetClientState NetClientState;
|
2015-10-07 05:52:14 +02:00
|
|
|
typedef struct NetFilterState NetFilterState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct NICInfo NICInfo;
|
2018-11-15 22:17:52 +01:00
|
|
|
typedef struct NodeInfo NodeInfo;
|
2017-08-29 17:30:20 +02:00
|
|
|
typedef struct NumaNodeMem NumaNodeMem;
|
2018-11-06 11:23:30 +01:00
|
|
|
typedef struct ObjectClass ObjectClass;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct PCIBridge PCIBridge;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct PCIBus PCIBus;
|
|
|
|
typedef struct PCIDevice PCIDevice;
|
|
|
|
typedef struct PCIEAERErr PCIEAERErr;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct PCIEAERLog PCIEAERLog;
|
|
|
|
typedef struct PCIEAERMsg PCIEAERMsg;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct PCIEPort PCIEPort;
|
|
|
|
typedef struct PCIESlot PCIESlot;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct PCIExpressDevice PCIExpressDevice;
|
|
|
|
typedef struct PCIExpressHost PCIExpressHost;
|
2016-03-09 13:44:19 +01:00
|
|
|
typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct PCIHostState PCIHostState;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct PCMachineState PCMachineState;
|
2015-11-05 19:11:02 +01:00
|
|
|
typedef struct PostcopyDiscardState PostcopyDiscardState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct Property Property;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct PropertyInfo PropertyInfo;
|
2018-11-15 22:17:51 +01:00
|
|
|
typedef struct QBool QBool;
|
|
|
|
typedef struct QDict QDict;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct QEMUBH QEMUBH;
|
|
|
|
typedef struct QemuConsole QemuConsole;
|
|
|
|
typedef struct QEMUFile QEMUFile;
|
2018-02-03 16:39:32 +01:00
|
|
|
typedef struct QemuLockable QemuLockable;
|
|
|
|
typedef struct QemuMutex QemuMutex;
|
2015-09-17 18:25:01 +02:00
|
|
|
typedef struct QemuOpt QemuOpt;
|
|
|
|
typedef struct QemuOpts QemuOpts;
|
|
|
|
typedef struct QemuOptsList QemuOptsList;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct QEMUSGList QEMUSGList;
|
2018-11-15 22:17:51 +01:00
|
|
|
typedef struct QemuSpin QemuSpin;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct QEMUTimer QEMUTimer;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct QEMUTimerListGroup QEMUTimerListGroup;
|
2018-06-08 10:39:09 +02:00
|
|
|
typedef struct QJSON QJSON;
|
2018-02-01 12:18:34 +01:00
|
|
|
typedef struct QList QList;
|
2017-06-26 19:25:14 +02:00
|
|
|
typedef struct QNull QNull;
|
2018-02-01 12:18:34 +01:00
|
|
|
typedef struct QNum QNum;
|
|
|
|
typedef struct QObject QObject;
|
|
|
|
typedef struct QString QString;
|
2015-11-05 19:10:32 +01:00
|
|
|
typedef struct RAMBlock RAMBlock;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct Range Range;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct SHPCDevice SHPCDevice;
|
|
|
|
typedef struct SSIBus SSIBus;
|
|
|
|
typedef struct VirtIODevice VirtIODevice;
|
|
|
|
typedef struct Visitor Visitor;
|
2017-06-14 10:34:34 +02:00
|
|
|
typedef void SaveStateHandler(QEMUFile *f, void *opaque);
|
|
|
|
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
|
2012-10-24 01:41:52 +02:00
|
|
|
|
|
|
|
#endif /* QEMU_TYPEDEFS_H */
|