From nobody Mon Feb 9 14:34:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 163671588251912.289308978115287; Fri, 12 Nov 2021 03:18:02 -0800 (PST) Received: from localhost ([::1]:54344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlUZF-0008Jz-EI for importer@patchew.org; Fri, 12 Nov 2021 06:18:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlUXI-0005dk-IJ; Fri, 12 Nov 2021 06:16:05 -0500 Received: from 7.mo548.mail-out.ovh.net ([46.105.33.25]:51599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlUXD-00078L-D8; Fri, 12 Nov 2021 06:15:59 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.156.98]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 4E08920D05; Fri, 12 Nov 2021 11:15:46 +0000 (UTC) Received: from kaod.org (37.59.142.101) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 12 Nov 2021 12:15:45 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-101G004877ebd69-2a42-4fe9-84af-ccb1c3fc694b, F9CF0200ECD1631E1678AE6CCE6AA99FD507468A) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , , Greg Kurz Subject: [PULL 1/3] target/ppc: Fix register update on lf[sd]u[x]/stf[sd]u[x] Date: Fri, 12 Nov 2021 12:15:41 +0100 Message-ID: <20211112111543.2556837-2-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211112111543.2556837-1-clg@kaod.org> References: <20211112111543.2556837-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.101] X-ClientProxiedBy: DAG1EX1.mxp5.local (172.16.2.1) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 4f6430af-5a54-4e21-8923-220d4b4580c3 X-Ovh-Tracer-Id: 5539990494889347948 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrvdefgddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=46.105.33.25; envelope-from=clg@kaod.org; helo=7.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Daniel Henrique Barboza , Matheus Ferst , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1636715885183100001 From: Matheus Ferst These instructions should update the GPR indicated by the field RA instead of RT. This error caused a regression on Mac OS 9 boot and some graphical glitches in OS X. Fixes: a39a106634a9 ("target/ppc: Move load and store floating point instru= ctions to decodetree") Reported-by: Mark Cave-Ayland Tested-by: Mark Cave-Ayland Signed-off-by: Matheus Ferst Signed-off-by: C=C3=A9dric Le Goater --- target/ppc/translate/fp-impl.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/translate/fp-impl.c.inc b/target/ppc/translate/fp-i= mpl.c.inc index d1dbb1b96b16..c9e05201d9e7 100644 --- a/target/ppc/translate/fp-impl.c.inc +++ b/target/ppc/translate/fp-impl.c.inc @@ -1328,7 +1328,7 @@ static bool do_lsfpsd(DisasContext *ctx, int rt, int = ra, TCGv displ, set_fpr(rt, t0); } if (update) { - tcg_gen_mov_tl(cpu_gpr[rt], ea); + tcg_gen_mov_tl(cpu_gpr[ra], ea); } tcg_temp_free_i64(t0); tcg_temp_free(ea); --=20 2.31.1 From nobody Mon Feb 9 14:34:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 1636716071773708.8226755656608; Fri, 12 Nov 2021 03:21:11 -0800 (PST) Received: from localhost ([::1]:34872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlUcI-0005xP-NH for importer@patchew.org; Fri, 12 Nov 2021 06:21:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlUXL-0005dq-5U for qemu-devel@nongnu.org; Fri, 12 Nov 2021 06:16:03 -0500 Received: from 3.mo552.mail-out.ovh.net ([178.33.254.192]:36337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlUXF-00078S-Fr for qemu-devel@nongnu.org; Fri, 12 Nov 2021 06:16:01 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.143.141]) by mo552.mail-out.ovh.net (Postfix) with ESMTPS id C07B721CC6; Fri, 12 Nov 2021 11:15:46 +0000 (UTC) Received: from kaod.org (37.59.142.101) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 12 Nov 2021 12:15:46 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-101G00479648c07-1230-4c61-b750-4543476d94d5, F9CF0200ECD1631E1678AE6CCE6AA99FD507468A) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , , Greg Kurz Subject: [PULL 2/3] spapr_numa.c: fix FORM1 distance-less nodes Date: Fri, 12 Nov 2021 12:15:42 +0100 Message-ID: <20211112111543.2556837-3-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211112111543.2556837-1-clg@kaod.org> References: <20211112111543.2556837-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.101] X-ClientProxiedBy: DAG1EX1.mxp5.local (172.16.2.1) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 71f26322-8e31-43ef-8e79-f4ebd8241a32 X-Ovh-Tracer-Id: 5539990492451605295 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrvdefgddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeetjeefleehtdehfefhvdduieevheellefggfekhfeltdfgteevjedtveduueetheenucffohhmrghinhepghhnuhdrohhrghenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=178.33.254.192; envelope-from=clg@kaod.org; helo=3.mo552.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Aneesh Kumar K . V" , Daniel Henrique Barboza , Richard Henderson , Nicholas Piggin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1636716072410100002 From: Daniel Henrique Barboza Commit 71e6fae3a99 fixed an issue with FORM2 affinity guests with NUMA nodes in which the distance info is absent in machine_state->numa_state->nodes. This happens when QEMU adds a default NUMA node and when the user adds NUMA nodes without specifying the distances. During the discussions of the forementioned patch [1] it was found that FORM1 guests were behaving in a strange way in the same scenario, with the kernel seeing the distances between the nodes as '160', as we can see in this example with 4 NUMA nodes without distance information: $ numactl -H available: 4 nodes (0-3) (...) node distances: node 0 1 2 3 0: 10 160 160 160 1: 160 10 160 160 2: 160 160 10 160 3: 160 160 160 10 Turns out that we have the same problem with FORM1 guests - we are calculating associativity domain using zeroed values. And as it also turns out, the solution from 71e6fae3a99 applies to FORM1 as well. This patch creates a wrapper called 'get_numa_distance' that contains the logic used in FORM2 to define node distances when this information is absent. This helper is then used in all places where we need to read distance information from machine_state->numa_state->nodes. That way we'll guarantee that the NUMA node distance is always being curated before being used. After this patch, the FORM1 guest mentioned above will have the following topology: $ numactl -H available: 4 nodes (0-3) (...) node distances: node 0 1 2 3 0: 10 20 20 20 1: 20 10 20 20 2: 20 20 10 20 3: 20 20 20 10 This is compatible with what FORM2 guests and other archs do in this case. [1] https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg01960.html Fixes: 690fbe4295d5 ("spapr_numa: consider user input when defining associa= tivity") CC: Aneesh Kumar K.V CC: Nicholas Piggin Reviewed-by: Richard Henderson Signed-off-by: Daniel Henrique Barboza Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr_numa.c | 62 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index 56ab2a5fb649..e9ef7e764696 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -66,16 +66,41 @@ static const uint32_t *get_associativity(SpaprMachineSt= ate *spapr, int node_id) return spapr->FORM1_assoc_array[node_id]; } =20 +/* + * Wrapper that returns node distance from ms->numa_state->nodes + * after handling edge cases where the distance might be absent. + */ +static int get_numa_distance(MachineState *ms, int src, int dst) +{ + NodeInfo *numa_info =3D ms->numa_state->nodes; + int ret =3D numa_info[src].distance[dst]; + + if (ret !=3D 0) { + return ret; + } + + /* + * In case QEMU adds a default NUMA single node when the user + * did not add any, or where the user did not supply distances, + * the distance will be absent (zero). Return local/remote + * distance in this case. + */ + if (src =3D=3D dst) { + return NUMA_DISTANCE_MIN; + } + + return NUMA_DISTANCE_DEFAULT; +} + static bool spapr_numa_is_symmetrical(MachineState *ms) { - int src, dst; int nb_numa_nodes =3D ms->numa_state->num_nodes; - NodeInfo *numa_info =3D ms->numa_state->nodes; + int src, dst; =20 for (src =3D 0; src < nb_numa_nodes; src++) { for (dst =3D src; dst < nb_numa_nodes; dst++) { - if (numa_info[src].distance[dst] !=3D - numa_info[dst].distance[src]) { + if (get_numa_distance(ms, src, dst) !=3D + get_numa_distance(ms, dst, src)) { return false; } } @@ -133,7 +158,6 @@ static uint8_t spapr_numa_get_numa_level(uint8_t distan= ce) static void spapr_numa_define_FORM1_domains(SpaprMachineState *spapr) { MachineState *ms =3D MACHINE(spapr); - NodeInfo *numa_info =3D ms->numa_state->nodes; int nb_numa_nodes =3D ms->numa_state->num_nodes; int src, dst, i, j; =20 @@ -170,7 +194,7 @@ static void spapr_numa_define_FORM1_domains(SpaprMachin= eState *spapr) * The PPC kernel expects the associativity domains of node 0 = to * be always 0, and this algorithm will grant that by default. */ - uint8_t distance =3D numa_info[src].distance[dst]; + uint8_t distance =3D get_numa_distance(ms, src, dst); uint8_t n_level =3D spapr_numa_get_numa_level(distance); uint32_t assoc_src; =20 @@ -498,7 +522,6 @@ static void spapr_numa_FORM2_write_rtas_tables(SpaprMac= hineState *spapr, void *fdt, int rtas) { MachineState *ms =3D MACHINE(spapr); - NodeInfo *numa_info =3D ms->numa_state->nodes; int nb_numa_nodes =3D ms->numa_state->num_nodes; int distance_table_entries =3D nb_numa_nodes * nb_numa_nodes; g_autofree uint32_t *lookup_index_table =3D NULL; @@ -540,30 +563,7 @@ static void spapr_numa_FORM2_write_rtas_tables(SpaprMa= chineState *spapr, =20 for (src =3D 0; src < nb_numa_nodes; src++) { for (dst =3D 0; dst < nb_numa_nodes; dst++) { - /* - * We need to be explicit with the local distance - * value to cover the case where the user didn't added any - * NUMA nodes, but QEMU adds the default NUMA node without - * adding the numa_info to retrieve distance info from. - */ - distance_table[i] =3D numa_info[src].distance[dst]; - if (distance_table[i] =3D=3D 0) { - /* - * In case QEMU adds a default NUMA single node when the u= ser - * did not add any, or where the user did not supply dista= nces, - * the value will be 0 here. Populate the table with a fal= lback - * simple local / remote distance. - */ - if (src =3D=3D dst) { - distance_table[i] =3D NUMA_DISTANCE_MIN; - } else { - distance_table[i] =3D numa_info[src].distance[dst]; - if (distance_table[i] < NUMA_DISTANCE_MIN) { - distance_table[i] =3D NUMA_DISTANCE_DEFAULT; - } - } - } - i++; + distance_table[i++] =3D get_numa_distance(ms, src, dst); } } =20 --=20 2.31.1 From nobody Mon Feb 9 14:34:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 1636715884331923.2723266534651; Fri, 12 Nov 2021 03:18:04 -0800 (PST) Received: from localhost ([::1]:54398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlUZH-0008Lw-DB for importer@patchew.org; Fri, 12 Nov 2021 06:18:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlUXJ-0005dm-DC for qemu-devel@nongnu.org; Fri, 12 Nov 2021 06:16:05 -0500 Received: from 1.mo552.mail-out.ovh.net ([178.32.96.117]:57481) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlUXF-00078T-Fp for qemu-devel@nongnu.org; Fri, 12 Nov 2021 06:16:01 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.143.141]) by mo552.mail-out.ovh.net (Postfix) with ESMTPS id 6C91721576; Fri, 12 Nov 2021 11:15:47 +0000 (UTC) Received: from kaod.org (37.59.142.101) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 12 Nov 2021 12:15:46 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-101G0046697492a-843d-4a8f-89e1-0fe2812e93b7, F9CF0200ECD1631E1678AE6CCE6AA99FD507468A) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , , Greg Kurz Subject: [PULL 3/3] ppc/mmu_helper.c: do not truncate 'ea' in booke206_invalidate_ea_tlb() Date: Fri, 12 Nov 2021 12:15:43 +0100 Message-ID: <20211112111543.2556837-4-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211112111543.2556837-1-clg@kaod.org> References: <20211112111543.2556837-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.101] X-ClientProxiedBy: DAG1EX1.mxp5.local (172.16.2.1) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 3f865683-ca67-4686-8d06-842c93b0c604 X-Ovh-Tracer-Id: 5540271967615093609 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrvdefgddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeevieejtedujeehtefgfeelffehveefudegjeejvdegtefgieetheffffeiheelfeenucffohhmrghinhepghhithhlrggsrdgtohhmpdhrrghpthhorhgtshdrtghomhenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=178.32.96.117; envelope-from=clg@kaod.org; helo=1.mo552.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1636715885223100003 From: Daniel Henrique Barboza 'tlbivax' is implemented by gen_tlbivax_booke206() via gen_helper_booke206_tlbivax(). In case the TLB needs to be flushed, booke206_invalidate_ea_tlb() is called. All these functions, but booke206_invalidate_ea_tlb(), uses a 64-bit effective address 'ea'. booke206_invalidate_ea_tlb() uses an uint32_t 'ea' argument that truncates the original 'ea' value for apparently no particular reason. This function retrieves the tlb pointer by calling booke206_get_tlbm(), which also uses a target_ulong address as parameter - in this case, a truncated 'ea' address. All the surrounding logic considers the effective TLB address as a 64 bit value, aside from the signature of booke206_invalidate_ea_tlb(). Last but not the least, PowerISA 2.07B section 6.11.4.9 [2] makes it clear that the effective address "EA" is a 64 bit value. Commit 01662f3e5133 introduced this code and no changes were made ever since. An user detected a problem with tlbivax [1] stating that this address truncation was the cause. This same behavior might be the source of several subtle bugs that were never caught. For all these reasons, this patch assumes that this address truncation is the result of a mistake/oversight of the original commit, and changes booke206_invalidate_ea_tlb() 'ea' argument to 'vaddr'. [1] https://gitlab.com/qemu-project/qemu/-/issues/52 [2] https://wiki.raptorcs.com/wiki/File:PowerISA_V2.07B.pdf Fixes: 01662f3e5133 ("PPC: Implement e500 (FSL) MMU") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/52 Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: C=C3=A9dric Le Goater --- target/ppc/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index 2cb98c516987..e0c4950dda53 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -1216,7 +1216,7 @@ void helper_booke206_tlbsx(CPUPPCState *env, target_u= long address) } =20 static inline void booke206_invalidate_ea_tlb(CPUPPCState *env, int tlbn, - uint32_t ea) + vaddr ea) { int i; int ways =3D booke206_tlb_ways(env, tlbn); --=20 2.31.1