mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
* configure: detect --cpu=mipsisa64r6
* target/i386: decode address before going back to translate.c * meson: allow configuring the x86-64 baseline * meson: remove dead optimization option * exec: small changes to allow compilation with C++ in Android emulator * fix SEV compilation on 32-bit systems -----BEGIN PGP SIGNATURE----- iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmZ+8mEUHHBib256aW5p QHJlZGhhdC5jb20ACgkQv/vSX3jHroMVmAf+PjJBpMYNFb2qxJDw5jI7hITsrtm4 v5TKo9x7E3pna5guae5ODFencYhBITQznHFa3gO9w09QN7Gq/rKjuBBST9VISslU dW3HtxY9A1eHQtNqHuD7jBWWo9N0hhNiLRa6xz/VDTjEJSxhjSdK2bRW9Yz9hZAe 8bbEEC9us21RdFTS+eijOMo9SPyASUlqIq4RbQpbAVuzzOMeXnfOuX9VSTcBy9o2 7cKMg7zjL8WQugJKynyl5lny7m1Ji55LD2UrYMF6Mik3Wz5kwgHcUITJ+ZHd/9hR a+MI7o/jyCPdmX9pBvJCxyerCVYBu0ugLqYKpAcsqU6111FLrnGgDvHf/g== =LdYd -----END PGP SIGNATURE----- Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging * configure: detect --cpu=mipsisa64r6 * target/i386: decode address before going back to translate.c * meson: allow configuring the x86-64 baseline * meson: remove dead optimization option * exec: small changes to allow compilation with C++ in Android emulator * fix SEV compilation on 32-bit systems # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmZ+8mEUHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroMVmAf+PjJBpMYNFb2qxJDw5jI7hITsrtm4 # v5TKo9x7E3pna5guae5ODFencYhBITQznHFa3gO9w09QN7Gq/rKjuBBST9VISslU # dW3HtxY9A1eHQtNqHuD7jBWWo9N0hhNiLRa6xz/VDTjEJSxhjSdK2bRW9Yz9hZAe # 8bbEEC9us21RdFTS+eijOMo9SPyASUlqIq4RbQpbAVuzzOMeXnfOuX9VSTcBy9o2 # 7cKMg7zjL8WQugJKynyl5lny7m1Ji55LD2UrYMF6Mik3Wz5kwgHcUITJ+ZHd/9hR # a+MI7o/jyCPdmX9pBvJCxyerCVYBu0ugLqYKpAcsqU6111FLrnGgDvHf/g== # =LdYd # -----END PGP SIGNATURE----- # gpg: Signature made Fri 28 Jun 2024 10:26:57 AM PDT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (23 commits) target/i386/sev: Fix printf formats target/i386/sev: Use size_t for object sizes target/i386: SEV: store pointer to decoded id_auth in SevSnpGuest target/i386: SEV: rename sev_snp_guest->id_auth target/i386: SEV: store pointer to decoded id_block in SevSnpGuest target/i386: SEV: rename sev_snp_guest->id_block target/i386: remove unused enum target/i386: give CC_OP_POPCNT low bits corresponding to MO_TL target/i386: use cpu_cc_dst for CC_OP_POPCNT target/i386: fix CC_OP dump include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH() exec: don't use void* in pointer arithmetic in headers exec: avoid using C++ keywords in function parameters block: rename former bdrv_file_open callbacks block: remove separate bdrv_file_open callback block: do not check bdrv_file_open block: make assertion more generic meson: remove dead optimization option meson: allow configuring the x86-64 baseline Revert "host/i386: assume presence of SSE2" ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
3665dd6bb9
17
block.c
17
block.c
@ -926,7 +926,6 @@ BlockDriver *bdrv_find_protocol(const char *filename,
|
||||
int i;
|
||||
|
||||
GLOBAL_STATE_CODE();
|
||||
/* TODO Drivers without bdrv_file_open must be specified explicitly */
|
||||
|
||||
/*
|
||||
* XXX(hch): we really should not let host device detection
|
||||
@ -1655,10 +1654,8 @@ bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_name,
|
||||
bs->drv = drv;
|
||||
bs->opaque = g_malloc0(drv->instance_size);
|
||||
|
||||
if (drv->bdrv_file_open) {
|
||||
assert(!drv->bdrv_needs_filename || bs->filename[0]);
|
||||
ret = drv->bdrv_file_open(bs, options, open_flags, &local_err);
|
||||
} else if (drv->bdrv_open) {
|
||||
assert(!drv->bdrv_needs_filename || bs->filename[0]);
|
||||
if (drv->bdrv_open) {
|
||||
ret = drv->bdrv_open(bs, options, open_flags, &local_err);
|
||||
} else {
|
||||
ret = 0;
|
||||
@ -1983,7 +1980,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
|
||||
open_flags = bdrv_open_flags(bs, bs->open_flags);
|
||||
node_name = qemu_opt_get(opts, "node-name");
|
||||
|
||||
assert(!drv->bdrv_file_open || file == NULL);
|
||||
assert(!drv->protocol_name || file == NULL);
|
||||
ret = bdrv_open_driver(bs, drv, node_name, options, open_flags, errp);
|
||||
if (ret < 0) {
|
||||
goto fail_opts;
|
||||
@ -2084,7 +2081,7 @@ static int bdrv_fill_options(QDict **options, const char *filename,
|
||||
}
|
||||
/* If the user has explicitly specified the driver, this choice should
|
||||
* override the BDRV_O_PROTOCOL flag */
|
||||
protocol = drv->bdrv_file_open;
|
||||
protocol = drv->protocol_name;
|
||||
}
|
||||
|
||||
if (protocol) {
|
||||
@ -4123,7 +4120,7 @@ bdrv_open_inherit(const char *filename, const char *reference, QDict *options,
|
||||
}
|
||||
|
||||
/* BDRV_O_PROTOCOL must be set iff a protocol BDS is about to be created */
|
||||
assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->bdrv_file_open);
|
||||
assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->protocol_name);
|
||||
/* file must be NULL if a protocol BDS is about to be created
|
||||
* (the inverse results in an error message from bdrv_open_common()) */
|
||||
assert(!(flags & BDRV_O_PROTOCOL) || !file);
|
||||
@ -5971,7 +5968,7 @@ int64_t coroutine_fn bdrv_co_get_allocated_file_size(BlockDriverState *bs)
|
||||
return drv->bdrv_co_get_allocated_file_size(bs);
|
||||
}
|
||||
|
||||
if (drv->bdrv_file_open) {
|
||||
if (drv->protocol_name) {
|
||||
/*
|
||||
* Protocol drivers default to -ENOTSUP (most of their data is
|
||||
* not stored in any of their children (if they even have any),
|
||||
@ -8030,7 +8027,7 @@ void bdrv_refresh_filename(BlockDriverState *bs)
|
||||
* Both of these conditions are represented by generate_json_filename.
|
||||
*/
|
||||
if (primary_child_bs->exact_filename[0] &&
|
||||
primary_child_bs->drv->bdrv_file_open &&
|
||||
primary_child_bs->drv->protocol_name &&
|
||||
!drv->is_filter && !generate_json_filename)
|
||||
{
|
||||
strcpy(bs->exact_filename, primary_child_bs->exact_filename);
|
||||
|
@ -1073,7 +1073,7 @@ static BlockDriver bdrv_blkdebug = {
|
||||
.is_filter = true,
|
||||
|
||||
.bdrv_parse_filename = blkdebug_parse_filename,
|
||||
.bdrv_file_open = blkdebug_open,
|
||||
.bdrv_open = blkdebug_open,
|
||||
.bdrv_close = blkdebug_close,
|
||||
.bdrv_reopen_prepare = blkdebug_reopen_prepare,
|
||||
.bdrv_child_perm = blkdebug_child_perm,
|
||||
|
@ -713,7 +713,7 @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options,
|
||||
* for example will fail.
|
||||
*
|
||||
* In order to open the device read-only, we are using the `read-only`
|
||||
* property of the libblkio driver in blkio_file_open().
|
||||
* property of the libblkio driver in blkio_open().
|
||||
*/
|
||||
fd = qemu_open(path, O_RDWR, NULL);
|
||||
if (fd < 0) {
|
||||
@ -791,8 +791,8 @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int blkio_file_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
static int blkio_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
{
|
||||
const char *blkio_driver = bs->drv->protocol_name;
|
||||
BDRVBlkioState *s = bs->opaque;
|
||||
@ -1088,7 +1088,7 @@ static void blkio_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
*/
|
||||
#define BLKIO_DRIVER_COMMON \
|
||||
.instance_size = sizeof(BDRVBlkioState), \
|
||||
.bdrv_file_open = blkio_file_open, \
|
||||
.bdrv_open = blkio_open, \
|
||||
.bdrv_close = blkio_close, \
|
||||
.bdrv_co_getlength = blkio_co_getlength, \
|
||||
.bdrv_co_truncate = blkio_truncate, \
|
||||
|
@ -321,7 +321,7 @@ static BlockDriver bdrv_blkverify = {
|
||||
.instance_size = sizeof(BDRVBlkverifyState),
|
||||
|
||||
.bdrv_parse_filename = blkverify_parse_filename,
|
||||
.bdrv_file_open = blkverify_open,
|
||||
.bdrv_open = blkverify_open,
|
||||
.bdrv_close = blkverify_close,
|
||||
.bdrv_child_perm = bdrv_default_perms,
|
||||
.bdrv_co_getlength = blkverify_co_getlength,
|
||||
|
@ -1034,7 +1034,7 @@ static BlockDriver bdrv_http = {
|
||||
|
||||
.instance_size = sizeof(BDRVCURLState),
|
||||
.bdrv_parse_filename = curl_parse_filename,
|
||||
.bdrv_file_open = curl_open,
|
||||
.bdrv_open = curl_open,
|
||||
.bdrv_close = curl_close,
|
||||
.bdrv_co_getlength = curl_co_getlength,
|
||||
|
||||
@ -1053,7 +1053,7 @@ static BlockDriver bdrv_https = {
|
||||
|
||||
.instance_size = sizeof(BDRVCURLState),
|
||||
.bdrv_parse_filename = curl_parse_filename,
|
||||
.bdrv_file_open = curl_open,
|
||||
.bdrv_open = curl_open,
|
||||
.bdrv_close = curl_close,
|
||||
.bdrv_co_getlength = curl_co_getlength,
|
||||
|
||||
@ -1072,7 +1072,7 @@ static BlockDriver bdrv_ftp = {
|
||||
|
||||
.instance_size = sizeof(BDRVCURLState),
|
||||
.bdrv_parse_filename = curl_parse_filename,
|
||||
.bdrv_file_open = curl_open,
|
||||
.bdrv_open = curl_open,
|
||||
.bdrv_close = curl_close,
|
||||
.bdrv_co_getlength = curl_co_getlength,
|
||||
|
||||
@ -1091,7 +1091,7 @@ static BlockDriver bdrv_ftps = {
|
||||
|
||||
.instance_size = sizeof(BDRVCURLState),
|
||||
.bdrv_parse_filename = curl_parse_filename,
|
||||
.bdrv_file_open = curl_open,
|
||||
.bdrv_open = curl_open,
|
||||
.bdrv_close = curl_close,
|
||||
.bdrv_co_getlength = curl_co_getlength,
|
||||
|
||||
|
@ -3886,7 +3886,7 @@ BlockDriver bdrv_file = {
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_probe = NULL, /* no probe for protocols */
|
||||
.bdrv_parse_filename = raw_parse_filename,
|
||||
.bdrv_file_open = raw_open,
|
||||
.bdrv_open = raw_open,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
@ -4257,7 +4257,7 @@ static BlockDriver bdrv_host_device = {
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_probe_device = hdev_probe_device,
|
||||
.bdrv_parse_filename = hdev_parse_filename,
|
||||
.bdrv_file_open = hdev_open,
|
||||
.bdrv_open = hdev_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
@ -4396,7 +4396,7 @@ static BlockDriver bdrv_host_cdrom = {
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_probe_device = cdrom_probe_device,
|
||||
.bdrv_parse_filename = cdrom_parse_filename,
|
||||
.bdrv_file_open = cdrom_open,
|
||||
.bdrv_open = cdrom_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
@ -4522,7 +4522,7 @@ static BlockDriver bdrv_host_cdrom = {
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_probe_device = cdrom_probe_device,
|
||||
.bdrv_parse_filename = cdrom_parse_filename,
|
||||
.bdrv_file_open = cdrom_open,
|
||||
.bdrv_open = cdrom_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
|
@ -746,7 +746,7 @@ BlockDriver bdrv_file = {
|
||||
.instance_size = sizeof(BDRVRawState),
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_parse_filename = raw_parse_filename,
|
||||
.bdrv_file_open = raw_open,
|
||||
.bdrv_open = raw_open,
|
||||
.bdrv_refresh_limits = raw_probe_alignment,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_co_create_opts = raw_co_create_opts,
|
||||
@ -920,7 +920,7 @@ static BlockDriver bdrv_host_device = {
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_parse_filename = hdev_parse_filename,
|
||||
.bdrv_probe_device = hdev_probe_device,
|
||||
.bdrv_file_open = hdev_open,
|
||||
.bdrv_open = hdev_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_refresh_limits = hdev_refresh_limits,
|
||||
|
||||
|
@ -1551,7 +1551,7 @@ static BlockDriver bdrv_gluster = {
|
||||
.format_name = "gluster",
|
||||
.protocol_name = "gluster",
|
||||
.instance_size = sizeof(BDRVGlusterState),
|
||||
.bdrv_file_open = qemu_gluster_open,
|
||||
.bdrv_open = qemu_gluster_open,
|
||||
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
|
||||
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
|
||||
.bdrv_reopen_abort = qemu_gluster_reopen_abort,
|
||||
@ -1580,7 +1580,7 @@ static BlockDriver bdrv_gluster_tcp = {
|
||||
.format_name = "gluster",
|
||||
.protocol_name = "gluster+tcp",
|
||||
.instance_size = sizeof(BDRVGlusterState),
|
||||
.bdrv_file_open = qemu_gluster_open,
|
||||
.bdrv_open = qemu_gluster_open,
|
||||
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
|
||||
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
|
||||
.bdrv_reopen_abort = qemu_gluster_reopen_abort,
|
||||
@ -1609,7 +1609,7 @@ static BlockDriver bdrv_gluster_unix = {
|
||||
.format_name = "gluster",
|
||||
.protocol_name = "gluster+unix",
|
||||
.instance_size = sizeof(BDRVGlusterState),
|
||||
.bdrv_file_open = qemu_gluster_open,
|
||||
.bdrv_open = qemu_gluster_open,
|
||||
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
|
||||
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
|
||||
.bdrv_reopen_abort = qemu_gluster_reopen_abort,
|
||||
|
@ -2429,7 +2429,7 @@ static BlockDriver bdrv_iscsi = {
|
||||
|
||||
.instance_size = sizeof(IscsiLun),
|
||||
.bdrv_parse_filename = iscsi_parse_filename,
|
||||
.bdrv_file_open = iscsi_open,
|
||||
.bdrv_open = iscsi_open,
|
||||
.bdrv_close = iscsi_close,
|
||||
.bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
.create_opts = &bdrv_create_opts_simple,
|
||||
@ -2468,7 +2468,7 @@ static BlockDriver bdrv_iser = {
|
||||
|
||||
.instance_size = sizeof(IscsiLun),
|
||||
.bdrv_parse_filename = iscsi_parse_filename,
|
||||
.bdrv_file_open = iscsi_open,
|
||||
.bdrv_open = iscsi_open,
|
||||
.bdrv_close = iscsi_close,
|
||||
.bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
.create_opts = &bdrv_create_opts_simple,
|
||||
|
@ -2146,7 +2146,7 @@ static BlockDriver bdrv_nbd = {
|
||||
.bdrv_parse_filename = nbd_parse_filename,
|
||||
.bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
.create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_file_open = nbd_open,
|
||||
.bdrv_open = nbd_open,
|
||||
.bdrv_reopen_prepare = nbd_client_reopen_prepare,
|
||||
.bdrv_co_preadv = nbd_client_co_preadv,
|
||||
.bdrv_co_pwritev = nbd_client_co_pwritev,
|
||||
@ -2174,7 +2174,7 @@ static BlockDriver bdrv_nbd_tcp = {
|
||||
.bdrv_parse_filename = nbd_parse_filename,
|
||||
.bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
.create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_file_open = nbd_open,
|
||||
.bdrv_open = nbd_open,
|
||||
.bdrv_reopen_prepare = nbd_client_reopen_prepare,
|
||||
.bdrv_co_preadv = nbd_client_co_preadv,
|
||||
.bdrv_co_pwritev = nbd_client_co_pwritev,
|
||||
@ -2202,7 +2202,7 @@ static BlockDriver bdrv_nbd_unix = {
|
||||
.bdrv_parse_filename = nbd_parse_filename,
|
||||
.bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
.create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_file_open = nbd_open,
|
||||
.bdrv_open = nbd_open,
|
||||
.bdrv_reopen_prepare = nbd_client_reopen_prepare,
|
||||
.bdrv_co_preadv = nbd_client_co_preadv,
|
||||
.bdrv_co_pwritev = nbd_client_co_pwritev,
|
||||
|
@ -888,7 +888,7 @@ static BlockDriver bdrv_nfs = {
|
||||
#endif
|
||||
.bdrv_co_truncate = nfs_file_co_truncate,
|
||||
|
||||
.bdrv_file_open = nfs_file_open,
|
||||
.bdrv_open = nfs_file_open,
|
||||
.bdrv_close = nfs_file_close,
|
||||
.bdrv_co_create = nfs_file_co_create,
|
||||
.bdrv_co_create_opts = nfs_file_co_create_opts,
|
||||
|
@ -77,8 +77,8 @@ static void null_aio_parse_filename(const char *filename, QDict *options,
|
||||
}
|
||||
}
|
||||
|
||||
static int null_file_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
static int null_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
{
|
||||
QemuOpts *opts;
|
||||
BDRVNullState *s = bs->opaque;
|
||||
@ -283,7 +283,7 @@ static BlockDriver bdrv_null_co = {
|
||||
.protocol_name = "null-co",
|
||||
.instance_size = sizeof(BDRVNullState),
|
||||
|
||||
.bdrv_file_open = null_file_open,
|
||||
.bdrv_open = null_open,
|
||||
.bdrv_parse_filename = null_co_parse_filename,
|
||||
.bdrv_co_getlength = null_co_getlength,
|
||||
.bdrv_co_get_allocated_file_size = null_co_get_allocated_file_size,
|
||||
@ -304,7 +304,7 @@ static BlockDriver bdrv_null_aio = {
|
||||
.protocol_name = "null-aio",
|
||||
.instance_size = sizeof(BDRVNullState),
|
||||
|
||||
.bdrv_file_open = null_file_open,
|
||||
.bdrv_open = null_open,
|
||||
.bdrv_parse_filename = null_aio_parse_filename,
|
||||
.bdrv_co_getlength = null_co_getlength,
|
||||
.bdrv_co_get_allocated_file_size = null_co_get_allocated_file_size,
|
||||
|
@ -889,7 +889,7 @@ out:
|
||||
qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)regs, 0, sizeof(NvmeBar));
|
||||
}
|
||||
|
||||
/* Cleaning up is done in nvme_file_open() upon error. */
|
||||
/* Cleaning up is done in nvme_open() upon error. */
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -967,8 +967,8 @@ static void nvme_close(BlockDriverState *bs)
|
||||
g_free(s->device);
|
||||
}
|
||||
|
||||
static int nvme_file_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
static int nvme_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
{
|
||||
const char *device;
|
||||
QemuOpts *opts;
|
||||
@ -1630,7 +1630,7 @@ static BlockDriver bdrv_nvme = {
|
||||
.create_opts = &bdrv_create_opts_simple,
|
||||
|
||||
.bdrv_parse_filename = nvme_parse_filename,
|
||||
.bdrv_file_open = nvme_file_open,
|
||||
.bdrv_open = nvme_open,
|
||||
.bdrv_close = nvme_close,
|
||||
.bdrv_co_getlength = nvme_co_getlength,
|
||||
.bdrv_probe_blocksizes = nvme_probe_blocksizes,
|
||||
|
@ -1815,8 +1815,9 @@ static const char *const qemu_rbd_strong_runtime_opts[] = {
|
||||
static BlockDriver bdrv_rbd = {
|
||||
.format_name = "rbd",
|
||||
.instance_size = sizeof(BDRVRBDState),
|
||||
|
||||
.bdrv_parse_filename = qemu_rbd_parse_filename,
|
||||
.bdrv_file_open = qemu_rbd_open,
|
||||
.bdrv_open = qemu_rbd_open,
|
||||
.bdrv_close = qemu_rbd_close,
|
||||
.bdrv_reopen_prepare = qemu_rbd_reopen_prepare,
|
||||
.bdrv_co_create = qemu_rbd_co_create,
|
||||
|
@ -837,8 +837,8 @@ static int connect_to_ssh(BDRVSSHState *s, BlockdevOptionsSsh *opts,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ssh_file_open(BlockDriverState *bs, QDict *options, int bdrv_flags,
|
||||
Error **errp)
|
||||
static int ssh_open(BlockDriverState *bs, QDict *options, int bdrv_flags,
|
||||
Error **errp)
|
||||
{
|
||||
BDRVSSHState *s = bs->opaque;
|
||||
BlockdevOptionsSsh *opts;
|
||||
@ -1362,7 +1362,7 @@ static BlockDriver bdrv_ssh = {
|
||||
.protocol_name = "ssh",
|
||||
.instance_size = sizeof(BDRVSSHState),
|
||||
.bdrv_parse_filename = ssh_parse_filename,
|
||||
.bdrv_file_open = ssh_file_open,
|
||||
.bdrv_open = ssh_open,
|
||||
.bdrv_co_create = ssh_co_create,
|
||||
.bdrv_co_create_opts = ssh_co_create_opts,
|
||||
.bdrv_close = ssh_close,
|
||||
|
@ -3258,7 +3258,7 @@ static BlockDriver bdrv_vvfat = {
|
||||
.instance_size = sizeof(BDRVVVFATState),
|
||||
|
||||
.bdrv_parse_filename = vvfat_parse_filename,
|
||||
.bdrv_file_open = vvfat_open,
|
||||
.bdrv_open = vvfat_open,
|
||||
.bdrv_refresh_limits = vvfat_refresh_limits,
|
||||
.bdrv_close = vvfat_close,
|
||||
.bdrv_child_perm = vvfat_child_perm,
|
||||
|
2
configure
vendored
2
configure
vendored
@ -450,7 +450,7 @@ case "$cpu" in
|
||||
linux_arch=loongarch
|
||||
;;
|
||||
|
||||
mips64*)
|
||||
mips64*|mipsisa64*)
|
||||
cpu=mips64
|
||||
host_arch=mips
|
||||
linux_arch=mips
|
||||
|
@ -110,13 +110,14 @@ static biz_accel_fn const accel_table[] = {
|
||||
|
||||
static unsigned best_accel(void)
|
||||
{
|
||||
#ifdef CONFIG_AVX2_OPT
|
||||
unsigned info = cpuinfo_init();
|
||||
|
||||
#ifdef CONFIG_AVX2_OPT
|
||||
if (info & CPUINFO_AVX2) {
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
return info & CPUINFO_SSE2 ? 1 : 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -11,8 +11,10 @@
|
||||
#define CPUINFO_ALWAYS (1u << 0) /* so cpuinfo is nonzero */
|
||||
#define CPUINFO_MOVBE (1u << 2)
|
||||
#define CPUINFO_LZCNT (1u << 3)
|
||||
#define CPUINFO_POPCNT (1u << 4)
|
||||
#define CPUINFO_BMI1 (1u << 5)
|
||||
#define CPUINFO_BMI2 (1u << 6)
|
||||
#define CPUINFO_SSE2 (1u << 7)
|
||||
#define CPUINFO_AVX1 (1u << 9)
|
||||
#define CPUINFO_AVX2 (1u << 10)
|
||||
#define CPUINFO_AVX512F (1u << 11)
|
||||
|
@ -248,9 +248,6 @@ struct BlockDriver {
|
||||
int GRAPH_UNLOCKED_PTR (*bdrv_open)(
|
||||
BlockDriverState *bs, QDict *options, int flags, Error **errp);
|
||||
|
||||
/* Protocol drivers should implement this instead of bdrv_open */
|
||||
int GRAPH_UNLOCKED_PTR (*bdrv_file_open)(
|
||||
BlockDriverState *bs, QDict *options, int flags, Error **errp);
|
||||
void (*bdrv_close)(BlockDriverState *bs);
|
||||
|
||||
int coroutine_fn GRAPH_UNLOCKED_PTR (*bdrv_co_create)(
|
||||
|
@ -925,7 +925,7 @@ struct MemoryListener {
|
||||
* the current transaction.
|
||||
*/
|
||||
void (*log_start)(MemoryListener *listener, MemoryRegionSection *section,
|
||||
int old, int new);
|
||||
int old_val, int new_val);
|
||||
|
||||
/**
|
||||
* @log_stop:
|
||||
@ -944,7 +944,7 @@ struct MemoryListener {
|
||||
* the current transaction.
|
||||
*/
|
||||
void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section,
|
||||
int old, int new);
|
||||
int old_val, int new_val);
|
||||
|
||||
/**
|
||||
* @log_sync:
|
||||
@ -2764,7 +2764,7 @@ MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
|
||||
#include "exec/memory_ldst_phys.h.inc"
|
||||
|
||||
struct MemoryRegionCache {
|
||||
void *ptr;
|
||||
uint8_t *ptr;
|
||||
hwaddr xlat;
|
||||
hwaddr len;
|
||||
FlatView *fv;
|
||||
|
@ -62,7 +62,7 @@ int parse_qapi_name(const char *name, bool complete);
|
||||
#define QAPI_LIST_LENGTH(list) \
|
||||
({ \
|
||||
size_t _len = 0; \
|
||||
typeof(list) _tail; \
|
||||
typeof_strip_qual(list) _tail; \
|
||||
for (_tail = list; _tail != NULL; _tail = _tail->next) { \
|
||||
_len++; \
|
||||
} \
|
||||
|
@ -20,48 +20,6 @@
|
||||
/* Compiler barrier */
|
||||
#define barrier() ({ asm volatile("" ::: "memory"); (void)0; })
|
||||
|
||||
/* The variable that receives the old value of an atomically-accessed
|
||||
* variable must be non-qualified, because atomic builtins return values
|
||||
* through a pointer-type argument as in __atomic_load(&var, &old, MODEL).
|
||||
*
|
||||
* This macro has to handle types smaller than int manually, because of
|
||||
* implicit promotion. int and larger types, as well as pointers, can be
|
||||
* converted to a non-qualified type just by applying a binary operator.
|
||||
*/
|
||||
#define typeof_strip_qual(expr) \
|
||||
typeof( \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), bool) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const bool) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile bool) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile bool), \
|
||||
(bool)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), signed char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const signed char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile signed char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile signed char), \
|
||||
(signed char)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), unsigned char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const unsigned char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile unsigned char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile unsigned char), \
|
||||
(unsigned char)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), signed short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const signed short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile signed short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile signed short), \
|
||||
(signed short)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), unsigned short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const unsigned short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile unsigned short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile unsigned short), \
|
||||
(unsigned short)1, \
|
||||
(expr)+0))))))
|
||||
|
||||
#ifndef __ATOMIC_RELAXED
|
||||
#error "Expecting C11 atomic ops"
|
||||
#endif
|
||||
|
@ -227,4 +227,50 @@
|
||||
#define SECOND_ARG(first, second, ...) second
|
||||
#define IS_EMPTY_(junk_maybecomma) SECOND_ARG(junk_maybecomma 1, 0)
|
||||
|
||||
#ifndef __cplusplus
|
||||
/*
|
||||
* Useful in macros that need to declare temporary variables. For example,
|
||||
* the variable that receives the old value of an atomically-accessed
|
||||
* variable must be non-qualified, because atomic builtins return values
|
||||
* through a pointer-type argument as in __atomic_load(&var, &old, MODEL).
|
||||
*
|
||||
* This macro has to handle types smaller than int manually, because of
|
||||
* implicit promotion. int and larger types, as well as pointers, can be
|
||||
* converted to a non-qualified type just by applying a binary operator.
|
||||
*/
|
||||
#define typeof_strip_qual(expr) \
|
||||
typeof( \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), bool) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const bool) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile bool) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile bool), \
|
||||
(bool)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), signed char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const signed char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile signed char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile signed char), \
|
||||
(signed char)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), unsigned char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const unsigned char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile unsigned char) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile unsigned char), \
|
||||
(unsigned char)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), signed short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const signed short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile signed short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile signed short), \
|
||||
(signed short)1, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(expr), unsigned short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const unsigned short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), volatile unsigned short) || \
|
||||
__builtin_types_compatible_p(typeof(expr), const volatile unsigned short), \
|
||||
(unsigned short)1, \
|
||||
(expr)+0))))))
|
||||
#endif
|
||||
|
||||
#endif /* COMPILER_H */
|
||||
|
54
meson.build
54
meson.build
@ -336,15 +336,40 @@ if host_arch == 'i386' and not cc.links('''
|
||||
qemu_common_flags = ['-march=i486'] + qemu_common_flags
|
||||
endif
|
||||
|
||||
# Assume x86-64-v2 (minus CMPXCHG16B for 32-bit code)
|
||||
if host_arch == 'i386'
|
||||
qemu_common_flags = ['-mfpmath=sse'] + qemu_common_flags
|
||||
endif
|
||||
# Pick x86-64 baseline version
|
||||
if host_arch in ['i386', 'x86_64']
|
||||
qemu_common_flags = ['-mpopcnt', '-msse4.2'] + qemu_common_flags
|
||||
endif
|
||||
if host_arch == 'x86_64'
|
||||
qemu_common_flags = ['-mcx16'] + qemu_common_flags
|
||||
if get_option('x86_version') == '0' and host_arch == 'x86_64'
|
||||
error('x86_64-v1 required for x86-64 hosts')
|
||||
endif
|
||||
|
||||
# add flags for individual instruction set extensions
|
||||
if get_option('x86_version') >= '1'
|
||||
if host_arch == 'i386'
|
||||
qemu_common_flags = ['-mfpmath=sse'] + qemu_common_flags
|
||||
else
|
||||
# present on basically all processors but technically not part of
|
||||
# x86-64-v1, so only include -mneeded for x86-64 version 2 and above
|
||||
qemu_common_flags = ['-mcx16'] + qemu_common_flags
|
||||
endif
|
||||
endif
|
||||
if get_option('x86_version') >= '2'
|
||||
qemu_common_flags = ['-mpopcnt'] + qemu_common_flags
|
||||
qemu_common_flags = cc.get_supported_arguments('-mneeded') + qemu_common_flags
|
||||
endif
|
||||
if get_option('x86_version') >= '3'
|
||||
qemu_common_flags = ['-mmovbe', '-mabm', '-mbmi1', '-mbmi2', '-mfma', '-mf16c'] + qemu_common_flags
|
||||
endif
|
||||
|
||||
# add required vector instruction set (each level implies those below)
|
||||
if get_option('x86_version') == '1'
|
||||
qemu_common_flags = ['-msse2'] + qemu_common_flags
|
||||
elif get_option('x86_version') == '2'
|
||||
qemu_common_flags = ['-msse4.2'] + qemu_common_flags
|
||||
elif get_option('x86_version') == '3'
|
||||
qemu_common_flags = ['-mavx2'] + qemu_common_flags
|
||||
elif get_option('x86_version') == '4'
|
||||
qemu_common_flags = ['-mavx512f', '-mavx512bw', '-mavx512cd', '-mavx512dq', '-mavx512vl'] + qemu_common_flags
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('prefer_static')
|
||||
@ -2849,18 +2874,6 @@ config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \
|
||||
int main(int argc, char *argv[]) { return bar(argv[argc - 1]); }
|
||||
'''), error_message: 'AVX2 not available').allowed())
|
||||
|
||||
config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
|
||||
.require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512F') \
|
||||
.require(cc.links('''
|
||||
#include <cpuid.h>
|
||||
#include <immintrin.h>
|
||||
static int __attribute__((target("avx512f"))) bar(void *a) {
|
||||
__m512i x = *(__m512i *)a;
|
||||
return _mm512_test_epi64_mask(x, x);
|
||||
}
|
||||
int main(int argc, char *argv[]) { return bar(argv[argc - 1]); }
|
||||
'''), error_message: 'AVX512F not available').allowed())
|
||||
|
||||
config_host_data.set('CONFIG_AVX512BW_OPT', get_option('avx512bw') \
|
||||
.require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512BW') \
|
||||
.require(cc.links('''
|
||||
@ -4258,7 +4271,6 @@ summary_info += {'mutex debugging': get_option('debug_mutex')}
|
||||
summary_info += {'memory allocator': get_option('malloc')}
|
||||
summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')}
|
||||
summary_info += {'avx512bw optimization': config_host_data.get('CONFIG_AVX512BW_OPT')}
|
||||
summary_info += {'avx512f optimization': config_host_data.get('CONFIG_AVX512F_OPT')}
|
||||
summary_info += {'gcov': get_option('b_coverage')}
|
||||
summary_info += {'thread sanitizer': get_option('tsan')}
|
||||
summary_info += {'CFI support': get_option('cfi')}
|
||||
|
@ -119,8 +119,6 @@ option('membarrier', type: 'feature', value: 'disabled',
|
||||
|
||||
option('avx2', type: 'feature', value: 'auto',
|
||||
description: 'AVX2 optimizations')
|
||||
option('avx512f', type: 'feature', value: 'disabled',
|
||||
description: 'AVX512F optimizations')
|
||||
option('avx512bw', type: 'feature', value: 'auto',
|
||||
description: 'AVX512BW optimizations')
|
||||
option('keyring', type: 'feature', value: 'auto',
|
||||
@ -370,3 +368,6 @@ option('qemu_ga_version', type: 'string', value: '',
|
||||
|
||||
option('hexagon_idef_parser', type : 'boolean', value : true,
|
||||
description: 'use idef-parser to automatically generate TCG code for the Hexagon frontend')
|
||||
|
||||
option('x86_version', type : 'combo', choices : ['0', '1', '2', '3', '4'], value: '1',
|
||||
description: 'tweak required x86_64 architecture version beyond compiler default')
|
||||
|
@ -82,6 +82,8 @@ meson_options_help() {
|
||||
printf "%s\n" ' --with-suffix=VALUE Suffix for QEMU data/modules/config directories'
|
||||
printf "%s\n" ' (can be empty) [qemu]'
|
||||
printf "%s\n" ' --with-trace-file=VALUE Trace file prefix for simple backend [trace]'
|
||||
printf "%s\n" ' --x86-version=CHOICE tweak required x86_64 architecture version beyond'
|
||||
printf "%s\n" ' compiler default [1] (choices: 0/1/2/3)'
|
||||
printf "%s\n" ''
|
||||
printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
|
||||
printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if available'
|
||||
@ -93,7 +95,6 @@ meson_options_help() {
|
||||
printf "%s\n" ' auth-pam PAM access control'
|
||||
printf "%s\n" ' avx2 AVX2 optimizations'
|
||||
printf "%s\n" ' avx512bw AVX512BW optimizations'
|
||||
printf "%s\n" ' avx512f AVX512F optimizations'
|
||||
printf "%s\n" ' blkio libblkio block device driver'
|
||||
printf "%s\n" ' bochs bochs image format support'
|
||||
printf "%s\n" ' bpf eBPF support'
|
||||
@ -238,8 +239,6 @@ _meson_option_parse() {
|
||||
--disable-avx2) printf "%s" -Davx2=disabled ;;
|
||||
--enable-avx512bw) printf "%s" -Davx512bw=enabled ;;
|
||||
--disable-avx512bw) printf "%s" -Davx512bw=disabled ;;
|
||||
--enable-avx512f) printf "%s" -Davx512f=enabled ;;
|
||||
--disable-avx512f) printf "%s" -Davx512f=disabled ;;
|
||||
--enable-gcov) printf "%s" -Db_coverage=true ;;
|
||||
--disable-gcov) printf "%s" -Db_coverage=false ;;
|
||||
--enable-lto) printf "%s" -Db_lto=true ;;
|
||||
@ -552,6 +551,7 @@ _meson_option_parse() {
|
||||
--disable-werror) printf "%s" -Dwerror=false ;;
|
||||
--enable-whpx) printf "%s" -Dwhpx=enabled ;;
|
||||
--disable-whpx) printf "%s" -Dwhpx=disabled ;;
|
||||
--x86-version=*) quote_sh "-Dx86_version=$2" ;;
|
||||
--enable-xen) printf "%s" -Dxen=enabled ;;
|
||||
--disable-xen) printf "%s" -Dxen=disabled ;;
|
||||
--enable-xen-pci-passthrough) printf "%s" -Dxen_pci_passthrough=enabled ;;
|
||||
|
@ -28,69 +28,70 @@
|
||||
/* x86 debug */
|
||||
|
||||
static const char *cc_op_str[CC_OP_NB] = {
|
||||
"DYNAMIC",
|
||||
"EFLAGS",
|
||||
[CC_OP_DYNAMIC] = "DYNAMIC",
|
||||
|
||||
"MULB",
|
||||
"MULW",
|
||||
"MULL",
|
||||
"MULQ",
|
||||
[CC_OP_EFLAGS] = "EFLAGS",
|
||||
[CC_OP_ADCX] = "ADCX",
|
||||
[CC_OP_ADOX] = "ADOX",
|
||||
[CC_OP_ADCOX] = "ADCOX",
|
||||
|
||||
"ADDB",
|
||||
"ADDW",
|
||||
"ADDL",
|
||||
"ADDQ",
|
||||
[CC_OP_MULB] = "MULB",
|
||||
[CC_OP_MULW] = "MULW",
|
||||
[CC_OP_MULL] = "MULL",
|
||||
[CC_OP_MULQ] = "MULQ",
|
||||
|
||||
"ADCB",
|
||||
"ADCW",
|
||||
"ADCL",
|
||||
"ADCQ",
|
||||
[CC_OP_ADDB] = "ADDB",
|
||||
[CC_OP_ADDW] = "ADDW",
|
||||
[CC_OP_ADDL] = "ADDL",
|
||||
[CC_OP_ADDQ] = "ADDQ",
|
||||
|
||||
"SUBB",
|
||||
"SUBW",
|
||||
"SUBL",
|
||||
"SUBQ",
|
||||
[CC_OP_ADCB] = "ADCB",
|
||||
[CC_OP_ADCW] = "ADCW",
|
||||
[CC_OP_ADCL] = "ADCL",
|
||||
[CC_OP_ADCQ] = "ADCQ",
|
||||
|
||||
"SBBB",
|
||||
"SBBW",
|
||||
"SBBL",
|
||||
"SBBQ",
|
||||
[CC_OP_SUBB] = "SUBB",
|
||||
[CC_OP_SUBW] = "SUBW",
|
||||
[CC_OP_SUBL] = "SUBL",
|
||||
[CC_OP_SUBQ] = "SUBQ",
|
||||
|
||||
"LOGICB",
|
||||
"LOGICW",
|
||||
"LOGICL",
|
||||
"LOGICQ",
|
||||
[CC_OP_SBBB] = "SBBB",
|
||||
[CC_OP_SBBW] = "SBBW",
|
||||
[CC_OP_SBBL] = "SBBL",
|
||||
[CC_OP_SBBQ] = "SBBQ",
|
||||
|
||||
"INCB",
|
||||
"INCW",
|
||||
"INCL",
|
||||
"INCQ",
|
||||
[CC_OP_LOGICB] = "LOGICB",
|
||||
[CC_OP_LOGICW] = "LOGICW",
|
||||
[CC_OP_LOGICL] = "LOGICL",
|
||||
[CC_OP_LOGICQ] = "LOGICQ",
|
||||
|
||||
"DECB",
|
||||
"DECW",
|
||||
"DECL",
|
||||
"DECQ",
|
||||
[CC_OP_INCB] = "INCB",
|
||||
[CC_OP_INCW] = "INCW",
|
||||
[CC_OP_INCL] = "INCL",
|
||||
[CC_OP_INCQ] = "INCQ",
|
||||
|
||||
"SHLB",
|
||||
"SHLW",
|
||||
"SHLL",
|
||||
"SHLQ",
|
||||
[CC_OP_DECB] = "DECB",
|
||||
[CC_OP_DECW] = "DECW",
|
||||
[CC_OP_DECL] = "DECL",
|
||||
[CC_OP_DECQ] = "DECQ",
|
||||
|
||||
"SARB",
|
||||
"SARW",
|
||||
"SARL",
|
||||
"SARQ",
|
||||
[CC_OP_SHLB] = "SHLB",
|
||||
[CC_OP_SHLW] = "SHLW",
|
||||
[CC_OP_SHLL] = "SHLL",
|
||||
[CC_OP_SHLQ] = "SHLQ",
|
||||
|
||||
"BMILGB",
|
||||
"BMILGW",
|
||||
"BMILGL",
|
||||
"BMILGQ",
|
||||
[CC_OP_SARB] = "SARB",
|
||||
[CC_OP_SARW] = "SARW",
|
||||
[CC_OP_SARL] = "SARL",
|
||||
[CC_OP_SARQ] = "SARQ",
|
||||
|
||||
"ADCX",
|
||||
"ADOX",
|
||||
"ADCOX",
|
||||
[CC_OP_BMILGB] = "BMILGB",
|
||||
[CC_OP_BMILGW] = "BMILGW",
|
||||
[CC_OP_BMILGL] = "BMILGL",
|
||||
[CC_OP_BMILGQ] = "BMILGQ",
|
||||
|
||||
"CLR",
|
||||
[CC_OP_POPCNT] = "POPCNT",
|
||||
[CC_OP_CLR] = "CLR",
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -1275,6 +1275,7 @@ typedef enum {
|
||||
CC_OP_ADCX, /* CC_DST = C, CC_SRC = rest. */
|
||||
CC_OP_ADOX, /* CC_SRC2 = O, CC_SRC = rest. */
|
||||
CC_OP_ADCOX, /* CC_DST = C, CC_SRC2 = O, CC_SRC = rest. */
|
||||
CC_OP_CLR, /* Z and P set, all other flags clear. */
|
||||
|
||||
CC_OP_MULB, /* modify all flags, C, O = (CC_SRC != 0) */
|
||||
CC_OP_MULW,
|
||||
@ -1331,8 +1332,16 @@ typedef enum {
|
||||
CC_OP_BMILGL,
|
||||
CC_OP_BMILGQ,
|
||||
|
||||
CC_OP_CLR, /* Z set, all other flags clear. */
|
||||
CC_OP_POPCNT, /* Z via CC_SRC, all other flags clear. */
|
||||
/*
|
||||
* Note that only CC_OP_POPCNT (i.e. the one with MO_TL size)
|
||||
* is used or implemented, because the translation needs
|
||||
* to zero-extend CC_DST anyway.
|
||||
*/
|
||||
CC_OP_POPCNTB__, /* Z via CC_DST, all other flags clear. */
|
||||
CC_OP_POPCNTW__,
|
||||
CC_OP_POPCNTL__,
|
||||
CC_OP_POPCNTQ__,
|
||||
CC_OP_POPCNT = sizeof(target_ulong) == 8 ? CC_OP_POPCNTQ__ : CC_OP_POPCNTL__,
|
||||
|
||||
CC_OP_NB,
|
||||
} CCOp;
|
||||
|
@ -121,7 +121,7 @@ struct SevCommonStateClass {
|
||||
Error **errp);
|
||||
int (*launch_start)(SevCommonState *sev_common);
|
||||
void (*launch_finish)(SevCommonState *sev_common);
|
||||
int (*launch_update_data)(SevCommonState *sev_common, hwaddr gpa, uint8_t *ptr, uint64_t len);
|
||||
int (*launch_update_data)(SevCommonState *sev_common, hwaddr gpa, uint8_t *ptr, size_t len);
|
||||
int (*kvm_init)(ConfidentialGuestSupport *cgs, Error **errp);
|
||||
};
|
||||
|
||||
@ -152,8 +152,10 @@ struct SevSnpGuestState {
|
||||
|
||||
/* configuration parameters */
|
||||
char *guest_visible_workarounds;
|
||||
char *id_block;
|
||||
char *id_auth;
|
||||
char *id_block_base64;
|
||||
uint8_t *id_block;
|
||||
char *id_auth_base64;
|
||||
uint8_t *id_auth;
|
||||
char *host_data;
|
||||
|
||||
struct kvm_sev_snp_launch_start kvm_start_conf;
|
||||
@ -171,7 +173,7 @@ typedef struct SevLaunchUpdateData {
|
||||
QTAILQ_ENTRY(SevLaunchUpdateData) next;
|
||||
hwaddr gpa;
|
||||
void *hva;
|
||||
uint64_t len;
|
||||
size_t len;
|
||||
int type;
|
||||
} SevLaunchUpdateData;
|
||||
|
||||
@ -884,7 +886,7 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest,
|
||||
|
||||
if (!data->hva || !data->len) {
|
||||
error_report("SNP_LAUNCH_UPDATE called with invalid address"
|
||||
"/ length: %p / %lx",
|
||||
"/ length: %p / %zx",
|
||||
data->hva, data->len);
|
||||
return 1;
|
||||
}
|
||||
@ -932,8 +934,9 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest,
|
||||
|
||||
out:
|
||||
if (!ret && update.gfn_start << TARGET_PAGE_BITS != data->gpa + data->len) {
|
||||
error_report("SEV-SNP: expected update of GPA range %lx-%lx,"
|
||||
"got GPA range %lx-%llx",
|
||||
error_report("SEV-SNP: expected update of GPA range %"
|
||||
HWADDR_PRIx "-%" HWADDR_PRIx ","
|
||||
"got GPA range %" HWADDR_PRIx "-%llx",
|
||||
data->gpa, data->gpa + data->len, data->gpa,
|
||||
update.gfn_start << TARGET_PAGE_BITS);
|
||||
ret = -EIO;
|
||||
@ -943,7 +946,8 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
sev_launch_update_data(SevCommonState *sev_common, hwaddr gpa, uint8_t *addr, uint64_t len)
|
||||
sev_launch_update_data(SevCommonState *sev_common, hwaddr gpa,
|
||||
uint8_t *addr, size_t len)
|
||||
{
|
||||
int ret, fw_error;
|
||||
struct kvm_sev_launch_update_data update;
|
||||
@ -1088,8 +1092,7 @@ sev_launch_finish(SevCommonState *sev_common)
|
||||
}
|
||||
|
||||
static int
|
||||
snp_launch_update_data(uint64_t gpa, void *hva,
|
||||
uint32_t len, int type)
|
||||
snp_launch_update_data(uint64_t gpa, void *hva, size_t len, int type)
|
||||
{
|
||||
SevLaunchUpdateData *data;
|
||||
|
||||
@ -1106,7 +1109,7 @@ snp_launch_update_data(uint64_t gpa, void *hva,
|
||||
|
||||
static int
|
||||
sev_snp_launch_update_data(SevCommonState *sev_common, hwaddr gpa,
|
||||
uint8_t *ptr, uint64_t len)
|
||||
uint8_t *ptr, size_t len)
|
||||
{
|
||||
int ret = snp_launch_update_data(gpa, ptr, len,
|
||||
KVM_SEV_SNP_PAGE_TYPE_NORMAL);
|
||||
@ -1163,7 +1166,7 @@ sev_snp_cpuid_info_fill(SnpCpuidInfo *snp_cpuid_info,
|
||||
}
|
||||
|
||||
static int
|
||||
snp_launch_update_cpuid(uint32_t cpuid_addr, void *hva, uint32_t cpuid_len)
|
||||
snp_launch_update_cpuid(uint32_t cpuid_addr, void *hva, size_t cpuid_len)
|
||||
{
|
||||
KvmCpuidInfo kvm_cpuid_info = {0};
|
||||
SnpCpuidInfo snp_cpuid_info;
|
||||
@ -1296,7 +1299,7 @@ sev_snp_launch_finish(SevCommonState *sev_common)
|
||||
}
|
||||
}
|
||||
|
||||
trace_kvm_sev_snp_launch_finish(sev_snp->id_block, sev_snp->id_auth,
|
||||
trace_kvm_sev_snp_launch_finish(sev_snp->id_block_base64, sev_snp->id_auth_base64,
|
||||
sev_snp->host_data);
|
||||
ret = sev_ioctl(sev_common->sev_fd, KVM_SEV_SNP_LAUNCH_FINISH,
|
||||
finish, &error);
|
||||
@ -2146,7 +2149,8 @@ sev_snp_guest_set_guest_visible_workarounds(Object *obj, const char *value,
|
||||
}
|
||||
|
||||
if (len != sizeof(start->gosvw)) {
|
||||
error_setg(errp, "parameter length of %lu exceeds max of %lu",
|
||||
error_setg(errp, "parameter length of %" G_GSIZE_FORMAT
|
||||
" exceeds max of %zu",
|
||||
len, sizeof(start->gosvw));
|
||||
return;
|
||||
}
|
||||
@ -2159,7 +2163,7 @@ sev_snp_guest_get_id_block(Object *obj, Error **errp)
|
||||
{
|
||||
SevSnpGuestState *sev_snp_guest = SEV_SNP_GUEST(obj);
|
||||
|
||||
return g_strdup(sev_snp_guest->id_block);
|
||||
return g_strdup(sev_snp_guest->id_block_base64);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2171,25 +2175,26 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp)
|
||||
|
||||
finish->id_block_en = 0;
|
||||
g_free(sev_snp_guest->id_block);
|
||||
g_free((guchar *)finish->id_block_uaddr);
|
||||
g_free(sev_snp_guest->id_block_base64);
|
||||
|
||||
/* store the base64 str so we don't need to re-encode in getter */
|
||||
sev_snp_guest->id_block = g_strdup(value);
|
||||
sev_snp_guest->id_block_base64 = g_strdup(value);
|
||||
sev_snp_guest->id_block =
|
||||
qbase64_decode(sev_snp_guest->id_block_base64, -1, &len, errp);
|
||||
|
||||
finish->id_block_uaddr =
|
||||
(uint64_t)qbase64_decode(sev_snp_guest->id_block, -1, &len, errp);
|
||||
|
||||
if (!finish->id_block_uaddr) {
|
||||
if (!sev_snp_guest->id_block) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (len != KVM_SEV_SNP_ID_BLOCK_SIZE) {
|
||||
error_setg(errp, "parameter length of %lu not equal to %u",
|
||||
error_setg(errp, "parameter length of %" G_GSIZE_FORMAT
|
||||
" not equal to %u",
|
||||
len, KVM_SEV_SNP_ID_BLOCK_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
finish->id_block_en = 1;
|
||||
finish->id_block_uaddr = (uintptr_t)sev_snp_guest->id_block;
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -2197,7 +2202,7 @@ sev_snp_guest_get_id_auth(Object *obj, Error **errp)
|
||||
{
|
||||
SevSnpGuestState *sev_snp_guest = SEV_SNP_GUEST(obj);
|
||||
|
||||
return g_strdup(sev_snp_guest->id_auth);
|
||||
return g_strdup(sev_snp_guest->id_auth_base64);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2207,24 +2212,27 @@ sev_snp_guest_set_id_auth(Object *obj, const char *value, Error **errp)
|
||||
struct kvm_sev_snp_launch_finish *finish = &sev_snp_guest->kvm_finish_conf;
|
||||
gsize len;
|
||||
|
||||
finish->id_auth_uaddr = 0;
|
||||
g_free(sev_snp_guest->id_auth);
|
||||
g_free((guchar *)finish->id_auth_uaddr);
|
||||
g_free(sev_snp_guest->id_auth_base64);
|
||||
|
||||
/* store the base64 str so we don't need to re-encode in getter */
|
||||
sev_snp_guest->id_auth = g_strdup(value);
|
||||
sev_snp_guest->id_auth_base64 = g_strdup(value);
|
||||
sev_snp_guest->id_auth =
|
||||
qbase64_decode(sev_snp_guest->id_auth_base64, -1, &len, errp);
|
||||
|
||||
finish->id_auth_uaddr =
|
||||
(uint64_t)qbase64_decode(sev_snp_guest->id_auth, -1, &len, errp);
|
||||
|
||||
if (!finish->id_auth_uaddr) {
|
||||
if (!sev_snp_guest->id_auth) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (len > KVM_SEV_SNP_ID_AUTH_SIZE) {
|
||||
error_setg(errp, "parameter length:ID_AUTH %lu exceeds max of %u",
|
||||
error_setg(errp, "parameter length:ID_AUTH %" G_GSIZE_FORMAT
|
||||
" exceeds max of %u",
|
||||
len, KVM_SEV_SNP_ID_AUTH_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
finish->id_auth_uaddr = (uintptr_t)sev_snp_guest->id_auth;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -2287,7 +2295,8 @@ sev_snp_guest_set_host_data(Object *obj, const char *value, Error **errp)
|
||||
}
|
||||
|
||||
if (len != sizeof(finish->host_data)) {
|
||||
error_setg(errp, "parameter length of %lu not equal to %lu",
|
||||
error_setg(errp, "parameter length of %" G_GSIZE_FORMAT
|
||||
" not equal to %zu",
|
||||
len, sizeof(finish->host_data));
|
||||
return;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ target_ulong helper_cc_compute_all(target_ulong dst, target_ulong src1,
|
||||
case CC_OP_CLR:
|
||||
return CC_Z | CC_P;
|
||||
case CC_OP_POPCNT:
|
||||
return src1 ? 0 : CC_Z;
|
||||
return dst ? 0 : CC_Z;
|
||||
|
||||
case CC_OP_MULB:
|
||||
return compute_all_mulb(dst, src1);
|
||||
|
@ -2804,10 +2804,10 @@ static void gen_POPA(DisasContext *s, X86DecodedInsn *decode)
|
||||
|
||||
static void gen_POPCNT(DisasContext *s, X86DecodedInsn *decode)
|
||||
{
|
||||
decode->cc_src = tcg_temp_new();
|
||||
decode->cc_dst = tcg_temp_new();
|
||||
decode->cc_op = CC_OP_POPCNT;
|
||||
|
||||
tcg_gen_mov_tl(decode->cc_src, s->T0);
|
||||
tcg_gen_mov_tl(decode->cc_dst, s->T0);
|
||||
tcg_gen_ctpop_tl(s->T0, s->T0);
|
||||
}
|
||||
|
||||
|
@ -282,22 +282,6 @@ enum {
|
||||
JCC_LE,
|
||||
};
|
||||
|
||||
enum {
|
||||
/* I386 int registers */
|
||||
OR_EAX, /* MUST be even numbered */
|
||||
OR_ECX,
|
||||
OR_EDX,
|
||||
OR_EBX,
|
||||
OR_ESP,
|
||||
OR_EBP,
|
||||
OR_ESI,
|
||||
OR_EDI,
|
||||
|
||||
OR_TMP0 = 16, /* temporary operand register */
|
||||
OR_TMP1,
|
||||
OR_A0, /* temporary register used when doing address evaluation */
|
||||
};
|
||||
|
||||
enum {
|
||||
USES_CC_DST = 1,
|
||||
USES_CC_SRC = 2,
|
||||
@ -324,7 +308,7 @@ static const uint8_t cc_op_live[CC_OP_NB] = {
|
||||
[CC_OP_ADOX] = USES_CC_SRC | USES_CC_SRC2,
|
||||
[CC_OP_ADCOX] = USES_CC_DST | USES_CC_SRC | USES_CC_SRC2,
|
||||
[CC_OP_CLR] = 0,
|
||||
[CC_OP_POPCNT] = USES_CC_SRC,
|
||||
[CC_OP_POPCNT] = USES_CC_DST,
|
||||
};
|
||||
|
||||
static void set_cc_op_1(DisasContext *s, CCOp op, bool dirty)
|
||||
@ -1019,8 +1003,6 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *s, TCGv reg)
|
||||
.imm = CC_Z };
|
||||
case CC_OP_CLR:
|
||||
return (CCPrepare) { .cond = TCG_COND_ALWAYS };
|
||||
case CC_OP_POPCNT:
|
||||
return (CCPrepare) { .cond = TCG_COND_EQ, .reg = cpu_cc_src };
|
||||
default:
|
||||
{
|
||||
MemOp size = (s->cc_op - CC_OP_ADDB) & 3;
|
||||
@ -3177,6 +3159,7 @@ static void disas_insn_old(DisasContext *s, CPUState *cpu, int b)
|
||||
case CC_OP_SHLB ... CC_OP_SHLQ:
|
||||
case CC_OP_SARB ... CC_OP_SARQ:
|
||||
case CC_OP_BMILGB ... CC_OP_BMILGQ:
|
||||
case CC_OP_POPCNT:
|
||||
/* Z was going to be computed from the non-zero status of CC_DST.
|
||||
We can get that same Z value (and the new C value) by leaving
|
||||
CC_DST alone, setting CC_SRC, and using a CC_OP_SAR of the
|
||||
|
@ -6,7 +6,7 @@ kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%zx"
|
||||
kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%zx"
|
||||
kvm_sev_change_state(const char *old, const char *new) "%s -> %s"
|
||||
kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p"
|
||||
kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIx64
|
||||
kvm_sev_launch_update_data(void *addr, size_t len) "addr %p len 0x%zx"
|
||||
kvm_sev_launch_measurement(const char *value) "data %s"
|
||||
kvm_sev_launch_finish(void) ""
|
||||
kvm_sev_launch_secret(uint64_t hpa, uint64_t hva, uint64_t secret, int len) "hpa 0x%" PRIx64 " hva 0x%" PRIx64 " data 0x%" PRIx64 " len %d"
|
||||
|
@ -111,6 +111,7 @@ typedef enum {
|
||||
#endif
|
||||
|
||||
#define have_bmi1 (cpuinfo & CPUINFO_BMI1)
|
||||
#define have_popcnt (cpuinfo & CPUINFO_POPCNT)
|
||||
#define have_avx1 (cpuinfo & CPUINFO_AVX1)
|
||||
#define have_avx2 (cpuinfo & CPUINFO_AVX2)
|
||||
#define have_movbe (cpuinfo & CPUINFO_MOVBE)
|
||||
@ -142,7 +143,7 @@ typedef enum {
|
||||
#define TCG_TARGET_HAS_nor_i32 0
|
||||
#define TCG_TARGET_HAS_clz_i32 1
|
||||
#define TCG_TARGET_HAS_ctz_i32 1
|
||||
#define TCG_TARGET_HAS_ctpop_i32 1
|
||||
#define TCG_TARGET_HAS_ctpop_i32 have_popcnt
|
||||
#define TCG_TARGET_HAS_deposit_i32 1
|
||||
#define TCG_TARGET_HAS_extract_i32 1
|
||||
#define TCG_TARGET_HAS_sextract_i32 1
|
||||
@ -177,7 +178,7 @@ typedef enum {
|
||||
#define TCG_TARGET_HAS_nor_i64 0
|
||||
#define TCG_TARGET_HAS_clz_i64 1
|
||||
#define TCG_TARGET_HAS_ctz_i64 1
|
||||
#define TCG_TARGET_HAS_ctpop_i64 1
|
||||
#define TCG_TARGET_HAS_ctpop_i64 have_popcnt
|
||||
#define TCG_TARGET_HAS_deposit_i64 1
|
||||
#define TCG_TARGET_HAS_extract_i64 1
|
||||
#define TCG_TARGET_HAS_sextract_i64 0
|
||||
|
@ -34,11 +34,13 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
|
||||
if (max >= 1) {
|
||||
__cpuid(1, a, b, c, d);
|
||||
|
||||
info |= (d & bit_SSE2 ? CPUINFO_SSE2 : 0);
|
||||
info |= (c & bit_MOVBE ? CPUINFO_MOVBE : 0);
|
||||
info |= (c & bit_POPCNT ? CPUINFO_POPCNT : 0);
|
||||
info |= (c & bit_PCLMUL ? CPUINFO_PCLMUL : 0);
|
||||
|
||||
/* NOTE: our AES support requires SSSE3 (PSHUFB) as well. */
|
||||
info |= (c & bit_AES) ? CPUINFO_AES : 0;
|
||||
/* Our AES support requires PSHUFB as well. */
|
||||
info |= ((c & bit_AES) && (c & bit_SSSE3) ? CPUINFO_AES : 0);
|
||||
|
||||
/* For AVX features, we must check available and usable. */
|
||||
if ((c & bit_AVX) && (c & bit_OSXSAVE)) {
|
||||
|
Loading…
Reference in New Issue
Block a user