pc: bugfixes, maintainers

A couple of bugfixes.
 Add a new vhost-user-blk maintainer.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAl6URY0PHG1zdEByZWRo
 YXQuY29tAAoJECgfDbjSjVRpkakH/Rr37dpu7ASDPebezMXh/1vztrgyw7Eyj18G
 crWCOeHLt6FjUmOzy3zmnjpVTR6Sg+1BQdH6n+p4jQ2mCTrYdCTphdf3l4p+KGfh
 9fuK30Ir4k+6gtX8qPehmEmhbNSsO+7Hh630bFFj/vcc9PycHFxSDx5sZze1WiBW
 4etKSJXrTRgDW2YDM+P9TUu9TJkYI5JpDJ7cyoVxfZ/L6TNvQqKCoRJ9EtsOAwH5
 9BzxrHqpcms8bmT72dpXTBjO7psLC5ElKCRnwOMtZ7y9dbhHswiCbky5bqkwcaFs
 r21cBCZbzF/2ujoiN2v5vemaZKSaid/hvSJtf00Xy4/cpJzHZIk=
 =r6Fb
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc: bugfixes, maintainers

A couple of bugfixes.
Add a new vhost-user-blk maintainer.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Mon 13 Apr 2020 11:57:17 BST
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  exec: Fix for qemu_ram_resize() callback
  fw_cfg: Migrate ACPI table mr sizes separately
  acpi: Use macro for table-loader file name
  MAINTAINERS: Add myself as vhost-user-blk maintainer

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
master
Peter Maydell 2020-04-13 15:42:51 +01:00
commit 14e5526b51
8 changed files with 126 additions and 5 deletions

View File

@ -1853,6 +1853,18 @@ F: hw/display/virtio-gpu*
F: hw/display/virtio-vga.*
F: include/hw/virtio/virtio-gpu.h
vhost-user-blk
M: Raphael Norwitz <raphael.norwitz@nutanix.com>
S: Maintained
F: contrib/vhost-user-blk/
F: contrib/vhost-user-scsi/
F: hw/block/vhost-user-blk.c
F: hw/scsi/vhost-user-scsi.c
F: hw/virtio/vhost-user-blk-pci.c
F: hw/virtio/vhost-user-scsi-pci.c
F: include/hw/virtio/vhost-user-blk.h
F: include/hw/virtio/vhost-user-scsi.h
vhost-user-gpu
M: Marc-André Lureau <marcandre.lureau@redhat.com>
M: Gerd Hoffmann <kraxel@redhat.com>

16
exec.c
View File

@ -2074,11 +2074,23 @@ static int memory_try_enable_merging(void *addr, size_t len)
*/
int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
{
const ram_addr_t unaligned_size = newsize;
assert(block);
newsize = HOST_PAGE_ALIGN(newsize);
if (block->used_length == newsize) {
/*
* We don't have to resize the ram block (which only knows aligned
* sizes), however, we have to notify if the unaligned size changed.
*/
if (unaligned_size != memory_region_size(block->mr)) {
memory_region_set_size(block->mr, unaligned_size);
if (block->resized) {
block->resized(block->idstr, unaligned_size, block->host);
}
}
return 0;
}
@ -2102,9 +2114,9 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
block->used_length = newsize;
cpu_physical_memory_set_dirty_range(block->offset, block->used_length,
DIRTY_CLIENTS_ALL);
memory_region_set_size(block->mr, newsize);
memory_region_set_size(block->mr, unaligned_size);
if (block->resized) {
block->resized(block->idstr, newsize, block->host);
block->resized(block->idstr, unaligned_size, block->host);
}
return 0;
}

View File

@ -929,7 +929,7 @@ void virt_acpi_setup(VirtMachineState *vms)
build_state->linker_mr =
acpi_add_rom_blob(virt_acpi_build_update, build_state,
tables.linker->cmd_blob, "etc/table-loader", 0);
tables.linker->cmd_blob, ACPI_BUILD_LOADER_FILE, 0);
fw_cfg_add_file(vms->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data,
acpi_data_len(tables.tcpalog));

View File

@ -39,6 +39,7 @@ GlobalProperty hw_compat_4_2[] = {
{ "usb-redir", "suppress-remote-wake", "off" },
{ "qxl", "revision", "4" },
{ "qxl-vga", "revision", "4" },
{ "fw_cfg", "acpi-mr-restore", "false" },
};
const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);

View File

@ -3043,7 +3043,7 @@ void acpi_setup(void)
build_state->linker_mr =
acpi_add_rom_blob(acpi_build_update, build_state,
tables.linker->cmd_blob, "etc/table-loader", 0);
tables.linker->cmd_blob, ACPI_BUILD_LOADER_FILE, 0);
fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
tables.tcpalog->data, acpi_data_len(tables.tcpalog));

View File

@ -39,6 +39,7 @@
#include "qemu/config-file.h"
#include "qemu/cutils.h"
#include "qapi/error.h"
#include "hw/acpi/aml-build.h"
#define FW_CFG_FILE_SLOTS_DFLT 0x20
@ -610,6 +611,55 @@ bool fw_cfg_dma_enabled(void *opaque)
return s->dma_enabled;
}
static bool fw_cfg_acpi_mr_restore(void *opaque)
{
FWCfgState *s = opaque;
bool mr_aligned;
mr_aligned = QEMU_IS_ALIGNED(s->table_mr_size, qemu_real_host_page_size) &&
QEMU_IS_ALIGNED(s->linker_mr_size, qemu_real_host_page_size) &&
QEMU_IS_ALIGNED(s->rsdp_mr_size, qemu_real_host_page_size);
return s->acpi_mr_restore && !mr_aligned;
}
static void fw_cfg_update_mr(FWCfgState *s, uint16_t key, size_t size)
{
MemoryRegion *mr;
ram_addr_t offset;
int arch = !!(key & FW_CFG_ARCH_LOCAL);
void *ptr;
key &= FW_CFG_ENTRY_MASK;
assert(key < fw_cfg_max_entry(s));
ptr = s->entries[arch][key].data;
mr = memory_region_from_host(ptr, &offset);
memory_region_ram_resize(mr, size, &error_abort);
}
static int fw_cfg_acpi_mr_restore_post_load(void *opaque, int version_id)
{
FWCfgState *s = opaque;
int i, index;
assert(s->files);
index = be32_to_cpu(s->files->count);
for (i = 0; i < index; i++) {
if (!strcmp(s->files->f[i].name, ACPI_BUILD_TABLE_FILE)) {
fw_cfg_update_mr(s, FW_CFG_FILE_FIRST + i, s->table_mr_size);
} else if (!strcmp(s->files->f[i].name, ACPI_BUILD_LOADER_FILE)) {
fw_cfg_update_mr(s, FW_CFG_FILE_FIRST + i, s->linker_mr_size);
} else if (!strcmp(s->files->f[i].name, ACPI_BUILD_RSDP_FILE)) {
fw_cfg_update_mr(s, FW_CFG_FILE_FIRST + i, s->rsdp_mr_size);
}
}
return 0;
}
static const VMStateDescription vmstate_fw_cfg_dma = {
.name = "fw_cfg/dma",
.needed = fw_cfg_dma_enabled,
@ -619,6 +669,20 @@ static const VMStateDescription vmstate_fw_cfg_dma = {
},
};
static const VMStateDescription vmstate_fw_cfg_acpi_mr = {
.name = "fw_cfg/acpi_mr",
.version_id = 1,
.minimum_version_id = 1,
.needed = fw_cfg_acpi_mr_restore,
.post_load = fw_cfg_acpi_mr_restore_post_load,
.fields = (VMStateField[]) {
VMSTATE_UINT64(table_mr_size, FWCfgState),
VMSTATE_UINT64(linker_mr_size, FWCfgState),
VMSTATE_UINT64(rsdp_mr_size, FWCfgState),
VMSTATE_END_OF_LIST()
},
};
static const VMStateDescription vmstate_fw_cfg = {
.name = "fw_cfg",
.version_id = 2,
@ -631,6 +695,7 @@ static const VMStateDescription vmstate_fw_cfg = {
},
.subsections = (const VMStateDescription*[]) {
&vmstate_fw_cfg_dma,
&vmstate_fw_cfg_acpi_mr,
NULL,
}
};
@ -815,6 +880,23 @@ static struct {
#define FW_CFG_ORDER_OVERRIDE_LAST 200
};
/*
* Any sub-page size update to these table MRs will be lost during migration,
* as we use aligned size in ram_load_precopy() -> qemu_ram_resize() path.
* In order to avoid the inconsistency in sizes save them seperately and
* migrate over in vmstate post_load().
*/
static void fw_cfg_acpi_mr_save(FWCfgState *s, const char *filename, size_t len)
{
if (!strcmp(filename, ACPI_BUILD_TABLE_FILE)) {
s->table_mr_size = len;
} else if (!strcmp(filename, ACPI_BUILD_LOADER_FILE)) {
s->linker_mr_size = len;
} else if (!strcmp(filename, ACPI_BUILD_RSDP_FILE)) {
s->rsdp_mr_size = len;
}
}
static int get_fw_cfg_order(FWCfgState *s, const char *name)
{
int i;
@ -914,6 +996,7 @@ void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
trace_fw_cfg_add_file(s, index, s->files->f[index].name, len);
s->files->count = cpu_to_be32(count+1);
fw_cfg_acpi_mr_save(s, filename, len);
}
void fw_cfg_add_file(FWCfgState *s, const char *filename,
@ -937,6 +1020,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
ptr = fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i,
data, len);
s->files->f[i].size = cpu_to_be32(len);
fw_cfg_acpi_mr_save(s, filename, len);
return ptr;
}
}
@ -973,7 +1057,10 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
qemu_register_reset(fw_cfg_machine_reset, s);
}
static Property fw_cfg_properties[] = {
DEFINE_PROP_BOOL("acpi-mr-restore", FWCfgState, acpi_mr_restore, true),
DEFINE_PROP_END_OF_LIST(),
};
static void fw_cfg_common_realize(DeviceState *dev, Error **errp)
{
@ -1097,6 +1184,8 @@ static void fw_cfg_class_init(ObjectClass *klass, void *data)
dc->reset = fw_cfg_reset;
dc->vmsd = &vmstate_fw_cfg;
device_class_set_props(dc, fw_cfg_properties);
}
static const TypeInfo fw_cfg_info = {

View File

@ -13,6 +13,7 @@
#define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
#define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
#define ACPI_BUILD_LOADER_FILE "etc/table-loader"
#define AML_NOTIFY_METHOD "NTFY"

View File

@ -53,6 +53,12 @@ struct FWCfgState {
dma_addr_t dma_addr;
AddressSpace *dma_as;
MemoryRegion dma_iomem;
/* restore during migration */
bool acpi_mr_restore;
uint64_t table_mr_size;
uint64_t linker_mr_size;
uint64_t rsdp_mr_size;
};
struct FWCfgIoState {