mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
pc and misc cleanups and fixes, virtio optimizations
Included here: Refactoring and bugfix patches in PC/ACPI. New commands for ipmi. Virtio optimizations. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJWtj8KAAoJECgfDbjSjVRpBIQIAJSB9xwTcBLXwD0+8z5lqjKC GTtuVbHU0+Y/eO8O3llN5l+SzaRtPHo18Ele20Oz7IQc0ompANY273K6TOlyILwB rOhrub71uqpOKbGlxXJflroEAXb78xVK02lohSUvOzCDpwV+6CS4ZaSer7yDCYkA MODZj7rrEuN0RmBWqxbs1R7Mj2CeQJzlgTUNTBGCLEstoZGFOJq8FjVdG5P1q8vI fnI9mGJ1JsDnmcUZe/bTFfB4VreqeQ7UuGyNAMMGnvIbr0D1a+CoaMdV7/HZ+KyT 5TIs0siVdhZei60A/Cq2OtSVCbj5QdxPBLhZfwJCp6oU4lh2U5tSvva0mh7MwJ0= =D/cA -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging pc and misc cleanups and fixes, virtio optimizations Included here: Refactoring and bugfix patches in PC/ACPI. New commands for ipmi. Virtio optimizations. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Sat 06 Feb 2016 18:44:26 GMT using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: (45 commits) net: set endianness on all backend devices fix MSI injection on Xen intel_iommu: large page support dimm: Correct type of MemoryHotplugState->base pc: set the OEM fields in the RSDT and the FADT from the SLIC acpi: add function to extract oem_id and oem_table_id from the user's SLIC acpi: expose oem_id and oem_table_id in build_rsdt() acpi: take oem_id in build_header(), optionally pc: Eliminate PcGuestInfo struct pc: Move APIC and NUMA data from PcGuestInfo to PCMachineState pc: Move PcGuestInfo.fw_cfg to PCMachineState pc: Remove PcGuestInfo.isapc_ram_fw field pc: Remove RAM size fields from PcGuestInfo pc: Remove compat fields from PcGuestInfo acpi: Don't save PcGuestInfo on AcpiBuildState acpi: Remove guest_info parameters from functions pc: Simplify xen_load_linux() signature pc: Simplify pc_memory_init() signature pc: Eliminate struct PcGuestInfoState pc: Move PcGuestInfo declaration to top of file ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
bdad0f3977
59 changed files with 1476 additions and 1122 deletions
|
@ -196,4 +196,11 @@ unsigned acpi_table_len(void *current);
|
|||
void acpi_table_add(const QemuOpts *opts, Error **errp);
|
||||
void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);
|
||||
|
||||
typedef struct AcpiSlicOem AcpiSlicOem;
|
||||
struct AcpiSlicOem {
|
||||
char *id;
|
||||
char *table_id;
|
||||
};
|
||||
int acpi_get_slic_oem(AcpiSlicOem *oem);
|
||||
|
||||
#endif /* !QEMU_HW_ACPI_H */
|
||||
|
|
|
@ -357,13 +357,14 @@ Aml *aml_sizeof(Aml *arg);
|
|||
void
|
||||
build_header(GArray *linker, GArray *table_data,
|
||||
AcpiTableHeader *h, const char *sig, int len, uint8_t rev,
|
||||
const char *oem_table_id);
|
||||
const char *oem_id, const char *oem_table_id);
|
||||
void *acpi_data_push(GArray *table_data, unsigned size);
|
||||
unsigned acpi_data_len(GArray *table);
|
||||
void acpi_add_table(GArray *table_offsets, GArray *table_data);
|
||||
void acpi_build_tables_init(AcpiBuildTables *tables);
|
||||
void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre);
|
||||
void
|
||||
build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets);
|
||||
build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets,
|
||||
const char *oem_id, const char *oem_table_id);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -83,6 +83,7 @@ struct VTDIOTLBEntry {
|
|||
uint64_t gfn;
|
||||
uint16_t domain_id;
|
||||
uint64_t slpte;
|
||||
uint64_t mask;
|
||||
bool read_flags;
|
||||
bool write_flags;
|
||||
};
|
||||
|
|
|
@ -45,11 +45,13 @@ struct PCMachineState {
|
|||
|
||||
/* State for other subsystems/APIs: */
|
||||
MemoryHotplugState hotplug_memory;
|
||||
Notifier machine_done;
|
||||
|
||||
/* Pointers to devices and objects: */
|
||||
HotplugHandler *acpi_dev;
|
||||
ISADevice *rtc;
|
||||
PCIBus *bus;
|
||||
FWCfgState *fw_cfg;
|
||||
|
||||
/* Configuration options: */
|
||||
uint64_t max_ram_below_4g;
|
||||
|
@ -59,6 +61,15 @@ struct PCMachineState {
|
|||
|
||||
/* RAM information (sizes, addresses, configuration): */
|
||||
ram_addr_t below_4g_mem_size, above_4g_mem_size;
|
||||
|
||||
/* CPU and apic information: */
|
||||
bool apic_xrupt_override;
|
||||
unsigned apic_id_limit;
|
||||
|
||||
/* NUMA information: */
|
||||
uint64_t numa_nodes;
|
||||
uint64_t *node_mem;
|
||||
uint64_t *node_cpu;
|
||||
};
|
||||
|
||||
#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
|
||||
|
@ -151,21 +162,6 @@ typedef struct PcPciInfo {
|
|||
#define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len"
|
||||
#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
|
||||
|
||||
struct PcGuestInfo {
|
||||
bool isapc_ram_fw;
|
||||
hwaddr ram_size, ram_size_below_4g;
|
||||
unsigned apic_id_limit;
|
||||
bool apic_xrupt_override;
|
||||
uint64_t numa_nodes;
|
||||
uint64_t *node_mem;
|
||||
uint64_t *node_cpu;
|
||||
FWCfgState *fw_cfg;
|
||||
int legacy_acpi_table_size;
|
||||
bool has_acpi_build;
|
||||
bool has_reserved_memory;
|
||||
bool rsdp_in_ram;
|
||||
};
|
||||
|
||||
/* parallel.c */
|
||||
|
||||
void parallel_hds_isa_init(ISABus *bus, int n);
|
||||
|
@ -232,7 +228,7 @@ void pc_cpus_init(PCMachineState *pcms);
|
|||
void pc_hot_add_cpu(const int64_t id, Error **errp);
|
||||
void pc_acpi_init(const char *default_dsdt);
|
||||
|
||||
PcGuestInfo *pc_guest_info_init(PCMachineState *pcms);
|
||||
void pc_guest_info_init(PCMachineState *pcms);
|
||||
|
||||
#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start"
|
||||
#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end"
|
||||
|
@ -245,13 +241,11 @@ PcGuestInfo *pc_guest_info_init(PCMachineState *pcms);
|
|||
void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
|
||||
MemoryRegion *pci_address_space);
|
||||
|
||||
FWCfgState *xen_load_linux(PCMachineState *pcms,
|
||||
PcGuestInfo *guest_info);
|
||||
FWCfgState *pc_memory_init(PCMachineState *pcms,
|
||||
MemoryRegion *system_memory,
|
||||
MemoryRegion *rom_memory,
|
||||
MemoryRegion **ram_memory,
|
||||
PcGuestInfo *guest_info);
|
||||
void xen_load_linux(PCMachineState *pcms);
|
||||
void pc_memory_init(PCMachineState *pcms,
|
||||
MemoryRegion *system_memory,
|
||||
MemoryRegion *rom_memory,
|
||||
MemoryRegion **ram_memory);
|
||||
qemu_irq pc_allocate_cpu_irq(void);
|
||||
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
|
||||
void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
|
||||
|
|
|
@ -210,4 +210,49 @@ IPMIFwInfo *ipmi_next_fwinfo(IPMIFwInfo *current);
|
|||
#define ipmi_debug(fs, ...)
|
||||
#endif
|
||||
|
||||
struct ipmi_sdr_header {
|
||||
uint8_t rec_id[2];
|
||||
uint8_t sdr_version; /* 0x51 */
|
||||
uint8_t rec_type;
|
||||
uint8_t rec_length;
|
||||
};
|
||||
#define IPMI_SDR_HEADER_SIZE sizeof(struct ipmi_sdr_header)
|
||||
|
||||
#define ipmi_sdr_recid(sdr) ((sdr)->rec_id[0] | ((sdr)->rec_id[1] << 8))
|
||||
#define ipmi_sdr_length(sdr) ((sdr)->rec_length + IPMI_SDR_HEADER_SIZE)
|
||||
|
||||
/*
|
||||
* 43.2 SDR Type 02h. Compact Sensor Record
|
||||
*/
|
||||
#define IPMI_SDR_COMPACT_TYPE 2
|
||||
|
||||
struct ipmi_sdr_compact {
|
||||
struct ipmi_sdr_header header;
|
||||
|
||||
uint8_t sensor_owner_id;
|
||||
uint8_t sensor_owner_lun;
|
||||
uint8_t sensor_owner_number; /* byte 8 */
|
||||
uint8_t entity_id;
|
||||
uint8_t entity_instance;
|
||||
uint8_t sensor_init;
|
||||
uint8_t sensor_caps;
|
||||
uint8_t sensor_type;
|
||||
uint8_t reading_type;
|
||||
uint8_t assert_mask[2]; /* byte 16 */
|
||||
uint8_t deassert_mask[2];
|
||||
uint8_t discrete_mask[2];
|
||||
uint8_t sensor_unit1;
|
||||
uint8_t sensor_unit2;
|
||||
uint8_t sensor_unit3;
|
||||
uint8_t sensor_direction[2]; /* byte 24 */
|
||||
uint8_t positive_threshold;
|
||||
uint8_t negative_threshold;
|
||||
uint8_t reserved[3];
|
||||
uint8_t oem;
|
||||
uint8_t id_str_len; /* byte 32 */
|
||||
uint8_t id_string[16];
|
||||
};
|
||||
|
||||
typedef uint8_t ipmi_sdr_compact_buffer[sizeof(struct ipmi_sdr_compact)];
|
||||
|
||||
#endif
|
||||
|
|
|
@ -77,7 +77,7 @@ typedef struct PCDIMMDeviceClass {
|
|||
* @mr: hotplug memory address space container
|
||||
*/
|
||||
typedef struct MemoryHotplugState {
|
||||
ram_addr_t base;
|
||||
hwaddr base;
|
||||
MemoryRegion mr;
|
||||
} MemoryHotplugState;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void vring_teardown(Vring *vring, VirtIODevice *vdev, int n);
|
|||
void vring_disable_notification(VirtIODevice *vdev, Vring *vring);
|
||||
bool vring_enable_notification(VirtIODevice *vdev, Vring *vring);
|
||||
bool vring_should_notify(VirtIODevice *vdev, Vring *vring);
|
||||
int vring_pop(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem);
|
||||
void *vring_pop(VirtIODevice *vdev, Vring *vring, size_t sz);
|
||||
void vring_push(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem,
|
||||
int len);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct VirtIOBalloon {
|
|||
uint32_t num_pages;
|
||||
uint32_t actual;
|
||||
uint64_t stats[VIRTIO_BALLOON_S_NR];
|
||||
VirtQueueElement stats_vq_elem;
|
||||
VirtQueueElement *stats_vq_elem;
|
||||
size_t stats_vq_offset;
|
||||
QEMUTimer *stats_timer;
|
||||
int64_t stats_last_update;
|
||||
|
|
|
@ -60,9 +60,9 @@ typedef struct VirtIOBlock {
|
|||
} VirtIOBlock;
|
||||
|
||||
typedef struct VirtIOBlockReq {
|
||||
VirtQueueElement elem;
|
||||
int64_t sector_num;
|
||||
VirtIOBlock *dev;
|
||||
VirtQueueElement elem;
|
||||
struct virtio_blk_inhdr *in;
|
||||
struct virtio_blk_outhdr out;
|
||||
QEMUIOVector qiov;
|
||||
|
@ -80,8 +80,7 @@ typedef struct MultiReqBuffer {
|
|||
bool is_write;
|
||||
} MultiReqBuffer;
|
||||
|
||||
VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s);
|
||||
|
||||
void virtio_blk_init_request(VirtIOBlock *s, VirtIOBlockReq *req);
|
||||
void virtio_blk_free_request(VirtIOBlockReq *req);
|
||||
|
||||
void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb);
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct VirtIONetQueue {
|
|||
QEMUBH *tx_bh;
|
||||
int tx_waiting;
|
||||
struct {
|
||||
VirtQueueElement elem;
|
||||
VirtQueueElement *elem;
|
||||
} async_tx;
|
||||
struct VirtIONet *n;
|
||||
} VirtIONetQueue;
|
||||
|
|
|
@ -112,18 +112,17 @@ typedef struct VirtIOSCSI {
|
|||
} VirtIOSCSI;
|
||||
|
||||
typedef struct VirtIOSCSIReq {
|
||||
/* Note:
|
||||
* - fields up to resp_iov are initialized by virtio_scsi_init_req;
|
||||
* - fields starting at vring are zeroed by virtio_scsi_init_req.
|
||||
* */
|
||||
VirtQueueElement elem;
|
||||
|
||||
VirtIOSCSI *dev;
|
||||
VirtQueue *vq;
|
||||
QEMUSGList qsgl;
|
||||
QEMUIOVector resp_iov;
|
||||
|
||||
/* Note:
|
||||
* - fields before elem are initialized by virtio_scsi_init_req;
|
||||
* - elem is uninitialized at the time of allocation.
|
||||
* - fields after elem are zeroed by virtio_scsi_init_req.
|
||||
* */
|
||||
|
||||
VirtQueueElement elem;
|
||||
/* Set by dataplane code. */
|
||||
VirtIOSCSIVring *vring;
|
||||
|
||||
|
@ -161,7 +160,7 @@ void virtio_scsi_common_unrealize(DeviceState *dev, Error **errp);
|
|||
void virtio_scsi_handle_ctrl_req(VirtIOSCSI *s, VirtIOSCSIReq *req);
|
||||
bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req);
|
||||
void virtio_scsi_handle_cmd_req_submit(VirtIOSCSI *s, VirtIOSCSIReq *req);
|
||||
VirtIOSCSIReq *virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq);
|
||||
void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req);
|
||||
void virtio_scsi_free_req(VirtIOSCSIReq *req);
|
||||
void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
|
||||
uint32_t event, uint32_t reason);
|
||||
|
|
|
@ -122,7 +122,7 @@ struct VirtIOSerialPort {
|
|||
* element popped and continue consuming it once the backend
|
||||
* becomes writable again.
|
||||
*/
|
||||
VirtQueueElement elem;
|
||||
VirtQueueElement *elem;
|
||||
|
||||
/*
|
||||
* The index and the offset into the iov buffer that was popped in
|
||||
|
|
|
@ -46,10 +46,10 @@ typedef struct VirtQueueElement
|
|||
unsigned int index;
|
||||
unsigned int out_num;
|
||||
unsigned int in_num;
|
||||
hwaddr in_addr[VIRTQUEUE_MAX_SIZE];
|
||||
hwaddr out_addr[VIRTQUEUE_MAX_SIZE];
|
||||
struct iovec in_sg[VIRTQUEUE_MAX_SIZE];
|
||||
struct iovec out_sg[VIRTQUEUE_MAX_SIZE];
|
||||
hwaddr *in_addr;
|
||||
hwaddr *out_addr;
|
||||
struct iovec *in_sg;
|
||||
struct iovec *out_sg;
|
||||
} VirtQueueElement;
|
||||
|
||||
#define VIRTIO_QUEUE_MAX 1024
|
||||
|
@ -143,6 +143,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
|||
|
||||
void virtio_del_queue(VirtIODevice *vdev, int n);
|
||||
|
||||
void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num);
|
||||
void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
|
||||
unsigned int len);
|
||||
void virtqueue_flush(VirtQueue *vq, unsigned int count);
|
||||
|
@ -152,7 +153,9 @@ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
|
|||
unsigned int len, unsigned int idx);
|
||||
|
||||
void virtqueue_map(VirtQueueElement *elem);
|
||||
int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem);
|
||||
void *virtqueue_pop(VirtQueue *vq, size_t sz);
|
||||
void *qemu_get_virtqueue_element(QEMUFile *f, size_t sz);
|
||||
void qemu_put_virtqueue_element(QEMUFile *f, VirtQueueElement *elem);
|
||||
int virtqueue_avail_bytes(VirtQueue *vq, unsigned int in_bytes,
|
||||
unsigned int out_bytes);
|
||||
void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,
|
||||
|
|
|
@ -33,6 +33,7 @@ int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num);
|
|||
void xen_piix3_set_irq(void *opaque, int irq_num, int level);
|
||||
void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len);
|
||||
void xen_hvm_inject_msi(uint64_t addr, uint32_t data);
|
||||
int xen_is_pirq_msi(uint32_t msi_data);
|
||||
|
||||
qemu_irq *xen_interrupt_controller_init(void);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue