}
static virCPUCompareResult
-virCPUarmCompare(virCPUDefPtr host G_GNUC_UNUSED,
- virCPUDefPtr cpu G_GNUC_UNUSED,
- bool failMessages G_GNUC_UNUSED)
+virCPUarmCompare(virCPUDefPtr host,
+ virCPUDefPtr cpu,
+ bool failIncompatible)
{
+ /* Only support host to host CPU compare for ARM */
+ if (cpu->type != VIR_CPU_TYPE_HOST)
+ return VIR_CPU_COMPARE_IDENTICAL;
+
+ if (!host || !host->model) {
+ if (failIncompatible) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
+ _("unknown host CPU"));
+ return VIR_CPU_COMPARE_ERROR;
+ }
+
+ VIR_WARN("unknown host CPU");
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
+ }
+
+ /* Compare vendor and model to check if CPUs are identical */
+ if (STRNEQ_NULLABLE(host->vendor, cpu->vendor) ||
+ STRNEQ_NULLABLE(host->model, cpu->model)) {
+ VIR_DEBUG("Host CPU model does not match required CPU "
+ "vendor %s or(and) model %s",
+ NULLSTR(cpu->vendor), NULLSTR(cpu->model));
+
+ if (failIncompatible) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE,
+ _("Host CPU model does not match required CPU "
+ "vendor %s or(and) model %s"),
+ NULLSTR(cpu->vendor), NULLSTR(cpu->model));
+ return VIR_CPU_COMPARE_ERROR;
+ }
+
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
+ }
+
return VIR_CPU_COMPARE_IDENTICAL;
}