From nobody Sun Feb 8 09:27:12 2026 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645006410331722.16438577816; Wed, 16 Feb 2022 02:13:30 -0800 (PST) Received: from localhost ([::1]:34288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKHJR-0007NA-1X for importer@patchew.org; Wed, 16 Feb 2022 05:13:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKHHL-0004Do-M1; Wed, 16 Feb 2022 05:11:20 -0500 Received: from [2607:f8b0:4864:20::c32] (port=44641 helo=mail-oo1-xc32.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKHHJ-00028F-H0; Wed, 16 Feb 2022 05:11:19 -0500 Received: by mail-oo1-xc32.google.com with SMTP id o128-20020a4a4486000000b003181707ed40so1858219ooa.11; Wed, 16 Feb 2022 02:11:16 -0800 (PST) Received: from rekt.ibmmodules.com ([2804:431:c7c6:367f:eb9c:8725:6b7f:76b3]) by smtp.gmail.com with ESMTPSA id y1sm17612689oad.38.2022.02.16.02.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 02:11:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EpGEy8fDu3EubxFFZaGiLhh8nzXGXNhzkEkvUY5o5LI=; b=XJ+jGUCe1KywNjWWLE0K9eLtLpJziYk/8RGaWyp85SEbILKon59ZAVCnHgdljZ22vF V8bepRSQQfwUdETxGxp4ZcKuchL3UD4igK7ZqHQ3LhIS0Sv66cQYYfWIeWw/v2i+5KoF rB1sRPwuiJdO8EslLpFA+6iJYqnSXJwj7VvSumBMHHaepVOg4T3WZ6WdKGf5TCTZgLeC GOEREiJ/kBa82YuXyQyWusSEgulC7n5Fe5eCGuwEyr/vp9ILH8kQ2sdONCCHJWunCsdX CO/+AKDBILpVrgkcZlLnhhiLpLRBINqwS56WZBPGcMBeuRcTw3AWZYBaG1v2bXtLPxeC oo5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EpGEy8fDu3EubxFFZaGiLhh8nzXGXNhzkEkvUY5o5LI=; b=y2FJ4hOlCHOEyK2s+WX2VBeN9sOi+kBzxyD6G1fSGxYULWYj79LesyEnaFuEYb6NHe Ct1ocr6Z5Rm/Exj1rmu64LlARo/+GjFz+FgJ/qTKw+nHaxI06/i9kFN5VK15wwbWBLaX tueW9K6KVR5w1kFYCMsSi60oHwrvqLydyyhIKNKcQvvxCMqQEZDP/wHyKySf+1jsrPbQ 9CTDa8pch/3v3KEq8yCPVK/mWtbjUOMvK3tkZ73qdcF8fjgzoY4bZWvcR0b6AqcFKMIa PGkSzm3q1wCv2TlTVQBJ+ZaczMZsu0M8I2sVnE7Oj1A4DmgZhsDT3mCnRj2zpOQN2ZpD 2L1Q== X-Gm-Message-State: AOAM532Jvji2+7vhEE8irDycBWubiNaJvBmF6Q2UyGog9A/4+3BEse6N 1g18Tm8Y4Kj42t/NXV95EjPHXDc6TIo= X-Google-Smtp-Source: ABdhPJwx7YUODW23xDh+stULtom135pF9d/qIFCLYWzKQH12EGvEEWtL0pkJjMC3Yn0XNmt+2aDQEw== X-Received: by 2002:a05:6871:4182:b0:d2:808e:c293 with SMTP id lc2-20020a056871418200b000d2808ec293mr206485oab.302.1645006275251; Wed, 16 Feb 2022 02:11:15 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v12 1/5] target/ppc: fix indent of powerpc_set_excp_state() Date: Wed, 16 Feb 2022 07:10:58 -0300 Message-Id: <20220216101102.179158-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216101102.179158-1-danielhb413@gmail.com> References: <20220216101102.179158-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::c32 (failed) 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=2607:f8b0:4864:20::c32; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc32.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645006411737100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: David Gibson Signed-off-by: Daniel Henrique Barboza --- target/ppc/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index fcc83a7701..bbc75afbc0 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -361,7 +361,7 @@ static void ppc_excp_apply_ail(PowerPCCPU *cpu, int exc= p, target_ulong msr, #endif =20 static void powerpc_set_excp_state(PowerPCCPU *cpu, - target_ulong vector, target_ulon= g msr) + target_ulong vector, target_ulong msr) { CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; --=20 2.34.1 From nobody Sun Feb 8 09:27:12 2026 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645006587026771.7489437487673; Wed, 16 Feb 2022 02:16:27 -0800 (PST) Received: from localhost ([::1]:41966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKHMH-0004NV-I0 for importer@patchew.org; Wed, 16 Feb 2022 05:16:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKHHN-0004Ix-Ji; Wed, 16 Feb 2022 05:11:21 -0500 Received: from [2607:f8b0:4864:20::c30] (port=33325 helo=mail-oo1-xc30.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKHHL-00028d-Uo; Wed, 16 Feb 2022 05:11:21 -0500 Received: by mail-oo1-xc30.google.com with SMTP id f11-20020a4abb0b000000b002e9abf6bcbcso1950096oop.0; Wed, 16 Feb 2022 02:11:19 -0800 (PST) Received: from rekt.ibmmodules.com ([2804:431:c7c6:367f:eb9c:8725:6b7f:76b3]) by smtp.gmail.com with ESMTPSA id y1sm17612689oad.38.2022.02.16.02.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 02:11:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mEXvtJYPsYtAmg+LDvDMqH7OKii6TP66eGiUs1MUwOM=; b=g3545fzBk2cJ+LPps9mmLyJQB+Zrcq5agDkXg0sGWp7oiN8EAX86hgAD5bSuE4i/vi TFKYvABZ4G2KO0ssfvUtCt0OgNEIYbxanZ5y2LIVKz38rxDPVgfTPToY3n/HM6Ygl/18 L9x7KS97mNUOojchplEPur5GkSJTmqMXMEI7Fe/HFGHK/T+Jwc+KG+Qi0/IVCfaDcmTt zMcAocT/zfNYlXayzpyjiGP/yxxt71NbPfmuMUS44SKQ50/FB6sFa0BZ8uSaKCKL6Gzi HWQC3rVtgOJwSlHt9+yqzOGK5l3LVMTwoNSeJW+xZMagAQ0B3pmHAYnyTj9iXoYC3dI2 LDOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mEXvtJYPsYtAmg+LDvDMqH7OKii6TP66eGiUs1MUwOM=; b=w7Rh5o3g1sTz+KCyPQUZzm7jG9c9hg/pTim4CxZ6zBxDI5R4pM+hLP4dl98yuvOiAN YlqizuUjwgFdMsbKM0atNi0mozavqOltq6MCxsds+Mjv1mbEnSExnOO16rIgCRLmp9FN 6TsVfXJl0zZHpBYaUx/6YmWY8R+pOUFjIaUUeYMjsJ0GE46k7cqn0lhoTLmh/kPcFujz +npNXh0vL38NqQUYjIM4yE7QfgBe/Khfk+otIv/3P8ZEu1R5pKhlSmrlSMzmDEUus32x iZEHgSl/8Qp3Y3VXqcZO4vdyOPpRK+hzPxuiuETrGdvIUzGYBdwFliWOsJPv3wlXE5pK +tfQ== X-Gm-Message-State: AOAM530M+INrY9m/5+VDvlPb7icE1ByqB5iZSgio5A2X9HCdjOJd4LBp X4DGeNfdrEVOKuLCFso9CJAJ8DyDw2I= X-Google-Smtp-Source: ABdhPJybGxVJCrocV0br2Bg8Bd+hK7HbpE8aQLBbHNiwSl6tetGOg6QgdR0Ou9tuKk0ve0J0139Bwg== X-Received: by 2002:a05:6870:a78d:b0:c4:7dc0:d78a with SMTP id x13-20020a056870a78d00b000c47dc0d78amr190657oao.349.1645006278243; Wed, 16 Feb 2022 02:11:18 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v12 2/5] target/ppc: make power8-pmu.c CONFIG_TCG only Date: Wed, 16 Feb 2022 07:10:59 -0300 Message-Id: <20220216101102.179158-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216101102.179158-1-danielhb413@gmail.com> References: <20220216101102.179158-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::c30 (failed) 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=2607:f8b0:4864:20::c30; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc30.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabiano Rosas , Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645006588882100001 Content-Type: text/plain; charset="utf-8" This is an exclusive TCG helper. Gating it with CONFIG_TCG and changing meson.build accordingly will prevent problems --disable-tcg and --disable-linux-user later on. Suggested-by: Fabiano Rosas Signed-off-by: Daniel Henrique Barboza --- target/ppc/cpu_init.c | 5 ++--- target/ppc/machine.c | 2 ++ target/ppc/meson.build | 2 +- target/ppc/power8-pmu.h | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index d97f718354..8fc644f8d6 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -6379,7 +6379,7 @@ static void register_power9_mmu_sprs(CPUPPCState *env) */ static void init_tcg_pmu_power8(CPUPPCState *env) { -#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) +#if defined(CONFIG_TCG) /* Init PMU overflow timers */ if (!kvm_enabled()) { cpu_ppc_pmu_init(env); @@ -7872,10 +7872,9 @@ static void ppc_cpu_reset(DeviceState *dev) if (env->mmu_model !=3D POWERPC_MMU_REAL) { ppc_tlb_invalidate_all(env); } + pmu_update_summaries(env); #endif /* CONFIG_TCG */ #endif - - pmu_update_summaries(env); hreg_compute_hflags(env); env->reserve_addr =3D (target_ulong)-1ULL; /* Be sure no exception or interrupt is pending */ diff --git a/target/ppc/machine.c b/target/ppc/machine.c index 1b63146ed1..a4b0fa1a78 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -20,7 +20,9 @@ static void post_load_update_msr(CPUPPCState *env) */ env->msr ^=3D env->msr_mask & ~((1ULL << MSR_TGPR) | MSR_HVB); ppc_store_msr(env, msr); +#if defined(CONFIG_TCG) pmu_update_summaries(env); +#endif } =20 static int get_avr(QEMUFile *f, void *pv, size_t size, diff --git a/target/ppc/meson.build b/target/ppc/meson.build index a49a8911e0..79beaff147 100644 --- a/target/ppc/meson.build +++ b/target/ppc/meson.build @@ -16,6 +16,7 @@ ppc_ss.add(when: 'CONFIG_TCG', if_true: files( 'misc_helper.c', 'timebase_helper.c', 'translate.c', + 'power8-pmu.c', )) =20 ppc_ss.add(libdecnumber) @@ -51,7 +52,6 @@ ppc_softmmu_ss.add(when: 'TARGET_PPC64', if_true: files( 'mmu-book3s-v3.c', 'mmu-hash64.c', 'mmu-radix64.c', - 'power8-pmu.c', )) =20 target_arch +=3D {'ppc': ppc_ss} diff --git a/target/ppc/power8-pmu.h b/target/ppc/power8-pmu.h index a839199561..256d90f523 100644 --- a/target/ppc/power8-pmu.h +++ b/target/ppc/power8-pmu.h @@ -13,11 +13,11 @@ #ifndef POWER8_PMU #define POWER8_PMU =20 -void cpu_ppc_pmu_init(CPUPPCState *env); - #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) +void cpu_ppc_pmu_init(CPUPPCState *env); void pmu_update_summaries(CPUPPCState *env); #else +static inline void cpu_ppc_pmu_init(CPUPPCState *env) { } static inline void pmu_update_summaries(CPUPPCState *env) { } #endif =20 --=20 2.34.1 From nobody Sun Feb 8 09:27:12 2026 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645006417953661.214751428256; Wed, 16 Feb 2022 02:13:37 -0800 (PST) Received: from localhost ([::1]:34790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKHJX-0007jW-Rg for importer@patchew.org; Wed, 16 Feb 2022 05:13:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKHHP-0004T2-U5; Wed, 16 Feb 2022 05:11:23 -0500 Received: from [2607:f8b0:4864:20::c2f] (port=44640 helo=mail-oo1-xc2f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKHHO-000293-4z; Wed, 16 Feb 2022 05:11:23 -0500 Received: by mail-oo1-xc2f.google.com with SMTP id o128-20020a4a4486000000b003181707ed40so1858483ooa.11; Wed, 16 Feb 2022 02:11:21 -0800 (PST) Received: from rekt.ibmmodules.com ([2804:431:c7c6:367f:eb9c:8725:6b7f:76b3]) by smtp.gmail.com with ESMTPSA id y1sm17612689oad.38.2022.02.16.02.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 02:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fZPI2m+wUmzdQWIlgl7wmaSuMlcvFlJcfg619/oCuhk=; b=nYhQVVXHluWdji2KZRKbdw8glH+UN7i3hmsOOE8FIatZJGeGewFuWs7nUM3T/Ph0u1 HLdHJZAKi7SGrqARE/UT5XWnTFk1oIhwSUoIu8IyuNk6aUzdOsHnWCz0SV/4+oMiI61s iNsiGz/ZmW2TPAS/+jO3FhIXH1MP2ElXxIK/3sRzcYb1OlNHAygrzMhCfUnVd1Zz7wB6 LqfsDcSQbxkss9KnyLQRvgShGEZZ/Zg5sQRz9OgTxJZLc13xsOWbZirUiKT2UHG6OeOq AJOezVdN4Zb5cFVe7GPLzsODizvWY8vK7El5zEN9oAKPunpniOps8mh3Nep4jVp5xVlm fHHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fZPI2m+wUmzdQWIlgl7wmaSuMlcvFlJcfg619/oCuhk=; b=C6yuiLzl+vKOdBvL5AoTJ1k6ZqXlMUmDK3Se1OaT46X3EnpCn++IZNfxegXtOW6Kkz f2jmCKbgaBFze16Eo5t58RB4DhjqJ8ZEjdKh/cXQqfJG2gke8S5o67NlDIeZ/6gWCgKZ yC1x1hGdvZPCnuv/+Qf44NMlJ8ij/km1qjy+i/BRcJo2rKSaK0xZUI8RuQetnQv0FGHh 2ET5Ggi8ro34HiYJb82YsWfUE1FLEzVMbA6L+K+eAOztz3YgGnhSnTujQHX7Z0Y9GQAJ fHTZSYTVUix1L6qatPZD3fN/7+9e/OLA0lrs7cGrLi8JIr8g+9aMpXVVV5OnCyS2/jFU pzOw== X-Gm-Message-State: AOAM532zZrF9r0eHY0FsFLHv12OqLPHRpn86m3p15poD8J2DfCONWKkK V4QuWqN31glDsrnjUQxUG2Pexuj1nyU= X-Google-Smtp-Source: ABdhPJy9f9W/VA5Pgx9+UALEVGCza9BtVwmHeGzxHaWe6HGMOnptpG2FgBXTJ9JG0bzI8Bqs74HFqw== X-Received: by 2002:a05:6870:a987:b0:d3:3505:4b8e with SMTP id ep7-20020a056870a98700b000d335054b8emr230958oab.88.1645006280727; Wed, 16 Feb 2022 02:11:20 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v12 3/5] target/ppc: finalize pre-EBB PMU logic Date: Wed, 16 Feb 2022 07:11:00 -0300 Message-Id: <20220216101102.179158-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216101102.179158-1-danielhb413@gmail.com> References: <20220216101102.179158-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::c2f (failed) 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=2607:f8b0:4864:20::c2f; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc2f.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645006419683100001 Content-Type: text/plain; charset="utf-8" There are still PMU exclusive bits to handle in fire_PMC_interrupt() before implementing the EBB support. Let's finalize it now to avoid dealing with PMU and EBB logic at the same time in the next patches. fire_PMC_interrupt() will fire an Performance Monitor alert depending on MMCR0_PMAE. If we are required to freeze the timers (MMCR0_FCECE) we'll also need to update summaries and delete the existing overflow timers. In all cases we're going to update the cycle counters. Signed-off-by: Daniel Henrique Barboza --- target/ppc/power8-pmu.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/target/ppc/power8-pmu.c b/target/ppc/power8-pmu.c index 236e8e66e9..d245663158 100644 --- a/target/ppc/power8-pmu.c +++ b/target/ppc/power8-pmu.c @@ -222,6 +222,20 @@ static void pmu_update_overflow_timers(CPUPPCState *en= v) } } =20 +static void pmu_delete_timers(CPUPPCState *env) +{ + QEMUTimer *pmc_overflow_timer; + int sprn; + + for (sprn =3D SPR_POWER_PMC1; sprn <=3D SPR_POWER_PMC6; sprn++) { + pmc_overflow_timer =3D get_cyc_overflow_timer(env, sprn); + + if (pmc_overflow_timer) { + timer_del(pmc_overflow_timer); + } + } +} + void helper_store_mmcr0(CPUPPCState *env, target_ulong value) { bool hflags_pmcc0 =3D (value & MMCR0_PMCC0) !=3D 0; @@ -271,8 +285,26 @@ static void fire_PMC_interrupt(PowerPCCPU *cpu) { CPUPPCState *env =3D &cpu->env; =20 - if (!(env->spr[SPR_POWER_MMCR0] & MMCR0_EBE)) { - return; + pmu_update_cycles(env); + + if (env->spr[SPR_POWER_MMCR0] & MMCR0_FCECE) { + env->spr[SPR_POWER_MMCR0] &=3D ~MMCR0_FCECE; + env->spr[SPR_POWER_MMCR0] |=3D MMCR0_FC; + + /* Changing MMCR0_FC requires a new HFLAGS_INSN_CNT calc */ + pmu_update_summaries(env); + + /* + * Delete all pending timers if we need to freeze + * the PMC. We'll restart them when the PMC starts + * running again. + */ + pmu_delete_timers(env); + } + + if (env->spr[SPR_POWER_MMCR0] & MMCR0_PMAE) { + env->spr[SPR_POWER_MMCR0] &=3D ~MMCR0_PMAE; + env->spr[SPR_POWER_MMCR0] |=3D MMCR0_PMAO; } =20 /* PMC interrupt not implemented yet */ --=20 2.34.1 From nobody Sun Feb 8 09:27:12 2026 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645006423024723.5086960713464; Wed, 16 Feb 2022 02:13:43 -0800 (PST) Received: from localhost ([::1]:34904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKHJd-0007nk-RU for importer@patchew.org; Wed, 16 Feb 2022 05:13:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKHHS-0004fs-JW; Wed, 16 Feb 2022 05:11:26 -0500 Received: from [2607:f8b0:4864:20::c2e] (port=46014 helo=mail-oo1-xc2e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKHHQ-0002A5-TR; Wed, 16 Feb 2022 05:11:26 -0500 Received: by mail-oo1-xc2e.google.com with SMTP id u25-20020a4ad0d9000000b002e8d4370689so1851611oor.12; Wed, 16 Feb 2022 02:11:24 -0800 (PST) Received: from rekt.ibmmodules.com ([2804:431:c7c6:367f:eb9c:8725:6b7f:76b3]) by smtp.gmail.com with ESMTPSA id y1sm17612689oad.38.2022.02.16.02.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 02:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=afcW9NjHxvKYiIPUrAUv9u2+Pl3fFq4NpoJePFp6Ykc=; b=gcByH1D9AvX2yVcyFXZSSERXksYvFUqcps72Xdaxm8ZHV0GNg/aJDNAgCcuKNlsbN6 sLpdQrXhr/CJPl6t8+5YGV2Ezsogw2cuyCM9fI1dQ/VsQxK+ahsfXQC7a+FM6XI6nse+ aIEHwdTzwqmv0W2rpgqMUaimtuzkj9CBhxXHQv6a/yaRs3lWUS3cDsT2ULE4W1x+rDs/ eKffG5bb262geq5YXj3zaLa2s/4Tc07SHOg6D9u8E0Ihnkg7R2s4/E7JY13k12FzeujU f+t/ULZSUqBgsO6BE0cpjEGtBPGvKDG3k7YA7x8Mg3EbJ7HsdBi2jpSTj02bTatEUofU Mpeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=afcW9NjHxvKYiIPUrAUv9u2+Pl3fFq4NpoJePFp6Ykc=; b=JaaLS/uLV3PuAzrrZzvZtoz0zSAov7ct4Qxr45ob1d+UnzEhbQEInmKNuqMK34FIRF wid3VuEEiKCKkhhnpwJj0x7olho46r39yGav58oZoquSPI5ON0kOqfJQi+UcridKKLZi /a0eusBXai/3Q8aY72ANqytctj5TaJE+HX01DYP54EZItcyw9je9cd12Xi82Ihbu/4BB UgvVJWLPFgNvo6A7Qd03gtmC0MYb/ke62STARE/2/LHgsRe1N4XPY8kthS2fhiDYvQvt NcoCnj1/lp5UZKTIHLiXtvy8O3OqlzZCZ2XT7tYL+pI5lKsWU3sAdPVx+QA5Jr8GnouZ Ah2g== X-Gm-Message-State: AOAM532bna5JtXujUq3mBmlEhtl7i0u7xre6dS8KLuaWGYpc6jlupLk6 mD5vrCMOK1Q649lAJW9Rgigb0YwQ3f8= X-Google-Smtp-Source: ABdhPJzamHaJUJWykyzRxlRFRdXUGT8YUcf9Vn0QL2cJgGULignak5aikuZb0czs8H7qIgOpajemoA== X-Received: by 2002:a05:6870:54c7:b0:c4:7dc0:d6e5 with SMTP id g7-20020a05687054c700b000c47dc0d6e5mr215193oan.184.1645006283384; Wed, 16 Feb 2022 02:11:23 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v12 4/5] target/ppc: add PPC_INTERRUPT_EBB and EBB exceptions Date: Wed, 16 Feb 2022 07:11:01 -0300 Message-Id: <20220216101102.179158-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216101102.179158-1-danielhb413@gmail.com> References: <20220216101102.179158-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::c2e (failed) 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=2607:f8b0:4864:20::c2e; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc2e.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645006423597100001 PPC_INTERRUPT_EBB is a new interrupt that will be used to deliver EBB exceptions that had to be postponed because the thread wasn't in problem state at the time the event-based branch was supposed to occur. ISA 3.1 also defines two EBB exceptions: Performance Monitor EBB exception and External EBB exception. They are being added as POWERPC_EXCP_PERFM_EBB and POWERPC_EXCP_EXTERNAL_EBB. PPC_INTERRUPT_EBB will check BESCR bits to see the EBB type that occurred and trigger the appropriate exception. Both exceptions are doing the same thing in this first implementation: clear BESCR_GE and enter the branch with env->nip retrieved from SPR_EBBHR. The checks being done by the interrupt code are msr_pr and BESCR_GE states. All other checks (EBB facility check, BESCR_PME bit, specific bits related to the event type) must be done beforehand. Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Daniel Henrique Barboza --- target/ppc/cpu.h | 5 ++++- target/ppc/cpu_init.c | 4 ++++ target/ppc/excp_helper.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 555c6b9245..e8a423d14d 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -127,8 +127,10 @@ enum { /* ISA 3.00 additions */ POWERPC_EXCP_HVIRT =3D 101, POWERPC_EXCP_SYSCALL_VECTORED =3D 102, /* scv exception = */ + POWERPC_EXCP_PERFM_EBB =3D 103, /* Performance Monitor EBB Exceptio= n */ + POWERPC_EXCP_EXTERNAL_EBB =3D 104, /* External EBB Exception = */ /* EOL = */ - POWERPC_EXCP_NB =3D 103, + POWERPC_EXCP_NB =3D 105, /* QEMU exceptions: special cases we want to stop translation = */ POWERPC_EXCP_SYSCALL_USER =3D 0x203, /* System call in user mode only = */ }; @@ -2426,6 +2428,7 @@ enum { PPC_INTERRUPT_HMI, /* Hypervisor Maintenance interrupt */ PPC_INTERRUPT_HDOORBELL, /* Hypervisor Doorbell interrupt = */ PPC_INTERRUPT_HVIRT, /* Hypervisor virtualization interrupt = */ + PPC_INTERRUPT_EBB, /* Event-based Branch exception = */ }; =20 /* Processor Compatibility mask (PCR) */ diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 8fc644f8d6..8ddac4e2fe 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -2239,6 +2239,10 @@ static void init_excp_POWER8(CPUPPCState *env) env->excp_vectors[POWERPC_EXCP_FU] =3D 0x00000F60; env->excp_vectors[POWERPC_EXCP_HV_FU] =3D 0x00000F80; env->excp_vectors[POWERPC_EXCP_SDOOR_HV] =3D 0x00000E80; + + /* Userland exceptions without vector value in PowerISA v3.1 */ + env->excp_vectors[POWERPC_EXCP_PERFM_EBB] =3D 0x0; + env->excp_vectors[POWERPC_EXCP_EXTERNAL_EBB] =3D 0x0; #endif } =20 diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index bbc75afbc0..04c61cff39 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -1513,6 +1513,21 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int = excp) new_msr |=3D (target_ulong)MSR_HVB; new_msr |=3D env->msr & ((target_ulong)1 << MSR_RI); break; + case POWERPC_EXCP_PERFM_EBB: /* Performance Monitor EBB Excepti= on */ + case POWERPC_EXCP_EXTERNAL_EBB: /* External EBB Exception = */ + env->spr[SPR_BESCR] &=3D ~BESCR_GE; + + /* + * Save NIP for rfebb insn in SPR_EBBRR. Next nip is + * stored in the EBB Handler SPR_EBBHR. + */ + env->spr[SPR_EBBRR] =3D env->nip; + powerpc_set_excp_state(cpu, env->spr[SPR_EBBHR], env->msr); + + /* + * This exception is handled in userspace. No need to proceed. + */ + return; case POWERPC_EXCP_THERM: /* Thermal interrupt = */ case POWERPC_EXCP_PERFM: /* Embedded performance monitor interrupt= */ case POWERPC_EXCP_VPUA: /* Vector assist exception = */ @@ -1742,6 +1757,24 @@ static void ppc_hw_interrupt(CPUPPCState *env) powerpc_excp(cpu, POWERPC_EXCP_THERM); return; } + /* EBB exception */ + if (env->pending_interrupts & (1 << PPC_INTERRUPT_EBB)) { + /* + * EBB exception must be taken in problem state and + * with BESCR_GE set. + */ + if (msr_pr =3D=3D 1 && env->spr[SPR_BESCR] & BESCR_GE) { + env->pending_interrupts &=3D ~(1 << PPC_INTERRUPT_EBB); + + if (env->spr[SPR_BESCR] & BESCR_PMEO) { + powerpc_excp(cpu, POWERPC_EXCP_PERFM_EBB); + } else if (env->spr[SPR_BESCR] & BESCR_EEO) { + powerpc_excp(cpu, POWERPC_EXCP_EXTERNAL_EBB); + } + + return; + } + } } =20 if (env->resume_as_sreset) { --=20 2.34.1 From nobody Sun Feb 8 09:27:12 2026 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645006599472299.53126706347143; Wed, 16 Feb 2022 02:16:39 -0800 (PST) Received: from localhost ([::1]:42368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKHMU-0004fQ-Fd for importer@patchew.org; Wed, 16 Feb 2022 05:16:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKHHV-0004rD-8L; Wed, 16 Feb 2022 05:11:29 -0500 Received: from [2607:f8b0:4864:20::236] (port=43745 helo=mail-oi1-x236.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKHHT-0002B6-BE; Wed, 16 Feb 2022 05:11:28 -0500 Received: by mail-oi1-x236.google.com with SMTP id s5so490221oic.10; Wed, 16 Feb 2022 02:11:26 -0800 (PST) Received: from rekt.ibmmodules.com ([2804:431:c7c6:367f:eb9c:8725:6b7f:76b3]) by smtp.gmail.com with ESMTPSA id y1sm17612689oad.38.2022.02.16.02.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 02:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5cBEGFkYOy9hRxli33ftixkD7di/63zI7udVHNDzaBk=; b=i0EdYCdg7t9jpBAZCzGypD13/35BmaJ2niOJNxo682FhuUzMQ+52T3iiAlIuzKfI9R 7Ibs1KI5duDkMmcdXxtuC3GH/tQMXUvmeGPRTglfiojiInq6vF42rnWlMIrhMWgmZSIb wpOmUY7TwbNH9CHXHELe1kfFeTGQjr+p86giwMVtfy0mQRJxbSqERzE3Avg8fE5PmA/c +vPrhdGT0Q7wuDlo1xNAn36w8EUa6fVTxOkQ+UpY5AKDdr9WEiNRIHo+otBMg1OrHD1z HQAspSRfxc40g/LmNAPerPv2k2j9hwhALbxfpK0Nv+b3/ZarYM9bnioEnR4R+60FlQAi PRAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5cBEGFkYOy9hRxli33ftixkD7di/63zI7udVHNDzaBk=; b=VHoDHypbrCv5wXwKdgDHOkOc+0+NS3IhH9jOJsC4GE7H7hAV0isiAA2r9mmcUUqnJ6 s/mspCcD9uJkrsZZnP4hwsRAAypYPoHTQJkWBoYlUP0TGp6akftBE64K8NldjJemheON sH+Uord8+u7/WvAr1OyanFaD9+nPmj7K/qaOohPmouDJDXLi486ENulhUk7lGAMooiYK 8Y8CZ3kYrWYKgWFxITblS5Qd05yVrShJNn1uT7g4HKAnENsPZ5v/7aG1aneOb5v/TB2C SLXrZ/y9IWCKmMgYmrCE+ygfuEuwR3DzumYmR17xlh2s4Ng8AVOWX1BjvSj7+9pCnsBo KYYA== X-Gm-Message-State: AOAM533XSNvOdzmMwCmBy0gqlvuMNGYtlIdZQ7s53JzWskKeIwfdyzQZ oEGvoYuG4zRLt2buMyW6ojV7N8dX9Zk= X-Google-Smtp-Source: ABdhPJwYI8UrIH6TV3jKjrz52ECVMZ/SEOaGKU7nWp2tzsKbX5s34zbSqBHk8WoPZzAYt8hd+W8bGw== X-Received: by 2002:a05:6808:1929:b0:2d4:374e:3980 with SMTP id bf41-20020a056808192900b002d4374e3980mr303544oib.294.1645006285767; Wed, 16 Feb 2022 02:11:25 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v12 5/5] target/ppc: trigger PERFM EBBs from power8-pmu.c Date: Wed, 16 Feb 2022 07:11:02 -0300 Message-Id: <20220216101102.179158-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216101102.179158-1-danielhb413@gmail.com> References: <20220216101102.179158-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::236 (failed) 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=2607:f8b0:4864:20::236; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x236.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645006600911100001 Content-Type: text/plain; charset="utf-8" This patch adds the EBB exception support that are triggered by Performance Monitor alerts. This happens when a Performance Monitor alert occurs and MMCR0_EBE, BESCR_PME and BESCR_GE are set. fire_PMC_interrupt() will execute a new ebb_perfm_excp() helper that will check for MMCR0_EBE, BESCR_PME and BESCR_GE bits. If all bits are set, do_ebb() will attempt to trigger a PERFM EBB event. If the EBB facility is enabled in both FSCR and HFSCR we consider that the EBB is valid and set BESCR_PMEO. After that, if we're running in problem state, fire a POWERPC_EXCP_PERM_EBB immediately. Otherwise we'll queue a PPC_INTERRUPT_EBB. Signed-off-by: Daniel Henrique Barboza --- target/ppc/excp_helper.c | 48 ++++++++++++++++++++++++++++++++++++++++ target/ppc/helper.h | 1 + target/ppc/power8-pmu.c | 3 +-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 04c61cff39..32a28ecce2 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2009,6 +2009,54 @@ void helper_rfebb(CPUPPCState *env, target_ulong s) env->spr[SPR_BESCR] &=3D ~BESCR_GE; } } + +/* + * Triggers or queues an 'ebb_excp' EBB exception. All checks + * but FSCR, HFSCR and msr_pr must be done beforehand. + * + * PowerISA v3.1 isn't clear about whether an EBB should be + * postponed or cancelled if the EBB facility is unavailable. + * Our assumption here is that the EBB is cancelled if both + * FSCR and HFSCR EBB facilities aren't available. + */ +static void do_ebb(CPUPPCState *env, int ebb_excp) +{ + PowerPCCPU *cpu =3D env_archcpu(env); + CPUState *cs =3D CPU(cpu); + + /* + * FSCR_EBB and FSCR_IC_EBB are the same bits used with + * HFSCR. + */ + helper_fscr_facility_check(env, FSCR_EBB, 0, FSCR_IC_EBB); + helper_hfscr_facility_check(env, FSCR_EBB, "EBB", FSCR_IC_EBB); + + if (ebb_excp =3D=3D POWERPC_EXCP_PERFM_EBB) { + env->spr[SPR_BESCR] |=3D BESCR_PMEO; + } else if (ebb_excp =3D=3D POWERPC_EXCP_EXTERNAL_EBB) { + env->spr[SPR_BESCR] |=3D BESCR_EEO; + } + + if (msr_pr =3D=3D 1) { + powerpc_excp(cpu, ebb_excp); + } else { + env->pending_interrupts |=3D 1 << PPC_INTERRUPT_EBB; + cpu_interrupt(cs, CPU_INTERRUPT_HARD); + } +} + +void helper_ebb_perfm_excp(CPUPPCState *env) +{ + bool perfm_ebb_enabled =3D env->spr[SPR_POWER_MMCR0] & MMCR0_EBE && + env->spr[SPR_BESCR] & BESCR_PME && + env->spr[SPR_BESCR] & BESCR_GE; + + if (!perfm_ebb_enabled) { + return; + } + + do_ebb(env, POWERPC_EXCP_PERFM_EBB); +} #endif =20 /*************************************************************************= ****/ diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ab008c9d4e..8c2c03fd48 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -18,6 +18,7 @@ DEF_HELPER_1(rfid, void, env) DEF_HELPER_1(rfscv, void, env) DEF_HELPER_1(hrfid, void, env) DEF_HELPER_2(rfebb, void, env, tl) +DEF_HELPER_1(ebb_perfm_excp, void, env) DEF_HELPER_2(store_lpcr, void, env, tl) DEF_HELPER_2(store_pcr, void, env, tl) DEF_HELPER_2(store_mmcr0, void, env, tl) diff --git a/target/ppc/power8-pmu.c b/target/ppc/power8-pmu.c index d245663158..38e1ecb782 100644 --- a/target/ppc/power8-pmu.c +++ b/target/ppc/power8-pmu.c @@ -307,8 +307,7 @@ static void fire_PMC_interrupt(PowerPCCPU *cpu) env->spr[SPR_POWER_MMCR0] |=3D MMCR0_PMAO; } =20 - /* PMC interrupt not implemented yet */ - return; + helper_ebb_perfm_excp(env); } =20 /* This helper assumes that the PMC is running. */ --=20 2.34.1