From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558073; cv=none; d=zohomail.com; s=zohoarc; b=C6NG4DiqJcsUQUyTcv8+FBGobT4CqZEAjoqrE57gokZdSAcCuhhF2qh3kCdv8oh7QmOc1tuQrHSbjUz0UPoYWszanrkHl+sLVMuRB1AmEBbxZEr7lquOSyLP0Moka7/2ymdLurL3tfEhVA5AeX7L3UTDvtbr3UHYj0HndaNlt1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558073; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Eq20GbSvUV2zWopoqtr2qL8m9cMruuLiySHSA20q0Ms=; b=FdF3TujlBoQANjA95VqCAGRu/trmzzaka5AmBKOE2FcovqCRZ8YMJ5Q3GLVb+K6xWa66k1JSzzfWBl9aI47shF0NvosQe6Xg9rnSzREKjXHfneNMGrJYg6P1un/3EbLEQaNfrX63rSiKJCg8HyZhT23oXTTPy7m6HZs+7Se4mPo= ARC-Authentication-Results: i=1; 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 1590558073245925.7867489062514; Tue, 26 May 2020 22:41:13 -0700 (PDT) Received: from localhost ([::1]:36090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdooR-0006XY-VI for importer@patchew.org; Wed, 27 May 2020 01:41:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolj-00015O-5W; Wed, 27 May 2020 01:38:23 -0400 Received: from ozlabs.org ([203.11.71.1]:57935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolh-0001bq-Kn; Wed, 27 May 2020 01:38:22 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03q1tpqz9sRW; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557895; bh=zC2AQ8bz3NPVon90j5g3Hah9yM8NZ5q/yFSIGF3Tb6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDbfaGyk/abL4UwotvcPxgR/+fD4QaxAzGNfb9RTQ0Y6HzM9UMNoELJAchvuyzEK5 TLHv914Ys1LbbWAbMkuCPH77Yd+q8C9QzO3S4SOo4jSDb7xaLrApjabVllgQDZJ8Na gIxhOD3DFu3OJ90wmvjcZ0K2ShqxTNVehn3Gwj50= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 01/15] ppc/pnv: Fix NMI system reset SRR1 value Date: Wed, 27 May 2020 15:37:55 +1000 Message-Id: <20200527053809.356168-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 01:38:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, Nicholas Piggin , groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Nicholas Piggin Commit a77fed5bd926 ("ppc/pnv: Add support for NMI interface") got the SRR1 setting wrong for sresets that hit outside of power-save states. Fix this, better documenting the source for the bit definitions. Fixes: 01b552b05b0f ("ppc/pnv: Add support for NMI interface") Cc: C=C3=A9dric Le Goater Cc: David Gibson Signed-off-by: Nicholas Piggin Message-Id: <20200507114824.788942-1-npiggin@gmail.com> Reviewed-by: C=C3=A9dric Le Goater [dwg: Fixed up some tab indentation] Signed-off-by: David Gibson --- hw/ppc/pnv.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index da637822f9..f48a61d6d1 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1984,12 +1984,26 @@ static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run= _on_cpu_data arg) =20 cpu_synchronize_state(cs); ppc_cpu_do_system_reset(cs); - /* - * SRR1[42:45] is set to 0100 which the ISA defines as implementation - * dependent. POWER processors use this for xscom triggered interrupts, - * which come from the BMC or NMI IPIs. - */ - env->spr[SPR_SRR1] |=3D PPC_BIT(43); + if (env->spr[SPR_SRR1] & PPC_BITMASK(46, 47)) { + /* + * Power-save wakeups, as indicated by non-zero SRR1[46:47] put the + * wakeup reason in SRR1[42:45], system reset is indicated with 0b= 0100 + * (PPC_BIT(43)). + */ + if (!(env->spr[SPR_SRR1] & PPC_BIT(43))) { + warn_report("ppc_cpu_do_system_reset does not set system reset= wakeup reason"); + env->spr[SPR_SRR1] |=3D PPC_BIT(43); + } + } else { + /* + * For non-powersave system resets, SRR1[42:45] are defined to be + * implementation-dependent. The POWER9 User Manual specifies that + * an external (SCOM driven, which may come from a BMC nmi command= or + * another CPU requesting a NMI IPI) system reset exception should= be + * 0b0010 (PPC_BIT(44)). + */ + env->spr[SPR_SRR1] |=3D PPC_BIT(44); + } } =20 static void pnv_nmi(NMIState *n, int cpu_index, Error **errp) --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590557971; cv=none; d=zohomail.com; s=zohoarc; b=fT17LD2l1ldYFEYhCEARmMCfKadVL6sqSe15G+wbIX0Dsaijg7+iCLx0WRFS7kTRMr8KfSgk9OhkNplzYU2EnKh9fk9gVWBfJYtrau9MBpht0G63vWKAqB1d31J38RqBx6RTI8wxnfuhHGhmW4ES7tynsxra0D1NhGywIrJVBkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590557971; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0jLxk61r6TiFhpXw1hEdDyCPHZ2Yrz5AqOmL8vUk9dY=; b=mV074ocoFqmbfxxokbgE6zueKo4b6C3ATXoMejcMaQRVW8KKFqaPI2DD7sPnV6NOQPEuH/9LFjpG3IBhcuuYSy26u3IaypypqLoX57SlvFK8SYX9BV3PuC85IiBbPBC+fQ6tg1Px1MalAnItFwj2GImYg/+o1Dsn5TKJYe9Pa4c= ARC-Authentication-Results: i=1; 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 159055797080679.82882583388175; Tue, 26 May 2020 22:39:30 -0700 (PDT) Received: from localhost ([::1]:54846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdomm-0002fX-VV for importer@patchew.org; Wed, 27 May 2020 01:39:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoli-00015C-VJ; Wed, 27 May 2020 01:38:22 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:52697 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 1jdolg-0001bl-Sc; Wed, 27 May 2020 01:38:22 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03q2jk5z9sSg; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557895; bh=bZ5HAdN/qla6XhBKfc5ETaol4quDnOLMYpCgVpG8Scs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gbS+8ZTPJDyi+EmuQe6cvuoGr7GB07giin34A5ixAAMBva8ax7EAC5+ICOrCAEkjW DEs0cQpJihhjltYhfTECNFcA78ajtl0j2IHuf6r0cwQxgSoAwmPfB6UUBiW8hZf1P5 VoCGd5sZaIG8XuMmqs5UUjstXNMUeYoDdrJLA3I8= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 02/15] ppc/spapr: add a POWER10 CPU model Date: Wed, 27 May 2020 15:37:56 +1000 Message-Id: <20200527053809.356168-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200507073855.2485680-1-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr_cpu_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index e1f76c74f3..9c8c1b14cf 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -407,6 +407,7 @@ static const TypeInfo spapr_cpu_core_type_infos[] =3D { DEFINE_SPAPR_CPU_CORE_TYPE("power8nvl_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v2.0"), + DEFINE_SPAPR_CPU_CORE_TYPE("power10_v1.0"), #ifdef CONFIG_KVM DEFINE_SPAPR_CPU_CORE_TYPE("host"), #endif --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590557990; cv=none; d=zohomail.com; s=zohoarc; b=HIEAa+xWThDqPnQ4RC5KUesu3N84HO3Zx6J61bGJJa+GEP/ObBxWkfipLwO3q/+MJU2zGsU4tz7J6kkaeUQVZxlSP4/A1+cEismAENSqrRI3WT9adY7ebirZGq+xvR7PssR1SRBwiFPid9IKNINYmyehb8XRUjRRVIJWmOiKJoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590557990; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mfY49DOftm88XXQQQUtbb2+6hwxjI7MEqAPJeteED+w=; b=IVqCNOH6pX5919SJsBm2b4l+av5HqodlWyP3tVn2MJNG1d0T5dYUCd3O58F5MmgZH5x2mBoxXCV2x30pAuq2MNgyJDRvTlBUrqOV5ODQks7mD/QGZgEhAa0UH1m/0k+74LR1uf8QOzeh94WduwPEvVlzQfqnw+7lUE6ZTyHVPzc= ARC-Authentication-Results: i=1; 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 15905579909131004.4608794004249; Tue, 26 May 2020 22:39:50 -0700 (PDT) Received: from localhost ([::1]:57186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdon7-0003aM-Mz for importer@patchew.org; Wed, 27 May 2020 01:39:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoli-00014y-M4; Wed, 27 May 2020 01:38:22 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:35859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolg-0001bp-RQ; Wed, 27 May 2020 01:38:22 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03q3Tj6z9sSk; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557895; bh=167hnw7FWUOfd27HKDy2X3q5Aj849B09c+brDsAAulw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMXg1g7apy31RoWrONdM/17x1tUgeFt3X3xVXd7HnJsWPeHyu0ROLoiUGQZ+kKIc3 /W7xK1pJpOK8BwTyxlzpc/pJLdiTtEC+FVYW1ulCPULJZJfY+bl6/tF+4wyGXgqw/y 5+MUIEaFLXGq0loIgAnJS04HAnrFHcQALof5kzbU= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 03/15] target/ppc: Untabify excp_helper.c Date: Wed, 27 May 2020 15:37:57 +1000 Message-Id: <20200527053809.356168-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz Some tabs crept in with a recent change. Fixes: 6dc6b557913f "target/ppc: Improve syscall exception logging" Signed-off-by: Greg Kurz Message-Id: <158886788307.1560068.14096740175576278978.stgit@bahia.lan> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- target/ppc/excp_helper.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index f052979664..ace8620026 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -70,16 +70,16 @@ static inline void dump_syscall(CPUPPCState *env) static inline void dump_hcall(CPUPPCState *env) { qemu_log_mask(CPU_LOG_INT, "hypercall r3=3D%016" PRIx64 - " r4=3D%016" PRIx64 " r5=3D%016" PRIx64 " r6=3D%016" PRIx64 - " r7=3D%016" PRIx64 " r8=3D%016" PRIx64 " r9=3D%016" PRIx64 - " r10=3D%016" PRIx64 " r11=3D%016" PRIx64 " r12=3D%016" PRIx64 + " r4=3D%016" PRIx64 " r5=3D%016" PRIx64 " r6=3D%016" PRI= x64 + " r7=3D%016" PRIx64 " r8=3D%016" PRIx64 " r9=3D%016" PRI= x64 + " r10=3D%016" PRIx64 " r11=3D%016" PRIx64 " r12=3D%016" = PRIx64 " nip=3D" TARGET_FMT_lx "\n", ppc_dump_gpr(env, 3), ppc_dump_gpr(env, 4), - ppc_dump_gpr(env, 5), ppc_dump_gpr(env, 6), - ppc_dump_gpr(env, 7), ppc_dump_gpr(env, 8), - ppc_dump_gpr(env, 9), ppc_dump_gpr(env, 10), - ppc_dump_gpr(env, 11), ppc_dump_gpr(env, 12), - env->nip); + ppc_dump_gpr(env, 5), ppc_dump_gpr(env, 6), + ppc_dump_gpr(env, 7), ppc_dump_gpr(env, 8), + ppc_dump_gpr(env, 9), ppc_dump_gpr(env, 10), + ppc_dump_gpr(env, 11), ppc_dump_gpr(env, 12), + env->nip); } =20 static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp, --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558104; cv=none; d=zohomail.com; s=zohoarc; b=Lr8mkd56SBnqmw1e9wverasXcxOw11EwWeR4rZkbGbbsCmVWvPVxS8ZMJAAlyyFsChj00LeyQJLC0dkEZp4Rw8Z7nhIear8jAhF6yn/E1hFobgNQwWbxzxxZAA3oA20hGgQsU3Yvvtj4Feuv2kV26NRoGzGGoW0c9TB1sqE9nCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558104; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AvhOTZ7fQieYYc1tbG54wSxi7Oi2PVL/QFbhSvzfn2s=; b=Nxux02MaIEaArhqX9z/Qh9+Y09GOj1oduNJLdX8xYKd7vZ3mJlmGEyFLuLCdfVMRVdNDm/73zg1agSieKFJsDxqNChwebNP1mCFtL+W9u4RvudG+YK+YGxC23rjLZIuGKrg8Cy2zNsnZAQUorBZAE17hDttwN0mOBj1boJvhBOg= ARC-Authentication-Results: i=1; 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 1590558104622355.1566510026379; Tue, 26 May 2020 22:41:44 -0700 (PDT) Received: from localhost ([::1]:39380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdoox-00084Z-7n for importer@patchew.org; Wed, 27 May 2020 01:41:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolm-0001CL-KT; Wed, 27 May 2020 01:38:26 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:53065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolk-0001eP-Tg; Wed, 27 May 2020 01:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03q5ZCNz9sSw; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557895; bh=X5fEee/H/+vjeon4K7GwbpFEEkKSFFv14BcGu5OJURw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXEXHJwa1Oo8tLScRhq+ReihYcpaMLqrjqbOmDlcuL57dZsY3JvLz0OY+Jm6Y4Jou FNCVkRZ/2oZwv/BqVsQjVsjKSuuPfXGgl4lOEdWDhRPxGv80ObQunHw6nTonQO3tgf TcKUazt98kebUHjX42gnG4vyzbpaWCVRmQmOByCM= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 04/15] target/ppc: Add support for scv and rfscv instructions Date: Wed, 27 May 2020 15:37:58 +1000 Message-Id: <20200527053809.356168-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, Nicholas Piggin , groug@kaod.org, qemu-ppc@nongnu.org, philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Nicholas Piggin POWER9 adds scv and rfscv instructions and the system call vectored interrupt. Linux does not support this instruction yet but it has been tested with a modified kernel that runs on real hardware. Signed-off-by: Nicholas Piggin Message-Id: <20200507115328.789175-1-npiggin@gmail.com> [dwg: Corrected an overlong line] Signed-off-by: David Gibson --- linux-user/ppc/cpu_loop.c | 1 + target/ppc/cpu.h | 7 ++- target/ppc/excp_helper.c | 98 ++++++++++++++++++++++++--------- target/ppc/helper.h | 1 + target/ppc/translate.c | 53 +++++++++++++++++- target/ppc/translate_init.inc.c | 3 +- 6 files changed, 133 insertions(+), 30 deletions(-) diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index 5b27f8603e..df71e15a25 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -267,6 +267,7 @@ void cpu_loop(CPUPPCState *env) queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case POWERPC_EXCP_SYSCALL: /* System call exception = */ + case POWERPC_EXCP_SYSCALL_VECTORED: cpu_abort(cs, "Syscall exception while in user mode. " "Aborting\n"); break; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 7db7882f52..c1005b04a0 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -127,8 +127,9 @@ enum { POWERPC_EXCP_SDOOR_HV =3D 100, /* ISA 3.00 additions */ POWERPC_EXCP_HVIRT =3D 101, + POWERPC_EXCP_SYSCALL_VECTORED =3D 102, /* scv exception = */ /* EOL = */ - POWERPC_EXCP_NB =3D 102, + POWERPC_EXCP_NB =3D 103, /* QEMU exceptions: used internally during code translation = */ POWERPC_EXCP_STOP =3D 0x200, /* stop translation = */ POWERPC_EXCP_BRANCH =3D 0x201, /* branch instruction = */ @@ -478,6 +479,7 @@ typedef struct ppc_v3_pate_t { /* Facility Status and Control (FSCR) bits */ #define FSCR_EBB (63 - 56) /* Event-Based Branch Facility */ #define FSCR_TAR (63 - 55) /* Target Address Register */ +#define FSCR_SCV (63 - 51) /* System call vectored */ /* Interrupt cause mask and position in FSCR. HFSCR has the same format */ #define FSCR_IC_MASK (0xFFULL) #define FSCR_IC_POS (63 - 7) @@ -487,6 +489,7 @@ typedef struct ppc_v3_pate_t { #define FSCR_IC_TM 5 #define FSCR_IC_EBB 7 #define FSCR_IC_TAR 8 +#define FSCR_IC_SCV 12 =20 /* Exception state register bits definition = */ #define ESR_PIL PPC_BIT(36) /* Illegal Instruction */ @@ -554,6 +557,8 @@ enum { POWERPC_FLAG_VSX =3D 0x00080000, /* Has Transaction Memory (ISA 2.07) = */ POWERPC_FLAG_TM =3D 0x00100000, + /* Has SCV (ISA 3.00) = */ + POWERPC_FLAG_SCV =3D 0x00200000, }; =20 /*************************************************************************= ****/ diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index ace8620026..14d3902982 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -67,6 +67,18 @@ static inline void dump_syscall(CPUPPCState *env) ppc_dump_gpr(env, 8), env->nip); } =20 +static inline void dump_syscall_vectored(CPUPPCState *env) +{ + qemu_log_mask(CPU_LOG_INT, "syscall r0=3D%016" PRIx64 + " r3=3D%016" PRIx64 " r4=3D%016" PRIx64 " r5=3D%016" PRI= x64 + " r6=3D%016" PRIx64 " r7=3D%016" PRIx64 " r8=3D%016" PRI= x64 + " nip=3D" TARGET_FMT_lx "\n", + ppc_dump_gpr(env, 0), ppc_dump_gpr(env, 3), + ppc_dump_gpr(env, 4), ppc_dump_gpr(env, 5), + ppc_dump_gpr(env, 6), ppc_dump_gpr(env, 7), + ppc_dump_gpr(env, 8), env->nip); +} + static inline void dump_hcall(CPUPPCState *env) { qemu_log_mask(CPU_LOG_INT, "hypercall r3=3D%016" PRIx64 @@ -185,7 +197,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; - int srr0, srr1, asrr0, asrr1, lev, ail; + int srr0, srr1, asrr0, asrr1, lev =3D -1, ail; bool lpes0; =20 qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx @@ -421,6 +433,13 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) new_msr |=3D (target_ulong)MSR_HVB; } break; + case POWERPC_EXCP_SYSCALL_VECTORED: /* scv exception = */ + lev =3D env->error_code; + dump_syscall_vectored(env); + env->nip +=3D 4; + new_msr |=3D env->msr & ((target_ulong)1 << MSR_EE); + new_msr |=3D env->msr & ((target_ulong)1 << MSR_RI); + break; case POWERPC_EXCP_FPU: /* Floating-point unavailable exception = */ case POWERPC_EXCP_APU: /* Auxiliary processor unavailable = */ case POWERPC_EXCP_DECR: /* Decrementer exception = */ @@ -724,12 +743,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) break; } =20 - /* Save PC */ - env->spr[srr0] =3D env->nip; - - /* Save MSR */ - env->spr[srr1] =3D msr; - /* Sanity check */ if (!(env->msr_mask & MSR_HVB)) { if (new_msr & MSR_HVB) { @@ -742,14 +755,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) } } =20 - /* If any alternate SRR register are defined, duplicate saved values */ - if (asrr0 !=3D -1) { - env->spr[asrr0] =3D env->spr[srr0]; - } - if (asrr1 !=3D -1) { - env->spr[asrr1] =3D env->spr[srr1]; - } - /* * Sort out endianness of interrupt, this differs depending on the * CPU, the HV mode, etc... @@ -784,14 +789,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) } #endif =20 - /* Jump to handler */ - vector =3D env->excp_vectors[excp]; - if (vector =3D=3D (target_ulong)-1ULL) { - cpu_abort(cs, "Raised an exception without defined vector %d\n", - excp); - } - vector |=3D env->excp_prefix; - /* * AIL only works if there is no HV transition and we are running * with translations enabled @@ -800,10 +797,21 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int = excp_model, int excp) ((new_msr & MSR_HVB) && !(msr & MSR_HVB))) { ail =3D 0; } - /* Handle AIL */ - if (ail) { - new_msr |=3D (1 << MSR_IR) | (1 << MSR_DR); - vector |=3D ppc_excp_vector_offset(cs, ail); + + vector =3D env->excp_vectors[excp]; + if (vector =3D=3D (target_ulong)-1ULL) { + cpu_abort(cs, "Raised an exception without defined vector %d\n", + excp); + } + + vector |=3D env->excp_prefix; + + /* If any alternate SRR register are defined, duplicate saved values */ + if (asrr0 !=3D -1) { + env->spr[asrr0] =3D env->nip; + } + if (asrr1 !=3D -1) { + env->spr[asrr1] =3D msr; } =20 #if defined(TARGET_PPC64) @@ -823,6 +831,37 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) } #endif =20 + if (excp !=3D POWERPC_EXCP_SYSCALL_VECTORED) { + /* Save PC */ + env->spr[srr0] =3D env->nip; + + /* Save MSR */ + env->spr[srr1] =3D msr; + + /* Handle AIL */ + if (ail) { + new_msr |=3D (1 << MSR_IR) | (1 << MSR_DR); + vector |=3D ppc_excp_vector_offset(cs, ail); + } + +#if defined(TARGET_PPC64) + } else { + /* scv AIL is a little different */ + if (ail) { + new_msr |=3D (1 << MSR_IR) | (1 << MSR_DR); + } + if (ail =3D=3D AIL_C000_0000_0000_4000) { + vector |=3D 0xc000000000003000ull; + } else { + vector |=3D 0x0000000000017000ull; + } + vector +=3D lev * 0x20; + + env->lr =3D env->nip; + env->ctr =3D msr; +#endif + } + powerpc_set_excp_state(cpu, vector, new_msr); } =20 @@ -1160,6 +1199,11 @@ void helper_rfid(CPUPPCState *env) do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1]); } =20 +void helper_rfscv(CPUPPCState *env) +{ + do_rfi(env, env->lr, env->ctr); +} + void helper_hrfid(CPUPPCState *env) { do_rfi(env, env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]); diff --git a/target/ppc/helper.h b/target/ppc/helper.h index a95c010391..2dfa1c6942 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -15,6 +15,7 @@ DEF_HELPER_1(rfmci, void, env) #if defined(TARGET_PPC64) DEF_HELPER_2(pminsn, void, env, i32) DEF_HELPER_1(rfid, void, env) +DEF_HELPER_1(rfscv, void, env) DEF_HELPER_1(hrfid, void, env) DEF_HELPER_2(store_lpcr, void, env, tl) DEF_HELPER_2(store_pcr, void, env, tl) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 338529879f..4ce3d664b5 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -173,6 +173,7 @@ struct DisasContext { bool vsx_enabled; bool spe_enabled; bool tm_enabled; + bool scv_enabled; bool gtse; ppc_spr_t *spr_cb; /* Needed to check rights for mfspr/mtspr */ int singlestep_enabled; @@ -4030,6 +4031,24 @@ static void gen_rfid(DisasContext *ctx) #endif } =20 +#if !defined(CONFIG_USER_ONLY) +static void gen_rfscv(DisasContext *ctx) +{ +#if defined(CONFIG_USER_ONLY) + GEN_PRIV; +#else + /* Restore CPU state */ + CHK_SV; + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } + gen_update_cfar(ctx, ctx->base.pc_next - 4); + gen_helper_rfscv(cpu_env); + gen_sync_exception(ctx); +#endif +} +#endif + static void gen_hrfid(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) @@ -4048,6 +4067,7 @@ static void gen_hrfid(DisasContext *ctx) #define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL_USER #else #define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL +#define POWERPC_SYSCALL_VECTORED POWERPC_EXCP_SYSCALL_VECTORED #endif static void gen_sc(DisasContext *ctx) { @@ -4057,6 +4077,23 @@ static void gen_sc(DisasContext *ctx) gen_exception_err(ctx, POWERPC_SYSCALL, lev); } =20 +#if defined(TARGET_PPC64) +#if !defined(CONFIG_USER_ONLY) +static void gen_scv(DisasContext *ctx) +{ + uint32_t lev; + + if (unlikely(!ctx->scv_enabled)) { + gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_SCV); + return; + } + + lev =3D (ctx->opcode >> 5) & 0x7F; + gen_exception_err(ctx, POWERPC_SYSCALL_VECTORED, lev); +} +#endif +#endif + /*** Trap = ***/ =20 /* Check for unconditional traps (always or never) */ @@ -7049,6 +7086,12 @@ GEN_HANDLER(mcrf, 0x13, 0x00, 0xFF, 0x00000001, PPC_= INTEGER), GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW), #if defined(TARGET_PPC64) GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B), +#if !defined(CONFIG_USER_ONLY) +/* Top bit of opc2 corresponds with low bit of LEV, so use two handlers */ +GEN_HANDLER_E(scv, 0x11, 0x10, 0xFF, 0x03FFF01E, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(scv, 0x11, 0x00, 0xFF, 0x03FFF01E, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(rfscv, 0x13, 0x12, 0x02, 0x03FF8001, PPC_NONE, PPC2_ISA300), +#endif GEN_HANDLER_E(stop, 0x13, 0x12, 0x0b, 0x03FFF801, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(doze, 0x13, 0x12, 0x0c, 0x03FFF801, PPC_NONE, PPC2_PM_ISA206= ), GEN_HANDLER_E(nap, 0x13, 0x12, 0x0d, 0x03FFF801, PPC_NONE, PPC2_PM_ISA206), @@ -7056,7 +7099,9 @@ GEN_HANDLER_E(sleep, 0x13, 0x12, 0x0e, 0x03FFF801, PP= C_NONE, PPC2_PM_ISA206), GEN_HANDLER_E(rvwinkle, 0x13, 0x12, 0x0f, 0x03FFF801, PPC_NONE, PPC2_PM_IS= A206), GEN_HANDLER(hrfid, 0x13, 0x12, 0x08, 0x03FF8001, PPC_64H), #endif -GEN_HANDLER(sc, 0x11, 0xFF, 0xFF, 0x03FFF01D, PPC_FLOW), +/* Top bit of opc2 corresponds with low bit of LEV, so use two handlers */ +GEN_HANDLER(sc, 0x11, 0x11, 0xFF, 0x03FFF01D, PPC_FLOW), +GEN_HANDLER(sc, 0x11, 0x01, 0xFF, 0x03FFF01D, PPC_FLOW), GEN_HANDLER(tw, 0x1F, 0x04, 0x00, 0x00000001, PPC_FLOW), GEN_HANDLER(twi, 0x03, 0xFF, 0xFF, 0x00000000, PPC_FLOW), #if defined(TARGET_PPC64) @@ -7835,6 +7880,12 @@ static void ppc_tr_init_disas_context(DisasContextBa= se *dcbase, CPUState *cs) } else { ctx->vsx_enabled =3D false; } + if ((env->flags & POWERPC_FLAG_SCV) + && (env->spr[SPR_FSCR] & (1ull << FSCR_SCV))) { + ctx->scv_enabled =3D true; + } else { + ctx->scv_enabled =3D false; + } #if defined(TARGET_PPC64) if ((env->flags & POWERPC_FLAG_TM) && msr_tm) { ctx->tm_enabled =3D !!msr_tm; diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index d8adc1bd49..38cb773ab4 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -3382,6 +3382,7 @@ static void init_excp_POWER9(CPUPPCState *env) =20 #if !defined(CONFIG_USER_ONLY) env->excp_vectors[POWERPC_EXCP_HVIRT] =3D 0x00000EA0; + env->excp_vectors[POWERPC_EXCP_SYSCALL_VECTORED] =3D 0x00000000; #endif } =20 @@ -9030,7 +9031,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) pcc->flags =3D POWERPC_FLAG_VRE | POWERPC_FLAG_SE | POWERPC_FLAG_BE | POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR | - POWERPC_FLAG_VSX | POWERPC_FLAG_TM; + POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV; pcc->l1_dcache_size =3D 0x8000; pcc->l1_icache_size =3D 0x8000; pcc->interrupts_big_endian =3D ppc_cpu_interrupts_big_endian_lpcr; --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590557971; cv=none; d=zohomail.com; s=zohoarc; b=hCmAFdPxJooN3OAK+vf7enzoukUUoIt23hcTS7xX4NQ6ZWCOqCjNpqjaGUduPauu9qcNWGa1RENCKTR2saXKxha1b8n1fNsslA1U1/bdZuW35fbXCEGV9UNEnYU9DQOb2c/J1bIgOtM0bZe465XlSOt3ZKieSZd05dZWXvAmx+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590557971; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ju50omxmIS4eY9YJZvLKqt2TS1BfJM6wvq9pcaUU5HM=; b=LK1tuak4fKSFzHA97tSuja3SI4wZuWwfNOOppmQuAeUOkR3+4YhYRvxfh4ObC1sL93PB8ZHbvqiprJkXqTuvAQe+qbd2d8m1jAGC5ibPDj1iV1qMlFrqKynLfTV0LUQHDDbyi1Sx9hjf8AQwTgApfG1nv4e8V+IDz0MOwixN9eU= ARC-Authentication-Results: i=1; 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 1590557971514152.43360734686007; Tue, 26 May 2020 22:39:31 -0700 (PDT) Received: from localhost ([::1]:55004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdomo-0002jI-Ad for importer@patchew.org; Wed, 27 May 2020 01:39:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoli-00014v-LS; Wed, 27 May 2020 01:38:22 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:50969 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 1jdolh-0001bo-D4; Wed, 27 May 2020 01:38:22 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03q4nq8z9sSn; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557895; bh=tM/dD/Q1dq5YeZuMnvtetIYBE7QDpqKX/IQGQsvb7Zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLFkuxTJzu5nyn9C9OjYLtrXI+iwBoYEr59MkmHQFRyiPd390C7q/aIJudm7ABI/b bpEA/RkknOY3krR+4ITyCGWKj9MLSuQwZ1WzGZLtV5qJ+8PkMvclIGqibBxfjlOYhN j0X/gLlIi0+vD+6j05B+uP1prsDuCa6yzl8X5Bs8= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 05/15] ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2 Date: Wed, 27 May 2020 15:37:59 +1000 Message-Id: <20200527053809.356168-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 01:38:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, Leonardo Bras , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, Leonardo Bras , Bharata B Rao , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Leonardo Bras On reboot, all memory that was previously added using object_add and device_add is placed in this DIMM area. The new SPAPR_LMB_FLAGS_HOTREMOVABLE flag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed by device_del and object_del. This new flag was accepted in Power Architecture documentation. Signed-off-by: Leonardo Bras Reviewed-by: Bharata B Rao Message-Id: <20200511200201.58537-1-leobras.c@gmail.com> [dwg: Fixed syntax error spotted by C=C3=A9dric Le Goater] Signed-off-by: David Gibson --- hw/ppc/pnv.c | 8 ++++---- hw/ppc/spapr.c | 3 ++- include/hw/ppc/spapr.h | 1 + target/ppc/cpu.h | 21 +++++++++++++++++++++ target/ppc/excp_helper.c | 16 ++++++++-------- 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index f48a61d6d1..806a5d9a8d 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1984,15 +1984,15 @@ static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run= _on_cpu_data arg) =20 cpu_synchronize_state(cs); ppc_cpu_do_system_reset(cs); - if (env->spr[SPR_SRR1] & PPC_BITMASK(46, 47)) { + if (env->spr[SPR_SRR1] & SRR1_WAKESTATE) { /* * Power-save wakeups, as indicated by non-zero SRR1[46:47] put the * wakeup reason in SRR1[42:45], system reset is indicated with 0b= 0100 * (PPC_BIT(43)). */ - if (!(env->spr[SPR_SRR1] & PPC_BIT(43))) { + if (!(env->spr[SPR_SRR1] & SRR1_WAKERESET)) { warn_report("ppc_cpu_do_system_reset does not set system reset= wakeup reason"); - env->spr[SPR_SRR1] |=3D PPC_BIT(43); + env->spr[SPR_SRR1] |=3D SRR1_WAKERESET; } } else { /* @@ -2002,7 +2002,7 @@ static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_o= n_cpu_data arg) * another CPU requesting a NMI IPI) system reset exception should= be * 0b0010 (PPC_BIT(44)). */ - env->spr[SPR_SRR1] |=3D PPC_BIT(44); + env->spr[SPR_SRR1] |=3D SRR1_WAKESCOM; } } =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9b358fcc60..3b1a5ed865 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -445,7 +445,8 @@ static int spapr_dt_dynamic_memory_v2(SpaprMachineState= *spapr, void *fdt, g_assert(drc); elem =3D spapr_get_drconf_cell(size / lmb_size, addr, spapr_drc_index(drc), node, - SPAPR_LMB_FLAGS_ASSIGNED); + (SPAPR_LMB_FLAGS_ASSIGNED | + SPAPR_LMB_FLAGS_HOTREMOVABLE)); QSIMPLEQ_INSERT_TAIL(&drconf_queue, elem, entry); nr_entries++; cur_addr =3D addr + size; diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index d2533e7264..c421410e3f 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -886,6 +886,7 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t= legacy_offset); #define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008 #define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020 #define SPAPR_LMB_FLAGS_RESERVED 0x00000080 +#define SPAPR_LMB_FLAGS_HOTREMOVABLE 0x00000100 =20 void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg); =20 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index c1005b04a0..1988b436cb 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -476,6 +476,27 @@ typedef struct ppc_v3_pate_t { #define SRR1_PROTFAULT DSISR_PROTFAULT #define SRR1_IAMR DSISR_AMR =20 +/* SRR1[42:45] wakeup fields for System Reset Interrupt */ + +#define SRR1_WAKEMASK 0x003c0000 /* reason for wakeup */ + +#define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */ +#define SRR1_WAKEHVI 0x00240000 /* Hypervisor Virt. Interrupt (= P9) */ +#define SRR1_WAKEEE 0x00200000 /* External interrupt */ +#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */ +#define SRR1_WAKEDBELL 0x00140000 /* Privileged doorbell */ +#define SRR1_WAKERESET 0x00100000 /* System reset */ +#define SRR1_WAKEHDBELL 0x000c0000 /* Hypervisor doorbell */ +#define SRR1_WAKESCOM 0x00080000 /* SCOM not in power-saving mod= e */ + +/* SRR1[46:47] power-saving exit mode */ + +#define SRR1_WAKESTATE 0x00030000 /* Powersave exit mask */ + +#define SRR1_WS_HVLOSS 0x00030000 /* HV resources not maintained = */ +#define SRR1_WS_GPRLOSS 0x00020000 /* GPRs not maintained */ +#define SRR1_WS_NOLOSS 0x00010000 /* All resources maintained */ + /* Facility Status and Control (FSCR) bits */ #define FSCR_EBB (63 - 56) /* Event-Based Branch Facility */ #define FSCR_TAR (63 - 55) /* Target Address Register */ diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 14d3902982..a988ba15f4 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -101,7 +101,7 @@ static int powerpc_reset_wakeup(CPUState *cs, CPUPPCSta= te *env, int excp, env->resume_as_sreset =3D false; =20 /* Pretend to be returning from doze always as we don't lose state */ - *msr |=3D (0x1ull << (63 - 47)); + *msr |=3D SRR1_WS_NOLOSS; =20 /* Machine checks are sent normally */ if (excp =3D=3D POWERPC_EXCP_MCHECK) { @@ -109,25 +109,25 @@ static int powerpc_reset_wakeup(CPUState *cs, CPUPPCS= tate *env, int excp, } switch (excp) { case POWERPC_EXCP_RESET: - *msr |=3D 0x4ull << (63 - 45); + *msr |=3D SRR1_WAKERESET; break; case POWERPC_EXCP_EXTERNAL: - *msr |=3D 0x8ull << (63 - 45); + *msr |=3D SRR1_WAKEEE; break; case POWERPC_EXCP_DECR: - *msr |=3D 0x6ull << (63 - 45); + *msr |=3D SRR1_WAKEDEC; break; case POWERPC_EXCP_SDOOR: - *msr |=3D 0x5ull << (63 - 45); + *msr |=3D SRR1_WAKEDBELL; break; case POWERPC_EXCP_SDOOR_HV: - *msr |=3D 0x3ull << (63 - 45); + *msr |=3D SRR1_WAKEHDBELL; break; case POWERPC_EXCP_HV_MAINT: - *msr |=3D 0xaull << (63 - 45); + *msr |=3D SRR1_WAKEHMI; break; case POWERPC_EXCP_HVIRT: - *msr |=3D 0x9ull << (63 - 45); + *msr |=3D SRR1_WAKEHVI; break; default: cpu_abort(cs, "Unsupported exception %d in Power Save mode\n", --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558190; cv=none; d=zohomail.com; s=zohoarc; b=VZa1Q/6QDT9A5kiZrWiesvwk3OGUf/7msMWJL0w66K7IcOBy5sajB/WD25crS1FHvn+ujds+LKnhQwKMK7iyZljmfsyxvmtHUBPw+rjQHIH2/x5sE7bYKF1k+cMLdj+CZS3w7jf43Km/IiGR0A5XehhruJUZNVB/7sJKhP+VDko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558190; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Nc11JIxMf/VYN4BsBEWvOSZJUQnS6EzeDYNEA7Pjdvk=; b=LA1y2Od9UmjeaUHjyh7pkAevJBd3VkLw6YvnvIfNGIdZJ9Fw9OYZdP8XLe2yGABrpDnL5iFc49+7t5pnyd0reTdELnwADCOgy2LoIIk9RClF+vY03ty7aMXaYXXZw/AxRZYmIp3TpINPgl5iSlIQktp1oCnmO+nNcWBKj+Dsx4w= ARC-Authentication-Results: i=1; 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 1590558190525541.544408848406; Tue, 26 May 2020 22:43:10 -0700 (PDT) Received: from localhost ([::1]:45690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdoqL-0002ZA-7T for importer@patchew.org; Wed, 27 May 2020 01:43:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoln-0001DF-0i; Wed, 27 May 2020 01:38:27 -0400 Received: from ozlabs.org ([203.11.71.1]:42241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoll-0001eV-JP; Wed, 27 May 2020 01:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03q6LG3z9sSs; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557895; bh=n1w5x4MWUM3sI147COwZWjKfkJROvjhmcH5edVfKqak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GA2Ioo8kciz8KVjVpuqS5xPs6J6rCJ+nuzxn8wBO1/dH57Jt6La9YQ2iXYORGbBPJ h/8aw+XVp+W90UgLIpDwRvPNEzpGglmFgep8F/hj6Lrmm1ePSVoqyf5LM4OZQdkZdk gbuD1o9iLfttNnEcxs6ZgCbNs9ZxTLrGPHlnU5HM= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 06/15] target/ppc: Pass const pointer to ppc_radix64_get_prot_amr() Date: Wed, 27 May 2020 15:38:00 +1000 Message-Id: <20200527053809.356168-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 01:38:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz This doesn't require write access to the CPU structure. Signed-off-by: Greg Kurz Message-Id: <158941060817.240484.14621015211317485106.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- target/ppc/mmu-radix64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu-radix64.h b/target/ppc/mmu-radix64.h index 96228546aa..f28c5794d0 100644 --- a/target/ppc/mmu-radix64.h +++ b/target/ppc/mmu-radix64.h @@ -55,9 +55,9 @@ static inline int ppc_radix64_get_prot_eaa(uint64_t pte) (pte & R_PTE_EAA_X ? PAGE_EXEC : 0); } =20 -static inline int ppc_radix64_get_prot_amr(PowerPCCPU *cpu) +static inline int ppc_radix64_get_prot_amr(const PowerPCCPU *cpu) { - CPUPPCState *env =3D &cpu->env; + const CPUPPCState *env =3D &cpu->env; int amr =3D env->spr[SPR_AMR] >> 62; /* We only care about key0 AMR63:= 62 */ int iamr =3D env->spr[SPR_IAMR] >> 62; /* We only care about key0 IAMR= 63:62 */ =20 --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558083; cv=none; d=zohomail.com; s=zohoarc; b=TjKG/LH21yL21EqBRlxgb9WDN6xtfzTCANYgzqx8lnEXbc1uOpOi4+Sw2YIYzYBFnQdHseKdKrde5XL60QHXagRSUXn89gQgQlLApRRBAunFRq9HwYCWe1IPOqGPsNrpA/UvGJrXzUD3swwlYuv4VUBgDkBcPT1QjKfuVwqE9b8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558083; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rrUZcHap/wXbK6p5owvlFmc9nDzWaZe3PS9A9pRTBDg=; b=JQwdnChIeKklzviDpIB1RRiySr+9p+hMUMYiLp8qMpuQCUnHWvW2lLbHYzmzRnQToxBRjrKPnesyYKUUJXWLDRIqiQgvnVUXvOVqJfSftU3DxEz0K47afV1v0Em8CIZ+eRMz1nEcOBkSHo/PVI0oy2QvKYrnODy5RTKiseb65ec= ARC-Authentication-Results: i=1; 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 1590558083524496.9679818763175; Tue, 26 May 2020 22:41:23 -0700 (PDT) Received: from localhost ([::1]:37204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdooc-00076Q-8e for importer@patchew.org; Wed, 27 May 2020 01:41:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoln-0001DX-2s; Wed, 27 May 2020 01:38:27 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:41791 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 1jdoll-0001ea-OV; Wed, 27 May 2020 01:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03q6tHZz9sSy; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557895; bh=bbcPOiyOzJWVXNkTbS8c1k0vm+Znts6m8wOzfSzt/4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IL6XwZzfFQzdaGLJDUlhsy4qNl2Tj0jHmCstEgQzxgE/aDFIZPydMknpbT5AgRaml VtE0Q08Jrfo2t/yhFUcgg4Oknmic7MAg/yFis2rdL4p3Btrw3ezUjw3df2LTx4mckC WwIAUodfQTJIxgnEVCN8imiU8mlMh7qIUVU4uLRA= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 07/15] target/ppc: Pass const pointer to ppc_radix64_get_fully_qualified_addr() Date: Wed, 27 May 2020 15:38:01 +1000 Message-Id: <20200527053809.356168-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 01:38:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz This doesn't require write access to the CPU registers. Signed-off-by: Greg Kurz Message-Id: <158941061434.240484.10700096396035994133.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- target/ppc/mmu-radix64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 1404e53dec..c76879f65b 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -28,7 +28,8 @@ #include "mmu-radix64.h" #include "mmu-book3s-v3.h" =20 -static bool ppc_radix64_get_fully_qualified_addr(CPUPPCState *env, vaddr e= addr, +static bool ppc_radix64_get_fully_qualified_addr(const CPUPPCState *env, + vaddr eaddr, uint64_t *lpid, uint64_t = *pid) { if (msr_hv) { /* MSR[HV] -> Hypervisor/bare metal */ --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558082; cv=none; d=zohomail.com; s=zohoarc; b=TQBLLrEJuaPEmaBUzn4n5MMg86sft+CWMFTfNfoLRyqpIqEgzza/IQYxXR9AhU+QR5UU3+TuQzgmzWZSHfnrru1dkY2mVqfTMXtoFeyhWxVAOJ/iaeRFWxZpAQ435sQu8XIhxBbyIuEQlAozgfpPblWsaOaeilbYpvW3IzSZd2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558082; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l1wkDdQHKqnuF10UL8JVvd/sAmqtb1/jY51+7rNlZTg=; b=gB8PiyfyUORPUpyWM98CJ6sJ9BSJxOSMJFKlKT7LnZdeGsrbJpGPVEZLSm9f3iM04hdLrLkriRAKvNRmTij7cQ47DeBich+ZiS9gQJQ2sH1Nk1yH+NKM42v6wsYfVwgeG8qceStTrR+l/UkEx4/oMt9zbfTaxUpxRZ47V6vS25Q= ARC-Authentication-Results: i=1; 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 1590558082301712.3483964643358; Tue, 26 May 2020 22:41:22 -0700 (PDT) Received: from localhost ([::1]:37028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdoob-00071Q-0l for importer@patchew.org; Wed, 27 May 2020 01:41:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoll-0001AZ-VB; Wed, 27 May 2020 01:38:25 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:47895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoll-0001eS-0N; Wed, 27 May 2020 01:38:25 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r0Y7Dz9sT0; Wed, 27 May 2020 15:38:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=KhokEOK/GurpUpa/QEkymwIvT39eY7CJwIkBx5sD8gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9qn7RHq5SmA99apPajBH/e0SptHCvefoRS3fXNd9g+WlOmCeadub5fBKQUxH2sEv pWT7oTvzzDLpnFd8KaBvIF3fYfNiZ4TqppDoCnWP3CLW9v6vWpBb+IvNenI3EoEQWa EYjfr+el2BHRoLDpEKHJugxSX/DsVVTog3UN6Gzg= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 08/15] target/ppc: Don't initialize some local variables in ppc_radix64_xlate() Date: Wed, 27 May 2020 15:38:02 +1000 Message-Id: <20200527053809.356168-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz It is the job of the ppc_radix64_get_fully_qualified_addr() function which is called at the beginning of ppc_radix64_xlate() to set both lpid *and* pid. It doesn't buy us anything to initialize them first. Worse, a bug in ppc_radix64_get_fully_qualified_addr(), eg. failing to set either lpid or pid, would be undetectable by static analysis tools like coverity. Some recent versions of gcc (eg. gcc-9.3.1-2.fc30) may still think that lpid or pid is used uninitialized though, so this also adds default cases in the switch statements to make it clear this cannot happen. Signed-off-by: Greg Kurz Message-Id: <158941062048.240484.9693581559252337111.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- target/ppc/mmu-radix64.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index c76879f65b..07f956c986 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -50,6 +50,8 @@ static bool ppc_radix64_get_fully_qualified_addr(const CP= UPPCState *env, *lpid =3D 0; *pid =3D 0; break; + default: + g_assert_not_reached(); } } else { /* !MSR[HV] -> Guest */ switch (eaddr & R_EADDR_QUADRANT) { @@ -64,6 +66,8 @@ static bool ppc_radix64_get_fully_qualified_addr(const CP= UPPCState *env, *lpid =3D env->spr[SPR_LPIDR]; *pid =3D 0; /* pid set to 0 -> addresses guest operating syste= m */ break; + default: + g_assert_not_reached(); } } =20 @@ -433,7 +437,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr ead= dr, int rwx, bool cause_excp) { CPUPPCState *env =3D &cpu->env; - uint64_t lpid =3D 0, pid =3D 0; + uint64_t lpid, pid; ppc_v3_pate_t pate; int psize, prot; hwaddr g_raddr; --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558299; cv=none; d=zohomail.com; s=zohoarc; b=ZgEEYZN25re9UrMFo7yWe6iqo3uCz85q6Khh4/flkBWnB4F0nC2qahiJfn5gUDIirqaXl9EseHJLL9vEDqlQ76Mm1S+VmDghLBAYyngpf1Umt4EHfl5Rol+Pta/HUxaxOb26CWvW/au2XeyiwjrD/z5fRfObAsJZM/n8yC8FAGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558299; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZwDFgGOXoAK6622Bq8nQZ6rFQkVK+1H/Xpmvf8tqmwc=; b=lZgz5bnsePbmd0/xuwM0MghvOz2j2HB13RHiC9mmk9b2nDCJdMvMMIVbf+qMkP/7rMuxcBS7hxFikZsMicUTUsqeG2RhuHbRp1Sk6gYu/wLbkQkFrr6xUz2F86nzgR6ApibD9ShZwaidXqCO2sYiq82I5eI0Hll3zh71gT2SLhw= ARC-Authentication-Results: i=1; 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 1590558299334348.07880049163543; Tue, 26 May 2020 22:44:59 -0700 (PDT) Received: from localhost ([::1]:53148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdos6-0005cC-09 for importer@patchew.org; Wed, 27 May 2020 01:44:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoln-0001DW-3K; Wed, 27 May 2020 01:38:27 -0400 Received: from ozlabs.org ([203.11.71.1]:54151) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoll-0001eg-Sr; Wed, 27 May 2020 01:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r1D5Pz9sT8; Wed, 27 May 2020 15:38:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=NroXLSplW0fTmfDs0p6T8iGM8Pup0FipWinzYIQ5+Ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UywGzckCJdLypLhjvdL03+VVOkYorcuyjK582idPg4ijKWj4wQgJhhILA7XN2d0BE LYCn1hZBAzlouiaxCqOyXOpsk+n7GZMs7hwSQVZUKuQEnlXz+DR+xgyF6Wyhf7701y IuAbiMCa4pOzh2lpoKnDsuP/xgd3wrDTH2Gif1H8= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 09/15] target/ppc: Add missing braces in ppc_radix64_partition_scoped_xlate() Date: Wed, 27 May 2020 15:38:03 +1000 Message-Id: <20200527053809.356168-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 01:38:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz As per CODING_STYLE. Fixes: d04ea940c597 "target/ppc: Add support for Radix partition-scoped tra= nslation" Signed-off-by: Greg Kurz Message-Id: <158941062665.240484.2663106458734800894.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- target/ppc/mmu-radix64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 07f956c986..fb7dfe25ba 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -286,8 +286,9 @@ static int ppc_radix64_partition_scoped_xlate(PowerPCCP= U *cpu, int rwx, pate.dw0 & PRTBE_R_RPDS, h_raddr, h_page_siz= e, &pte, &fault_cause, &pte_addr) || ppc_radix64_check_prot(cpu, rwx, pte, &fault_cause, h_prot, true))= { - if (pde_addr) /* address being translated was that of a guest pde = */ + if (pde_addr) { /* address being translated was that of a guest pd= e */ fault_cause |=3D DSISR_PRTABLE_FAULT; + } if (cause_excp) { ppc_radix64_raise_hsi(cpu, rwx, eaddr, g_raddr, fault_cause); } --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558179; cv=none; d=zohomail.com; s=zohoarc; b=l8MsDYpBbbyebmM3XmO75t8ACQJDcladymME0pri7S/A0zGGFt/HuTG2bi05O+uYppuCmCBYAkbcIpWKhUSW0M9KRqnP2qruPOND2G4XG738HJzrxmwJx8C2FusU0YLRySz1aUsnXY3KcgJZyNQ+Eg7VoYFw2N0TasJgxQji7MI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558179; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TLexZXxN2HIc2B+dT/GJONbBfLVMwMicRWrORfFXth4=; b=LXCsQe7cBOfQTH/E2LLQK2Nc4WHfKylKBYgELCkeUwJg/jrQL4h/otdM7fXZuanT8hg6msaLXY39bEqCWeiFvnzd+21uF8hhu6iKDYARzf6wZFus+aJJX5SjuD+ZLxeDP/fdEh+qxdbggf7U+SkDyjzL/bHSGRGNo+TJbnr5G54= ARC-Authentication-Results: i=1; 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 1590558179435708.7197102553938; Tue, 26 May 2020 22:42:59 -0700 (PDT) Received: from localhost ([::1]:44592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdoqA-00027V-6i for importer@patchew.org; Wed, 27 May 2020 01:42:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolm-0001Bn-Cg; Wed, 27 May 2020 01:38:26 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:35375) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoll-0001ee-GB; Wed, 27 May 2020 01:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r1rXmz9sTG; Wed, 27 May 2020 15:38:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=oFs/1DHUiY3Rm2+0DGzW6SZI/mjNmnW0jD38QyXReX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BDHYPlJHL6YdXAuVUGRetEl/3ywJ8C15QF/MGSwA74acq2ATRB5U/dLFPZEtn2xoh VWuBdc8dgCYibQe/Yr/ZaS1zgwUmgARt36Uj2NgRbqqLj+kXvtk9t4BHmHaOH6Gs83 CypiurfPlwuAOMDCP/OTwInbZE8zsQpzv/dYnF5s= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 10/15] target/ppc: Fix arguments to ppc_radix64_partition_scoped_xlate() Date: Wed, 27 May 2020 15:38:04 +1000 Message-Id: <20200527053809.356168-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz The last two arguments have the bool type. Also, we shouldn't raise an exception when using gdbstub. This was found while reading the code. Since it only affects the powernv machine, I didn't dig further to find an actual bug. Fixes: d04ea940c597 "target/ppc: Add support for Radix partition-scoped tra= nslation" Signed-off-by: Greg Kurz Message-Id: <158941063281.240484.9114539141307005992.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- target/ppc/mmu-radix64.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index fb7dfe25ba..7ce37cb778 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -339,7 +339,8 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, */ ret =3D ppc_radix64_partition_scoped_xlate(cpu, 0, eaddr, prtbe_ad= dr, pate, &h_raddr, &h_prot, - &h_page_size, 1, 1); + &h_page_size, true, + cause_excp); if (ret) { return ret; } @@ -378,7 +379,8 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, do { ret =3D ppc_radix64_partition_scoped_xlate(cpu, 0, eaddr, pte_= addr, pate, &h_raddr, &h_pr= ot, - &h_page_size, 1, 1); + &h_page_size, true, + cause_excp); if (ret) { return ret; } --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558237; cv=none; d=zohomail.com; s=zohoarc; b=XFAVBDBZjkUa1xPV4LcS0Pfwgxz409KQBPeON9JDsqwKcabKKt7ByBBxKxClSfX9oVlh8pVTgRNK2Om0jxAx1I72cwyMnKCfYy1pgYLPleipgvQ4T6SreyrxvUSW13/Z7ZizLXOu6q8d9lPlj2KIxtMSciEpAR5J7IgwaOtAGhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558237; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZAnSOVsNeHZKzBVUwtuLj+Oz5CSER1msoeVNHLD06Gw=; b=ZoVW2JwuIUhYOF32hWzwnX1gD1RqKijjGs2wliJYvu0OAAlmB3L/r6cxeAtPSFTkJ5Jxz1v/pIwn3N6fRWTv8xijca3XFmJNeZW/lOLA/LavIZcsrNgUbQHZ4zzaNC2HPRqP3G94TVqeqO5Y5EOG/1MZG3Up64laUHmtOkWdIgo= ARC-Authentication-Results: i=1; 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 1590558237269305.20717247513005; Tue, 26 May 2020 22:43:57 -0700 (PDT) Received: from localhost ([::1]:48204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdor4-0003aC-1r for importer@patchew.org; Wed, 27 May 2020 01:43:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoln-0001DJ-1a; Wed, 27 May 2020 01:38:27 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:53057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoll-0001ei-Kg; Wed, 27 May 2020 01:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r2l37z9sTK; Wed, 27 May 2020 15:38:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=V7+62qseqtwt71VNf/uBxCQnQbUz3nRZHhrS5KZw8hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSli55tGR/umJJgzWcCvDZrv90E3w5sdMLTwEp8v/4ZBzZJYHiLcqLPvp7EbEOPCR jxetkQplRM04Cac0nE6uEP3KysyaPS/WDSMWMIqB7AoowDtG5NLSl7oCx05oMFGoZQ t2hktRmQbahe11dBBBF7B1adjmewmZ0Ql9Mbv2F0= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 11/15] target/ppc: Don't update radix PTE R/C bits with gdbstub Date: Wed, 27 May 2020 15:38:05 +1000 Message-Id: <20200527053809.356168-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz gdbstub shouldn't silently change guest visible state when doing address translation. Since the R/C bits can only be updated when handling a MMU fault, let's reuse the cause_excp flag and rename it to guest_visible. While here drop a not very useful comment. This was found while reading the code. I could verify that this affects both powernv and pseries, but I failed to observe any actual bug. Fixes: d04ea940c597 "target/ppc: Add support for Radix partition-scoped tra= nslation" Signed-off-by: Greg Kurz Message-Id: <158941063899.240484.2778628492106387793.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- target/ppc/mmu-radix64.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 7ce37cb778..0d3922537c 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -274,7 +274,7 @@ static int ppc_radix64_partition_scoped_xlate(PowerPCCP= U *cpu, int rwx, ppc_v3_pate_t pate, hwaddr *h_raddr, int *h_prot, int *h_page_size, bool pde_a= ddr, - bool cause_excp) + bool guest_visible) { int fault_cause =3D 0; hwaddr pte_addr; @@ -289,14 +289,15 @@ static int ppc_radix64_partition_scoped_xlate(PowerPC= CPU *cpu, int rwx, if (pde_addr) { /* address being translated was that of a guest pd= e */ fault_cause |=3D DSISR_PRTABLE_FAULT; } - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_hsi(cpu, rwx, eaddr, g_raddr, fault_cause); } return 1; } =20 - /* Update Reference and Change Bits */ - ppc_radix64_set_rc(cpu, rwx, pte, pte_addr, h_prot); + if (guest_visible) { + ppc_radix64_set_rc(cpu, rwx, pte, pte_addr, h_prot); + } =20 return 0; } @@ -305,7 +306,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, vaddr eaddr, uint64_t pid, ppc_v3_pate_t pate, hwaddr *g_= raddr, int *g_prot, int *g_page_size, - bool cause_excp) + bool guest_visible) { CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; @@ -319,7 +320,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, size =3D 1ULL << ((pate.dw1 & PATE1_R_PRTS) + 12); if (offset >=3D size) { /* offset exceeds size of the process table */ - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_si(cpu, rwx, eaddr, DSISR_NOPTE); } return 1; @@ -340,7 +341,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, ret =3D ppc_radix64_partition_scoped_xlate(cpu, 0, eaddr, prtbe_ad= dr, pate, &h_raddr, &h_prot, &h_page_size, true, - cause_excp); + guest_visible); if (ret) { return ret; } @@ -360,7 +361,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, &fault_cause, &pte_addr); if (ret) { /* No valid PTE */ - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_si(cpu, rwx, eaddr, fault_cause); } return ret; @@ -380,7 +381,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, ret =3D ppc_radix64_partition_scoped_xlate(cpu, 0, eaddr, pte_= addr, pate, &h_raddr, &h_pr= ot, &h_page_size, true, - cause_excp); + guest_visible); if (ret) { return ret; } @@ -389,7 +390,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, &nls, g_page_size, &pte, &fault_c= ause); if (ret) { /* No valid pte */ - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_si(cpu, rwx, eaddr, fault_cause); } return ret; @@ -406,13 +407,15 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCP= U *cpu, int rwx, =20 if (ppc_radix64_check_prot(cpu, rwx, pte, &fault_cause, g_prot, false)= ) { /* Access denied due to protection */ - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_si(cpu, rwx, eaddr, fault_cause); } return 1; } =20 - ppc_radix64_set_rc(cpu, rwx, pte, pte_addr, g_prot); + if (guest_visible) { + ppc_radix64_set_rc(cpu, rwx, pte, pte_addr, g_prot); + } =20 return 0; } @@ -437,7 +440,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU = *cpu, int rwx, static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr eaddr, int rwx, bool relocation, hwaddr *raddr, int *psizep, int *protp, - bool cause_excp) + bool guest_visible) { CPUPPCState *env =3D &cpu->env; uint64_t lpid, pid; @@ -447,7 +450,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr ead= dr, int rwx, =20 /* Virtual Mode Access - get the fully qualified address */ if (!ppc_radix64_get_fully_qualified_addr(&cpu->env, eaddr, &lpid, &pi= d)) { - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_segi(cpu, rwx, eaddr); } return 1; @@ -460,13 +463,13 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr e= addr, int rwx, vhc->get_pate(cpu->vhyp, &pate); } else { if (!ppc64_v3_get_pate(cpu, lpid, &pate)) { - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_si(cpu, rwx, eaddr, DSISR_NOPTE); } return 1; } if (!validate_pate(cpu, lpid, &pate)) { - if (cause_excp) { + if (guest_visible) { ppc_radix64_raise_si(cpu, rwx, eaddr, DSISR_R_BADCONFIG); } return 1; @@ -487,7 +490,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr ead= dr, int rwx, if (relocation) { int ret =3D ppc_radix64_process_scoped_xlate(cpu, rwx, eaddr, pid, pate, &g_raddr, &prot, - &psize, cause_excp); + &psize, guest_visible); if (ret) { return ret; } @@ -510,7 +513,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr ead= dr, int rwx, =20 ret =3D ppc_radix64_partition_scoped_xlate(cpu, rwx, eaddr, g_= raddr, pate, raddr, &prot, &= psize, - 0, cause_excp); + 0, guest_visible); if (ret) { return ret; } --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558199; cv=none; d=zohomail.com; s=zohoarc; b=kbK0zrZsGepzVNguvAmnubGQIHpmonqWCUqH5FWfyv01uR+SL/mCIAIgIjf1L98IJ/uUN2/8jMZd4xl0JzEFPU/u3/Iw+QobLrNJDTdgg1UKljDiSF1zoW04Bld8UKlf6961GLwg0GreFrtOIuKm2N8fqPLVqt1ZGv3//g2qaVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558199; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4kJAl/yE6IrMM602k1cx1e887VZE802vA65wVgTmiNY=; b=YQF36AGyJQ3XjyjV9QTbR8baaMtUxtIBwW9ur4gRkgLqy3bHee9nuKNYnhy1ph4J6z4VxNstSdo18Fm7EOqsyv6m2h1/b5Yi9gVEZOQOeTrGlK/ZnjJXqYKsWD/OmIp5uwh3QLeSMNKx92gEiNgO9JnBO1iVYtfpUlhNwp+G31o= ARC-Authentication-Results: i=1; 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 1590558199837676.1285754385976; Tue, 26 May 2020 22:43:19 -0700 (PDT) Received: from localhost ([::1]:46558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdoqU-0002uT-I5 for importer@patchew.org; Wed, 27 May 2020 01:43:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdoln-0001DY-2v; Wed, 27 May 2020 01:38:27 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:58441 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 1jdolm-0001ek-2p; Wed, 27 May 2020 01:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r3Qwyz9sTN; Wed, 27 May 2020 15:38:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=ETSGs96TSR7w2U8n99R4HifZTQ3fmStvJb44mdxdVls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfsnTr2E2+KBrLhrugnzrB59nH1WDl4Tz1kg+Q1ZW2+YNeHUx90oOla3742s4Go+G EhYHVATEb1EWLThCyodlc4FGY2q0wfbhixZyfHAwjvUv2QWe+PVcktBARSh84mZN2l E56ElhMAKVo6ebJeeAtS2j+mk4HyC6Fty7eEgd6E= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 12/15] hw/pci-bridge/dec: Remove dead debug code Date: Wed, 27 May 2020 15:38:06 +1000 Message-Id: <20200527053809.356168-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 01:38:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Remove debug code never used since added in commit e1c6bbabee30. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200525033910.26166-1-f4bug@amsat.org> Signed-off-by: David Gibson --- hw/pci-bridge/dec.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c index 3ae2f788a4..952bc71122 100644 --- a/hw/pci-bridge/dec.c +++ b/hw/pci-bridge/dec.c @@ -32,16 +32,6 @@ #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_bus.h" =20 -/* debug DEC */ -//#define DEBUG_DEC - -#ifdef DEBUG_DEC -#define DEC_DPRINTF(fmt, ...) \ - do { printf("DEC: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DEC_DPRINTF(fmt, ...) -#endif - #define DEC_21154(obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154) =20 typedef struct DECState { --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558395; cv=none; d=zohomail.com; s=zohoarc; b=W8s+a4MTuchHx/wI8ijyC14/MG348OEUVsnf/psHv0b/7gDwzh7J+LLNC36KHnWZOABJRTP3phrkNjNUitF3sJIiIeUuQ2T4xUfKtYZkXWDwoItwCyuGLteCYCtYZ4Giqs1iCIwB1eddWXs2A3ovq52FQ3DksF5ci8BYOZhjVP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558395; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bi35DO+kE/EsuP/er2UV/wBDZVbGSMuZxpDpkkgWKFw=; b=CIma2oAEc0HxRv9DPMcM8p5/ig9dea2MhcNOD4csiiTow7M9eOuFcb+CuKepIA4HHHkXndXh8K5R4ZeRHEtIgXDB9EMnpG+6SZ21y4mq8xZQFVA/z7EzwoWuLzT8yy5XZ5Qp3qEvhs6YsyfACCn8E44FEtOqJZVPI6h9KOwRH/0= ARC-Authentication-Results: i=1; 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 1590558395739704.592945423271; Tue, 26 May 2020 22:46:35 -0700 (PDT) Received: from localhost ([::1]:58656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdote-00007W-AW for importer@patchew.org; Wed, 27 May 2020 01:46:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolp-0001L9-OS; Wed, 27 May 2020 01:38:29 -0400 Received: from ozlabs.org ([203.11.71.1]:40021) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolo-0001fs-M5; Wed, 27 May 2020 01:38:29 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r4RYPz9sTP; Wed, 27 May 2020 15:38:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=dETticln5jue/6C4D6AhTH9jzwfw913NTSrQRT2LqDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkzzrtoyFhGb7Hbgl8Zqx5M1RS4Tjht/EFle+/y5qqsCiONDI/cvBhDCcX/wMzb9i R8gaXdwfuWqYWFV21NRIs0KIPx/eTeVZWhy4olKhNvqsHKnUfHpGdCx+8yJHLXZEBv h6vpzMc0UTWT1XkGXgDPA1U1wXhwnpizONc8ZZj4= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 13/15] hw/nvram/mac_nvram: Convert debug printf()s to trace events Date: Wed, 27 May 2020 15:38:07 +1000 Message-Id: <20200527053809.356168-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 01:38:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Convert NVR_DPRINTF() to trace events and remove ifdef'ry. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200524165126.13920-1-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/nvram/mac_nvram.c | 17 +++-------------- hw/nvram/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c index ff5db03e6b..beec1c4e4d 100644 --- a/hw/nvram/mac_nvram.c +++ b/hw/nvram/mac_nvram.c @@ -30,18 +30,9 @@ #include "migration/vmstate.h" #include "qemu/cutils.h" #include "qemu/module.h" +#include "trace.h" #include =20 -/* debug NVR */ -//#define DEBUG_NVR - -#ifdef DEBUG_NVR -#define NVR_DPRINTF(fmt, ...) \ - do { printf("NVR: " fmt , ## __VA_ARGS__); } while (0) -#else -#define NVR_DPRINTF(fmt, ...) -#endif - #define DEF_SYSTEM_SIZE 0xc10 =20 /* macio style NVRAM device */ @@ -51,9 +42,8 @@ static void macio_nvram_writeb(void *opaque, hwaddr addr, MacIONVRAMState *s =3D opaque; =20 addr =3D (addr >> s->it_shift) & (s->size - 1); + trace_macio_nvram_write(addr, value); s->data[addr] =3D value; - NVR_DPRINTF("writeb addr %04" HWADDR_PRIx " val %" PRIx64 "\n", - addr, value); } =20 static uint64_t macio_nvram_readb(void *opaque, hwaddr addr, @@ -64,8 +54,7 @@ static uint64_t macio_nvram_readb(void *opaque, hwaddr ad= dr, =20 addr =3D (addr >> s->it_shift) & (s->size - 1); value =3D s->data[addr]; - NVR_DPRINTF("readb addr %04" HWADDR_PRIx " val %" PRIx32 "\n", - addr, value); + trace_macio_nvram_read(addr, value); =20 return value; } diff --git a/hw/nvram/trace-events b/hw/nvram/trace-events index 0dea9260ce..e023193295 100644 --- a/hw/nvram/trace-events +++ b/hw/nvram/trace-events @@ -13,3 +13,7 @@ fw_cfg_add_string(uint16_t key_value, const char *key_nam= e, const char *value) " fw_cfg_add_i16(uint16_t key_value, const char *key_name, uint16_t value) "= key 0x%04" PRIx16 " '%s', value 0x%" PRIx16 fw_cfg_add_i32(uint16_t key_value, const char *key_name, uint32_t value) "= key 0x%04" PRIx16 " '%s', value 0x%" PRIx32 fw_cfg_add_i64(uint16_t key_value, const char *key_name, uint64_t value) "= key 0x%04" PRIx16 " '%s', value 0x%" PRIx64 + +# mac_nvram.c +macio_nvram_read(uint32_t addr, uint8_t val) "read addr=3D0x%04"PRIx32" va= l=3D0x%02x" +macio_nvram_write(uint32_t addr, uint8_t val) "write addr=3D0x%04"PRIx32" = val=3D0x%02x" --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558455; cv=none; d=zohomail.com; s=zohoarc; b=jED/5KzgGwvIFTwQ3dwLSa41A8uW6glkyiRjyMeRrwZvxzVcJkUm4YjIuZndZ/B+oCySVBkytWuxNaOSyPuvnBuFZlWPDNcXdLBQ58RCz0wSvf84go/BkWwbVq31L/g+DBe7iJeMOqND1T4pFDqYQrsV2SvacIlp3/mOshcNxbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558455; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uSfKfTQOY6F+oh84Yk9rR+HFNeYPFdmQgdju5yTk1jM=; b=D1nlEDxEwsRwH9PKr5GfiXJp0yl1xqjj0WzquJckBb7tMBxCtQiZHftMYLnJja+dPgQKO5BgC4eCq3O+FKRVvYFFX4W7Jda6j8rLInlCysd9Meg4f1PLtUCaRc74q+Z72+wvtvyleSNbhorUgCc9kS3OseXvoMzfUOmZK6IX2H4= ARC-Authentication-Results: i=1; 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 1590558455344410.68943432583444; Tue, 26 May 2020 22:47:35 -0700 (PDT) Received: from localhost ([::1]:34022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdouc-0001c1-2N for importer@patchew.org; Wed, 27 May 2020 01:47:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolp-0001KW-HC; Wed, 27 May 2020 01:38:29 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:50721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolo-0001g6-LM; Wed, 27 May 2020 01:38:29 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r5Rszz9sTR; Wed, 27 May 2020 15:38:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=ZdziwBbHkLdIQ4OII0MTdm9IDgKyNZtOw/B7Z808atI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ff/+s4g1xs+5tdo88LExNQWKrbQFuOVjX6t2Fvpkl3vsiN0fTmAoc5uB2PhrilhVq aKHzrXltHChI3YghCvpxI+bT3DqtMoT+elVygergxLdoEUKg1eZ8etWQaBARd3D1/2 U8rsqkmoLFbBWpFJgjOkCN0882Xii5N31Tzxk0cc= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 14/15] target/ppc: Fix argument to ppc_radix64_partition_scoped_xlate() again Date: Wed, 27 May 2020 15:38:08 +1000 Message-Id: <20200527053809.356168-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz The penultimate argument of function ppc_radix64_partition_scoped_xlate() has the bool type. Fixes: d04ea940c597 "target/ppc: Add support for Radix partition-scoped tra= nslation" Signed-off-by: Greg Kurz Message-Id: <159051003729.407106.10610703877543955831.stgit@bahia.lan> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- target/ppc/mmu-radix64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 0d3922537c..c60bf31357 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -513,7 +513,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr ead= dr, int rwx, =20 ret =3D ppc_radix64_partition_scoped_xlate(cpu, rwx, eaddr, g_= raddr, pate, raddr, &prot, &= psize, - 0, guest_visible); + false, guest_visible); if (ret) { return ret; } --=20 2.26.2 From nobody Sat May 18 08:46:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1590558336; cv=none; d=zohomail.com; s=zohoarc; b=UDLT2HLYfJqs6SFXeFpseasj5i+VUkuWADFx/ja7eFa10vZbp3H88Vw+orntPrBcoZVUbfO1acnCRZGGJnaCwCAkWhWT7ZVuQ0hJjYT0c2rt1qj6Gux2XFzGtFxMQG4k2SaPHDw1UCOkhdEebNYHTfmtHFnCuAVH679uMznkL6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590558336; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MYh+aIRrxUVGwUIRTs8bzz6BNsAgtBy4PBqkFiSCpIk=; b=HLFEb2zM+NQ3TFXxIVyhCDBPzohDZkC1bmawbvlOF10QkK/UJ4vzZB+4dIa7jJlXTbM48KwoiErwIL+/v0UDrzxzh2u90oDUFdEC+2eg60fxE1HCvai+jzCFkusL8LSbWEpSIMFtj1GoSSIjh2ETYUTRFYZNFtf/Hf4SbVwuZrM= ARC-Authentication-Results: i=1; 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 159055833673417.263698817018508; Tue, 26 May 2020 22:45:36 -0700 (PDT) Received: from localhost ([::1]:54910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdosh-0006QS-4j for importer@patchew.org; Wed, 27 May 2020 01:45:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolp-0001Lq-W9; Wed, 27 May 2020 01:38:30 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:60563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdolo-0001gD-R0; Wed, 27 May 2020 01:38:29 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49X03r67ZGz9sTS; Wed, 27 May 2020 15:38:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590557896; bh=mTRQ3UkFdW4Cd5hGSYESFKYSCtE5pkmUVvHesx/YgEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GtgW6IkZshUDlvq31wFtyFfpHey/Pc87a5JyuHEWblXslapzaXowwsHNtSpEomWLm NWgyovf5iGuUe/epVT1pl3aKXT35VbwIz/IM1zqJgoUfgrNNTnZFNbB5aPMjSjgACn B0u8Pt12BFXYod7Cs73FIWoX8I8x/md9/gH2QIFU= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 15/15] vfio/nvlink: Remove exec permission to avoid SELinux AVCs Date: Wed, 27 May 2020 15:38:09 +1000 Message-Id: <20200527053809.356168-16-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527053809.356168-1-david@gibson.dropbear.id.au> References: <20200527053809.356168-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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: lvivier@redhat.com, Leonardo Bras , qemu-devel@nongnu.org, groug@kaod.org, Alex Williamson , qemu-ppc@nongnu.org, philmd@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Leonardo Bras If SELinux is setup without 'execmem' permission for qemu, all mmap with (PROT_WRITE | PROT_EXEC) will fail and print a warning in SELinux log. If "nvlink2-mr" memory allocation fails (fist diff), it will cause guest NUMA nodes to not be correctly configured (V100 memory will not be visible for guest, nor its NUMA nodes). Not having 'execmem' permission is intesting for virtual machines to avoid buffer-overflow based attacks, and it's adopted in distros like RHEL. So, removing the PROT_EXEC flag seems the right thing to do. Browsing some other code that mmaps memory for usage with memory_region_init_ram_device_ptr, I could notice it's usual to not have PROT_EXEC (only PROT_READ | PROT_WRITE), so it should be no problem around this. Signed-off-by: Leonardo Bras Message-Id: <20200501055448.286518-1-leobras.c@gmail.com> Acked-by: Alex Williamson Signed-off-by: David Gibson --- hw/vfio/pci-quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 3bd05fed12..f2155ddb1d 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1620,7 +1620,7 @@ int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev= , Error **errp) } cap =3D (void *) hdr; =20 - p =3D mmap(NULL, nv2reg->size, PROT_READ | PROT_WRITE | PROT_EXEC, + p =3D mmap(NULL, nv2reg->size, PROT_READ | PROT_WRITE, MAP_SHARED, vdev->vbasedev.fd, nv2reg->offset); if (p =3D=3D MAP_FAILED) { ret =3D -errno; @@ -1680,7 +1680,7 @@ int vfio_pci_nvlink2_init(VFIOPCIDevice *vdev, Error = **errp) =20 /* Some NVLink bridges may not have assigned ATSD */ if (atsdreg->size) { - p =3D mmap(NULL, atsdreg->size, PROT_READ | PROT_WRITE | PROT_EXEC, + p =3D mmap(NULL, atsdreg->size, PROT_READ | PROT_WRITE, MAP_SHARED, vdev->vbasedev.fd, atsdreg->offset); if (p =3D=3D MAP_FAILED) { ret =3D -errno; --=20 2.26.2