mirror of https://github.com/xemu-project/xemu.git
Fix global property and -cpu handling bug
This bug fix was supposed to be applied just after 2.8.0 was released, but it slipped through the cracks. Sending it now for the next -rc. -----BEGIN PGP SIGNATURE----- iQIcBAABCAAGBQJYyEziAAoJECgHk2+YTcWmrAgQAKytitYc7V60M6jyLFEADmkb HhJLLhHAMW831+2fIKHjiYmRDy3cy5pxQAr2A1w3QqiEmVL9+MtKnLKuy4tXP1Bj AbU1ZHXcxVuVHN/SzzsDzoSpK04TncwK509hhuGuhXHDiUKOlBewyPpvzMYg+lEz VlF7KDIDoQ/VLgcwt/+bTp2ds1jIDpcIKtHX0OTTJT4VtdqJBsRsZZl4VBR8lUzJ wh+EQ1PiTdwSMpz214agR7pVOZbcqJ8FQdawpnyUkHb+i0Ax23dh3JKcWptq+A5c Pgb+DG9XnkfmjykXyQXBx4ZaxeikC1Y0v3Vs0V5TJmtEgCXSA4TdJZmzcYoWJckr ZFUZduBGE5QQf3nymfBYpITus61GyM/WZ01JMqjeLEsgHRScKKs5ryuSV79K+kWx OW333a8Iyz9dBOfTbtsh9T4uB68FmN7da1cGKX6qp5V0s9bpxJOrrtRa60K8uUNB HelLzi5ZrGwNrd3ahiAHyAKwVIYS0mlk3fh8TsGzH3Pfw9CHC7cPAkfxxrIGyQ+g UUR4Mf1/ik2/xkmdP0xWRkhvLymH5/zFPG6Sngx4qDYF4Jgo3/03xnjhZRNWCqOd 2DTm+xRe+Cub8iZFo23YOv84dK14nR6SX3KDFlfjqYmVg3ajvo6gYWTk+FhE1NsL zSQ03KezgxFl1I6DmFWl =wtpp -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ehabkost/tags/machine-pull-request' into staging Fix global property and -cpu handling bug This bug fix was supposed to be applied just after 2.8.0 was released, but it slipped through the cracks. Sending it now for the next -rc. # gpg: Signature made Tue 14 Mar 2017 20:04:50 GMT # gpg: using RSA key 0x2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-pull-request: machine: Convert abstract typename on compat_props to subclass names Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
926e368388
|
@ -585,11 +585,31 @@ static void machine_class_finalize(ObjectClass *klass, void *data)
|
|||
g_free(mc->name);
|
||||
}
|
||||
|
||||
static void register_compat_prop(const char *driver,
|
||||
const char *property,
|
||||
const char *value)
|
||||
{
|
||||
GlobalProperty *p = g_new0(GlobalProperty, 1);
|
||||
/* Machine compat_props must never cause errors: */
|
||||
p->errp = &error_abort;
|
||||
p->driver = driver;
|
||||
p->property = property;
|
||||
p->value = value;
|
||||
qdev_prop_register_global(p);
|
||||
}
|
||||
|
||||
static void machine_register_compat_for_subclass(ObjectClass *oc, void *opaque)
|
||||
{
|
||||
GlobalProperty *p = opaque;
|
||||
register_compat_prop(object_class_get_name(oc), p->property, p->value);
|
||||
}
|
||||
|
||||
void machine_register_compat_props(MachineState *machine)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
int i;
|
||||
GlobalProperty *p;
|
||||
ObjectClass *oc;
|
||||
|
||||
if (!mc->compat_props) {
|
||||
return;
|
||||
|
@ -597,9 +617,22 @@ void machine_register_compat_props(MachineState *machine)
|
|||
|
||||
for (i = 0; i < mc->compat_props->len; i++) {
|
||||
p = g_array_index(mc->compat_props, GlobalProperty *, i);
|
||||
/* Machine compat_props must never cause errors: */
|
||||
p->errp = &error_abort;
|
||||
qdev_prop_register_global(p);
|
||||
oc = object_class_by_name(p->driver);
|
||||
if (oc && object_class_is_abstract(oc)) {
|
||||
/* temporary hack to make sure we do not override
|
||||
* globals set explicitly on -global: if an abstract class
|
||||
* is on compat_props, register globals for all its
|
||||
* non-abstract subtypes instead.
|
||||
*
|
||||
* This doesn't solve the problem for cases where
|
||||
* a non-abstract typename mentioned on compat_props
|
||||
* has subclasses, like spapr-pci-host-bridge.
|
||||
*/
|
||||
object_class_foreach(machine_register_compat_for_subclass,
|
||||
p->driver, false, p);
|
||||
} else {
|
||||
register_compat_prop(p->driver, p->property, p->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue