From nobody Mon May 13 12:38:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627542377845780.7808412905284; Thu, 29 Jul 2021 00:06:17 -0700 (PDT) Received: from localhost ([::1]:48278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m907U-0000Bt-Ht for importer@patchew.org; Thu, 29 Jul 2021 03:06:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m903E-00044z-US; Thu, 29 Jul 2021 03:01:53 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:45091 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9038-0002iK-1h; Thu, 29 Jul 2021 03:01:52 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Gb1fX3njMz9sCD; Thu, 29 Jul 2021 17:01:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1627542100; bh=lyh3nioXBhrxJDri2BQ3Iv5w1IUycxnRQbZnG8OYWzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=adZEDQDZRSg4Y/QXGhgHcLZ3WmsUz1EO+kRWpsCE6oCT+SeoxKADJQUG4Hf76+g0S gtv1DT/bEqpZ+mpaA+MAufhIP9UDhdJ62RrEFmnlw3jeJZclZQgNofI5LW+Cyne4Lm eRUlB72+dN89j9ZV8bDNUXDyi30DbQ8AlHZiiQOo= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 1/5] ppc/pegasos2: Fix spurious warning with -bios Date: Thu, 29 Jul 2021 17:01:31 +1000 Message-Id: <20210729070135.422262-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210729070135.422262-1-david@gibson.dropbear.id.au> References: <20210729070135.422262-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, groug@kaod.org, David Gibson , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627542379392100003 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan The -append option is currently not compatible with -bios (as we don't yet emulate nvram so we can only put it in the environment with VOF). Therefore a warning is printed if -append is used with -bios but because the default value of kernel_cmdline seems to be an empty string instead of NULL this warning was printed even without -append when -bios is used. Only print warning if -append is given. Signed-off-by: BALATON Zoltan Message-Id: <483ac599a1407b766179aaea2794aed60cc09f53.1626367844.git.balato= n@eik.bme.hu> Signed-off-by: David Gibson --- hw/ppc/pegasos2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 9fad1854b1..b8ce859f1a 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -191,7 +191,7 @@ static void pegasos2_init(MachineState *machine) warn_report("Option -kernel may be ineffective with -bios."); } } - if (machine->kernel_cmdline && !pm->vof) { + if (!pm->vof && machine->kernel_cmdline && machine->kernel_cmdline[0])= { warn_report("Option -append may be ineffective with -bios."); } } --=20 2.31.1 From nobody Mon May 13 12:38:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627542276196307.46599026958506; Thu, 29 Jul 2021 00:04:36 -0700 (PDT) Received: from localhost ([::1]:45610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m905q-0006qv-Aa for importer@patchew.org; Thu, 29 Jul 2021 03:04:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m903A-00044C-TP; Thu, 29 Jul 2021 03:01:49 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:46887 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9037-0002iJ-Lx; Thu, 29 Jul 2021 03:01:48 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Gb1fX5Lgnz9sX5; Thu, 29 Jul 2021 17:01:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1627542100; bh=qe6Vd5howK2H7l3/sMihCzBl+/mB0ivjbnIClOLBUiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoLHa2kUcIWSrlsV7kyICZJ3KO/9Ye4PKP/rs5cNrUWHq06LE+x9CjLfMiKjBGkCK 6ubphEhT74lbNrgiKwmZhAj6mGxBjr/FLRdWZKiLAEVcB8tR+bnCB6rBxhRYoUkXeR +6JFyI2pdZ7AbY9zv6ac5inx1bq2HAC+otbvEAPM= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 2/5] i2c/smbus_eeprom: Add feature bit to SPD data Date: Thu, 29 Jul 2021 17:01:32 +1000 Message-Id: <20210729070135.422262-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210729070135.422262-1-david@gibson.dropbear.id.au> References: <20210729070135.422262-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627542279023100001 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Add the differential clock input feature bit to the generated SPD data. Most guests don't seem to care but pegasos2 firmware version 1.2 checks for this bit and stops with unsupported module type error if it's not present. Since this feature is likely present on real memory modules add it in the general code rather than patching the generated SPD data in pegasos2 board only. Signed-off-by: BALATON Zoltan Message-Id: <19d42ade295d5297aa624a9eb757b8df18cf64d6.1626367844.git.balato= n@eik.bme.hu> Acked-by: Corey Minyard Signed-off-by: David Gibson --- hw/i2c/smbus_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index 4d2bf99207..12c5741f38 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -276,7 +276,7 @@ uint8_t *spd_data_generate(enum sdram_type type, ram_ad= dr_t ram_size) spd[18] =3D 12; /* ~CAS latencies supported */ spd[19] =3D (type =3D=3D DDR2 ? 0 : 1); /* reserved / ~CS latencies su= pported */ spd[20] =3D 2; /* DIMM type / ~WE latencies */ - /* module features */ + spd[21] =3D (type < DDR2 ? 0x20 : 0); /* module features */ /* memory chip features */ spd[23] =3D 0x12; /* clock cycle time @ medium CAS latency */ /* data access time */ --=20 2.31.1 From nobody Mon May 13 12:38:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627542278322351.076458882471; Thu, 29 Jul 2021 00:04:38 -0700 (PDT) Received: from localhost ([::1]:45630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m905s-0006rf-Fq for importer@patchew.org; Thu, 29 Jul 2021 03:04:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m903A-00044B-Bc; Thu, 29 Jul 2021 03:01:49 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:33917 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9037-0002iN-JB; Thu, 29 Jul 2021 03:01:48 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Gb1fX6Srfz9sXb; Thu, 29 Jul 2021 17:01:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1627542100; bh=Sz7YMZvtiZkZDqvVz9jug2QqtQv/PoOjO9wcsFUmoTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=amlOM1ewWfx0kgMZLxF+eFXuIVAGowx0zR/hGgM7kmc8xf8tfD6XkZh/sw19zbgzU bE9aG3pExFl188Yipii2RtPIFE7jcModLnOO8WATwa2t2sJNOpkQH8CA/eSZlAp/fG hd4FDI3L36HaVaAC4xOXrwNu6E68l294iZ2v3cS4= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 3/5] target/ppc: Ease L=0 requirement on cmp/cmpi/cmpl/cmpli for ppc32 Date: Thu, 29 Jul 2021 17:01:33 +1000 Message-Id: <20210729070135.422262-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210729070135.422262-1-david@gibson.dropbear.id.au> References: <20210729070135.422262-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Richard Henderson , groug@kaod.org, qemu-ppc@nongnu.org, Matheus Ferst , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627542279062100002 Content-Type: text/plain; charset="utf-8" From: Matheus Ferst In commit 8f0a4b6a9b, we started to require L=3D0 for ppc32 to match what The Programming Environments Manual say: "For 32-bit implementations, the L field must be cleared, otherwise the instruction form is invalid." The stricter behavior, however, broke AROS boot on sam460ex, which is a regression from 6.0. This patch partially reverts the change, raising the exception only for CPUs known to require L=3D0 (e500 and e500mc) and logging a guest error for other cases. Both behaviors are acceptable by the PowerISA, which allows "the system illegal instruction error handler to be invoked or yield boundedly undefined results." Reported-by: BALATON Zoltan Fixes: 8f0a4b6a9b ("target/ppc: Move cmp/cmpi/cmpl/cmpli to decodetree") Tested-by: BALATON Zoltan Signed-off-by: Matheus Ferst Message-Id: <20210720135507.2444635-1-matheus.ferst@eldorado.org.br> Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/translate/fixedpoint-impl.c.inc | 58 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index 8864ac4516..2e2518ee15 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -171,8 +171,35 @@ TRANS64(PSTD, do_ldst_PLS_D, false, true, MO_Q) =20 static bool do_cmp_X(DisasContext *ctx, arg_X_bfl *a, bool s) { + if ((ctx->insns_flags & PPC_64B) =3D=3D 0) { + /* + * For 32-bit implementations, The Programming Environments Manual= says + * that "the L field must be cleared, otherwise the instruction fo= rm is + * invalid." It seems, however, that most 32-bit CPUs ignore inval= id + * forms (e.g., section "Instruction Formats" of the 405 and 440 + * manuals, "Integer Compare Instructions" of the 601 manual), wit= h the + * notable exception of the e500 and e500mc, where L=3D1 was repor= ted to + * cause an exception. + */ + if (a->l) { + if ((ctx->insns_flags2 & PPC2_BOOKE206)) { + /* + * For 32-bit Book E v2.06 implementations (i.e. e500/e500= mc), + * generate an illegal instruction exception. + */ + return false; + } else { + qemu_log_mask(LOG_GUEST_ERROR, + "Invalid form of CMP%s at 0x" TARGET_FMT_lx ", L = =3D 1\n", + s ? "" : "L", ctx->cia); + } + } + gen_op_cmp32(cpu_gpr[a->ra], cpu_gpr[a->rb], s, a->bf); + return true; + } + + /* For 64-bit implementations, deal with bit L accordingly. */ if (a->l) { - REQUIRE_64BIT(ctx); gen_op_cmp(cpu_gpr[a->ra], cpu_gpr[a->rb], s, a->bf); } else { gen_op_cmp32(cpu_gpr[a->ra], cpu_gpr[a->rb], s, a->bf); @@ -182,8 +209,35 @@ static bool do_cmp_X(DisasContext *ctx, arg_X_bfl *a, = bool s) =20 static bool do_cmp_D(DisasContext *ctx, arg_D_bf *a, bool s) { + if ((ctx->insns_flags & PPC_64B) =3D=3D 0) { + /* + * For 32-bit implementations, The Programming Environments Manual= says + * that "the L field must be cleared, otherwise the instruction fo= rm is + * invalid." It seems, however, that most 32-bit CPUs ignore inval= id + * forms (e.g., section "Instruction Formats" of the 405 and 440 + * manuals, "Integer Compare Instructions" of the 601 manual), wit= h the + * notable exception of the e500 and e500mc, where L=3D1 was repor= ted to + * cause an exception. + */ + if (a->l) { + if ((ctx->insns_flags2 & PPC2_BOOKE206)) { + /* + * For 32-bit Book E v2.06 implementations (i.e. e500/e500= mc), + * generate an illegal instruction exception. + */ + return false; + } else { + qemu_log_mask(LOG_GUEST_ERROR, + "Invalid form of CMP%s at 0x" TARGET_FMT_lx ", L = =3D 1\n", + s ? "I" : "LI", ctx->cia); + } + } + gen_op_cmp32(cpu_gpr[a->ra], tcg_constant_tl(a->imm), s, a->bf); + return true; + } + + /* For 64-bit implementations, deal with bit L accordingly. */ if (a->l) { - REQUIRE_64BIT(ctx); gen_op_cmp(cpu_gpr[a->ra], tcg_constant_tl(a->imm), s, a->bf); } else { gen_op_cmp32(cpu_gpr[a->ra], tcg_constant_tl(a->imm), s, a->bf); --=20 2.31.1 From nobody Mon May 13 12:38:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627542536661265.4175270774099; Thu, 29 Jul 2021 00:08:56 -0700 (PDT) Received: from localhost ([::1]:53116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m90A3-0003aD-Hj for importer@patchew.org; Thu, 29 Jul 2021 03:08:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m903B-00044F-9Z; Thu, 29 Jul 2021 03:01:49 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:38421 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9037-0002iL-KD; Thu, 29 Jul 2021 03:01:49 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Gb1fY0fzBz9sXh; Thu, 29 Jul 2021 17:01:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1627542101; bh=dXpiJ9pGCTw0ZuzVdmgjpi2b30u6aXi4yOzPh4dkoBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bno1tL5WorobS3S2oj5Ssv1DGXy3Zj0d96veCAglpkDuHSiu1yBNfIkSyNUgEvVM4 9tqxF+uSbYDQqQEz/vh8w6rh4uaFCerTwVl9RukpVxYxHwB5JhSAy5Z9DRtncOQudW P2CMmnW9qDtsiMV7ZGI+4bV88HDghlW3mT0w3TQ4= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 4/5] ppc/vof: Fix Coverity issues Date: Thu, 29 Jul 2021 17:01:34 +1000 Message-Id: <20210729070135.422262-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210729070135.422262-1-david@gibson.dropbear.id.au> References: <20210729070135.422262-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627542538038100001 Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy Coverity reported issues which are caused by mixing of signed return codes from DTC and unsigned return codes of the client interface. This introduces PROM_ERROR and makes distinction between the error types. This fixes NEGATIVE_RETURNS, OVERRUN issues reported by Coverity. This adds a comment about the return parameters number in the VOF hcall. The reason for such counting is to keep the numbers look the same in vof_client_handle() and the Linux (an OF client). vmc->client_architecture_support() returns target_ulong and we want to propagate this to the client (for example H_MULTI_THREADS_ACTIVE). The VOF path to do_client_architecture_support() needs chopping off the top 32bit but SLOF's H_CAS does not; and either way the return values are either 0 or 32bit negative error code. For now this chops the top 32bits. This makes "claim" fail if the allocated address is above 4GB as the client interface is 32bit. This still allows claiming memory above 4GB as potentially initrd can be put there and the client can read the address from the FDT's "available" property. Fixes: CID 1458139, 1458138, 1458137, 1458133, 1458132 Signed-off-by: Alexey Kardashevskiy Message-Id: <20210720050726.2737405-1-aik@ozlabs.ru> Signed-off-by: David Gibson --- hw/ppc/trace-events | 4 +- hw/ppc/vof.c | 139 +++++++++++++++++++++++-------------------- include/hw/ppc/vof.h | 2 + 3 files changed, 78 insertions(+), 67 deletions(-) diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events index 6e90a01072..da6e74b80d 100644 --- a/hw/ppc/trace-events +++ b/hw/ppc/trace-events @@ -88,8 +88,8 @@ vof_getproplen(uint32_t ph, const char *prop, uint32_t re= t) "ph=3D0x%x \"%s\" =3D> l vof_setprop(uint32_t ph, const char *prop, const char *val, uint32_t valle= n, uint32_t ret) "ph=3D0x%x \"%s\" [%s] len=3D%d =3D> ret=3D%d" vof_open(const char *path, uint32_t ph, uint32_t ih) "%s ph=3D0x%x =3D> ih= =3D0x%x" vof_interpret(const char *cmd, uint32_t param1, uint32_t param2, uint32_t = ret, uint32_t ret2) "[%s] 0x%x 0x%x =3D> 0x%x 0x%x" -vof_package_to_path(uint32_t ph, const char *tmp, uint32_t ret) "ph=3D0x%x= =3D> %s len=3D%d" -vof_instance_to_path(uint32_t ih, uint32_t ph, const char *tmp, uint32_t r= et) "ih=3D0x%x ph=3D0x%x =3D> %s len=3D%d" +vof_package_to_path(uint32_t ph, const char *tmp, int ret) "ph=3D0x%x =3D>= %s len=3D%d" +vof_instance_to_path(uint32_t ih, uint32_t ph, const char *tmp, int ret) "= ih=3D0x%x ph=3D0x%x =3D> %s len=3D%d" vof_instance_to_package(uint32_t ih, uint32_t ph) "ih=3D0x%x =3D> ph=3D0x%= x" vof_write(uint32_t ih, unsigned cb, const char *msg) "ih=3D0x%x [%u] \"%s\= "" vof_avail(uint64_t start, uint64_t end, uint64_t size) "0x%"PRIx64"..0x%"P= RIx64" size=3D0x%"PRIx64 diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c index 81f6596215..73adc44ec2 100644 --- a/hw/ppc/vof.c +++ b/hw/ppc/vof.c @@ -160,7 +160,7 @@ static int path_offset(const void *fdt, const char *pat= h) static uint32_t vof_finddevice(const void *fdt, uint32_t nodeaddr) { char fullnode[VOF_MAX_PATH]; - uint32_t ret =3D -1; + uint32_t ret =3D PROM_ERROR; int offset; =20 if (readstr(nodeaddr, fullnode, sizeof(fullnode))) { @@ -172,7 +172,7 @@ static uint32_t vof_finddevice(const void *fdt, uint32_= t nodeaddr) ret =3D fdt_get_phandle(fdt, offset); } trace_vof_finddevice(fullnode, ret); - return (uint32_t) ret; + return ret; } =20 static const void *getprop(const void *fdt, int nodeoff, const char *propn= ame, @@ -229,10 +229,10 @@ static uint32_t vof_getprop(const void *fdt, uint32_t= nodeph, uint32_t pname, bool write0; =20 if (nodeoff < 0) { - return -1; + return PROM_ERROR; } if (readstr(pname, propname, sizeof(propname))) { - return -1; + return PROM_ERROR; } prop =3D getprop(fdt, nodeoff, propname, &proplen, &write0); if (prop) { @@ -244,7 +244,7 @@ static uint32_t vof_getprop(const void *fdt, uint32_t n= odeph, uint32_t pname, (write0 && cb =3D=3D proplen && VOF_MEM_WRITE(valaddr + cb - 1, &zero, 1) !=3D MEMTX_OK)) { - ret =3D -1; + ret =3D PROM_ERROR; } else { /* * OF1275 says: @@ -259,7 +259,7 @@ static uint32_t vof_getprop(const void *fdt, uint32_t n= odeph, uint32_t pname, } } } else { - ret =3D -1; + ret =3D PROM_ERROR; } trace_vof_getprop(nodeph, propname, ret, trval); =20 @@ -275,16 +275,16 @@ static uint32_t vof_getproplen(const void *fdt, uint3= 2_t nodeph, uint32_t pname) int nodeoff =3D fdt_node_offset_by_phandle(fdt, nodeph); =20 if (nodeoff < 0) { - return -1; + return PROM_ERROR; } if (readstr(pname, propname, sizeof(propname))) { - return -1; + return PROM_ERROR; } prop =3D getprop(fdt, nodeoff, propname, &proplen, NULL); if (prop) { ret =3D proplen; } else { - ret =3D -1; + ret =3D PROM_ERROR; } trace_vof_getproplen(nodeph, propname, ret); =20 @@ -296,8 +296,8 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt= , Vof *vof, uint32_t valaddr, uint32_t vallen) { char propname[OF_PROPNAME_LEN_MAX + 1]; - uint32_t ret =3D -1; - int offset; + uint32_t ret =3D PROM_ERROR; + int offset, rc; char trval[64] =3D ""; char nodepath[VOF_MAX_PATH] =3D ""; Object *vmo =3D object_dynamic_cast(OBJECT(ms), TYPE_VOF_MACHINE_IF); @@ -314,8 +314,8 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt= , Vof *vof, if (offset < 0) { goto trace_exit; } - ret =3D get_path(fdt, offset, nodepath, sizeof(nodepath)); - if (ret <=3D 0) { + rc =3D get_path(fdt, offset, nodepath, sizeof(nodepath)); + if (rc <=3D 0) { goto trace_exit; } =20 @@ -333,8 +333,8 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt= , Vof *vof, goto trace_exit; } =20 - ret =3D fdt_setprop(fdt, offset, propname, val, vallen); - if (ret) { + rc =3D fdt_setprop(fdt, offset, propname, val, vallen); + if (rc) { goto trace_exit; } =20 @@ -358,7 +358,7 @@ static uint32_t vof_nextprop(const void *fdt, uint32_t = phandle, const char *tmp; =20 if (readstr(prevaddr, prev, sizeof(prev))) { - return -1; + return PROM_ERROR; } =20 fdt_for_each_property_offset(offset, fdt, nodeoff) { @@ -377,7 +377,7 @@ static uint32_t vof_nextprop(const void *fdt, uint32_t = phandle, } =20 if (VOF_MEM_WRITE(nameaddr, tmp, strlen(tmp) + 1) !=3D MEMTX_O= K) { - return -1; + return PROM_ERROR; } return 1; } @@ -388,18 +388,17 @@ static uint32_t vof_nextprop(const void *fdt, uint32_= t phandle, =20 static uint32_t vof_peer(const void *fdt, uint32_t phandle) { - int ret; + uint32_t ret =3D 0; + int rc; =20 if (phandle =3D=3D 0) { - ret =3D fdt_path_offset(fdt, "/"); + rc =3D fdt_path_offset(fdt, "/"); } else { - ret =3D fdt_next_subnode(fdt, fdt_node_offset_by_phandle(fdt, phan= dle)); + rc =3D fdt_next_subnode(fdt, fdt_node_offset_by_phandle(fdt, phand= le)); } =20 - if (ret < 0) { - ret =3D 0; - } else { - ret =3D fdt_get_phandle(fdt, ret); + if (rc >=3D 0) { + ret =3D fdt_get_phandle(fdt, rc); } =20 return ret; @@ -407,12 +406,11 @@ static uint32_t vof_peer(const void *fdt, uint32_t ph= andle) =20 static uint32_t vof_child(const void *fdt, uint32_t phandle) { - int ret =3D fdt_first_subnode(fdt, fdt_node_offset_by_phandle(fdt, pha= ndle)); + uint32_t ret =3D 0; + int rc =3D fdt_first_subnode(fdt, fdt_node_offset_by_phandle(fdt, phan= dle)); =20 - if (ret < 0) { - ret =3D 0; - } else { - ret =3D fdt_get_phandle(fdt, ret); + if (rc >=3D 0) { + ret =3D fdt_get_phandle(fdt, rc); } =20 return ret; @@ -420,12 +418,11 @@ static uint32_t vof_child(const void *fdt, uint32_t p= handle) =20 static uint32_t vof_parent(const void *fdt, uint32_t phandle) { - int ret =3D fdt_parent_offset(fdt, fdt_node_offset_by_phandle(fdt, pha= ndle)); + uint32_t ret =3D 0; + int rc =3D fdt_parent_offset(fdt, fdt_node_offset_by_phandle(fdt, phan= dle)); =20 - if (ret < 0) { - ret =3D 0; - } else { - ret =3D fdt_get_phandle(fdt, ret); + if (rc >=3D 0) { + ret =3D fdt_get_phandle(fdt, rc); } =20 return ret; @@ -433,7 +430,7 @@ static uint32_t vof_parent(const void *fdt, uint32_t ph= andle) =20 static uint32_t vof_do_open(void *fdt, Vof *vof, int offset, const char *p= ath) { - uint32_t ret =3D -1; + uint32_t ret =3D PROM_ERROR; OfInstance *inst =3D NULL; =20 if (vof->of_instance_last =3D=3D 0xFFFFFFFF) { @@ -461,18 +458,18 @@ trace_exit: uint32_t vof_client_open_store(void *fdt, Vof *vof, const char *nodename, const char *prop, const char *path) { - int node =3D fdt_path_offset(fdt, nodename); - int inst, offset; + int offset, node =3D fdt_path_offset(fdt, nodename); + uint32_t inst; =20 offset =3D fdt_path_offset(fdt, path); if (offset < 0) { trace_vof_error_unknown_path(path); - return offset; + return PROM_ERROR; } =20 inst =3D vof_do_open(fdt, vof, offset, path); =20 - return fdt_setprop_cell(fdt, node, prop, inst); + return fdt_setprop_cell(fdt, node, prop, inst) >=3D 0 ? 0 : PROM_ERROR; } =20 static uint32_t vof_open(void *fdt, Vof *vof, uint32_t pathaddr) @@ -481,13 +478,13 @@ static uint32_t vof_open(void *fdt, Vof *vof, uint32_= t pathaddr) int offset; =20 if (readstr(pathaddr, path, sizeof(path))) { - return -1; + return PROM_ERROR; } =20 offset =3D path_offset(fdt, path); if (offset < 0) { trace_vof_error_unknown_path(path); - return offset; + return PROM_ERROR; } =20 return vof_do_open(fdt, vof, offset, path); @@ -504,7 +501,7 @@ static uint32_t vof_instance_to_package(Vof *vof, uint3= 2_t ihandle) { gpointer instp =3D g_hash_table_lookup(vof->of_instances, GINT_TO_POINTER(ihandle)); - uint32_t ret =3D -1; + uint32_t ret =3D PROM_ERROR; =20 if (instp) { ret =3D ((OfInstance *)instp)->phandle; @@ -517,39 +514,39 @@ static uint32_t vof_instance_to_package(Vof *vof, uin= t32_t ihandle) static uint32_t vof_package_to_path(const void *fdt, uint32_t phandle, uint32_t buf, uint32_t len) { - uint32_t ret =3D -1; + int rc; char tmp[VOF_MAX_PATH] =3D ""; =20 - ret =3D phandle_to_path(fdt, phandle, tmp, sizeof(tmp)); - if (ret > 0) { - if (VOF_MEM_WRITE(buf, tmp, ret) !=3D MEMTX_OK) { - ret =3D -1; + rc =3D phandle_to_path(fdt, phandle, tmp, sizeof(tmp)); + if (rc > 0) { + if (VOF_MEM_WRITE(buf, tmp, rc) !=3D MEMTX_OK) { + rc =3D -1; } } =20 - trace_vof_package_to_path(phandle, tmp, ret); + trace_vof_package_to_path(phandle, tmp, rc); =20 - return ret; + return rc > 0 ? (uint32_t)rc : PROM_ERROR; } =20 static uint32_t vof_instance_to_path(void *fdt, Vof *vof, uint32_t ihandle, uint32_t buf, uint32_t len) { - uint32_t ret =3D -1; + int rc =3D -1; uint32_t phandle =3D vof_instance_to_package(vof, ihandle); char tmp[VOF_MAX_PATH] =3D ""; =20 if (phandle !=3D -1) { - ret =3D phandle_to_path(fdt, phandle, tmp, sizeof(tmp)); - if (ret > 0) { - if (VOF_MEM_WRITE(buf, tmp, ret) !=3D MEMTX_OK) { - ret =3D -1; + rc =3D phandle_to_path(fdt, phandle, tmp, sizeof(tmp)); + if (rc > 0) { + if (VOF_MEM_WRITE(buf, tmp, rc) !=3D MEMTX_OK) { + rc =3D -1; } } } - trace_vof_instance_to_path(ihandle, phandle, tmp, ret); + trace_vof_instance_to_path(ihandle, phandle, tmp, rc); =20 - return ret; + return rc > 0 ? (uint32_t)rc : PROM_ERROR; } =20 static uint32_t vof_write(Vof *vof, uint32_t ihandle, uint32_t buf, @@ -562,13 +559,13 @@ static uint32_t vof_write(Vof *vof, uint32_t ihandle,= uint32_t buf, =20 if (!inst) { trace_vof_error_write(ihandle); - return -1; + return PROM_ERROR; } =20 for ( ; len > 0; len -=3D cb) { cb =3D MIN(len, sizeof(tmp) - 1); if (VOF_MEM_READ(buf, tmp, cb) !=3D MEMTX_OK) { - return -1; + return PROM_ERROR; } =20 /* FIXME: there is no backend(s) yet so just call a trace */ @@ -747,7 +744,7 @@ uint64_t vof_claim(Vof *vof, uint64_t virt, uint64_t si= ze, =20 static uint32_t vof_release(Vof *vof, uint64_t virt, uint64_t size) { - uint32_t ret =3D -1; + uint32_t ret =3D PROM_ERROR; int i; GArray *claimed =3D vof->claimed; OfClaimed c; @@ -776,7 +773,7 @@ static uint32_t vof_call_method(MachineState *ms, Vof *= vof, uint32_t methodaddr, uint32_t param2, uint32_t param3, uint32_t param4, uint32_t *ret2) { - uint32_t ret =3D -1; + uint32_t ret =3D PROM_ERROR; char method[VOF_MAX_METHODLEN] =3D ""; OfInstance *inst; =20 @@ -802,7 +799,8 @@ static uint32_t vof_call_method(MachineState *ms, Vof *= vof, uint32_t methodaddr, VofMachineIfClass *vmc =3D VOF_MACHINE_GET_CLASS(vmo); =20 g_assert(vmc->client_architecture_support); - ret =3D vmc->client_architecture_support(ms, first_cpu, pa= ram1); + ret =3D (uint32_t)vmc->client_architecture_support(ms, fir= st_cpu, + param1); } =20 *ret2 =3D 0; @@ -826,7 +824,7 @@ trace_exit: static uint32_t vof_call_interpret(uint32_t cmdaddr, uint32_t param1, uint32_t param2, uint32_t *ret2) { - uint32_t ret =3D -1; + uint32_t ret =3D PROM_ERROR; char cmd[VOF_MAX_FORTHCODE] =3D ""; =20 /* No interpret implemented so just call a trace */ @@ -895,13 +893,20 @@ static uint32_t vof_client_handle(MachineState *ms, v= oid *fdt, Vof *vof, } else if (cmpserv("write", 3, 1)) { ret =3D vof_write(vof, args[0], args[1], args[2]); } else if (cmpserv("claim", 3, 1)) { - ret =3D vof_claim(vof, args[0], args[1], args[2]); - if (ret !=3D -1) { + uint64_t ret64 =3D vof_claim(vof, args[0], args[1], args[2]); + + if (ret64 < 0x100000000UL) { vof_dt_memory_available(fdt, vof->claimed, vof->claimed_base); + ret =3D (uint32_t)ret64; + } else { + if (ret64 !=3D -1) { + vof_release(vof, ret, args[1]); + } + ret =3D PROM_ERROR; } } else if (cmpserv("release", 2, 0)) { ret =3D vof_release(vof, args[0], args[1]); - if (ret !=3D -1) { + if (ret !=3D PROM_ERROR) { vof_dt_memory_available(fdt, vof->claimed, vof->claimed_base); } } else if (cmpserv("call-method", 0, 0)) { @@ -965,11 +970,15 @@ int vof_client_call(MachineState *ms, Vof *vof, void = *fdt, } =20 nret =3D be32_to_cpu(args_be.nret); + if (nret > ARRAY_SIZE(args_be.args) - nargs) { + return -EINVAL; + } ret =3D vof_client_handle(ms, fdt, vof, service, args, nargs, rets, nr= et); if (!nret) { return 0; } =20 + /* @nrets includes the value which this function returns */ args_be.args[nargs] =3D cpu_to_be32(ret); for (i =3D 1; i < nret; ++i) { args_be.args[nargs + i] =3D cpu_to_be32(rets[i - 1]); diff --git a/include/hw/ppc/vof.h b/include/hw/ppc/vof.h index 640be46163..97fdef758b 100644 --- a/include/hw/ppc/vof.h +++ b/include/hw/ppc/vof.h @@ -55,4 +55,6 @@ struct VofMachineIfClass { address_space_write(&address_space_memory, \ (pa), MEMTXATTRS_UNSPECIFIED, (buf), (size)) =20 +#define PROM_ERROR (~0U) + #endif /* HW_VOF_H */ --=20 2.31.1 From nobody Mon May 13 12:38:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627542326961547.1070434016327; Thu, 29 Jul 2021 00:05:26 -0700 (PDT) Received: from localhost ([::1]:46538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m906f-0007SQ-TK for importer@patchew.org; Thu, 29 Jul 2021 03:05:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m903E-00044n-JD; Thu, 29 Jul 2021 03:01:52 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:41731 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m903C-0002mg-Ju; Thu, 29 Jul 2021 03:01:52 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Gb1fY1m6nz9sjD; Thu, 29 Jul 2021 17:01:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1627542101; bh=Jl6xuoP214Fxa/VVS1LDGZ3xPuBsuF5l+i5Y/s+dhDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mE3RQTx0zjzQxbTafGOQvBxfXhRX3Mf1zhPJmzFzCDIpDlW6impv+a1w8+pVWXMGY VTkkhwtrS0Oiux+YRG4MYIMf/ccTNerXdeu9nJP4LMr9nF8q458OpUaFE+f6iwV7T9 nW8sBTrddP81HpuU8Z83BTwkA/HSSdhil0W7ZU2M= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 5/5] kvm: ppc: Print meaningful message on KVM_CREATE_VM failure Date: Thu, 29 Jul 2021 17:01:35 +1000 Message-Id: <20210729070135.422262-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210729070135.422262-1-david@gibson.dropbear.id.au> References: <20210729070135.422262-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabiano Rosas , qemu-ppc@nongnu.org, groug@kaod.org, David Gibson , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627542328621100003 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas PowerPC has two KVM types (HV, PR) that translate into three kernel modules: kvm.ko - common kvm code kvm_hv.ko - kvm running with MSR_HV=3D1 or MSR_HV|PR=3D0 in a nested guest. kvm_pr.ko - kvm running in usermode MSR_PR=3D1. Since the two KVM types can both be running at the same time, this creates a situation in which it is possible for one or both of the modules to fail to initialize, leaving the generic one behind. This leads QEMU to think it can create a guest, but KVM will fail when calling the type-specific code: ioctl(KVM_CREATE_VM) failed: 22 Invalid argument qemu-kvm: failed to initialize KVM: Invalid argument Ideally this would be solved kernel-side, but it might be a while until we can get rid of one of the modules. So in the meantime this patch tries to make this less confusing for the end user by adding a more elucidative message: ioctl(KVM_CREATE_VM) failed: 22 Invalid argument PPC KVM module is not loaded. Try 'modprobe kvm_hv'. [dwg: Fixed error in #elif which failed compile on !ppc hosts] Signed-off-by: Fabiano Rosas Message-Id: <20210722141340.2367905-1-farosas@linux.ibm.com> Signed-off-by: David Gibson --- accel/kvm/kvm-all.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index e5b10dd129..0125c17edb 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2397,6 +2397,12 @@ static int kvm_init(MachineState *ms) "- for kernels supporting the vm.allocate_pgste sysctl= , " "whether it is enabled\n"); } +#elif defined(TARGET_PPC) + if (ret =3D=3D -EINVAL) { + fprintf(stderr, + "PPC KVM module is not loaded. Try modprobe kvm_%s.\n", + (type =3D=3D 2) ? "pr" : "hv"); + } #endif goto err; } --=20 2.31.1