aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-05-16 14:21:50 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-05-16 14:21:50 -0700
commitafdb415e67e13e8726edc21238c9883447b2c704 (patch)
tree691c911809a56d796dcabde30d6cd6d047712ccb /hw
parent54b592c427ca2575187082b35d5d6ae85db59f7b (diff)
parent8eccdb9eb84615291faef1257d5779ebfef7a0d0 (diff)
downloadqemu-afdb415e67e13e8726edc21238c9883447b2c704.zip
qemu-afdb415e67e13e8726edc21238c9883447b2c704.tar.gz
qemu-afdb415e67e13e8726edc21238c9883447b2c704.tar.bz2
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* fix WHPX debugging * misc qga-vss fixes * remove the deprecated CPU model 'Icelake-Client' * support for x86 architectural LBR * remove deprecated properties * replace deprecated -soundhw with -audio # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmJ/hZ4UHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroN2Igf/bFs+yluOikt0eFNmXYnshrGBWPXr # oam0iumPox34vTzZnjpSjF6tJGxHWOgi+wbgIvbwOYHA/ONxx8akW580j+1VhEWa # X29VyUzjZBffgFtmlF4fM74/ELYm7s4c1a1/D9TpVP6Dr0fSWbMujbx4dfeVstvf # sONN+A8sVxaNdV9QKPE6BvqfMlPLoCiigrOetf6iY1KuUtkQDF8xDB0MdzdutqAQ # szAtQ0rrzjxDx9EuGN1SECFM1/riDUbtOOoA9g2C7gGKrx3/iUc6pzrkIcAfWLFK # xXbH7+6Wynia0cbUxnrvRdY4daMIxm4N3wUvN7szXgF9kxYxeQcsdgGsNA== # =n4lu # -----END PGP SIGNATURE----- # gpg: Signature made Sat 14 May 2022 03:34:06 AM PDT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [undefined] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (23 commits) configure: remove duplicate help messages configure: remove another dead variable build: remove useless dependency introduce -audio as a replacement for -soundhw soundhw: move help handling to vl.c soundhw: unify initialization for ISA and PCI soundhw soundhw: extract soundhw help to a separate function soundhw: remove ability to create multiple soundcards rng: make opened property read-only crypto: make loaded property read-only target/i386: Support Arch LBR in CPUID enumeration target/i386: introduce helper to access supported CPUID target/i386: Enable Arch LBR migration states in vmstate target/i386: Add MSR access interface for Arch LBR target/i386: Add XSAVES support for Arch LBR target/i386: Enable support for XSAVES based features target/i386: Add kvm_get_one_msr helper target/i386: Add lbr-fmt vPMU option to support guest LBR qdev-properties: Add a new macro with bitmask check for uint64_t property i386/cpu: Remove the deprecated cpu model 'Icelake-Client' ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/audio/intel-hda.c5
-rw-r--r--hw/audio/soundhw.c130
-rw-r--r--hw/core/qdev-properties.c19
3 files changed, 78 insertions, 76 deletions
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index bc77e3d..f381170 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -1311,17 +1311,16 @@ static const TypeInfo hda_codec_device_type_info = {
* create intel hda controller with codec attached to it,
* so '-soundhw hda' works.
*/
-static int intel_hda_and_codec_init(PCIBus *bus)
+static int intel_hda_and_codec_init(PCIBus *bus, const char *audiodev)
{
DeviceState *controller;
BusState *hdabus;
DeviceState *codec;
- warn_report("'-soundhw hda' is deprecated, "
- "please use '-device intel-hda -device hda-duplex' instead");
controller = DEVICE(pci_create_simple(bus, -1, "intel-hda"));
hdabus = QLIST_FIRST(&controller->child_bus);
codec = qdev_new("hda-duplex");
+ qdev_prop_set_string(codec, "audiodev", audiodev);
qdev_realize_and_unref(codec, hdabus, &error_fatal);
return 0;
}
diff --git a/hw/audio/soundhw.c b/hw/audio/soundhw.c
index f7d94d7..94d9463 100644
--- a/hw/audio/soundhw.c
+++ b/hw/audio/soundhw.c
@@ -25,7 +25,9 @@
#include "qemu/option.h"
#include "qemu/help_option.h"
#include "qemu/error-report.h"
+#include "qapi/error.h"
#include "qom/object.h"
+#include "hw/qdev-properties.h"
#include "hw/isa/isa.h"
#include "hw/pci/pci.h"
#include "hw/audio/soundhw.h"
@@ -34,16 +36,15 @@ struct soundhw {
const char *name;
const char *descr;
const char *typename;
- int enabled;
int isa;
- int (*init_pci) (PCIBus *bus);
+ int (*init_pci) (PCIBus *bus, const char *audiodev);
};
static struct soundhw soundhw[9];
static int soundhw_count;
void pci_register_soundhw(const char *name, const char *descr,
- int (*init_pci)(PCIBus *bus))
+ int (*init_pci)(PCIBus *bus, const char *audiodev))
{
assert(soundhw_count < ARRAY_SIZE(soundhw) - 1);
soundhw[soundhw_count].name = name;
@@ -64,95 +65,78 @@ void deprecated_register_soundhw(const char *name, const char *descr,
soundhw_count++;
}
-void select_soundhw(const char *optarg)
+void show_valid_soundhw(void)
{
struct soundhw *c;
- if (is_help_option(optarg)) {
- show_valid_cards:
-
- if (soundhw_count) {
- printf("Valid sound card names (comma separated):\n");
- for (c = soundhw; c->name; ++c) {
- printf ("%-11s %s\n", c->name, c->descr);
- }
- printf("\n-soundhw all will enable all of the above\n");
- } else {
- printf("Machine has no user-selectable audio hardware "
- "(it may or may not have always-present audio hardware).\n");
- }
- exit(!is_help_option(optarg));
+ if (soundhw_count) {
+ printf("Valid sound card names (comma separated):\n");
+ for (c = soundhw; c->name; ++c) {
+ printf ("%-11s %s\n", c->name, c->descr);
+ }
+ } else {
+ printf("Machine has no user-selectable audio hardware "
+ "(it may or may not have always-present audio hardware).\n");
}
- else {
- size_t l;
- const char *p;
- char *e;
- int bad_card = 0;
+}
- if (!strcmp(optarg, "all")) {
- for (c = soundhw; c->name; ++c) {
- c->enabled = 1;
- }
- return;
- }
+static struct soundhw *selected = NULL;
+static const char *audiodev_id;
- p = optarg;
- while (*p) {
- e = strchr(p, ',');
- l = !e ? strlen(p) : (size_t) (e - p);
+void select_soundhw(const char *optarg, const char *audiodev)
+{
+ struct soundhw *c;
- for (c = soundhw; c->name; ++c) {
- if (!strncmp(c->name, p, l) && !c->name[l]) {
- c->enabled = 1;
- break;
- }
- }
+ if (selected) {
+ error_setg(&error_fatal, "only one -soundhw option is allowed");
+ }
- if (!c->name) {
- if (l > 80) {
- error_report("Unknown sound card name (too big to show)");
- }
- else {
- error_report("Unknown sound card name `%.*s'",
- (int) l, p);
- }
- bad_card = 1;
- }
- p += l + (e != NULL);
+ for (c = soundhw; c->name; ++c) {
+ if (g_str_equal(c->name, optarg)) {
+ selected = c;
+ audiodev_id = audiodev;
+ break;
}
+ }
- if (bad_card) {
- goto show_valid_cards;
- }
+ if (!c->name) {
+ error_report("Unknown sound card name `%s'", optarg);
+ show_valid_soundhw();
+ exit(1);
}
}
void soundhw_init(void)
{
- struct soundhw *c;
+ struct soundhw *c = selected;
ISABus *isa_bus = (ISABus *) object_resolve_path_type("", TYPE_ISA_BUS, NULL);
PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL);
+ BusState *bus;
- for (c = soundhw; c->name; ++c) {
- if (c->enabled) {
- if (c->typename) {
- warn_report("'-soundhw %s' is deprecated, "
- "please use '-device %s' instead",
- c->name, c->typename);
- if (c->isa) {
- isa_create_simple(isa_bus, c->typename);
- } else {
- pci_create_simple(pci_bus, -1, c->typename);
- }
- } else {
- assert(!c->isa);
- if (!pci_bus) {
- error_report("PCI bus not available for %s", c->name);
- exit(1);
- }
- c->init_pci(pci_bus);
- }
+ if (!c) {
+ return;
+ }
+ if (c->isa) {
+ if (!isa_bus) {
+ error_report("ISA bus not available for %s", c->name);
+ exit(1);
+ }
+ bus = BUS(isa_bus);
+ } else {
+ if (!pci_bus) {
+ error_report("PCI bus not available for %s", c->name);
+ exit(1);
}
+ bus = BUS(pci_bus);
+ }
+
+ if (c->typename) {
+ DeviceState *dev = qdev_new(c->typename);
+ qdev_prop_set_string(dev, "audiodev", audiodev_id);
+ qdev_realize_and_unref(dev, bus, &error_fatal);
+ } else {
+ assert(!c->isa);
+ c->init_pci(pci_bus, audiodev_id);
}
}
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index c34aac6..357b876 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -428,6 +428,25 @@ const PropertyInfo qdev_prop_int64 = {
.set_default_value = qdev_propinfo_set_default_value_int,
};
+static void set_uint64_checkmask(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ Property *prop = opaque;
+ uint64_t *ptr = object_field_prop_ptr(obj, prop);
+
+ visit_type_uint64(v, name, ptr, errp);
+ if (*ptr & ~prop->bitmask) {
+ error_setg(errp, "Property value for '%s' has bits outside mask '0x%" PRIx64 "'",
+ name, prop->bitmask);
+ }
+}
+
+const PropertyInfo qdev_prop_uint64_checkmask = {
+ .name = "uint64",
+ .get = get_uint64,
+ .set = set_uint64_checkmask,
+};
+
/* --- string --- */
static void release_string(Object *obj, const char *name, void *opaque)