mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pci, pc, virtio fixes and cleanups A bunch of fixes all over the place. All of ACPI refactoring has been merged. Legacy pci commands have been dropped. virtio header cleanup initial patches from virtio-1.0 branch Signed-off-by: Michael S. Tsirkin <mst@redhat.com> * remotes/mst/tags/for_upstream: (130 commits) acpi: drop unused code aml-build: comment fix acpi-build: fix typo in comment acpi: update generated files vhost user:support vhost user nic for non msi guests aml-build: fix build for glib < 2.22 acpi: update generated files Makefile.target: binary depends on config-devices acpi-test-data: update after pci rewrite acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb(). pci-hotplug-old: Has been dead for five major releases, bury pci: Give a few helpers internal linkage acpi: make build_*() routines static to aml-build.c pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs pc: acpi-build: drop template patching and create PCI bus tree dynamically tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation pc: acpi-build: simplify PCI bus tree generation tests: add ACPI blobs for qemu with bridge cases tests: bios-tables-test: add support for testing bridges tests: ACPI test blobs update due to PCI0._CRS changes ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Conflicts: hw/pci/pci-hotplug-old.c
This commit is contained in:
@@ -26,7 +26,6 @@ CONFIG_APPLESMC=y
|
||||
CONFIG_I8259=y
|
||||
CONFIG_PFLASH_CFI01=y
|
||||
CONFIG_TPM_TIS=$(CONFIG_TPM)
|
||||
CONFIG_PCI_HOTPLUG_OLD=y
|
||||
CONFIG_MC146818RTC=y
|
||||
CONFIG_PAM=y
|
||||
CONFIG_PCI_PIIX=y
|
||||
|
||||
@@ -26,7 +26,6 @@ CONFIG_APPLESMC=y
|
||||
CONFIG_I8259=y
|
||||
CONFIG_PFLASH_CFI01=y
|
||||
CONFIG_TPM_TIS=$(CONFIG_TPM)
|
||||
CONFIG_PCI_HOTPLUG_OLD=y
|
||||
CONFIG_MC146818RTC=y
|
||||
CONFIG_PAM=y
|
||||
CONFIG_PCI_PIIX=y
|
||||
|
||||
+3
-4
@@ -30,7 +30,7 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "monitor/monitor.h"
|
||||
|
||||
DriveInfo *add_init_drive(const char *optstr)
|
||||
static DriveInfo *add_init_drive(const char *optstr)
|
||||
{
|
||||
DriveInfo *dinfo;
|
||||
QemuOpts *opts;
|
||||
@@ -69,9 +69,8 @@ void hmp_drive_add(Monitor *mon, const QDict *qdict)
|
||||
monitor_printf(mon, "OK\n");
|
||||
break;
|
||||
default:
|
||||
if (pci_drive_hot_add(mon, qdict, dinfo)) {
|
||||
goto err;
|
||||
}
|
||||
monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
|
||||
goto err;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
@@ -1347,6 +1347,8 @@ int qemu_ram_resize(ram_addr_t base, ram_addr_t newsize, Error **errp)
|
||||
|
||||
assert(block);
|
||||
|
||||
newsize = TARGET_PAGE_ALIGN(newsize);
|
||||
|
||||
if (block->used_length == newsize) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1147,38 +1147,6 @@ STEXI
|
||||
@item drive_add
|
||||
@findex drive_add
|
||||
Add drive to PCI storage controller.
|
||||
ETEXI
|
||||
|
||||
#if defined(CONFIG_PCI_HOTPLUG_OLD)
|
||||
{
|
||||
.name = "pci_add",
|
||||
.args_type = "pci_addr:s,type:s,opts:s?",
|
||||
.params = "auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...",
|
||||
.help = "hot-add PCI device",
|
||||
.mhandler.cmd = hmp_pci_add,
|
||||
},
|
||||
#endif
|
||||
|
||||
STEXI
|
||||
@item pci_add
|
||||
@findex pci_add
|
||||
Hot-add PCI device.
|
||||
ETEXI
|
||||
|
||||
#if defined(CONFIG_PCI_HOTPLUG_OLD)
|
||||
{
|
||||
.name = "pci_del",
|
||||
.args_type = "pci_addr:s",
|
||||
.params = "[[<domain>:]<bus>:]<slot>",
|
||||
.help = "hot remove PCI device",
|
||||
.mhandler.cmd = hmp_pci_del,
|
||||
},
|
||||
#endif
|
||||
|
||||
STEXI
|
||||
@item pci_del
|
||||
@findex pci_del
|
||||
Hot remove PCI device.
|
||||
ETEXI
|
||||
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
static uint32_t virtio_9p_get_features(VirtIODevice *vdev, uint32_t features)
|
||||
{
|
||||
features |= 1 << VIRTIO_9P_MOUNT_TAG;
|
||||
virtio_add_feature(&features, VIRTIO_9P_MOUNT_TAG);
|
||||
return features;
|
||||
}
|
||||
|
||||
|
||||
+2
-16
@@ -7,16 +7,14 @@
|
||||
#include <utime.h>
|
||||
#include <sys/resource.h>
|
||||
#include <glib.h>
|
||||
#include "standard-headers/linux/virtio_9p.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/virtio/virtio-9p.h"
|
||||
#include "fsdev/file-op-9p.h"
|
||||
#include "fsdev/virtio-9p-marshal.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
|
||||
/* The feature bitmap for virtio 9P */
|
||||
/* The mount point is specified in a config variable */
|
||||
#define VIRTIO_9P_MOUNT_TAG 0
|
||||
|
||||
enum {
|
||||
P9_TLERROR = 6,
|
||||
P9_RLERROR,
|
||||
@@ -144,10 +142,6 @@ struct V9fsPDU
|
||||
* 1) change user needs to set groups and stuff
|
||||
*/
|
||||
|
||||
/* from Linux's linux/virtio_9p.h */
|
||||
|
||||
/* The ID for virtio console */
|
||||
#define VIRTIO_ID_9P 9
|
||||
#define MAX_REQ 128
|
||||
#define MAX_TAG_LEN 32
|
||||
|
||||
@@ -277,14 +271,6 @@ typedef struct V9fsWriteState {
|
||||
int cnt;
|
||||
} V9fsWriteState;
|
||||
|
||||
struct virtio_9p_config
|
||||
{
|
||||
/* number of characters in tag */
|
||||
uint16_t tag_len;
|
||||
/* Variable size tag name */
|
||||
uint8_t tag[0];
|
||||
} QEMU_PACKED;
|
||||
|
||||
typedef struct V9fsMkState {
|
||||
V9fsPDU *pdu;
|
||||
size_t offset;
|
||||
|
||||
@@ -2,3 +2,4 @@ common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o cpu_hotplug.o
|
||||
common-obj-$(CONFIG_ACPI) += memory_hotplug.o
|
||||
common-obj-$(CONFIG_ACPI) += acpi_interface.o
|
||||
common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
|
||||
common-obj-$(CONFIG_ACPI) += aml-build.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -141,6 +141,7 @@ void bios_linker_loader_add_pointer(GArray *linker,
|
||||
uint8_t pointer_size)
|
||||
{
|
||||
BiosLinkerLoaderEntry entry;
|
||||
size_t offset = (gchar *)pointer - table->data;
|
||||
|
||||
memset(&entry, 0, sizeof entry);
|
||||
strncpy(entry.pointer.dest_file, dest_file,
|
||||
@@ -148,7 +149,8 @@ void bios_linker_loader_add_pointer(GArray *linker,
|
||||
strncpy(entry.pointer.src_file, src_file,
|
||||
sizeof entry.pointer.src_file - 1);
|
||||
entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_POINTER);
|
||||
entry.pointer.offset = cpu_to_le32((gchar *)pointer - table->data);
|
||||
assert(table->len >= offset + pointer_size);
|
||||
entry.pointer.offset = cpu_to_le32(offset);
|
||||
entry.pointer.size = pointer_size;
|
||||
assert(pointer_size == 1 || pointer_size == 2 ||
|
||||
pointer_size == 4 || pointer_size == 8);
|
||||
|
||||
@@ -397,6 +397,20 @@ void ich9_pm_device_plug_cb(ICH9LPCPMRegs *pm, DeviceState *dev, Error **errp)
|
||||
}
|
||||
}
|
||||
|
||||
void ich9_pm_device_unplug_request_cb(ICH9LPCPMRegs *pm, DeviceState *dev,
|
||||
Error **errp)
|
||||
{
|
||||
error_setg(errp, "acpi: device unplug request for not supported device"
|
||||
" type: %s", object_get_typename(OBJECT(dev)));
|
||||
}
|
||||
|
||||
void ich9_pm_device_unplug_cb(ICH9LPCPMRegs *pm, DeviceState *dev,
|
||||
Error **errp)
|
||||
{
|
||||
error_setg(errp, "acpi: device unplug for not supported device"
|
||||
" type: %s", object_get_typename(OBJECT(dev)));
|
||||
}
|
||||
|
||||
void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
|
||||
{
|
||||
ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
|
||||
|
||||
@@ -168,7 +168,8 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
|
||||
{
|
||||
MemStatus *mdev;
|
||||
Error *local_err = NULL;
|
||||
int slot = object_property_get_int(OBJECT(dev), "slot", &local_err);
|
||||
int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP,
|
||||
&local_err);
|
||||
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
|
||||
+12
-6
@@ -297,10 +297,11 @@ static const MemoryRegionOps acpi_pcihp_io_ops = {
|
||||
},
|
||||
};
|
||||
|
||||
void acpi_pcihp_init(AcpiPciHpState *s, PCIBus *root_bus,
|
||||
void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus,
|
||||
MemoryRegion *address_space_io, bool bridges_enabled)
|
||||
{
|
||||
uint16_t io_size = ACPI_PCIHP_SIZE;
|
||||
s->io_len = ACPI_PCIHP_SIZE;
|
||||
s->io_base = ACPI_PCIHP_ADDR;
|
||||
|
||||
s->root= root_bus;
|
||||
s->legacy_piix = !bridges_enabled;
|
||||
@@ -308,16 +309,21 @@ void acpi_pcihp_init(AcpiPciHpState *s, PCIBus *root_bus,
|
||||
if (s->legacy_piix) {
|
||||
unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);
|
||||
|
||||
io_size = ACPI_PCIHP_LEGACY_SIZE;
|
||||
s->io_len = ACPI_PCIHP_LEGACY_SIZE;
|
||||
|
||||
*bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;
|
||||
object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,
|
||||
bus_bsel, NULL);
|
||||
}
|
||||
|
||||
memory_region_init_io(&s->io, NULL, &acpi_pcihp_io_ops, s,
|
||||
"acpi-pci-hotplug", io_size);
|
||||
memory_region_add_subregion(address_space_io, ACPI_PCIHP_ADDR, &s->io);
|
||||
memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s,
|
||||
"acpi-pci-hotplug", s->io_len);
|
||||
memory_region_add_subregion(address_space_io, s->io_base, &s->io);
|
||||
|
||||
object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base,
|
||||
&error_abort);
|
||||
object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len,
|
||||
&error_abort);
|
||||
}
|
||||
|
||||
const VMStateDescription vmstate_acpi_pcihp_pci_status = {
|
||||
|
||||
+11
-4
@@ -370,6 +370,13 @@ static void piix4_device_unplug_request_cb(HotplugHandler *hotplug_dev,
|
||||
}
|
||||
}
|
||||
|
||||
static void piix4_device_unplug_cb(HotplugHandler *hotplug_dev,
|
||||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
error_setg(errp, "acpi: device unplug for not supported device"
|
||||
" type: %s", object_get_typename(OBJECT(dev)));
|
||||
}
|
||||
|
||||
static void piix4_update_bus_hotplug(PCIBus *pci_bus, void *opaque)
|
||||
{
|
||||
PIIX4PMState *s = opaque;
|
||||
@@ -420,7 +427,7 @@ static void piix4_pm_add_propeties(PIIX4PMState *s)
|
||||
&s->io_base, NULL);
|
||||
}
|
||||
|
||||
static int piix4_pm_initfn(PCIDevice *dev)
|
||||
static void piix4_pm_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
PIIX4PMState *s = PIIX4_PM(dev);
|
||||
uint8_t *pci_conf;
|
||||
@@ -470,7 +477,6 @@ static int piix4_pm_initfn(PCIDevice *dev)
|
||||
piix4_acpi_system_hot_add_init(pci_address_space_io(dev), dev->bus, s);
|
||||
|
||||
piix4_pm_add_propeties(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Object *piix4_pm_find(void)
|
||||
@@ -556,7 +562,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
|
||||
"acpi-gpe0", GPE_LEN);
|
||||
memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe);
|
||||
|
||||
acpi_pcihp_init(&s->acpi_pci_hotplug, bus, parent,
|
||||
acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent,
|
||||
s->use_acpi_pci_hotplug);
|
||||
|
||||
acpi_cpu_hotplug_init(parent, OBJECT(s), &s->gpe_cpu,
|
||||
@@ -593,7 +599,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
|
||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(klass);
|
||||
|
||||
k->init = piix4_pm_initfn;
|
||||
k->realize = piix4_pm_realize;
|
||||
k->config_write = pm_write_config;
|
||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3;
|
||||
@@ -610,6 +616,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
|
||||
dc->hotpluggable = false;
|
||||
hc->plug = piix4_device_plug_cb;
|
||||
hc->unplug_request = piix4_device_unplug_request_cb;
|
||||
hc->unplug = piix4_device_unplug_cb;
|
||||
adevc->ospm_status = piix4_ospm_status;
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -1337,7 +1337,7 @@ static void ac97_on_reset (DeviceState *dev)
|
||||
mixer_reset (s);
|
||||
}
|
||||
|
||||
static int ac97_initfn (PCIDevice *dev)
|
||||
static void ac97_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
AC97LinkState *s = DO_UPCAST (AC97LinkState, dev, dev);
|
||||
uint8_t *c = s->dev.config;
|
||||
@@ -1384,7 +1384,6 @@ static int ac97_initfn (PCIDevice *dev)
|
||||
pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
|
||||
AUD_register_card ("ac97", &s->card);
|
||||
ac97_on_reset (&s->dev.qdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ac97_init (PCIBus *bus)
|
||||
@@ -1403,7 +1402,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS (klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS (klass);
|
||||
|
||||
k->init = ac97_initfn;
|
||||
k->realize = ac97_realize;
|
||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_82801AA_5;
|
||||
k->revision = 0x01;
|
||||
|
||||
+2
-3
@@ -1016,7 +1016,7 @@ static void es1370_on_reset (void *opaque)
|
||||
es1370_reset (s);
|
||||
}
|
||||
|
||||
static int es1370_initfn (PCIDevice *dev)
|
||||
static void es1370_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
ES1370State *s = DO_UPCAST (ES1370State, dev, dev);
|
||||
uint8_t *c = s->dev.config;
|
||||
@@ -1039,7 +1039,6 @@ static int es1370_initfn (PCIDevice *dev)
|
||||
|
||||
AUD_register_card ("es1370", &s->card);
|
||||
es1370_reset (s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int es1370_init (PCIBus *bus)
|
||||
@@ -1053,7 +1052,7 @@ static void es1370_class_init (ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS (klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS (klass);
|
||||
|
||||
k->init = es1370_initfn;
|
||||
k->realize = es1370_realize;
|
||||
k->vendor_id = PCI_VENDOR_ID_ENSONIQ;
|
||||
k->device_id = PCI_DEVICE_ID_ENSONIQ_ES1370;
|
||||
k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
|
||||
|
||||
@@ -1126,7 +1126,7 @@ static void intel_hda_reset(DeviceState *dev)
|
||||
intel_hda_update_irq(d);
|
||||
}
|
||||
|
||||
static int intel_hda_init(PCIDevice *pci)
|
||||
static void intel_hda_realize(PCIDevice *pci, Error **errp)
|
||||
{
|
||||
IntelHDAState *d = INTEL_HDA(pci);
|
||||
uint8_t *conf = d->pci.config;
|
||||
@@ -1147,8 +1147,6 @@ static int intel_hda_init(PCIDevice *pci)
|
||||
|
||||
hda_codec_bus_init(DEVICE(pci), &d->codecs, sizeof(d->codecs),
|
||||
intel_hda_response, intel_hda_xfer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void intel_hda_exit(PCIDevice *pci)
|
||||
@@ -1245,7 +1243,7 @@ static void intel_hda_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = intel_hda_init;
|
||||
k->realize = intel_hda_realize;
|
||||
k->exit = intel_hda_exit;
|
||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||
k->class_id = PCI_CLASS_MULTIMEDIA_HD_AUDIO;
|
||||
|
||||
+14
-17
@@ -667,11 +667,11 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
|
||||
memset(&blkcfg, 0, sizeof(blkcfg));
|
||||
virtio_stq_p(vdev, &blkcfg.capacity, capacity);
|
||||
virtio_stl_p(vdev, &blkcfg.seg_max, 128 - 2);
|
||||
virtio_stw_p(vdev, &blkcfg.cylinders, conf->cyls);
|
||||
virtio_stw_p(vdev, &blkcfg.geometry.cylinders, conf->cyls);
|
||||
virtio_stl_p(vdev, &blkcfg.blk_size, blk_size);
|
||||
virtio_stw_p(vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size);
|
||||
virtio_stw_p(vdev, &blkcfg.opt_io_size, conf->opt_io_size / blk_size);
|
||||
blkcfg.heads = conf->heads;
|
||||
blkcfg.geometry.heads = conf->heads;
|
||||
/*
|
||||
* We must ensure that the block device capacity is a multiple of
|
||||
* the logical block size. If that is not the case, let's use
|
||||
@@ -684,9 +684,9 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
|
||||
* per track (cylinder).
|
||||
*/
|
||||
if (blk_getlength(s->blk) / conf->heads / conf->secs % blk_size) {
|
||||
blkcfg.sectors = conf->secs & ~s->sector_mask;
|
||||
blkcfg.geometry.sectors = conf->secs & ~s->sector_mask;
|
||||
} else {
|
||||
blkcfg.sectors = conf->secs;
|
||||
blkcfg.geometry.sectors = conf->secs;
|
||||
}
|
||||
blkcfg.size_max = 0;
|
||||
blkcfg.physical_block_exp = get_physical_block_exp(conf);
|
||||
@@ -711,20 +711,20 @@ static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features)
|
||||
{
|
||||
VirtIOBlock *s = VIRTIO_BLK(vdev);
|
||||
|
||||
features |= (1 << VIRTIO_BLK_F_SEG_MAX);
|
||||
features |= (1 << VIRTIO_BLK_F_GEOMETRY);
|
||||
features |= (1 << VIRTIO_BLK_F_TOPOLOGY);
|
||||
features |= (1 << VIRTIO_BLK_F_BLK_SIZE);
|
||||
features |= (1 << VIRTIO_BLK_F_SCSI);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_GEOMETRY);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_TOPOLOGY);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_SCSI);
|
||||
|
||||
if (s->conf.config_wce) {
|
||||
features |= (1 << VIRTIO_BLK_F_CONFIG_WCE);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_CONFIG_WCE);
|
||||
}
|
||||
if (blk_enable_write_cache(s->blk)) {
|
||||
features |= (1 << VIRTIO_BLK_F_WCE);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_WCE);
|
||||
}
|
||||
if (blk_is_read_only(s->blk)) {
|
||||
features |= 1 << VIRTIO_BLK_F_RO;
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_RO);
|
||||
}
|
||||
|
||||
return features;
|
||||
@@ -733,7 +733,6 @@ static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features)
|
||||
static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
|
||||
{
|
||||
VirtIOBlock *s = VIRTIO_BLK(vdev);
|
||||
uint32_t features;
|
||||
|
||||
if (s->dataplane && !(status & (VIRTIO_CONFIG_S_DRIVER |
|
||||
VIRTIO_CONFIG_S_DRIVER_OK))) {
|
||||
@@ -744,8 +743,6 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
|
||||
return;
|
||||
}
|
||||
|
||||
features = vdev->guest_features;
|
||||
|
||||
/* A guest that supports VIRTIO_BLK_F_CONFIG_WCE must be able to send
|
||||
* cache flushes. Thus, the "auto writethrough" behavior is never
|
||||
* necessary for guests that support the VIRTIO_BLK_F_CONFIG_WCE feature.
|
||||
@@ -761,10 +758,10 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
|
||||
*
|
||||
* s->blk would erroneously be placed in writethrough mode.
|
||||
*/
|
||||
if (!(features & (1 << VIRTIO_BLK_F_CONFIG_WCE))) {
|
||||
if (!virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) {
|
||||
aio_context_acquire(blk_get_aio_context(s->blk));
|
||||
blk_set_enable_write_cache(s->blk,
|
||||
!!(features & (1 << VIRTIO_BLK_F_WCE)));
|
||||
virtio_has_feature(vdev, VIRTIO_BLK_F_WCE));
|
||||
aio_context_release(blk_get_aio_context(s->blk));
|
||||
}
|
||||
}
|
||||
|
||||
+9
-13
@@ -48,7 +48,7 @@ typedef struct PCIMultiSerialState {
|
||||
uint8_t prog_if;
|
||||
} PCIMultiSerialState;
|
||||
|
||||
static int serial_pci_init(PCIDevice *dev)
|
||||
static void serial_pci_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev);
|
||||
SerialState *s = &pci->state;
|
||||
@@ -57,9 +57,8 @@ static int serial_pci_init(PCIDevice *dev)
|
||||
s->baudbase = 115200;
|
||||
serial_realize_core(s, &err);
|
||||
if (err != NULL) {
|
||||
qerror_report_err(err);
|
||||
error_free(err);
|
||||
return -1;
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
|
||||
pci->dev.config[PCI_CLASS_PROG] = pci->prog_if;
|
||||
@@ -68,7 +67,6 @@ static int serial_pci_init(PCIDevice *dev)
|
||||
|
||||
memory_region_init_io(&s->io, OBJECT(pci), &serial_io_ops, s, "serial", 8);
|
||||
pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void multi_serial_irq_mux(void *opaque, int n, int level)
|
||||
@@ -85,7 +83,7 @@ static void multi_serial_irq_mux(void *opaque, int n, int level)
|
||||
pci_set_irq(&pci->dev, pending);
|
||||
}
|
||||
|
||||
static int multi_serial_pci_init(PCIDevice *dev)
|
||||
static void multi_serial_pci_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
|
||||
PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev);
|
||||
@@ -116,9 +114,8 @@ static int multi_serial_pci_init(PCIDevice *dev)
|
||||
s->baudbase = 115200;
|
||||
serial_realize_core(s, &err);
|
||||
if (err != NULL) {
|
||||
qerror_report_err(err);
|
||||
error_free(err);
|
||||
return -1;
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
s->irq = pci->irqs[i];
|
||||
pci->name[i] = g_strdup_printf("uart #%d", i+1);
|
||||
@@ -126,7 +123,6 @@ static int multi_serial_pci_init(PCIDevice *dev)
|
||||
pci->name[i], 8);
|
||||
memory_region_add_subregion(&pci->iobar, 8 * i, &s->io);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void serial_pci_exit(PCIDevice *dev)
|
||||
@@ -203,7 +199,7 @@ static void serial_pci_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass);
|
||||
pc->init = serial_pci_init;
|
||||
pc->realize = serial_pci_realize;
|
||||
pc->exit = serial_pci_exit;
|
||||
pc->vendor_id = PCI_VENDOR_ID_REDHAT;
|
||||
pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL;
|
||||
@@ -218,7 +214,7 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass);
|
||||
pc->init = multi_serial_pci_init;
|
||||
pc->realize = multi_serial_pci_realize;
|
||||
pc->exit = multi_serial_pci_exit;
|
||||
pc->vendor_id = PCI_VENDOR_ID_REDHAT;
|
||||
pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL2;
|
||||
@@ -233,7 +229,7 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass);
|
||||
pc->init = multi_serial_pci_init;
|
||||
pc->realize = multi_serial_pci_realize;
|
||||
pc->exit = multi_serial_pci_exit;
|
||||
pc->vendor_id = PCI_VENDOR_ID_REDHAT;
|
||||
pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL4;
|
||||
|
||||
@@ -75,7 +75,7 @@ static VirtIOSerialPort *find_port_by_name(char *name)
|
||||
static bool use_multiport(VirtIOSerial *vser)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(vser);
|
||||
return vdev->guest_features & (1 << VIRTIO_CONSOLE_F_MULTIPORT);
|
||||
return virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT);
|
||||
}
|
||||
|
||||
static size_t write_to_port(VirtIOSerialPort *port,
|
||||
@@ -474,7 +474,7 @@ static uint32_t get_features(VirtIODevice *vdev, uint32_t features)
|
||||
vser = VIRTIO_SERIAL(vdev);
|
||||
|
||||
if (vser->bus.max_nr_ports > 1) {
|
||||
features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT);
|
||||
virtio_add_feature(&features, VIRTIO_CONSOLE_F_MULTIPORT);
|
||||
}
|
||||
return features;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user