aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2019-11-29 16:23:21 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2019-12-17 10:39:48 +1100
commitd1d32d6255a395eb071c10aeffb932a3485bdfcd (patch)
tree8f913032bd9385a5c578fd2bf6416e3f35471694 /hw/ppc/spapr.c
parent0c21e073541cc093b4cb8744640e24f130e6f8ba (diff)
downloadqemu-d1d32d6255a395eb071c10aeffb932a3485bdfcd.zip
qemu-d1d32d6255a395eb071c10aeffb932a3485bdfcd.tar.gz
qemu-d1d32d6255a395eb071c10aeffb932a3485bdfcd.tar.bz2
spapr: Simplify ovec diff
spapr_ovec_diff(ov, old, new) has somewhat complex semantics. ov is set to those bits which are in new but not old, and it returns as a boolean whether or not there are any bits in old but not new. It turns out that both callers only care about the second, not the first. This is basically equivalent to a bitmap subset operation, which is easier to understand and implement. So replace spapr_ovec_diff() with spapr_ovec_subset(). Cc: Mike Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Cedric Le Goater <clg@fr.ibm.com>
Diffstat (limited to 'hw/ppc/spapr.c')
-rw-r--r--hw/ppc/spapr.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 3dedb41..f11422f 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1840,8 +1840,6 @@ static bool spapr_ov5_cas_needed(void *opaque)
{
SpaprMachineState *spapr = opaque;
SpaprOptionVector *ov5_mask = spapr_ovec_new();
- SpaprOptionVector *ov5_legacy = spapr_ovec_new();
- SpaprOptionVector *ov5_removed = spapr_ovec_new();
bool cas_needed;
/* Prior to the introduction of SpaprOptionVector, we had two option
@@ -1873,17 +1871,11 @@ static bool spapr_ov5_cas_needed(void *opaque)
spapr_ovec_set(ov5_mask, OV5_DRCONF_MEMORY);
spapr_ovec_set(ov5_mask, OV5_DRMEM_V2);
- /* spapr_ovec_diff returns true if bits were removed. we avoid using
- * the mask itself since in the future it's possible "legacy" bits may be
- * removed via machine options, which could generate a false positive
- * that breaks migration.
- */
- spapr_ovec_intersect(ov5_legacy, spapr->ov5, ov5_mask);
- cas_needed = spapr_ovec_diff(ov5_removed, spapr->ov5, ov5_legacy);
+ /* We need extra information if we have any bits outside the mask
+ * defined above */
+ cas_needed = !spapr_ovec_subset(spapr->ov5, ov5_mask);
spapr_ovec_cleanup(ov5_mask);
- spapr_ovec_cleanup(ov5_legacy);
- spapr_ovec_cleanup(ov5_removed);
return cas_needed;
}