From patchwork Thu Jan 23 21:55:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859391 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494615wrq; Thu, 23 Jan 2025 13:58:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUG5blMao3ykct0KZnXyxb62TQgNqn2B47YkN38JaqMaDGPTGJR0lHdhQDQgwOxg/NrudshsQ==@linaro.org X-Google-Smtp-Source: AGHT+IGgqs0X8RaD7IMlTnSHYBjIoM/BKw3SoDUi9QEN91i/IhbjOIODX4fJg4ZQFcWCURjeR0fq X-Received: by 2002:a05:620a:2586:b0:7b9:c4bb:271e with SMTP id af79cd13be357-7be6320bbc6mr4024564585a.27.1737669487676; Thu, 23 Jan 2025 13:58:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669487; cv=none; d=google.com; s=arc-20240605; b=hv537eEw3tuAWaGtv7ExLXXW3wVjgjmdS1AO/FebpkMSjd8qC0B6zRGJHjO68XZbsd JA61gkI5n+UTCWDQK5bVwjkH6l1ro7p08ozPqdGKLYeoX+VRwcIKrxbHnBvMJBojCPWF aD+qBLrfL0S5SXdewFPSq3U0fyTf/ngPwBzWzoldY3uwvP5bl53P/4XE5UWU5obVwaOp dPPNAdMUeJAWW0pCl4eWhkE3kn8JnlwFSXUDUzlIpjNp15a7viDmn6vUZtsifpRxXqEz VFXeiBteteaqRBcBqRbBpsl+n/Pt0xhQVEjyiweoB0UTXz3XAxfK8f2JRJxk8BwVh/nh WQlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ycsjGlBlHbu4fIwJ8eBiUHF+eH/dzlIjpqCh9RpatQY=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=YzOH+pZUX4R9A+ynn74nh07MBNR98F82f4+NpA/Ma+5PclE4CKW0v9vYcmQiNW1WzW PjwyPW4gqA2epqdvexw3UH8JHFHQa64hQlRfloYM70SSa5S+vRuWmiz70GaHFau0lHEf wtrYPsb/kjAAFgfNgC9GCvSL3x5JBXd3iCCDH8RYO0IQBttWPahgRISenVi6/WFiV1Fb KirSNTuG8lafqDoOR7K/z1MOmU2wMT7sZXU7qwsQnuLbodO/0nO+SDuK+2GGbBELRxXH xDRs+snjms6OpXtqwu7K/S8w4G09X36JZ2bcuc8GD5LFiTwhootZUDnHoK4dbRUr7wPG AvBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V1XoC5Fm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be9af11c7asi64059785a.552.2025.01.23.13.58.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V1XoC5Fm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5BV-0004pQ-DD; Thu, 23 Jan 2025 16:56:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5BT-0004os-C6 for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:19 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5BR-0002iJ-Uf for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:19 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-385f07cd1a4so1388581f8f.1 for ; Thu, 23 Jan 2025 13:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669376; x=1738274176; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ycsjGlBlHbu4fIwJ8eBiUHF+eH/dzlIjpqCh9RpatQY=; b=V1XoC5FmU/XuUuuVeZ9X439SJzKMH2/jz8q+RQPCzJ0EPjc1zSxWVphbZ9futE/Iqe lKYLUyz/CZvG3eBAc6AQIz/3Oldn/olEeovF9KZzNK7WUNY4XSBGRHmqszolDsxHsp2z JRZLPioTH1MZqh4sW5nu1Rk8VqBhtNrxVGJTLedwM1P36JtegCSy2zooDCOkK11AVVo7 m7LqbVF7EBMXA14Yczmy+D0x1TcPXU0T0mOn+WSV+dC3Ry17hhXEwH6Bu0w0UzD0a2E7 HOjwmcqR4txMLctz1z4zbszFtsMgY2zZbXVW90plXoCUOymaj3+eY/f/hPeFNUMozwK2 76pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669376; x=1738274176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ycsjGlBlHbu4fIwJ8eBiUHF+eH/dzlIjpqCh9RpatQY=; b=wWHfarM2uUnOtXo2+OStyDxwz96e/YdbxMzzih8qH3vDC9iSbGebrB95vlxwxhaX46 M5dtOCMaIl5LmgBKix604dGY41VBiEZTlZaba7NYahNjjJyq8rcVFzedHS7mrjcMB7jJ dVE85+v46M46o7CWLt9g+7nN5LfwyYk3zXs6NxV98s+PzCVSEFjXLikBvxLC8mF5wEWr PvJMCADVB+EtsU/yy2io3W7d39DSzVJNXnVnuV1OjDAZJthMfZe+pg6BFOuTD+uQ5jF+ Iqytc3Dinf2hcdBOe94ExRUeR/fOHj7DM3CrUNq2KyQscxnMqmYpJxVO/SGJ6PT6xxgC JFgQ== X-Gm-Message-State: AOJu0Yy8gCwKJxjymitq3W1QG/MQtjhJ3eu4L3vKeGEQYKnadFytHyiu gxA7ZFxj/uvULeQGcF67p9BSln//cbs7vZJMvRhiuEyImO2/pLi7uBqcA3EaUJHptK2b/yaGkW4 cvO8= X-Gm-Gg: ASbGncuZfCNe2/qiI853/xfyauewQrHhr4XJqULWzzfcF3WWPFMMrqf5PdKzAUu1SQe zJLFozl/U90bno2wMmICcBpaORlNBIj8WNJD2eTgivR8ojshmWX7w0QvcwrEZBo7JSzEwTdAXbk xOh6b00CL/IsmqfMxorELp49k5CYq6hhyeEIYJDwWSSbQ5KP+ZXKQFkOCCAqmFithfUKNy+Jo79 yqb4d349KVrZPZSWKIz7aXakJXlbJ8xTeCxDyixFLs4IKcFDhbFBFiwBIc5+zyR7LhSYDsOqEr6 LHyDho2swbW6cqbGD/UYiwVYZ97MZQxtw+FXefb5uBI7J7a0TCr6c3A= X-Received: by 2002:a5d:5f8c:0:b0:386:3329:6a04 with SMTP id ffacd0b85a97d-38bf57a957cmr32823500f8f.39.1737669376244; Thu, 23 Jan 2025 13:56:16 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c42fcsm791958f8f.96.2025.01.23.13.56.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 01/15] hw/ppc/spapr: Restrict CONFER hypercall to TCG Date: Thu, 23 Jan 2025 22:55:55 +0100 Message-ID: <20250123215609.30432-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org TODO: Add PPC folks why :) Signed-off-by: Philippe Mathieu-Daudé --- RFC: Missing appropriate commit description... hw/ppc/spapr_hcall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index f8ab7670630..dbf30358a1a 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -578,6 +578,8 @@ static target_ulong h_confer(PowerPCCPU *cpu, SpaprMachineState *spapr, CPUState *cs = CPU(cpu); SpaprCpuState *spapr_cpu; + assert(tcg_enabled()); /* KVM will have handled this */ + /* * -1 means confer to all other CPUs without dispatch counter check, * otherwise it's a targeted confer. From patchwork Thu Jan 23 21:55:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859386 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494415wrq; Thu, 23 Jan 2025 13:57:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUE3oVo9j1eTZslmbVChpZGXzalsn91ruwjeGRl3Xj0RHvHbYEDFATNVXVt1HVHIx9IKTC+ow==@linaro.org X-Google-Smtp-Source: AGHT+IFzq+10//7+UcOasdajfekIcCKxKrRnMxsbjERuKKgTrev4z8GEsr4Ee03O1HxgPXnvAOAR X-Received: by 2002:ac8:5f48:0:b0:467:5642:5917 with SMTP id d75a77b69052e-46e12b68097mr449716631cf.32.1737669444183; Thu, 23 Jan 2025 13:57:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669444; cv=none; d=google.com; s=arc-20240605; b=bzSQ5tgINp2DEuoqPawjac5TMKIqIQocfPY57IrJ9XkvfcXlzBpiTJ6FfbwAy+6HP1 uuYo3JNoDvl0T6tBdSHgobBHKJ0gAjhz5+m2Z2N6QkdsLtdeYBOhquQKDfyh/dpwJusu 6/cgxaeIGUWtZjNAVwkzfuZ0/MLbUv4r/dB8w52PEoE0ACazKT80ZpG3mxq/F8/Oz4cI GW8ohQ6KkqzlLlg5wuVOZ7OIByH6cKqc4pDhKnrnDhVibBRBU4ul5xUfyWhPpL4IOAl4 xXPmTZVzqNYWnhoCUTVOYMKMMPu+X2051OotrUyHyVw27ERup8zAB8KcZiIfb08a1hju yc8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bH5J3cRQDjcVRgPq7zp3SpsLhqrv1PdlyvsdQnQjIBk=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=IRgTaqPRHOGynnrIAVXhBLS7wZbXTJqVOhA8OMMvyJWgygPE7NwqptlbiVmFQiIebH TIoPmOnknsvaVc9u4c1WD3VFDMubCyNtb3dvfoEoGjcAYfQfYAtfsbw8XaG34ONj+Inm zZXKcCCv0wDaWbhbY71Alt3YzTBSvVUMUsImhiB9tngiGJT40YgOQkuwTidJmDEDdVsi oUz8vHaaE9Tlo0YLVjcK65WhhcWSNmNk4shxe83J7DwrjA+UkZM1WBbK/E5GA3QpJmKY XJjFzaaea4n1Scg7H4zR92p8ml/HrYx23D7jr4Ry7Y0bWMLRtUkYrA19X5GXcZ6QxvEH kogw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Eh6Z+/BI"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e205df71c3si6285626d6.215.2025.01.23.13.57.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:57:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Eh6Z+/BI"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Ba-0004q5-K8; Thu, 23 Jan 2025 16:56:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5BY-0004pq-8O for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:24 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5BW-0002jA-Pu for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:24 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-385e0e224cbso841340f8f.2 for ; Thu, 23 Jan 2025 13:56:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669381; x=1738274181; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bH5J3cRQDjcVRgPq7zp3SpsLhqrv1PdlyvsdQnQjIBk=; b=Eh6Z+/BIeON7Np2C8AGq6cvYnbSqAAvojCEn7CYn6/UwLmDUXUP6BiXyKAVDkB13Dv 5gF0RQwlQcJBuImrhD9BtqPRSgxgRVCU5Q9X5g1BgHNttzkvFg9uwJjZMGNaQULDc0zK ixNxvVT1dI0PoljLaDnB3ppFzmFLj5X2WyDDAWF88S8m7ed9wlrSzJ2N3vdfh+vIWtSA tEk4FZ9Y+ZrS04IPQiYk1zkkNCS5kOfu1ugkuQXE6Lph0LLFzYSa56Y8ksrqIOEcY/dL 6Af7hFifuwCsyn4eANGeDRtCFAs738BwgL1g5x5Hqc6SXXCiIZV/mPsTvnnmU49CTd0S XVOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669381; x=1738274181; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bH5J3cRQDjcVRgPq7zp3SpsLhqrv1PdlyvsdQnQjIBk=; b=Sbq4anpk1qH0Eq+25fNDwP/UD4ZoEmMVbHNTT8rTajYviPEGDEm//+0evYzyJTb7pH pwMAoqZOYslLmpYahCAGO3h6t1JtIMFYdDFF9dh8Sf8oGLLC/cy0aiEqr4CbXW0uCbvv eZrUNvNz/N1Z4FMg8qe+uiSQ5XaEH07TO9XArbtm8rgsFdPZbpeYaTcV6pbot2K3rY8G JpgGLJq2fdP4q8tS79TYGNqUwAA5G8cdCwrwHYe5JXf5AKlWwmzg7f7X7yN2TUsSQrBo LoDFr19sSjRnGQgqwud7IKUzSRzuHZH4u0ku+SYXsPeuxdtht5OqUqGM+0rOPzvZfUDV Bfqg== X-Gm-Message-State: AOJu0Yzwc4ylgWXccyg3dzCofXXYnJGNX4gYTparFmqFqXeAKyaP2ERB ysdP/m6kPwRt5wB6Cbq92CLl8J96IxcBHgMAF/z+H7Cg9E7EFMROK+Vt2mbL5sB+c+zFP4AVe7l wtio= X-Gm-Gg: ASbGncvQyXG1eMQDQdZWnJ2z4DG0AMEiqlEXjxWixvSz7wFIFYmvyS3kqsOSC2u05tm CFmjgG3ohe5J3Xo0VrhzHF43tOWakBKtfD7PKaD8fFfTsNxswC+aWCxcPMpTxSB0JDt8hBr/2wx gKapDPDKxtd5/7OlaSjrpEeRnOBDFQQbfJZLPto85dj2lVptGsUZa3GOr29rCZWFzO48x0HarBm Cg9l4VujEwI7Lz79huuuY8ne+k6gWCIvVT3KlWusQwjtE3SmQ01u6mbBKGE1ZOpEJW7luXL/6L3 83ifAsCV1iYKGCFeSZ2R/DiMiBIWnJAgK+iei0FmuCgYGq38eUmiv6k= X-Received: by 2002:a05:6000:1863:b0:385:f560:7911 with SMTP id ffacd0b85a97d-38bf5655589mr26500138f8f.10.1737669381002; Thu, 23 Jan 2025 13:56:21 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1ca723sm772228f8f.101.2025.01.23.13.56.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 02/15] hw/ppc/spapr: Restrict part of PAGE_INIT hypercall to TCG Date: Thu, 23 Jan 2025 22:55:56 +0100 Message-ID: <20250123215609.30432-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Restrict the tb_flush() call to TCG. Assert we are using KVM or TCG. Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/spapr_hcall.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index dbf30358a1a..4f1933b8da6 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -299,8 +299,10 @@ static target_ulong h_page_init(PowerPCCPU *cpu, SpaprMachineState *spapr, if (flags & (H_ICACHE_SYNCHRONIZE | H_ICACHE_INVALIDATE)) { if (kvm_enabled()) { kvmppc_icbi_range(cpu, pdst, len); - } else { + } else if (tcg_enabled()) { tb_flush(CPU(cpu)); + } else { + g_assert_not_reached(); } } From patchwork Thu Jan 23 21:55:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859392 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494617wrq; Thu, 23 Jan 2025 13:58:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVhwQZjNyhbilB7ZBBVuGgBYe+aNQYqcHU+XP6bryE5DxjUs87W9rGqX+v9aWqi0R/FksMLaA==@linaro.org X-Google-Smtp-Source: AGHT+IGreO6v+yyeexypRC/QyhxZsJLiry6xmnDOp5am831txfrmtnoaYJ6cK5jLUAMYMGVRaZaT X-Received: by 2002:ac8:404f:0:b0:46e:2a18:93b4 with SMTP id d75a77b69052e-46e2a189514mr261157861cf.33.1737669487714; Thu, 23 Jan 2025 13:58:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669487; cv=none; d=google.com; s=arc-20240605; b=OQTk9MG5kz0KbNKQI35VYGqavTnGnYMyzClrcLbiGzXmIpQ1HRmJ92vNbBsLUy/D7S K6f7t9NhZcOXmX5rFGbGVS9mXHB+n2jYCKLwSi41JAo4Pcpl3T3kE6Zp65973s2CJydw ePILloZS7LMyWOi4UDPah8ZKHbY5BU7YkFRnofyHk+1CwJzMMkwGBDqHb9HVOuAIk4z8 Ccpy6lOERzfd6VCRjGIAKMxv3lsiNiL+xHO3PYw8ixAxII+YcnQf4zE6v+xvM+Pag7nZ nLszw767rKJNveNF4I1bGa8qqFACsDSuYp8Vii4pwb7Hau74ubYSeNnE8Q9ET6hvbORy I1Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=axO9L9zvQNnbH3QdpMtYTEFgm/4DySr8I7ccuAMR/ZA=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=eyRWPo5d/ws3uVQH8rJiv6PQre4q80fry0HpBz7H643wZuqiztq4q5cnERQScZFET5 hsZ5JrpyEnEvNhzql031dYAg7mSCssutEBv8AhSZyETmlrCA00Ywy0qoBVsMnIQhG+Mv hjVuupOb/Tlker7KUBwYgTKHjo4a8vFsueIQYfeHhhY41lKaMwjAQt0D+3tSnTKcW9w0 JecRXSQrPuCI182PYXywJy6uoAnhhfQd1w2h9CSw2KwaAlcyQP00p6a3YkFIQiSA4Sar QUSEKastusTkAUJNyFArup0/a/7d5nQjW1q2HP0Xt7zxKHU/DuLz14OgbFMWjmHuWqCt WiEQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FKOEFDr1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e6686d362si8280971cf.64.2025.01.23.13.58.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FKOEFDr1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Bf-0004rp-GK; Thu, 23 Jan 2025 16:56:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5Bd-0004r7-RM for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:29 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5Bc-0002kB-A1 for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:29 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-388cae9eb9fso791473f8f.3 for ; Thu, 23 Jan 2025 13:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669386; x=1738274186; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=axO9L9zvQNnbH3QdpMtYTEFgm/4DySr8I7ccuAMR/ZA=; b=FKOEFDr1EFefZD0yugHOrspdszTIlAuZtREP6Dj+0cTxXrYe0j6fvtUYiPcZUQt1wa DiAbHY+niOr1OGHSl8CAtTygVdObsHjWjtPbStRz7xOrIxIra+wZwO4p+x54cXU3C0o2 IFlnDjD4DtZP3PBBWGT8cw1CaU2R0lkqwmcET+QWdXekbwuLIZ8SL4/UdJeY7ESkmrT8 XPNXvV508rN9xpxoDHIvcBI5T8rvPkbr+RTDW634EcgF7LY5KQPTD79/cISgeQT+q+fy H6kIDMqFkdk4MT3ou0ZGzYUOA+rn6YieUE5QH5ihf/tjDlpBQYpOi30DNdWqVmxqXys/ WT+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669386; x=1738274186; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=axO9L9zvQNnbH3QdpMtYTEFgm/4DySr8I7ccuAMR/ZA=; b=eGlKVUNFdn7VzxS/4VH7I4FCuNEp9pTzJd3SngCuXN4DeBNjKE5WjODYk7vdCwp/SX /TnEF7ffvkjKenTHH3YtxnxRdAj0FHDRSvuBFaH8zjVxEY1+o3KRZUe1wFcX6h9YSu9w 2JzTlCYBmMWOrnsR39+64Xhx/oCPPpjVYZiiNl032qSVquG0aMA7tigQbl8G66pMHqqx bxPWnEkk/XAwjihYf9nYO6v9cjSKU1Sx5GEpjJUWQ5kg3ZlrR0ZiUDf+3vfzKa51PmTN K5a2xE7hoDvsdwwUZoUzEOOrLBKvjdZkPsi3dC8PtAa+4JoQQCn4pBW0Og6Qfplgd2I4 tKkA== X-Gm-Message-State: AOJu0Yy//k5327GSPy/NpjAWuAxArZFPmSm0oSYMRE0PVowCbOZ65gbc MVQrZIlr0Lgl9lTdaoC0pfGQWVjqFa/L06kogGMt2Tg29kksUOq5Qb7LPlYwuiGthCruO4FkCm7 kxVw= X-Gm-Gg: ASbGncv1ra2vTPNp5TB7fAvM8ndYYWaeYikak6mUdsLJa3IjzwPatGUINux2qJupiaR Ny9ILO2CfCFBAPbf0w2hJ7S0WrdNKC3UP5DYaH8PLlvhiC5CXnQpWD4EDjMGOTN+RzxQnURz730 up9ZymyWCpdghGNqw/eb2yZPahsAPaVQoauBX6QLeDGctb5B2xRnKh6QeQEgjmQTbUtGgOKIjWE k/hn3++KZmIyf7nx841CulLrI1d1KU4MUh5yHevvM2AT5mDRG9OR7pFQxkZrocG2R8Ko7jlYrBK 4Em7oog2SrgGi+9yGc8Ippn5noLB61X7OtmDWBTT4g6ZR+GeNeo+mA4= X-Received: by 2002:a05:6000:b04:b0:388:caf4:e909 with SMTP id ffacd0b85a97d-38bf566f3camr22750985f8f.25.1737669386348; Thu, 23 Jan 2025 13:56:26 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17d759sm789025f8f.24.2025.01.23.13.56.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 03/15] target/ppc: Make ppc_ldl_code() declaration public Date: Thu, 23 Jan 2025 22:55:57 +0100 Message-ID: <20250123215609.30432-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We are going to move code calling ppc_ldl_code() out of excp_helper.c where it is defined. Expose its declaration for few commits, until eventually making it static again once everything is moved. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/internal.h | 2 ++ target/ppc/excp_helper.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 20fb2ec593c..46db6adfcf6 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -268,6 +268,8 @@ static inline void pte_invalidate(target_ulong *pte0) #define PTE_PTEM_MASK 0x7FFFFFBF #define PTE_CHECK_MASK (TARGET_PAGE_MASK | 0x7B) +uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr); + #ifdef CONFIG_USER_ONLY void ppc_cpu_record_sigsegv(CPUState *cs, vaddr addr, MMUAccessType access_type, diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index fde9912230e..7ed4bbec035 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -144,7 +144,7 @@ static inline bool insn_need_byteswap(CPUArchState *env) return !!(env->msr & ((target_ulong)1 << MSR_LE)); } -static uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) +uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) { uint32_t insn = cpu_ldl_code(env, addr); From patchwork Thu Jan 23 21:55:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859390 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494512wrq; Thu, 23 Jan 2025 13:57:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU0rg2a4Q1v2dV5EbLBJ6p626IAdUCSkfYq2M/ZBXkxthUxY6HNtAjxcmXHGZeNtdbfOQbSxg==@linaro.org X-Google-Smtp-Source: AGHT+IFDuRw2XJrIFgOMg3+KlKo1+ftxA4PNf9RZYu+y44+ZIXxNKBi7pPaofx/xYNknpKw9c/sZ X-Received: by 2002:a05:622a:19a6:b0:466:d559:b528 with SMTP id d75a77b69052e-46e5b8065cemr70007201cf.17.1737669463844; Thu, 23 Jan 2025 13:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669463; cv=none; d=google.com; s=arc-20240605; b=GUMO1IfJsj+BdiFjg8Q3q08P3hXTfm/dAgCPm50syn61ooJhP4Q+xj5CbuxxSI2zaD 8m9bm8igM+v/PwWE8v66DAEEoEyA22m1kNrD/a2V94v7Zct+Ox0IATevInzE0pQvz9PM 95FqGsYq9y441eioAdw7ug87zVVC2EKRHM1pbZfi6pkeaxUQelLVODjiRffhOkKnAsMF kSU8r/S4gMJX7She3ovo1ztQQ+3p57mfu4IT8gtirv/pcHHJlNJl9Op59Rzk8zrI/VEt LqkQCsRN8bgeZSGHJLiohj+R7yFxelMhsWTDE4wvh1pYBu8iFzQOSOwhqjC3FPqIxPqZ BHrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TTJwfGzF9H+nXAFh4oKJlHlsOewOwWpsY8vG45m99Ks=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=KJ5iRqLaP2j11ByNUGD+8HlspN5tI26sY3I7w4wRbwVl3XmuJfsgfUck59PWVjHFS5 xFHXpuIH+iwMrVjdHGoUks0PigxPUbCfExkN0l0jHStE1NOKx99r9fqd5x0t6HBqOva0 I0jor6phWnhqRHl9AZSo4cj1AFoxvZDVnq6c0nzo5FzjHr/E5YUL1PXDSf6vJ4oKx14A YqtEthQgtwYCjrIKdzHYhqjiKPdFeRtX8837WIsEknTK4bzojy1FJEXdduR0F0RJavb1 KMlq603WWe0Km2rKjT5RPqU4V6A813Hbw4kpClm0V4rthwMiqUiY5F6dBcoMmp1LPuRT pDGQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q6AeO++B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e6686c359si7417031cf.93.2025.01.23.13.57.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:57:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q6AeO++B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Bm-0004uk-Sy; Thu, 23 Jan 2025 16:56:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5Bl-0004tQ-2c for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:37 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5Bi-0002l1-MQ for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:36 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-436202dd730so10299285e9.2 for ; Thu, 23 Jan 2025 13:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669393; x=1738274193; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TTJwfGzF9H+nXAFh4oKJlHlsOewOwWpsY8vG45m99Ks=; b=Q6AeO++BTcaWnHF3acIqD/DxewMLrR+16WkIy1ptAf5acpuxXKW+B9eBU615aolhii gIQncUtCxXCuAOYLUY2Q7UmYrQhDIBsYKAcC+40kJYRN7SM9YQwCheCcv8TO9pYWa//P o/JdSInBMn7E4txNAi/5tGmDtXiLDqaY5UUO+V1jlYulYkSq4fL5dR2YyjqeL7t5NLYB U6gDhM89QejvDl56Yp8Up2V7RQLPARp3lN8vyfnEx+pIuEwKLs4MnrV8Pv1GgSQLc5ZV OJRD3BumVezxf5GcG3Ub21S+W3WkRVEkJZc54D+9O5Gn2/k8CIRBWYdnWqlanqG6TOuC yDTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669393; x=1738274193; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TTJwfGzF9H+nXAFh4oKJlHlsOewOwWpsY8vG45m99Ks=; b=g3Yn3jY+0DMpZe5Y6WlVWkaSHK8C/FKG2UJur7Oyl9BClu4zL5/tR5q1/Zgox3833Z 4ETwCpngT9DkaOSo3Y4FjY3vva1YsNVQxM0KloJiwMZZblXTP9tV6NfYn7uKqB96RF07 wIPsWzriPv55F6wWZLaHCyz1m7LcRXrN4kZebs10aBQ7J8xphjirVgAdlRAZ/U+ODbyP j1Zil4bUpLhRcEUKMAEQCr1CiDkkq9OOfk8FJk8ZFTXFr0vjB8EIDXq/YrG8iwzdxTAg v2r8dKOrj2Vj3HgRhAtPm6QQXuQlMhIeUve6jnOPy9qnVE0efJfABm59dA9p1YKBATw2 6tTA== X-Gm-Message-State: AOJu0YwoYgokfOledqSFAyjVlQJP7L6WtCzcUT09qbYfljNDYqw7C570 6nC2FrwrOH+T8c/CrJDEBlGALVmkFqNbLAe6nwk88iwZZBQLrATtA5WWVXhBBvN9xMP0rZJBm/r 54xc= X-Gm-Gg: ASbGncs1Z6RMsCkzw4ZzE90tCaJc2bZeZ1oYrhlGf+lyM0HZ0N6WoAA5gyKEUEV3EwG Hala9EegnA/u/SJbzCFtVoZx3jk+8c42T4sA7z2jbfdllWBmvgp2+sAAiaDq6keHosdr7CfqSgP pj1Prj5KLiB3RozpbJMwu74WLh5jEr3efSZSiIGDoinAZI97eFs98aq32y6pU1ekNiIqBi5LjTE TTnVYlCYicDoH/JGar5pJIUsAAgljq9W/6R7Xw4IE9gx7PeNPUw1jUdYcp4KNfkALOiWxzWSZLA tR3lRofVIri50sqy3Ck47Eiwj11c7FbTIrg5ZpLLApRO3HLNiHe8Xfw= X-Received: by 2002:a05:600c:3d96:b0:434:9dfe:20e6 with SMTP id 5b1f17b1804b1-43891439dfdmr252175745e9.23.1737669392560; Thu, 23 Jan 2025 13:56:32 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47f25csm5050725e9.1.2025.01.23.13.56.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:31 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 04/15] target/ppc: Move TCG specific exception handlers to tcg-excp_helper.c Date: Thu, 23 Jan 2025 22:55:58 +0100 Message-ID: <20250123215609.30432-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move the TCGCPUOps handlers to a new unit: tcg-excp_helper.c, only built when TCG is selected. See in target/ppc/cpu_init.c: #ifdef CONFIG_TCG static const TCGCPUOps ppc_tcg_ops = { ... .do_unaligned_access = ppc_cpu_do_unaligned_access, .do_transaction_failed = ppc_cpu_do_transaction_failed, .debug_excp_handler = ppc_cpu_debug_excp_handler, .debug_check_breakpoint = ppc_cpu_debug_check_breakpoint, .debug_check_watchpoint = ppc_cpu_debug_check_watchpoint, }; #endif /* CONFIG_TCG */ Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 173 ------------------------------ target/ppc/tcg-excp_helper.c | 202 +++++++++++++++++++++++++++++++++++ target/ppc/meson.build | 1 + 3 files changed, 203 insertions(+), 173 deletions(-) create mode 100644 target/ppc/tcg-excp_helper.c diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 7ed4bbec035..b05eb7f5aec 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -3144,178 +3144,5 @@ void helper_book3s_trace(CPUPPCState *env, target_ulong prev_ip) raise_exception_err(env, POWERPC_EXCP_TRACE, error_code); } -void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, - MMUAccessType access_type, - int mmu_idx, uintptr_t retaddr) -{ - CPUPPCState *env = cpu_env(cs); - uint32_t insn; - - /* Restore state and reload the insn we executed, for filling in DSISR. */ - cpu_restore_state(cs, retaddr); - insn = ppc_ldl_code(env, env->nip); - - switch (env->mmu_model) { - case POWERPC_MMU_SOFT_4xx: - env->spr[SPR_40x_DEAR] = vaddr; - break; - case POWERPC_MMU_BOOKE: - case POWERPC_MMU_BOOKE206: - env->spr[SPR_BOOKE_DEAR] = vaddr; - break; - default: - env->spr[SPR_DAR] = vaddr; - break; - } - - cs->exception_index = POWERPC_EXCP_ALIGN; - env->error_code = insn & 0x03FF0000; - cpu_loop_exit(cs); -} - -void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, - vaddr vaddr, unsigned size, - MMUAccessType access_type, - int mmu_idx, MemTxAttrs attrs, - MemTxResult response, uintptr_t retaddr) -{ - CPUPPCState *env = cpu_env(cs); - - switch (env->excp_model) { -#if defined(TARGET_PPC64) - case POWERPC_EXCP_POWER8: - case POWERPC_EXCP_POWER9: - case POWERPC_EXCP_POWER10: - case POWERPC_EXCP_POWER11: - /* - * Machine check codes can be found in processor User Manual or - * Linux or skiboot source. - */ - if (access_type == MMU_DATA_LOAD) { - env->spr[SPR_DAR] = vaddr; - env->spr[SPR_DSISR] = PPC_BIT(57); - env->error_code = PPC_BIT(42); - - } else if (access_type == MMU_DATA_STORE) { - /* - * MCE for stores in POWER is asynchronous so hardware does - * not set DAR, but QEMU can do better. - */ - env->spr[SPR_DAR] = vaddr; - env->error_code = PPC_BIT(36) | PPC_BIT(43) | PPC_BIT(45); - env->error_code |= PPC_BIT(42); - - } else { /* Fetch */ - /* - * is_prefix_insn_excp() tests !PPC_BIT(42) to avoid fetching - * the instruction, so that must always be clear for fetches. - */ - env->error_code = PPC_BIT(36) | PPC_BIT(44) | PPC_BIT(45); - } - break; -#endif - default: - /* - * TODO: Check behaviour for other CPUs, for now do nothing. - * Could add a basic MCE even if real hardware ignores. - */ - return; - } - - cs->exception_index = POWERPC_EXCP_MCHECK; - cpu_loop_exit_restore(cs, retaddr); -} - -void ppc_cpu_debug_excp_handler(CPUState *cs) -{ -#if defined(TARGET_PPC64) - CPUPPCState *env = cpu_env(cs); - - if (env->insns_flags2 & PPC2_ISA207S) { - if (cs->watchpoint_hit) { - if (cs->watchpoint_hit->flags & BP_CPU) { - env->spr[SPR_DAR] = cs->watchpoint_hit->hitaddr; - env->spr[SPR_DSISR] = PPC_BIT(41); - cs->watchpoint_hit = NULL; - raise_exception(env, POWERPC_EXCP_DSI); - } - cs->watchpoint_hit = NULL; - } else if (cpu_breakpoint_test(cs, env->nip, BP_CPU)) { - raise_exception_err(env, POWERPC_EXCP_TRACE, - PPC_BIT(33) | PPC_BIT(43)); - } - } -#endif -} - -bool ppc_cpu_debug_check_breakpoint(CPUState *cs) -{ -#if defined(TARGET_PPC64) - CPUPPCState *env = cpu_env(cs); - - if (env->insns_flags2 & PPC2_ISA207S) { - target_ulong priv; - - priv = env->spr[SPR_CIABR] & PPC_BITMASK(62, 63); - switch (priv) { - case 0x1: /* problem */ - return env->msr & ((target_ulong)1 << MSR_PR); - case 0x2: /* supervisor */ - return (!(env->msr & ((target_ulong)1 << MSR_PR)) && - !(env->msr & ((target_ulong)1 << MSR_HV))); - case 0x3: /* hypervisor */ - return (!(env->msr & ((target_ulong)1 << MSR_PR)) && - (env->msr & ((target_ulong)1 << MSR_HV))); - default: - g_assert_not_reached(); - } - } -#endif - - return false; -} - -bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) -{ -#if defined(TARGET_PPC64) - CPUPPCState *env = cpu_env(cs); - - if (env->insns_flags2 & PPC2_ISA207S) { - if (wp == env->dawr0_watchpoint) { - uint32_t dawrx = env->spr[SPR_DAWRX0]; - bool wt = extract32(dawrx, PPC_BIT_NR(59), 1); - bool wti = extract32(dawrx, PPC_BIT_NR(60), 1); - bool hv = extract32(dawrx, PPC_BIT_NR(61), 1); - bool sv = extract32(dawrx, PPC_BIT_NR(62), 1); - bool pr = extract32(dawrx, PPC_BIT_NR(62), 1); - - if ((env->msr & ((target_ulong)1 << MSR_PR)) && !pr) { - return false; - } else if ((env->msr & ((target_ulong)1 << MSR_HV)) && !hv) { - return false; - } else if (!sv) { - return false; - } - - if (!wti) { - if (env->msr & ((target_ulong)1 << MSR_DR)) { - if (!wt) { - return false; - } - } else { - if (wt) { - return false; - } - } - } - - return true; - } - } -#endif - - return false; -} - #endif /* !CONFIG_USER_ONLY */ #endif /* CONFIG_TCG */ diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c new file mode 100644 index 00000000000..3402dbe05ee --- /dev/null +++ b/target/ppc/tcg-excp_helper.c @@ -0,0 +1,202 @@ +/* + * PowerPC exception emulation helpers for QEMU (TCG specific) + * + * Copyright (c) 2003-2007 Jocelyn Mayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ +#include "qemu/osdep.h" +#include "exec/cpu_ldst.h" + +#include "hw/ppc/ppc.h" +#include "internal.h" +#include "cpu.h" +#include "trace.h" + +#ifndef CONFIG_USER_ONLY + +void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr) +{ + CPUPPCState *env = cpu_env(cs); + uint32_t insn; + + /* Restore state and reload the insn we executed, for filling in DSISR. */ + cpu_restore_state(cs, retaddr); + insn = ppc_ldl_code(env, env->nip); + + switch (env->mmu_model) { + case POWERPC_MMU_SOFT_4xx: + env->spr[SPR_40x_DEAR] = vaddr; + break; + case POWERPC_MMU_BOOKE: + case POWERPC_MMU_BOOKE206: + env->spr[SPR_BOOKE_DEAR] = vaddr; + break; + default: + env->spr[SPR_DAR] = vaddr; + break; + } + + cs->exception_index = POWERPC_EXCP_ALIGN; + env->error_code = insn & 0x03FF0000; + cpu_loop_exit(cs); +} + +void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, + vaddr vaddr, unsigned size, + MMUAccessType access_type, + int mmu_idx, MemTxAttrs attrs, + MemTxResult response, uintptr_t retaddr) +{ + CPUPPCState *env = cpu_env(cs); + + switch (env->excp_model) { +#if defined(TARGET_PPC64) + case POWERPC_EXCP_POWER8: + case POWERPC_EXCP_POWER9: + case POWERPC_EXCP_POWER10: + case POWERPC_EXCP_POWER11: + /* + * Machine check codes can be found in processor User Manual or + * Linux or skiboot source. + */ + if (access_type == MMU_DATA_LOAD) { + env->spr[SPR_DAR] = vaddr; + env->spr[SPR_DSISR] = PPC_BIT(57); + env->error_code = PPC_BIT(42); + + } else if (access_type == MMU_DATA_STORE) { + /* + * MCE for stores in POWER is asynchronous so hardware does + * not set DAR, but QEMU can do better. + */ + env->spr[SPR_DAR] = vaddr; + env->error_code = PPC_BIT(36) | PPC_BIT(43) | PPC_BIT(45); + env->error_code |= PPC_BIT(42); + + } else { /* Fetch */ + /* + * is_prefix_insn_excp() tests !PPC_BIT(42) to avoid fetching + * the instruction, so that must always be clear for fetches. + */ + env->error_code = PPC_BIT(36) | PPC_BIT(44) | PPC_BIT(45); + } + break; +#endif + default: + /* + * TODO: Check behaviour for other CPUs, for now do nothing. + * Could add a basic MCE even if real hardware ignores. + */ + return; + } + + cs->exception_index = POWERPC_EXCP_MCHECK; + cpu_loop_exit_restore(cs, retaddr); +} + +void ppc_cpu_debug_excp_handler(CPUState *cs) +{ +#if defined(TARGET_PPC64) + CPUPPCState *env = cpu_env(cs); + + if (env->insns_flags2 & PPC2_ISA207S) { + if (cs->watchpoint_hit) { + if (cs->watchpoint_hit->flags & BP_CPU) { + env->spr[SPR_DAR] = cs->watchpoint_hit->hitaddr; + env->spr[SPR_DSISR] = PPC_BIT(41); + cs->watchpoint_hit = NULL; + raise_exception(env, POWERPC_EXCP_DSI); + } + cs->watchpoint_hit = NULL; + } else if (cpu_breakpoint_test(cs, env->nip, BP_CPU)) { + raise_exception_err(env, POWERPC_EXCP_TRACE, + PPC_BIT(33) | PPC_BIT(43)); + } + } +#endif +} + +bool ppc_cpu_debug_check_breakpoint(CPUState *cs) +{ +#if defined(TARGET_PPC64) + CPUPPCState *env = cpu_env(cs); + + if (env->insns_flags2 & PPC2_ISA207S) { + target_ulong priv; + + priv = env->spr[SPR_CIABR] & PPC_BITMASK(62, 63); + switch (priv) { + case 0x1: /* problem */ + return env->msr & ((target_ulong)1 << MSR_PR); + case 0x2: /* supervisor */ + return (!(env->msr & ((target_ulong)1 << MSR_PR)) && + !(env->msr & ((target_ulong)1 << MSR_HV))); + case 0x3: /* hypervisor */ + return (!(env->msr & ((target_ulong)1 << MSR_PR)) && + (env->msr & ((target_ulong)1 << MSR_HV))); + default: + g_assert_not_reached(); + } + } +#endif + + return false; +} + +bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) +{ +#if defined(TARGET_PPC64) + CPUPPCState *env = cpu_env(cs); + + if (env->insns_flags2 & PPC2_ISA207S) { + if (wp == env->dawr0_watchpoint) { + uint32_t dawrx = env->spr[SPR_DAWRX0]; + bool wt = extract32(dawrx, PPC_BIT_NR(59), 1); + bool wti = extract32(dawrx, PPC_BIT_NR(60), 1); + bool hv = extract32(dawrx, PPC_BIT_NR(61), 1); + bool sv = extract32(dawrx, PPC_BIT_NR(62), 1); + bool pr = extract32(dawrx, PPC_BIT_NR(62), 1); + + if ((env->msr & ((target_ulong)1 << MSR_PR)) && !pr) { + return false; + } else if ((env->msr & ((target_ulong)1 << MSR_HV)) && !hv) { + return false; + } else if (!sv) { + return false; + } + + if (!wti) { + if (env->msr & ((target_ulong)1 << MSR_DR)) { + if (!wt) { + return false; + } + } else { + if (wt) { + return false; + } + } + } + + return true; + } + } +#endif + + return false; +} + +#endif /* !CONFIG_USER_ONLY */ diff --git a/target/ppc/meson.build b/target/ppc/meson.build index db3b7a0c33b..8eed1fa40ca 100644 --- a/target/ppc/meson.build +++ b/target/ppc/meson.build @@ -14,6 +14,7 @@ ppc_ss.add(when: 'CONFIG_TCG', if_true: files( 'int_helper.c', 'mem_helper.c', 'misc_helper.c', + 'tcg-excp_helper.c', 'timebase_helper.c', 'translate.c', 'power8-pmu.c', From patchwork Thu Jan 23 21:55:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859395 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494645wrq; Thu, 23 Jan 2025 13:58:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWxMAJaponzVkcjjikNpPtpd7rAK7hdRXdwgPqFLGIUvW7reI4Jgyxprk7qySPeHXeM6MK+4Q==@linaro.org X-Google-Smtp-Source: AGHT+IHKg3f+k230zHTtI3zuxiSBqz7FhdUutJ9HzciOKS0DpBDOlAS2C1bLLo4yUJwlNzvh0IKf X-Received: by 2002:ac8:7f4b:0:b0:466:b382:a789 with SMTP id d75a77b69052e-46e12a2d0a2mr434768711cf.4.1737669492585; Thu, 23 Jan 2025 13:58:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669492; cv=none; d=google.com; s=arc-20240605; b=gO2LC9VIIyShy1LjZVi6St0/gSQsU3X0t5wst8SxS/CMCziGkwzxACAWp4JhJa/hD7 otLuiuaFYdXOOvzj1l3wyBzb8Np4F5BCa3DdxrUO1cNuzzKEehUi2sezlqXvUCQvU7YG HtucwWeb9rSTw0LBz1fkY5sc2ZLdt6yEAYF9Ev9G+6UGRS2Ii/gYn1X9jJNzDDpst7fB 6LnF2ffoahDVUpaqXa6GNZS5DWNGIduCxeZceAe0XjgxkVWkBX/VRybXci8FBPUj99BJ BH8mWp4bbHhstDZ3e54YpEzzu74pHt6umickwwwKt7GIOrB0vquqRLUSYpXsMpJdpVJb QWEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1BMW+C7jqPLrnYT1UisfzzT75nHHylLVxw3pRQiBjgM=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=RR9NEY6NhajrU6VD4sUvUdCa0QKRxSP1wKKO+2XY8KeclJaaw1mqz3ZqOQfhEwqZ/q SHpM8h4IKwqdd8ShM/pz5Dc3Ql6G9ytDkdpYoffnKk+jdjvMGWXbQ6Y7mgk3aaknVqZx 2c00fYELWqcfAS4mNUC6dpqiWgflVNPEe6GB2fYLArDt2PJhyAevjga+E+WHheFU+vzK epD7FI3epzkHDcR4difBg1coPGp0Ky5KUXqwRn9YLazTyck0U7vWgTJx2BRVX6ccU267 oDM7h1wReJi2LmMfEZ3FE9FQ4l+nz/SjNJzoi794GFEZ6MA/+IZusF86eGTCYtz91Px7 7Zgw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OEoezC6I; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e66b67da2si8031491cf.290.2025.01.23.13.58.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OEoezC6I; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Bp-0004wc-Sr; Thu, 23 Jan 2025 16:56:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5Bo-0004vl-CM for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:40 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5Bm-0002ln-WE for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:40 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-385eed29d17so786539f8f.0 for ; Thu, 23 Jan 2025 13:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669397; x=1738274197; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1BMW+C7jqPLrnYT1UisfzzT75nHHylLVxw3pRQiBjgM=; b=OEoezC6IxlWhLgUHahXWKu7697MUp+HoIsGJszv2rGoNiW/Tb+mU3Mk4X3nkTFaUZ5 6Zrm4JL0aRNC/szn+z25mZsCe9GU3EQAZOf1TfhbZc+tb4V3LkCVAgf4twXq/nRXAIyc KtbEECX0dl5fYumHDPbc7EIAeSyMEju7Fim5KnvICQDi3GohOQ9s6pTJMmytst7/xUne l13fhvrYdvLy5/AaMT6NcnSbNojjZSmuNapFnAFWDyj8ut+Rq2VLuquXIZqxdYfzqUnq OYLhPBSGy+IjiIOp0KSQ3gqO7G08BEhJRCVy9tTJw6ziPGIzLPvaJ5LI4aErKpP9noRd eRyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669397; x=1738274197; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1BMW+C7jqPLrnYT1UisfzzT75nHHylLVxw3pRQiBjgM=; b=hL+RMnua1K+QaadeZD2xF10k/OKUI/KZcdFljMwG+1328prHXfRcNaZyNV6QcWKYLg 6ppMxzpd5yH2jQlNmDtgLocmD+Oid06lWuvvGajnEE/m5ZBEjYCgYzyw3eKTK7Ya1ZRQ ALAZOaBiiqME2FOdZpv1zVq9OWz2wCHeyF3fUHYGP/z5/ETIdgn1t7nkDFMYDfq5RgfW hhzFGYHWEnbUfLzUUrJelLJR+h2yHArMysIMTbLSEqb7OYCpm8iKYKx9uPUyHG3TR3ow q4eOAzSk6iz7UjaWT0wMziDzjRpDS1R1QienilhAkriuw8MovJF7w5+75CGWTxnPORZA cXMA== X-Gm-Message-State: AOJu0Yx8d/PmS9nL/LWgs1+5wdfULC7t6nxpSHIKePCRp+plWznMuChj csdGJXD9TGuzGUIkSgm+221zWreEja8W1/KrWGtV8T+l8Kenr6z1B6fqF3cNeevEw3gwqEenBvF DFIU= X-Gm-Gg: ASbGncuFtQrhYafqQIOHdrLA+tJ+D4UxCAKngXgBUtvQ95diMSMvJyR7wHEmHuC6xK+ UoeAkg9hCMFKZeNJNOCzhASxsQge/ZZGpoxzRMlWrEyZVF+nw4ZTHzLjRPo1CBMRTKRtFe39WmX XcbPFZp9dLE+wviaLt8fm8cyzDNsraAF6DTVp6iw+SP62IJ/vvbqAzso4LyW3aZVu+OQSJ7ARwM zEKLwufcdp4K4hpEhkZYXNLSpfNIwyPdNp4BaYVgbTICVfFJIizSrcDix18oG2/TP1q4j8hR+yX 0O0kAbuT1q9wdEUAvZ0X77161lk6r3Q3emDZ77oDivnbg+B5+MdLjok= X-Received: by 2002:a05:6000:178e:b0:38a:a043:eacc with SMTP id ffacd0b85a97d-38bf5655a55mr23265382f8f.1.1737669397200; Thu, 23 Jan 2025 13:56:37 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1bbd93sm779002f8f.76.2025.01.23.13.56.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 05/15] target/ppc: Move ppc_ldl_code() to tcg-excp_helper.c Date: Thu, 23 Jan 2025 22:55:59 +0100 Message-ID: <20250123215609.30432-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 21 --------------------- target/ppc/tcg-excp_helper.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index b05eb7f5aec..8956466db1d 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -136,27 +136,6 @@ static void dump_hcall(CPUPPCState *env) env->nip); } -#ifdef CONFIG_TCG -/* Return true iff byteswap is needed to load instruction */ -static inline bool insn_need_byteswap(CPUArchState *env) -{ - /* SYSTEM builds TARGET_BIG_ENDIAN. Need to swap when MSR[LE] is set */ - return !!(env->msr & ((target_ulong)1 << MSR_LE)); -} - -uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) -{ - uint32_t insn = cpu_ldl_code(env, addr); - - if (insn_need_byteswap(env)) { - insn = bswap32(insn); - } - - return insn; -} - -#endif - static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int excp) { const char *es; diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 3402dbe05ee..6950b78774d 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -199,4 +199,22 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) return false; } +/* Return true iff byteswap is needed to load instruction */ +static inline bool insn_need_byteswap(CPUArchState *env) +{ + /* SYSTEM builds TARGET_BIG_ENDIAN. Need to swap when MSR[LE] is set */ + return !!(env->msr & ((target_ulong)1 << MSR_LE)); +} + +uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) +{ + uint32_t insn = cpu_ldl_code(env, addr); + + if (insn_need_byteswap(env)) { + insn = bswap32(insn); + } + + return insn; +} + #endif /* !CONFIG_USER_ONLY */ From patchwork Thu Jan 23 21:56:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859401 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494816wrq; Thu, 23 Jan 2025 13:58:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXBN+fQzHluXvuyOUNZmkcp3aTfj25DJQLDD/RSGTWwnagaR92v4t3ZQsSR0fbljRuCsroEMw==@linaro.org X-Google-Smtp-Source: AGHT+IEbhDLuJgPElZbJa6xeLbXAdi7RwiN/YziG6L8MwhxIPpJeRjh8dejm6v65pBXWLDB5r2M1 X-Received: by 2002:a05:620a:2a0e:b0:7b6:d079:748f with SMTP id af79cd13be357-7be6325df6emr5799614685a.54.1737669530425; Thu, 23 Jan 2025 13:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669530; cv=none; d=google.com; s=arc-20240605; b=AoJrDbZZdnDd823fzoBYxNrhWQLMvPdpiTOzVcYqy8jLM7/XbX4wAJ9GsYydNRsiiH 0CN7YCti82a7UUVrEGfXwqdu2IgBCZC3EErX/DrI23hSnDm9pB5KB/oLvXCTbRfb6ZAB 3/Nsdy8Ujar896zB4gXMl3Rlo+oj2cB91hTVHvlz1kBtMC5xNwnhcPIfb6088H1MVMaM w9JVh0dyTffM371jlOLX0r49ehiZBhLfSZjxyFAvP7rizRkBc4aoptgMLZMhYrlYtpyQ U9Bppk83/rotE88k9JofShuHTEf62owNsoCccSU6hbS/fUp8/TkH0//DV6YFJHnzEB/k WenQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pHD1U6D3WvJOsbcmnGXDiHvtbFUdg0u7emrKOSlHmN4=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=htC5XdKl0gNo3HL2UqonGNVU1OtukS4nwEoATw4xWnkY7VNTyry6+zehIXKGbIVd2m oKNbJwLTtOJp2YQLpVFTMHbPwXlredoPvQj8EPj202UZQrJ5viW72hMM5GBL7Uqpet6U HzORIWHQodqg7G+JKJeBMfnVwkj6CbyQLHBBfLCb9l/0e1sALSQi58EijlJqTYFH8C3d rpR6HQMd26Zdsm3trCIUOHUjoJ34E227a0LbzeNh9o2L+BdxYaRW7+cBXm9Hh1f2gSPo aR2Ui4uFWK9G/++f96DNJriVlQryoLptYy9AQmILFC+h78WF0YOWsE1WA7ZZdYbWQnLM GKzw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZtNq3ZEk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be9af12553si74599785a.555.2025.01.23.13.58.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZtNq3ZEk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Bv-0004xa-Fi; Thu, 23 Jan 2025 16:56:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5Bt-0004xD-TT for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:45 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5Bs-0002me-DK for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:45 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-38789e5b6a7so819956f8f.1 for ; Thu, 23 Jan 2025 13:56:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669402; x=1738274202; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pHD1U6D3WvJOsbcmnGXDiHvtbFUdg0u7emrKOSlHmN4=; b=ZtNq3ZEklS8e4F1uJlKdmF6Dki/rlgEt6EyqLSwNrnBcUsRCunibhEXafPAAtanNKc lEK+LUT0Po9rNn6PBqr2wEpRdt3cR2o3I85akwCy32yHahfmYh+PfU3XbVs5i5Q2JIN3 OWdM8uL8fd1yj8ulzmN51eHKdNTw/J8jDv3wCgd2NF2EurnoVuGhBEpUEDTrWElcF9PQ b/ZfAis8ml7rEVCSo+xjUuwbbFW60490Gu9+6EMxY44v85wvevF0LQlzApxgIvm0sv87 XFpTz8OMiDCU4UKRdp1vOtrBTS0TPWvXD4+HKD16ZjRku5/hLdDERC7o5vmie6wRelQv K9Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669402; x=1738274202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pHD1U6D3WvJOsbcmnGXDiHvtbFUdg0u7emrKOSlHmN4=; b=Q4icjzlnB9OLccmEcin0N/M/4nDjxh6h0D+etkeyQst8bfXdE/wgDHKp3T8s7SQM1P SNcPBC/0noy9kN+31E03hytVtXRBji5146Arc7CZr+ushm7juzK/ufJwTKCprsfH14h4 KvZSrLg1ucgojqR/6B9xk/10JrvMBvZLkaOeMgeANgDaCxZLo5g6YXvwVX76sxDbWFly H6ZBW/4xSgHW9N4evrYMePFXcwWlNLA1WCXXq11+bYIqR+IQagky8AtNjbwAfInXtS3P 7CDbrK2kEYefUF3OvBNqDOfdslO9nDkJFByrwMEt2HCpul4FUNlQX7nb35L5pXl3+WGc PeuQ== X-Gm-Message-State: AOJu0YxMqrfRjhs0Ae+86dI5aR16sJ7VtbKSHG0n0bIY1VJzi+y5S41t yCiaCqxcOoTck9WzrxrdDogJbcH/1W8pE4yrfFyM0wv6h6YZiyzsItVBeoq6r18biTT6TxvA1Wm Lzl8= X-Gm-Gg: ASbGncsMStdWzCy08+Y5lH+rxuvRqSNvRmDSGfA9gYMaKPw75VVvwvpHwI6s0U7zepa CYie9P8V0wV4fkdkRClwQfmyWqvfZDQYAuxJ2CL3cA3lnn3pvgrpnJtCbOjzlMnb+ExzqgmEQK1 xUoPMtOpoQZ1vVjpkKxKDEvFYjGKSCA3TdpRkMWiBDTgMdKVgHzZSZsJUMGJN+PYe1PgydUo9/i 6qTgrA66XxZ3b7a8pGmchEigz1KOisCcJMSyCiLQbTDS3bhuZYRmYBlZmBdakcNSZrq8y18BVMd G/M7SsmcNV+KdgicYz7WPvcm7p2CC7cuFwqp+V2SjiRjrubleHtujtU= X-Received: by 2002:a5d:64e4:0:b0:38a:5ce8:df51 with SMTP id ffacd0b85a97d-38bf564d5f2mr27169952f8f.2.1737669402622; Thu, 23 Jan 2025 13:56:42 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a188689sm796191f8f.48.2025.01.23.13.56.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 06/15] target/ppc: Ensure powerpc_checkstop() is only called under TCG Date: Thu, 23 Jan 2025 22:56:00 +0100 Message-ID: <20250123215609.30432-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 8956466db1d..b08cd53688c 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" #include "qemu/log.h" +#include "system/tcg.h" #include "system/system.h" #include "system/runstate.h" #include "cpu.h" @@ -30,7 +31,6 @@ #include "trace.h" #ifdef CONFIG_TCG -#include "system/tcg.h" #include "exec/helper-proto.h" #include "exec/cpu_ldst.h" #endif @@ -443,13 +443,11 @@ void helper_attn(CPUPPCState *env) static void powerpc_mcheck_checkstop(CPUPPCState *env) { /* KVM guests always have MSR[ME] enabled */ -#ifdef CONFIG_TCG if (FIELD_EX64(env->msr, MSR, ME)) { return; } - + assert(tcg_enabled()); powerpc_checkstop(env, "machine check with MSR[ME]=0"); -#endif } static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) From patchwork Thu Jan 23 21:56:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859394 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494627wrq; Thu, 23 Jan 2025 13:58:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWTZUotgRLAYu97YpOfRDjTHbglYFTeax+qwLWk61qi3vLk76OUmBAJ2IybWS3hb8nF/HLTZQ==@linaro.org X-Google-Smtp-Source: AGHT+IERUe9CS/06oMg+vFOD2Z/e2g7+x61EiVbQZpUxYwW/9imHHifr44osyPZ0gsQnnaaFhFKg X-Received: by 2002:ad4:5e85:0:b0:6d8:8fbf:d1b7 with SMTP id 6a1803df08f44-6e1b223ad9fmr386048986d6.43.1737669489207; Thu, 23 Jan 2025 13:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669489; cv=none; d=google.com; s=arc-20240605; b=Y4+yuzE0uOZKcGr2YBYkHBlVL5okuRde+rfB9LDdeDywrMTyb8M65cCIcygDRVS/0O /6/VDZVH5KrrOcJa44ALjDwZRBixWdtOu4qkrRb0ndQ+zEFx+bCTnEt4cLDcH0M/vlfl dDudK1Vcdbun8BHGewn6OPen/YjBkHwH5pJnCMF5r5hfSlqAwOehdMnn2Y6Nn6ZXN6wT X9AKrKGDpD4o608k8/HLEnhreQtg3Dm6QRtnMRtZltvk6C1QxbKPKJCyaLDT8cfeg7Mn tx1r+llXHldAH7A1ZUJe9CtmlYf+c2ha1CeD471VyUXkZKTATH4/D1xwkgJsHPHgWC2y jDCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RvU1L8TmR0niaHN7D1u6sbhbe7T6PjXXRojbsrJxUGY=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=PyUnVgnFAcLz/GiBWqVLiCwxjfWYL6aSp/psuUnpmOYHJXDptnQLWDnHBvI5dwP42J 3PeRXh6yHV+URAOT9RTkJtzxUvBjifwR/o/NonqWrfUBZNEzM49YJ/XemdQMbwfF46MO 6Qf34TqLujLYCdrBokf3rWXJygHhtKQW4R+tTZsWNawGAn+y4K1lL8dojUCyI2T9XCoY Sjz9x5Q7kvgN+joxBKycKAQkkNApLHPspLyMdz+eUJtONixW3V5qCDrDJPF319lYpje8 wjC97IRdEAVbgH2hEYfSgwNy4/uXgBU//VlYYptbAGsYaE2V7MeNoy/9KtyQbFg5Q/yN 5beA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KkrJfLjs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e2052596a5si6415516d6.92.2025.01.23.13.58.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KkrJfLjs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5C2-00050r-KR; Thu, 23 Jan 2025 16:56:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5Bz-00050R-S0 for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:52 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5Bx-0002nV-3a for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:51 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4363dc916ceso16944995e9.0 for ; Thu, 23 Jan 2025 13:56:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669407; x=1738274207; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RvU1L8TmR0niaHN7D1u6sbhbe7T6PjXXRojbsrJxUGY=; b=KkrJfLjsxVHZL9c9A6c9GdtH6AWbOoHC2eSiIYS2MDMbtmT+DNqO3AdK5kZhaKNwnm +kbwK9q4M+0+tTlZRi1vbPiu5zm9qhRAlrMWFN4uWKkvE13YAMvKCmfNh36IXYlCe3Jq Ri/cDLjm+RI64fxSTPCI7PujAf9jHI5MbrdM8bLuJWsNbmXwf6ysvAjSYhn5XGXVH824 0GKQEOBGq44NTBocZ3L+sSRUhwecq+c8+ldm7fJz6kVe0iLrQWZaayULTyb0ICpu13+i zn3FzO829wjmGJSoESjGpSeI3lAh1f8xS5DD02EsYZa47mpCdCm0wBnEQAZUwqjkTlVR +ivQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669407; x=1738274207; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RvU1L8TmR0niaHN7D1u6sbhbe7T6PjXXRojbsrJxUGY=; b=lQRTFt+YXBJqUz7YKS8zJwW3r13cq4EgBuAEUMSeE7n9vgIohJT37ZCB+5Uj24KbgI Tu6nzTJ6NKn3ay5tzcSVGJ7iQO2OpIlOPLrIxvx0Vt3Yu2RMMNDuM1Lcll3Z/guDuHJe sVNqermIPcL5bjEY2nIlIkRZVAe4Slmxf/8U1GZIy3bDI9CpAu0/Vgf7iWTa9GIjAe3Z akQAsYK4PsZD8TkHt7Yvg5nrulc3TO7p167zkc9qM0Ens+Quq736s4S9XaaANsLkueDI oVtG8vj9LPdIdo83XV7LZSVnCsfXSFeBPIDRIzHCJLmEudZJosStdfHKrH7Mi6iNHOyx gK6w== X-Gm-Message-State: AOJu0YwHP2dzxnxmY2bqpirXgMXZ+hLkmHSOCXBQOyP6hkjaTRFzyQ0K THatcz9slzN6bIhJmiiKu9FWcKFrjeEss83/+rzeGSwjuKmeVSfHmcoeWgWJMSj60C7YLoDKPOl DL2Y= X-Gm-Gg: ASbGncuvBV8NYhULjz1kCMXRe1aeEI8hIks3oI5wasuiZ0QEg5G2zz82z9Te0kSoYxl dkYCciplofVRWE4+u3iK8DzbGroO3ZIGGsuLLIH8GmcJTtzn+psXmpM6DIAA23Wq6+VQN+eYHG9 6s9ZLj+xcEJ/34V/2YBA6f4DFcMBRzFjvgH1XdSetGJXx7w064QPMBZSiQmdR6HEFaRK/9qms+k AG7D5lY5mLTTCHwJskDeaOmKJLiYMPFDZI6OoDQJP9OUUqlfWpWFqBGbOWjwSj0hLdMBZargPHs Xv5GHarLccO8ZxVf036FjxtSdACVp+D+WkXARsTLgK3/aCk5Q0MRU7Q= X-Received: by 2002:adf:e50d:0:b0:38a:8d32:272d with SMTP id ffacd0b85a97d-38c2227d072mr4559041f8f.28.1737669407245; Thu, 23 Jan 2025 13:56:47 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1764desm805629f8f.9.2025.01.23.13.56.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 07/15] target/ppc: Restrict powerpc_checkstop() to TCG Date: Thu, 23 Jan 2025 22:56:01 +0100 Message-ID: <20250123215609.30432-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Expose powerpc_checkstop() prototype, and move it to tcg-excp_helper.c, only built when TCG is available. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/internal.h | 2 ++ target/ppc/excp_helper.c | 26 -------------------------- target/ppc/tcg-excp_helper.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 46db6adfcf6..42e33be496f 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -289,6 +289,8 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, void ppc_cpu_debug_excp_handler(CPUState *cs); bool ppc_cpu_debug_check_breakpoint(CPUState *cs); bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); + +G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason); #endif FIELD(GER_MSK, XMSK, 0, 4) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index b08cd53688c..236e5078f56 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -400,32 +400,6 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu, target_ulong vector, } #ifdef CONFIG_TCG -/* - * This stops the machine and logs CPU state without killing QEMU (like - * cpu_abort()) because it is often a guest error as opposed to a QEMU error, - * so the machine can still be debugged. - */ -static G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason) -{ - CPUState *cs = env_cpu(env); - FILE *f; - - f = qemu_log_trylock(); - if (f) { - fprintf(f, "Entering checkstop state: %s\n", reason); - cpu_dump_state(cs, f, CPU_DUMP_FPU | CPU_DUMP_CCOP); - qemu_log_unlock(f); - } - - /* - * This stops the machine and logs CPU state without killing QEMU - * (like cpu_abort()) so the machine can still be debugged (because - * it is often a guest error). - */ - qemu_system_guest_panicked(NULL); - cpu_loop_exit_noexc(cs); -} - #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) void helper_attn(CPUPPCState *env) { diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 6950b78774d..93c2d6b5a03 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -17,7 +17,9 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "exec/cpu_ldst.h" +#include "system/runstate.h" #include "hw/ppc/ppc.h" #include "internal.h" @@ -199,6 +201,32 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) return false; } +/* + * This stops the machine and logs CPU state without killing QEMU (like + * cpu_abort()) because it is often a guest error as opposed to a QEMU error, + * so the machine can still be debugged. + */ +G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason) +{ + CPUState *cs = env_cpu(env); + FILE *f; + + f = qemu_log_trylock(); + if (f) { + fprintf(f, "Entering checkstop state: %s\n", reason); + cpu_dump_state(cs, f, CPU_DUMP_FPU | CPU_DUMP_CCOP); + qemu_log_unlock(f); + } + + /* + * This stops the machine and logs CPU state without killing QEMU + * (like cpu_abort()) so the machine can still be debugged (because + * it is often a guest error). + */ + qemu_system_guest_panicked(NULL); + cpu_loop_exit_noexc(cs); +} + /* Return true iff byteswap is needed to load instruction */ static inline bool insn_need_byteswap(CPUArchState *env) { From patchwork Thu Jan 23 21:56:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859387 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494419wrq; Thu, 23 Jan 2025 13:57:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWERxvHYWmbkLsloa971g1ZXPj7bwIpVcWOPRriwr/OJTrIjtwQXfKqZv3IH0SnW7mnE9qeiA==@linaro.org X-Google-Smtp-Source: AGHT+IEPvhgU8ME5NMn+2v4+wiv3GIR03VX2u6q+N2LyNz/SqZbUhoOXrC9LdADnFS9XqDkMBZk1 X-Received: by 2002:a05:620a:4556:b0:7b6:d736:55c4 with SMTP id af79cd13be357-7be63216284mr3490825085a.17.1737669444798; Thu, 23 Jan 2025 13:57:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669444; cv=none; d=google.com; s=arc-20240605; b=dcDZCV2PGsA0PDP0rZ4SajISmrcsmzG5XWI4OQolGZWc+55VUd9T7h+wT3XRkTMh70 tC3yWEoEJ/eRDn/s61ZtXd3TnRGcMZO7h4iXQoMKKmmI85Kf0qZsHFHszlG2SLIh7SPC sDX4pv22hHiXPLXGZbne3SME2H2ZPPJtxr9oUWlcn0MSucuZG64gLRSS47uKhrBSk611 0qBRp5Tv3hi7QGtrXWLR1IiEVEZwZZ2t60CPImoHvHLgzEU9VeIqpuxymSw/+sQtviSa ET/6vq/uoPh8YjalLuaZedDjefrthJQMp23wilcsoU1ktZ789H8qFooKJpXo9Pm8wRkc 3Fsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gXRYcwTEjcVPemISiJ0oN9v7hHJA///00CaMfmTQwfo=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=DIJ/jFS8nti28PUrZN2KFhmXBkxFI8A1qB7/uoRCkbkalOUh/Nc4MdgubPKTWEnDoo W4Pi+ATbzzPXSfeL2M1BbN2khZY9YG1StHR55OwWowctP9R8e6xE1lTtIlMkUrVGONsC q1IaVnyncBRbK1rCTU8nOV+ZFH9mdiimDlQkDKkFrocHDLaNAS871I6Gkhu71v2V8qMX gbWbTzpLXpojleSe7lyRfODVYk+HajXE8c8uwvTf0n0iY68eGJL7+7oWQFi92ky7DHdw rrX0Pj79YA9OQLGq6ywkhu1Ox9GXS5IG12qeQVeNe8Z2nf55fMrBUHwAdSgpP+B9CWrQ OBrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mBNS1u/2"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be9af11cb9si75799685a.539.2025.01.23.13.57.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:57:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mBNS1u/2"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5C5-000521-UF; Thu, 23 Jan 2025 16:56:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5C3-00051Q-U8 for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:55 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5C2-0002ok-D1 for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:55 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4361f796586so15349715e9.3 for ; Thu, 23 Jan 2025 13:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669412; x=1738274212; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gXRYcwTEjcVPemISiJ0oN9v7hHJA///00CaMfmTQwfo=; b=mBNS1u/2bI7eV0b3dXgkY4Nl4FANMyu95Q9QDjgop91d3y0XHjnQRlesvPXqjZtszG ROfRVRYZVi7gX4ZouPY8mSwfb0LqXh0QyszMxB1bZfTY1EN9MNhyhc1SoN8ASiFfltDv fK3p25CxONGhmPAw7GoA2dQ4SQpgW/afelrBY/mJEh9yqLsFWYx41otlmPY3HfJHzaMb pPs31oAwS2EpC4vsr9lWS6ilFAeuIAoVZrGGXafB8Ch8yQrXabNTmgKvp0wre+XG9biG TWUz9PQyHW1qOJT25MfJVq7j6iwxTBbKmykyftzWcTp15bgrjgcQAXh7SjJ0I896Z5bl Gg+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669412; x=1738274212; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gXRYcwTEjcVPemISiJ0oN9v7hHJA///00CaMfmTQwfo=; b=YuHArhJ4HAqmRMlWIdwPKJHwJT9TM6VBzgHb9zarhzmBs+3xoG4Tg7hL1mfnyNpLFl IMDYGVoM8+nGGLcdTY+o1WJzmGJmbs1YMcqKacIqchgSIgTFnZOzNapMrEr4GL39GLCU JZpxidjP9cwPxENulxGvPhKJ/qYBvWQ+q4tOmor/dwUeWJ9LGj1pTkQ6bHYRcQfO8fQv pOxWoxcxjUVOPtXjcGtyk/3qZnFMANAP8caB6EF5khDWk1tJTea4+A77jVxESN4+fkhf EFW6W7RFzGGuQi18/k0UTzwCPR5o1WiXcnYNFOeqiLFTqTaDq3B7fu1q0EdaFIMnPpiu 9s8A== X-Gm-Message-State: AOJu0YzjZ3JPJE84YRjUnij58UWZh3k9UxIaLvZQZv90ewhmsvpbWf7j 6Wx6UfvTPIB3mjAvYh2PouDAnCo0eQM0sak9PPKa276PsXY+DuT52sBSOdz6qPFQ/XD4hXh29bV 5d08= X-Gm-Gg: ASbGncsz5KSqLdY8KAugiIAdfkNECrhiKVfxWk5xw9ZmAnosXuatcV7+qIpI5O9XobI Ywalf8zc8/X+ODMaSk0KZMDc66sQWU3W9UWjJVgNXOdcYgENoekVWJgLfF291cVQ1Qk0GkOCMNm ienSQgtl2Rtjwu5z732nl5IukhG5jozggq9w6YOJ5JhOe1fWCMIRwGTtyVrr2m2mciE6sN5GH8z WRcxITj/J2EuNS1ecMngeyMP9Vnep8jLtYns3+XUuf4BopxA630NVJwpMZSrOErfaAmsXsTfXv6 wzAyS2/AE83+HP6zTWQC13YY/MvFvoHHhmE6dyt+pdySU9Kt2zKzWqMmb/1G3++aCQ== X-Received: by 2002:adf:f48c:0:b0:385:f996:1b8e with SMTP id ffacd0b85a97d-38bf5659a94mr22526857f8f.16.1737669412599; Thu, 23 Jan 2025 13:56:52 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c4295sm792689f8f.91.2025.01.23.13.56.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 08/15] target/ppc: Remove raise_exception_ra() Date: Thu, 23 Jan 2025 22:56:02 +0100 Message-ID: <20250123215609.30432-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Introduced in commit db789c6cd33 ("ppc: Provide basic raise_exception_* functions"), raise_exception_ra() has never been used. Remove as dead code. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/cpu.h | 2 -- target/ppc/excp_helper.c | 6 ------ 2 files changed, 8 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 0b8b4c05172..4ca27d6b389 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2753,8 +2753,6 @@ static inline void cpu_get_tb_cpu_state(CPUPPCState *env, vaddr *pc, #endif G_NORETURN void raise_exception(CPUPPCState *env, uint32_t exception); -G_NORETURN void raise_exception_ra(CPUPPCState *env, uint32_t exception, - uintptr_t raddr); G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exception, uint32_t error_code); G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exception, diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 236e5078f56..9e1a2ecc36f 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2528,12 +2528,6 @@ void raise_exception(CPUPPCState *env, uint32_t exception) raise_exception_err_ra(env, exception, 0, 0); } -void raise_exception_ra(CPUPPCState *env, uint32_t exception, - uintptr_t raddr) -{ - raise_exception_err_ra(env, exception, 0, raddr); -} - #ifdef CONFIG_TCG void helper_raise_exception_err(CPUPPCState *env, uint32_t exception, uint32_t error_code) From patchwork Thu Jan 23 21:56:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859389 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494497wrq; Thu, 23 Jan 2025 13:57:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXckJT61kII2KXEfkzjrp1QqT2iydxm7tK/MLrtKrozY+2GHAVPy3vPpLUavpIbWwduF8oyZg==@linaro.org X-Google-Smtp-Source: AGHT+IF9ua18tSs7FcXB21EILNDF4ovh0Eq3MjiLwz8fgYPk3vZ/0bdgNFjGWchs6YE090mVgWvb X-Received: by 2002:a05:6214:3382:b0:6d8:893b:2a13 with SMTP id 6a1803df08f44-6e1f9f053f7mr75849296d6.0.1737669460410; Thu, 23 Jan 2025 13:57:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669460; cv=none; d=google.com; s=arc-20240605; b=BbPz2lILJSCfQx482btMU/lvzY+Eg/Tp9UKi+vn27aWVrTJsovef2pt08Fo8+jL69s ElniW3KCay8jVFybdZmzrFwtbS1gEqXguArHI2XRJSYvyeEl7eBqLlt4wxWyvcj2IFY3 fcualf4QRZcn1EsUFY/J0eAII0dOD5wMbbveh/1yqj12HlISyLrQ1P1VO+VrGJJBnfCI hkVQWAMV8vBmRTYw/NnCJ/2EIKEw6kvwMMOouEZUgub9T6pEprW8po+HfkcKkuVNRaIG +ujbNUEGk5fdVUjdpgmzWtEQIpWjQKkW4PtKItslXf1ZyP1OcG42hlsGArRIBIUQUjNY 5Hrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6f/oCQzbSHImCkqqj0iWpdHWh0qIumN7VF7msGHxoiQ=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=FuFAcS1GKfCYWUt7bzxtt4IsLs1G83F7Rq3SxEjR1h/jJxkVqjRvSWqwBbHlg4jnV6 jgeKmhxGXmCXxax+UvUwgDgivBlelc+TPmCG42E3ySDC5KQPp+1oOGOQ3tMVsA9EcnVI Q95i11dxu2YYGcVkN3m5aJcv5FN6/NgFkNGO1HA41keZuZzrlrXtS56wPftkpTggBRVb QaR4xahN0tQEBqBLvTYyrmk8J9VbIx4hnGpUgOo6jjvutm3NSdyfQicTb0K4BuJZc7fK l8p73q51xPAl9tsfWRlapZzhKti7G1o0+BD3zkVQXZ5QXPaQxlMUkNHhF+xdwLKck5pG 01kA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BTm3CAQ9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e20611df43si6488366d6.436.2025.01.23.13.57.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:57:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BTm3CAQ9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5CB-00053A-8x; Thu, 23 Jan 2025 16:57:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5CA-00052k-1V for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:02 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5C7-0002pq-SW for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:01 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43618283d48so10535395e9.1 for ; Thu, 23 Jan 2025 13:56:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669418; x=1738274218; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6f/oCQzbSHImCkqqj0iWpdHWh0qIumN7VF7msGHxoiQ=; b=BTm3CAQ9gNi1mjL1hrGVYtOGJ303BmXw8wfU9snOgrLnYcfVXjnaq0Yh6QOR/Xcsfo KlpefdYKvlivcwOKrPCllTpAYiufDLNFmBbbigqMpUzRuqq+nmrJPer3YiHOCNGS5n3S icd5akML7bkilO6QKN+eI8TFawsrB2q7qj0uOvXR8Yqeh5ifDg3fZ7cC7db4MjSQ1omC co4wHky/f+RLZ3E5+O4wEKoPEcfhpMI4N78B3pL11Kygv6IeJu09GtoSfUSqMM4fcHEU 3E8VG7RjdE3qGecFjA0FxOMqW4rDXJ1rzfWstsWqsaXFRAk3AaNVw12kUokrmT7M8533 XF4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669418; x=1738274218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6f/oCQzbSHImCkqqj0iWpdHWh0qIumN7VF7msGHxoiQ=; b=ZghVJKGE8u4AE4q5NsRqqLtN41jVupCv/NK3BmmYeN5a//dCc+eP/tkky4zqxdZyjh hSrlmJvjRWoN55FVh80y+l7DIoeLorJ+uGJbfB4kLAwO9QHfaPpv4jAXY/fP+DEDIL82 AhPmvKBJEYW5zjt6ZKNzaaf/sN/JM8rSXV1PtzhJbVrrHFJKi9GDnFjp2IYO0qix85gh c7i2nVlJJxTuNWTIm1BlYrW8BldPm+qKDdOXuGF7sTGjg1MeP8ZflEPqAalRs+yi5WZV yrJanjBRYmjMIJeQZ2GOlQJv0cHhAmanaJuj9Y3yqGvTrD1bBUZG4AKftLu9v5dkxiZJ wBhw== X-Gm-Message-State: AOJu0YzclEvTFi1ymghqdso1x/agdkRZWzHPiZhXjY//Ybm6oOYO0PL6 fv9fIcd6DGWr5ebkJ0VOWiBpZbEJloxC1sTBiuFUu/tzFSNFImC2GlgZj6iDjkaAtliqAcGFa6V GDy0= X-Gm-Gg: ASbGnct9covRYCLAHI+J/JVwMOPglmuf8cYf6g8qraWQpUiGVhJjLRX7e2yE9xAO+wq WRV5tOHSQs0Z/u42t2sOPlHUkUyfmVw/g5UrZGTUabQrcC2epmZ/3hU+sXOWs0NDEoJInAWh2EA 6mFrhjsCVRdwStgARnec0dwEUBQGZ9SXL7C7CD1mtvvj+SZ6ZPG794NWKaMuz5G4Z48AAVF1UMj yeq9k0PHC3/WhL4lg0hrYGE8CI5G0qWedMDXwCBTNDvzLdKVg81b2wLRq20/AlTI1PAavhirTE2 fszRQhieDpE7L2kQMIh/9LDwVkGxhPKeLpSVx4rY18qhiyoc18zOtCjg+kVmeUIkGQ== X-Received: by 2002:a5d:6a92:0:b0:386:3403:7b63 with SMTP id ffacd0b85a97d-38bf57b3d42mr17860596f8f.36.1737669418137; Thu, 23 Jan 2025 13:56:58 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1bb040sm785629f8f.67.2025.01.23.13.56.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:57 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 09/15] target/ppc: Restrict exception helpers to TCG Date: Thu, 23 Jan 2025 22:56:03 +0100 Message-ID: <20250123215609.30432-10-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move exception helpers to tcg-excp_helper.c so they are only built when TCG is selected. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 34 -------------------------------- target/ppc/tcg-excp_helper.c | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 9e1a2ecc36f..6a12402b23a 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2504,41 +2504,7 @@ bool ppc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) #endif /* !CONFIG_USER_ONLY */ -/*****************************************************************************/ -/* Exceptions processing helpers */ - -void raise_exception_err_ra(CPUPPCState *env, uint32_t exception, - uint32_t error_code, uintptr_t raddr) -{ - CPUState *cs = env_cpu(env); - - cs->exception_index = exception; - env->error_code = error_code; - cpu_loop_exit_restore(cs, raddr); -} - -void raise_exception_err(CPUPPCState *env, uint32_t exception, - uint32_t error_code) -{ - raise_exception_err_ra(env, exception, error_code, 0); -} - -void raise_exception(CPUPPCState *env, uint32_t exception) -{ - raise_exception_err_ra(env, exception, 0, 0); -} - #ifdef CONFIG_TCG -void helper_raise_exception_err(CPUPPCState *env, uint32_t exception, - uint32_t error_code) -{ - raise_exception_err_ra(env, exception, error_code, 0); -} - -void helper_raise_exception(CPUPPCState *env, uint32_t exception) -{ - raise_exception_err_ra(env, exception, 0, 0); -} #ifndef CONFIG_USER_ONLY void helper_store_msr(CPUPPCState *env, target_ulong val) diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 93c2d6b5a03..268a1614597 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -19,15 +19,53 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "exec/cpu_ldst.h" +#include "exec/exec-all.h" +#include "exec/helper-proto.h" #include "system/runstate.h" +#include "helper_regs.h" #include "hw/ppc/ppc.h" #include "internal.h" #include "cpu.h" #include "trace.h" +/*****************************************************************************/ +/* Exceptions processing helpers */ + +void raise_exception_err_ra(CPUPPCState *env, uint32_t exception, + uint32_t error_code, uintptr_t raddr) +{ + CPUState *cs = env_cpu(env); + + cs->exception_index = exception; + env->error_code = error_code; + cpu_loop_exit_restore(cs, raddr); +} + +void helper_raise_exception_err(CPUPPCState *env, uint32_t exception, + uint32_t error_code) +{ + raise_exception_err_ra(env, exception, error_code, 0); +} + +void helper_raise_exception(CPUPPCState *env, uint32_t exception) +{ + raise_exception_err_ra(env, exception, 0, 0); +} + #ifndef CONFIG_USER_ONLY +void raise_exception_err(CPUPPCState *env, uint32_t exception, + uint32_t error_code) +{ + raise_exception_err_ra(env, exception, error_code, 0); +} + +void raise_exception(CPUPPCState *env, uint32_t exception) +{ + raise_exception_err_ra(env, exception, 0, 0); +} + void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) From patchwork Thu Jan 23 21:56:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859397 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494750wrq; Thu, 23 Jan 2025 13:58:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWtRtAtFKjUvsLGeq5AFiaxD42M8JCcYHCRQSldUztsTQtge1VKgYDXPSN3LQmJZtVd4nll0g==@linaro.org X-Google-Smtp-Source: AGHT+IEnJDhCP6cKNj9c5fZeIudlH1ztwbkXcNHV2/72RgW4Jg9PmjaYP/mnJkvRdh4yh60F7qbP X-Received: by 2002:a05:6214:2421:b0:6e1:69cb:4292 with SMTP id 6a1803df08f44-6e1b220e1eemr431239916d6.33.1737669515006; Thu, 23 Jan 2025 13:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669514; cv=none; d=google.com; s=arc-20240605; b=Uqx0CKxJZ31SP9i3SdMIDTdKCL8W5JEOJumNFAsrGXloa9fupCt+s4FcRW345moQ1d lav7XStzjPYyThhlwDdNUVIw3GrsN1olMtSgpoJyURO4ZZFEEa8FeIiObVT46/5aTZPP VDRw3xxr8x4Ab9cd6kABsAIR5PBz3WQfg2H+j+HQOtzJMgE9N/okXbb/eJ+vwZRhZlUf 25tDq60ZTse8T3ikK+n9U7mUvLYDVnsA+soXPrPGuqDpUzoM5iSU1nwyHbZ/I+0vwEf8 0nzVcnyH1hWl4rsj/kpIzibss1SYu4rh6Ne/61ckE1vV3SL+bkeaOOo3bZj9nLP+HQdB 3u+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w/s+egRhxN6zM3AeA9IUXU+DNXqnyBTll7yI3vCEboM=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=cblElStzYvrH6gdJ1nzLxnHFlbmmZPET0D13bttr87L0vdOh7oyjsQ7HHiIi0tooSf VnD3tZlIBIOka678VQo6uEabbw2jVTsKBILY0gdsaO7EtyFzfOYi+y801pYgy1hC+NNX zC36mrWfBNKSmApOkOuzgm7LKxxAQqpWryH6uynDR7Qg0uoWZgGclJADqgDbrTcYUjzJ UnpvUYPVHxMBD0bF7RFPNen2klrHJduv5lu0o8r91WMPRdlOV5AzJdIES8vLPI4SkIor CVIkcu9rZyoqmlxTPTYkxRawAlEDZQIfuGgvO7C6pFCrKsj7shAH4Tz1RdeOMpW0y3Jb JZrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="p/1Es+RD"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e205f02a35si6265246d6.336.2025.01.23.13.58.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="p/1Es+RD"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Co-0005bi-5P; Thu, 23 Jan 2025 16:57:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5CG-00057R-7Y for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:08 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5CD-0002qo-5A for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:07 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-385f07cd1a4so1389031f8f.1 for ; Thu, 23 Jan 2025 13:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669423; x=1738274223; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w/s+egRhxN6zM3AeA9IUXU+DNXqnyBTll7yI3vCEboM=; b=p/1Es+RDSVpBnyLg5qeJbSTzlC1hwwkoDGOCTstOcSi7guApRsdMGSLuRWQomVouoI y6RCtQyu8RuNxYz06xRukKPvNxy5UjYEtVtECVBxszvuLwv5sQMhyeF1k1nS4RCOlurq YUSquSZVftOojD3Uj8mPaxfWTN+x1UKHrpcnVFsFpjxqG9yijQjwIz5T5TuLNIpiqiMS qNmiJCNTFwLSGlMFneNn4SFNQ+gHeyA43CmtKbHKlY7mlNRUgeJ3G3nfCuTrtYoieGek e42BWz4g0jXK6I2zDPhe5LmICDNg/D2o0Hvx6NEEkbYS7/nVmBSiIBsDhkoj17NjDego KETQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669423; x=1738274223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w/s+egRhxN6zM3AeA9IUXU+DNXqnyBTll7yI3vCEboM=; b=w87Rv0J7qrLWOryYkJB8D1UXY4c+uVihTq+pMeih75oJgvuotDiRI/SzdyhqlJrrGf EkPZ4hdRHyhXitc6swqyWseQWaIayoFgIHQnzoHS2cZGhT5IR1vDShkHxwGDwKhZmJ/R S7mnhKQHFXu0lE3nMwB2Tj2jq4X8wjApawiEWKgAs4uUtiF2033Slfz3RLB9RXc3kzJS jnkvb36WWPIUUnBmhYMl39TqKgFgV9fXPaVG7M/ILUkVb9jc+PJZmRnwU6gVTr12MuHW G+1r5us0TCSiPRG8zEW7ZNeFHbtG2WNKsm2lfufEy3HT6ncJTQ6+PakDqOmYUXclllz1 9jyg== X-Gm-Message-State: AOJu0YxEw+ID9VSUfgxResrsCwOSAUbiiypyD+XF8LTe7UKoKBrDkV99 zcWtrwI+iNwrnwL4x+LF/Xolx/JZVSwlEArPMTkfGTQBKm++jZx6tFaD9SXonBv/XbE7MYX8S2F 0Hwo= X-Gm-Gg: ASbGncsDNxh5M0oyubYjwKY3o3imK3OMIqJMzH0vh5iiChIEe09zOtyBAucFoh6BpDJ I75zc3LhUjsuW0siWJsxfpEQTIdf32yTiFX4z/IWBhdfgj7bXDlLBwlzqZctXWNitjtJnHmQfSh oKiwKWlhKu5feApA1iwstXMnagWPltmuiqgE9VnLQiI4dnZNzEFcL7bMOt8n8S05iRgaCm1vmli fmVJ3rwf04tGaSrF7v3bD5GNHNlLKwQWZTmL4TYSZVHBXUT2w1S7YEtGyQ9tQxpy/8xq72Qy0Zh lYvg2Sc7KtQkJFQYNwHeXK34R8VCHR9HFCjaUmbtQksU5abE4C36NMU= X-Received: by 2002:a5d:64a1:0:b0:38a:8ace:85e8 with SMTP id ffacd0b85a97d-38bf57a98fdmr30215746f8f.44.1737669422872; Thu, 23 Jan 2025 13:57:02 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c42b4sm791232f8f.99.2025.01.23.13.57.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:57:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 10/15] target/ppc: Restrict ppc_tcg_hv_emu() to TCG Date: Thu, 23 Jan 2025 22:56:04 +0100 Message-ID: <20250123215609.30432-11-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Make is_prefix_insn_excp() prototype but have it guarded by a tcg_enabled() check. Inline part of it in powerpc_excp_books(). Extract POWERPC_EXCP_HV_EMU handling code to ppc_tcg_hv_emu(), also exposing its prototype in "internal.h". Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/internal.h | 3 ++ target/ppc/excp_helper.c | 101 +++++------------------------------ target/ppc/tcg-excp_helper.c | 71 ++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 89 deletions(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 42e33be496f..3f9dc6f514e 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -291,6 +291,9 @@ bool ppc_cpu_debug_check_breakpoint(CPUState *cs); bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason); +bool is_prefix_insn_excp(CPUPPCState *env, int excp); +void ppc_tcg_hv_emu(CPUPPCState *env, target_ulong *new_msr, + int *srr0, int *srr1); #endif FIELD(GER_MSK, XMSK, 0, 4) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 6a12402b23a..56a56148a40 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" #include "qemu/log.h" +#include "system/kvm.h" #include "system/tcg.h" #include "system/system.h" #include "system/runstate.h" @@ -1194,81 +1195,6 @@ static bool books_vhyp_handles_hv_excp(PowerPCCPU *cpu) return false; } -#ifdef CONFIG_TCG -static bool is_prefix_insn(CPUPPCState *env, uint32_t insn) -{ - if (!(env->insns_flags2 & PPC2_ISA310)) { - return false; - } - return ((insn & 0xfc000000) == 0x04000000); -} - -static bool is_prefix_insn_excp(PowerPCCPU *cpu, int excp) -{ - CPUPPCState *env = &cpu->env; - - if (!(env->insns_flags2 & PPC2_ISA310)) { - return false; - } - - if (!tcg_enabled()) { - /* - * This does not load instructions and set the prefix bit correctly - * for injected interrupts with KVM. That may have to be discovered - * and set by the KVM layer before injecting. - */ - return false; - } - - switch (excp) { - case POWERPC_EXCP_MCHECK: - if (!(env->error_code & PPC_BIT(42))) { - /* - * Fetch attempt caused a machine check, so attempting to fetch - * again would cause a recursive machine check. - */ - return false; - } - break; - case POWERPC_EXCP_HDSI: - /* HDSI PRTABLE_FAULT has the originating access type in error_code */ - if ((env->spr[SPR_HDSISR] & DSISR_PRTABLE_FAULT) && - (env->error_code == MMU_INST_FETCH)) { - /* - * Fetch failed due to partition scope translation, so prefix - * indication is not relevant (and attempting to load the - * instruction at NIP would cause recursive faults with the same - * translation). - */ - return false; - } - break; - - case POWERPC_EXCP_DSI: - case POWERPC_EXCP_DSEG: - case POWERPC_EXCP_ALIGN: - case POWERPC_EXCP_PROGRAM: - case POWERPC_EXCP_FPU: - case POWERPC_EXCP_TRACE: - case POWERPC_EXCP_HV_EMU: - case POWERPC_EXCP_VPU: - case POWERPC_EXCP_VSXU: - case POWERPC_EXCP_FU: - case POWERPC_EXCP_HV_FU: - break; - default: - return false; - } - - return is_prefix_insn(env, ppc_ldl_code(env, env->nip)); -} -#else -static bool is_prefix_insn_excp(PowerPCCPU *cpu, int excp) -{ - return false; -} -#endif - static void powerpc_excp_books(PowerPCCPU *cpu, int excp) { CPUPPCState *env = &cpu->env; @@ -1310,7 +1236,15 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp) } vector |= env->excp_prefix; - if (is_prefix_insn_excp(cpu, excp)) { + if (env->insns_flags2 & PPC2_ISA310) { + /* nothing to do */ + } else if (kvm_enabled()) { + /* + * This does not load instructions and set the prefix bit correctly + * for injected interrupts with KVM. That may have to be discovered + * and set by the KVM layer before injecting. + */ + } else if (tcg_enabled() && is_prefix_insn_excp(env, excp)) { msr |= PPC_BIT(34); } @@ -1484,20 +1418,9 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp) new_msr |= env->msr & ((target_ulong)1 << MSR_RI); break; #ifdef CONFIG_TCG - case POWERPC_EXCP_HV_EMU: { - uint32_t insn = ppc_ldl_code(env, env->nip); - env->spr[SPR_HEIR] = insn; - if (is_prefix_insn(env, insn)) { - uint32_t insn2 = ppc_ldl_code(env, env->nip + 4); - env->spr[SPR_HEIR] <<= 32; - env->spr[SPR_HEIR] |= insn2; - } - srr0 = SPR_HSRR0; - srr1 = SPR_HSRR1; - new_msr |= (target_ulong)MSR_HVB; - new_msr |= env->msr & ((target_ulong)1 << MSR_RI); + case POWERPC_EXCP_HV_EMU: + ppc_tcg_hv_emu(env, &new_msr, &srr0, &srr1); break; - } #endif case POWERPC_EXCP_VPU: /* Vector unavailable exception */ case POWERPC_EXCP_VSXU: /* VSX unavailable exception */ diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 268a1614597..ecc9e4de8ba 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -283,4 +283,75 @@ uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) return insn; } +static bool is_prefix_insn(CPUPPCState *env, uint32_t insn) +{ + if (!(env->insns_flags2 & PPC2_ISA310)) { + return false; + } + return ((insn & 0xfc000000) == 0x04000000); +} + +bool is_prefix_insn_excp(CPUPPCState *env, int excp) +{ + switch (excp) { + case POWERPC_EXCP_MCHECK: + if (!(env->error_code & PPC_BIT(42))) { + /* + * Fetch attempt caused a machine check, so attempting to fetch + * again would cause a recursive machine check. + */ + return false; + } + break; + case POWERPC_EXCP_HDSI: + /* HDSI PRTABLE_FAULT has the originating access type in error_code */ + if ((env->spr[SPR_HDSISR] & DSISR_PRTABLE_FAULT) && + (env->error_code == MMU_INST_FETCH)) { + /* + * Fetch failed due to partition scope translation, so prefix + * indication is not relevant (and attempting to load the + * instruction at NIP would cause recursive faults with the same + * translation). + */ + return false; + } + break; + + case POWERPC_EXCP_DSI: + case POWERPC_EXCP_DSEG: + case POWERPC_EXCP_ALIGN: + case POWERPC_EXCP_PROGRAM: + case POWERPC_EXCP_FPU: + case POWERPC_EXCP_TRACE: + case POWERPC_EXCP_HV_EMU: + case POWERPC_EXCP_VPU: + case POWERPC_EXCP_VSXU: + case POWERPC_EXCP_FU: + case POWERPC_EXCP_HV_FU: + break; + default: + return false; + } + + return is_prefix_insn(env, ppc_ldl_code(env, env->nip)); +} + +void ppc_tcg_hv_emu(CPUPPCState *env, target_ulong *new_msr, + int *srr0, int *srr1) +{ + uint32_t insn = ppc_ldl_code(env, env->nip); + + env->spr[SPR_HEIR] = insn; + if (is_prefix_insn(env, insn)) { + uint32_t insn2 = ppc_ldl_code(env, env->nip + 4); + + env->spr[SPR_HEIR] <<= 32; + env->spr[SPR_HEIR] |= insn2; + } + *srr0 = SPR_HSRR0; + *srr1 = SPR_HSRR1; + *new_msr |= (target_ulong)MSR_HVB; + *new_msr |= env->msr & ((target_ulong)1 << MSR_RI); +} + #endif /* !CONFIG_USER_ONLY */ From patchwork Thu Jan 23 21:56:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859393 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494621wrq; Thu, 23 Jan 2025 13:58:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUjJNPX5HXpTEzl7s5wmQLi1InBCfXHVh+E0KPqv5a8SPsNL5HmxJ5MaUM5mjdRAL7EwmdTIA==@linaro.org X-Google-Smtp-Source: AGHT+IHHXdWZsNQS+uN7Cil4uVIty9wVZPP5SW+NbO6eDPketfBhe4zv2b2lmAJ0D89grFLHqgGk X-Received: by 2002:a05:620a:4084:b0:7b1:3c0e:3289 with SMTP id af79cd13be357-7be931d4659mr793478585a.22.1737669488183; Thu, 23 Jan 2025 13:58:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669488; cv=none; d=google.com; s=arc-20240605; b=i2IdBYEdfc3V4LWzPAhcXT3pBWJz4FwIWqc8VPINzhDn/ji+5+Zyh21V7Q665ZSLtL GtR11guFCzeBhoC55O1R3MkdQ7isIxAdRp3NKzsG8J3AGEW5aWTiCkw4bcwMCRiCcVQv WmUF6TfJozvfRM6Cbo26nLzx3CU/3IFpqnrDpNVS1G6dJKGPpDc80Qn/lbtuv2M6HE0F wb1H2lj0h+8jfiP0g4IH9rVXg9bSF1XDvTTzjhcleGpqatMKzFd2Ij1tlPuLUJMrYMH1 hQD133Nw7FDEepCJfNJA8WyA8lamNHW9sfY1NoMtSRUHsPonKAqhR3WnMTMasiwnkW61 QGIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/C4Efdk0ebVZpJSRXTPNWvPX73CGAEaLiQLefsCf/+k=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=Gwd3WswXT/62XTlNpPLeK+VGGjiUwpTniAICuHPEebE9jke6SDvOMhQ9CPfKz5AqhG 5ILbR1ib+ondJ6bDLMhVL5UaI31JV+S9YGRpgCslpmWdrmWtILTvWT0SznHgNEoVM++q 3hPmQhtOI/DK7SRKahXXSONS/qM610nPZXd+GvE3cZFR8On2MjH8L0zgA+OYMbvol/Gg tX6sXSa29tyfot95bocvk2tyiDxHjBqQPPNJh78Mci5CUfyfqhyLNqZfxk/7+FRO3Agv dGtpWcSseXvwOeeLmZEvx0stehqbN6T/7q3PFEhHC3yCfGzMswW9yY4/gpLtCgDiQPl2 AqBQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fN2PVtR/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be9aee1188si67318785a.253.2025.01.23.13.58.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fN2PVtR/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Cu-00061H-09; Thu, 23 Jan 2025 16:57:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5CK-00058j-4Z for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:13 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5CH-0002rf-E8 for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:11 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso15066105e9.0 for ; Thu, 23 Jan 2025 13:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669427; x=1738274227; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/C4Efdk0ebVZpJSRXTPNWvPX73CGAEaLiQLefsCf/+k=; b=fN2PVtR/K1tXDDmz2i9a8VirgD5oiBIk8yL5km6OtIwTAMTb4ol1EiJ9+daZDmXAtw Me39SkNpb+gHO/Filv5uJ+948v6TRF9YDqDIOz6K6ruY+tGvlWgYih9G3C4BfshqIufI DRlJQrRx76NnNR04uVAF+N1ZE+dAiSRHyG2Ve73ZOwxr6P954A4h6zSacK7sB8YJr8n7 UqpK6D4yfNVv5c7A+FkNbLCH6Whp4DHiXi89WaSda5RbvPr1cSYYptdPRrc+cgWlpUB2 4XT+qgFX7sjXJ/qkp/pJw+LxV7/0KdELbQvxiVkq6hVi8UWDt6MMq+dXBHAnHdrHE/m1 G8SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669427; x=1738274227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/C4Efdk0ebVZpJSRXTPNWvPX73CGAEaLiQLefsCf/+k=; b=XGQLvdpcPi0D6jwceVkjuA8Obhcw+X+lx6TAXLh42TqcLPc2SadPteUyGPTjydO6cy pgVA/c9R9lgwRI54MwIioo9N0eJ/VBYyfBseXYiyv9pYGzSC99tYz4CUk3RNgvq0EsRd lw/CxExMv4jFxclYgz92RlNNPuWJ8mgBP38UJB2vOX9mhOeNU25xHoS6kwYHeFyc6LOZ 1R5yNir9eRwkgrpjUwLLfujddkWrrnUQyAW6Ac7XPUftBo+NEK50BfkkZShQkucHX9pj MmtFW2laaeHYJ/vg0cONv9XyNjHBws2DuIi1oBTaJ7/WCTDp5MZRHKH8XSW0ltPaxzCT ka3Q== X-Gm-Message-State: AOJu0Ywav8f3IrSA/3+o5skruTHUXSmPy9TzTA3VE1X3Fk0I/UeQVxxq IqXQD2O9mBJWLCUWcgaPo8IH5o7Bbu9Ri2UlsZgyvx30bcPOgC41s2VdVR9ulUy9Ar2PcAR9wQ9 ywao= X-Gm-Gg: ASbGnctpeZO33KDU2spwGz9nlhfvHKVeaQ7l5YIplKqKG+EwVpXFiivIS+LWvG9cVXS jR9G03/dMPdMg+DlJJfeAnr1X6kfOvPJ4BBAKVWeyhrB+x7Zp5Q/M8GzRtYPP1AtiCRuDFJUxPd aAER29vT+pA4Ld15SkFvbWq+ylU+Y4htqqbURFohbcJbiHAH0qsI55uBw8/DkECmaUdgfbe5N24 q40VgLV81BdNubmeL1iTSrbLx90Uj8nvCn2+QZmIc1FmiUNP2uv+/SnbjpAALCxte+1G+lYjK7s w3G+e3wFJPAqIcCVFeCaBZ9J4cV6gn/4kfEVkGw7FKCs7PlOQ+NM0dM= X-Received: by 2002:a05:6000:186f:b0:385:ec6e:e87a with SMTP id ffacd0b85a97d-38bf57b75efmr27127807f8f.43.1737669427512; Thu, 23 Jan 2025 13:57:07 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1bbc8dsm784421f8f.72.2025.01.23.13.57.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:57:07 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 11/15] target/ppc: Restrict various common helpers to TCG Date: Thu, 23 Jan 2025 22:56:05 +0100 Message-ID: <20250123215609.30432-12-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move helpers common to system/user emulation to tcg-excp_helper.c. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 141 ---------------------------------- target/ppc/tcg-excp_helper.c | 143 +++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 141 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 56a56148a40..48e08d65bd7 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2634,148 +2634,7 @@ void helper_rfmci(CPUPPCState *env) /* FIXME: choose CSRR1 or MCSRR1 based on cpu type */ do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]); } -#endif /* !CONFIG_USER_ONLY */ -void helper_TW(CPUPPCState *env, target_ulong arg1, target_ulong arg2, - uint32_t flags) -{ - if (!likely(!(((int32_t)arg1 < (int32_t)arg2 && (flags & 0x10)) || - ((int32_t)arg1 > (int32_t)arg2 && (flags & 0x08)) || - ((int32_t)arg1 == (int32_t)arg2 && (flags & 0x04)) || - ((uint32_t)arg1 < (uint32_t)arg2 && (flags & 0x02)) || - ((uint32_t)arg1 > (uint32_t)arg2 && (flags & 0x01))))) { - raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, - POWERPC_EXCP_TRAP, GETPC()); - } -} - -#ifdef TARGET_PPC64 -void helper_TD(CPUPPCState *env, target_ulong arg1, target_ulong arg2, - uint32_t flags) -{ - if (!likely(!(((int64_t)arg1 < (int64_t)arg2 && (flags & 0x10)) || - ((int64_t)arg1 > (int64_t)arg2 && (flags & 0x08)) || - ((int64_t)arg1 == (int64_t)arg2 && (flags & 0x04)) || - ((uint64_t)arg1 < (uint64_t)arg2 && (flags & 0x02)) || - ((uint64_t)arg1 > (uint64_t)arg2 && (flags & 0x01))))) { - raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, - POWERPC_EXCP_TRAP, GETPC()); - } -} -#endif /* TARGET_PPC64 */ - -static uint32_t helper_SIMON_LIKE_32_64(uint32_t x, uint64_t key, uint32_t lane) -{ - const uint16_t c = 0xfffc; - const uint64_t z0 = 0xfa2561cdf44ac398ULL; - uint16_t z = 0, temp; - uint16_t k[32], eff_k[32], xleft[33], xright[33], fxleft[32]; - - for (int i = 3; i >= 0; i--) { - k[i] = key & 0xffff; - key >>= 16; - } - xleft[0] = x & 0xffff; - xright[0] = (x >> 16) & 0xffff; - - for (int i = 0; i < 28; i++) { - z = (z0 >> (63 - i)) & 1; - temp = ror16(k[i + 3], 3) ^ k[i + 1]; - k[i + 4] = c ^ z ^ k[i] ^ temp ^ ror16(temp, 1); - } - - for (int i = 0; i < 8; i++) { - eff_k[4 * i + 0] = k[4 * i + ((0 + lane) % 4)]; - eff_k[4 * i + 1] = k[4 * i + ((1 + lane) % 4)]; - eff_k[4 * i + 2] = k[4 * i + ((2 + lane) % 4)]; - eff_k[4 * i + 3] = k[4 * i + ((3 + lane) % 4)]; - } - - for (int i = 0; i < 32; i++) { - fxleft[i] = (rol16(xleft[i], 1) & - rol16(xleft[i], 8)) ^ rol16(xleft[i], 2); - xleft[i + 1] = xright[i] ^ fxleft[i] ^ eff_k[i]; - xright[i + 1] = xleft[i]; - } - - return (((uint32_t)xright[32]) << 16) | xleft[32]; -} - -static uint64_t hash_digest(uint64_t ra, uint64_t rb, uint64_t key) -{ - uint64_t stage0_h = 0ULL, stage0_l = 0ULL; - uint64_t stage1_h, stage1_l; - - for (int i = 0; i < 4; i++) { - stage0_h |= ror64(rb & 0xff, 8 * (2 * i + 1)); - stage0_h |= ((ra >> 32) & 0xff) << (8 * 2 * i); - stage0_l |= ror64((rb >> 32) & 0xff, 8 * (2 * i + 1)); - stage0_l |= (ra & 0xff) << (8 * 2 * i); - rb >>= 8; - ra >>= 8; - } - - stage1_h = (uint64_t)helper_SIMON_LIKE_32_64(stage0_h >> 32, key, 0) << 32; - stage1_h |= helper_SIMON_LIKE_32_64(stage0_h, key, 1); - stage1_l = (uint64_t)helper_SIMON_LIKE_32_64(stage0_l >> 32, key, 2) << 32; - stage1_l |= helper_SIMON_LIKE_32_64(stage0_l, key, 3); - - return stage1_h ^ stage1_l; -} - -static void do_hash(CPUPPCState *env, target_ulong ea, target_ulong ra, - target_ulong rb, uint64_t key, bool store) -{ - uint64_t calculated_hash = hash_digest(ra, rb, key), loaded_hash; - - if (store) { - cpu_stq_data_ra(env, ea, calculated_hash, GETPC()); - } else { - loaded_hash = cpu_ldq_data_ra(env, ea, GETPC()); - if (loaded_hash != calculated_hash) { - raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, - POWERPC_EXCP_TRAP, GETPC()); - } - } -} - -#include "qemu/guest-random.h" - -#ifdef TARGET_PPC64 -#define HELPER_HASH(op, key, store, dexcr_aspect) \ -void helper_##op(CPUPPCState *env, target_ulong ea, target_ulong ra, \ - target_ulong rb) \ -{ \ - if (env->msr & R_MSR_PR_MASK) { \ - if (!(env->spr[SPR_DEXCR] & R_DEXCR_PRO_##dexcr_aspect##_MASK || \ - env->spr[SPR_HDEXCR] & R_HDEXCR_ENF_##dexcr_aspect##_MASK)) \ - return; \ - } else if (!(env->msr & R_MSR_HV_MASK)) { \ - if (!(env->spr[SPR_DEXCR] & R_DEXCR_PNH_##dexcr_aspect##_MASK || \ - env->spr[SPR_HDEXCR] & R_HDEXCR_ENF_##dexcr_aspect##_MASK)) \ - return; \ - } else if (!(env->msr & R_MSR_S_MASK)) { \ - if (!(env->spr[SPR_HDEXCR] & R_HDEXCR_HNU_##dexcr_aspect##_MASK)) \ - return; \ - } \ - \ - do_hash(env, ea, ra, rb, key, store); \ -} -#else -#define HELPER_HASH(op, key, store, dexcr_aspect) \ -void helper_##op(CPUPPCState *env, target_ulong ea, target_ulong ra, \ - target_ulong rb) \ -{ \ - do_hash(env, ea, ra, rb, key, store); \ -} -#endif /* TARGET_PPC64 */ - -HELPER_HASH(HASHST, env->spr[SPR_HASHKEYR], true, NPHIE) -HELPER_HASH(HASHCHK, env->spr[SPR_HASHKEYR], false, NPHIE) -HELPER_HASH(HASHSTP, env->spr[SPR_HASHPKEYR], true, PHIE) -HELPER_HASH(HASHCHKP, env->spr[SPR_HASHPKEYR], false, PHIE) - -#ifndef CONFIG_USER_ONLY /* Embedded.Processor Control */ static int dbell2irq(target_ulong rb) { diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index ecc9e4de8ba..124a81fd699 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -66,6 +66,149 @@ void raise_exception(CPUPPCState *env, uint32_t exception) raise_exception_err_ra(env, exception, 0, 0); } +#endif /* CONFIG_USER_ONLY */ + +void helper_TW(CPUPPCState *env, target_ulong arg1, target_ulong arg2, + uint32_t flags) +{ + if (!likely(!(((int32_t)arg1 < (int32_t)arg2 && (flags & 0x10)) || + ((int32_t)arg1 > (int32_t)arg2 && (flags & 0x08)) || + ((int32_t)arg1 == (int32_t)arg2 && (flags & 0x04)) || + ((uint32_t)arg1 < (uint32_t)arg2 && (flags & 0x02)) || + ((uint32_t)arg1 > (uint32_t)arg2 && (flags & 0x01))))) { + raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, + POWERPC_EXCP_TRAP, GETPC()); + } +} + +#ifdef TARGET_PPC64 +void helper_TD(CPUPPCState *env, target_ulong arg1, target_ulong arg2, + uint32_t flags) +{ + if (!likely(!(((int64_t)arg1 < (int64_t)arg2 && (flags & 0x10)) || + ((int64_t)arg1 > (int64_t)arg2 && (flags & 0x08)) || + ((int64_t)arg1 == (int64_t)arg2 && (flags & 0x04)) || + ((uint64_t)arg1 < (uint64_t)arg2 && (flags & 0x02)) || + ((uint64_t)arg1 > (uint64_t)arg2 && (flags & 0x01))))) { + raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, + POWERPC_EXCP_TRAP, GETPC()); + } +} +#endif /* TARGET_PPC64 */ + +static uint32_t helper_SIMON_LIKE_32_64(uint32_t x, uint64_t key, uint32_t lane) +{ + const uint16_t c = 0xfffc; + const uint64_t z0 = 0xfa2561cdf44ac398ULL; + uint16_t z = 0, temp; + uint16_t k[32], eff_k[32], xleft[33], xright[33], fxleft[32]; + + for (int i = 3; i >= 0; i--) { + k[i] = key & 0xffff; + key >>= 16; + } + xleft[0] = x & 0xffff; + xright[0] = (x >> 16) & 0xffff; + + for (int i = 0; i < 28; i++) { + z = (z0 >> (63 - i)) & 1; + temp = ror16(k[i + 3], 3) ^ k[i + 1]; + k[i + 4] = c ^ z ^ k[i] ^ temp ^ ror16(temp, 1); + } + + for (int i = 0; i < 8; i++) { + eff_k[4 * i + 0] = k[4 * i + ((0 + lane) % 4)]; + eff_k[4 * i + 1] = k[4 * i + ((1 + lane) % 4)]; + eff_k[4 * i + 2] = k[4 * i + ((2 + lane) % 4)]; + eff_k[4 * i + 3] = k[4 * i + ((3 + lane) % 4)]; + } + + for (int i = 0; i < 32; i++) { + fxleft[i] = (rol16(xleft[i], 1) & + rol16(xleft[i], 8)) ^ rol16(xleft[i], 2); + xleft[i + 1] = xright[i] ^ fxleft[i] ^ eff_k[i]; + xright[i + 1] = xleft[i]; + } + + return (((uint32_t)xright[32]) << 16) | xleft[32]; +} + +static uint64_t hash_digest(uint64_t ra, uint64_t rb, uint64_t key) +{ + uint64_t stage0_h = 0ULL, stage0_l = 0ULL; + uint64_t stage1_h, stage1_l; + + for (int i = 0; i < 4; i++) { + stage0_h |= ror64(rb & 0xff, 8 * (2 * i + 1)); + stage0_h |= ((ra >> 32) & 0xff) << (8 * 2 * i); + stage0_l |= ror64((rb >> 32) & 0xff, 8 * (2 * i + 1)); + stage0_l |= (ra & 0xff) << (8 * 2 * i); + rb >>= 8; + ra >>= 8; + } + + stage1_h = (uint64_t)helper_SIMON_LIKE_32_64(stage0_h >> 32, key, 0) << 32; + stage1_h |= helper_SIMON_LIKE_32_64(stage0_h, key, 1); + stage1_l = (uint64_t)helper_SIMON_LIKE_32_64(stage0_l >> 32, key, 2) << 32; + stage1_l |= helper_SIMON_LIKE_32_64(stage0_l, key, 3); + + return stage1_h ^ stage1_l; +} + +static void do_hash(CPUPPCState *env, target_ulong ea, target_ulong ra, + target_ulong rb, uint64_t key, bool store) +{ + uint64_t calculated_hash = hash_digest(ra, rb, key), loaded_hash; + + if (store) { + cpu_stq_data_ra(env, ea, calculated_hash, GETPC()); + } else { + loaded_hash = cpu_ldq_data_ra(env, ea, GETPC()); + if (loaded_hash != calculated_hash) { + raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, + POWERPC_EXCP_TRAP, GETPC()); + } + } +} + +#include "qemu/guest-random.h" + +#ifdef TARGET_PPC64 +#define HELPER_HASH(op, key, store, dexcr_aspect) \ +void helper_##op(CPUPPCState *env, target_ulong ea, target_ulong ra, \ + target_ulong rb) \ +{ \ + if (env->msr & R_MSR_PR_MASK) { \ + if (!(env->spr[SPR_DEXCR] & R_DEXCR_PRO_##dexcr_aspect##_MASK || \ + env->spr[SPR_HDEXCR] & R_HDEXCR_ENF_##dexcr_aspect##_MASK)) \ + return; \ + } else if (!(env->msr & R_MSR_HV_MASK)) { \ + if (!(env->spr[SPR_DEXCR] & R_DEXCR_PNH_##dexcr_aspect##_MASK || \ + env->spr[SPR_HDEXCR] & R_HDEXCR_ENF_##dexcr_aspect##_MASK)) \ + return; \ + } else if (!(env->msr & R_MSR_S_MASK)) { \ + if (!(env->spr[SPR_HDEXCR] & R_HDEXCR_HNU_##dexcr_aspect##_MASK)) \ + return; \ + } \ + \ + do_hash(env, ea, ra, rb, key, store); \ +} +#else +#define HELPER_HASH(op, key, store, dexcr_aspect) \ +void helper_##op(CPUPPCState *env, target_ulong ea, target_ulong ra, \ + target_ulong rb) \ +{ \ + do_hash(env, ea, ra, rb, key, store); \ +} +#endif /* TARGET_PPC64 */ + +HELPER_HASH(HASHST, env->spr[SPR_HASHKEYR], true, NPHIE) +HELPER_HASH(HASHCHK, env->spr[SPR_HASHKEYR], false, NPHIE) +HELPER_HASH(HASHSTP, env->spr[SPR_HASHPKEYR], true, PHIE) +HELPER_HASH(HASHCHKP, env->spr[SPR_HASHPKEYR], false, PHIE) + +#ifndef CONFIG_USER_ONLY + void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) From patchwork Thu Jan 23 21:56:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859398 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494767wrq; Thu, 23 Jan 2025 13:58:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX1Rl95xmEZIpWMtY73KPqq2XDTEFF2AtxCV4q81/UYLF+wdmpveuEzLfz/Pddm3D4u3KYNwQ==@linaro.org X-Google-Smtp-Source: AGHT+IF6W7suHHctbSqqMT4YiPBavQMi2f36d7t+Qc4VsO3yVZDjESGaWzUcBVzxHlf/8J7j6qXQ X-Received: by 2002:a05:620a:148:b0:7be:73b5:b2ed with SMTP id af79cd13be357-7be73b5b45amr2648669985a.1.1737669521410; Thu, 23 Jan 2025 13:58:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669521; cv=none; d=google.com; s=arc-20240605; b=gnpOyiF78Dd2JP1jTt9sMdsQrEYPnK36YhlL2YGKHXUCVspqof4+imbxMboUOtIc9d 7O0EBn63PUN+TxzU0BMIAvx5VT07a51LXTpwn4VTweLn3M7tXH2naM9Ima5f4FWntdyx M3nQAVVYk/Js2LxLUxN+6prxsr/nBZcIT1rZ9srJy8SrhzlT+O611h8Kypj7RWwhuQaB pQLobkleLt+fcSjLoLdnQBjvhf/ZIjrsYMdCptOod+yXAiNYnTpQwHd8csOwCG5govHH hXl1VQeeBgYjnMv/7vYudowiXZCNW3lD1tDEmp7THYvOYxR1agCzpfbrwS8RSHwXI4jE QJ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DgByrMylZY256tTsI6R1dbeQexynJICQtGDxrv9XG/o=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=PKh0el88w3YKA7rVCfIL1EiXTTyPvsddEcVVNkaIXvR/f6Nwz2S6OTiFw5lyaX5gUZ 2fpWv5m8uIyI2LQLLMXG6dwwr+ysoDAHj2yeoIsAdrcEOVnoALWpyNP6ojCGH7jAQXkJ 5JyrKeaYFNANyuX7I1rCbBWgfJ1ckfDfZ5OUylclypsgyLQ2Az+0Gnf1a2W0QAzmW89D d0arKHvkUSgCafJJqIbMJEU0LLe98cFMpntNBXSEhqUltBuiV8s7MDw3req4ke1Jvh4z ngN2gAFFZZlZuCNFde8B/AD7+Pjq4cFZ35kfALDS5A+mC+hrrU45iZHl0FHytOSJOhjF o3nQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tlIglBuX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be9ae819a7si65625585a.12.2025.01.23.13.58.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tlIglBuX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Cw-0006Ic-E3; Thu, 23 Jan 2025 16:57:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5CN-00059Y-9M for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:15 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5CL-0002sl-Pr for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:14 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso10466985e9.2 for ; Thu, 23 Jan 2025 13:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669432; x=1738274232; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DgByrMylZY256tTsI6R1dbeQexynJICQtGDxrv9XG/o=; b=tlIglBuXQLVek3lkFg/zcllYypQFQQ2M3sDaEaEcFow4qpkIWYLXbreBoFqig9IOzG lOcMVAEoVG16xB+GlO4vVpyzziTAVBPk4PeuavTubO1VaZRMnU7Ksdbuj7JUTrJnGypI 6FnMc76zGiyaiJeSMOQsLsvnY62odrz+0s1HOLeZcHSAfyYIopy3sf3HhknUaj2udmFh j4OwqAoP3774S9SdM2BJfuo+A8gq1KdO7g7c4zEu3oVWxto7fbeAUxM/4Ybj7yJttmmA BV4yMpAU21xDdAXS1Gk+Zu2Eq8ffwWswWWjMYMaJwcuai/UOPLGOBpRjfWBpad2klF5H RA5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669432; x=1738274232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DgByrMylZY256tTsI6R1dbeQexynJICQtGDxrv9XG/o=; b=vwh916pYZBRYs5+sIEzeMQyrMimxJ/s09DN/hPiAdL4ZpMyJ3EOheOUXyLJuavomvX FLfGyfozsGqkgMTN+Chr6Ct0zmlTOZEZPXEORRdYESsDRTUVvpJDw61cFsOOQvmtqt1K PmPPI0CVfDNGdmmSUSpbyN5I/iytumRFyXVm1H2UpkzxAnzdbSeDRWBHpZVN2xyEDgiY HEtJID+YbnGkLMfSx6VWh/P8urrBTW+TM2hwzubGqQ4sGoYdbM3KCy9p7Hcjf76wwhMf yITKH5dZQs2YedOZxfz0EBrZZbq6tZH6ax27ttIfwqOVsmElYu+LocaLSgADgemvYE3F 9B6A== X-Gm-Message-State: AOJu0Yw3dkHpQF30WOQRqpmAfBVPjvKB8WBkdmlq7emnrqEedTa/5HFs eJiI6AOfWWVvJWqb27+QVq9OIj/6xio+uOe+QqRtlR5Dv2cUfIcBGWxH6MDYg6qiXGUZ/hFkyxR yhcU= X-Gm-Gg: ASbGncs/fU9Hp/zBVoi8VpwzfoEXzEtPzRnUqJ9EiSht/61iEXFMb9l7YUjh0GTIQQj tWlIxap7yjBMYSZdDYrk3Tt1L82eS6zSdofG74PlEAP2dXUoe9Qi9s7Mne6nTRjvdugbamJhs6c ogUN0KU3Cog7y+zENjIw2aWl7lW6a8kDxgpmHk2OBbZsiyeVtg3eLrCqDpjnNNHElnVe/7PHpAH KXLZvCt6YrS5CTG8Fd078GeQTCJqiL22Xv1UsQ8A40Vwn3amEqS7QTF+WN+wDRGcNEP26XBl9JA +9j3sS3hTxkWcihJnW7qtJqmCQfi0wv9PSTMyXu1xqgnYQ1OUvb9lAo= X-Received: by 2002:adf:ef8d:0:b0:385:f060:b7fc with SMTP id ffacd0b85a97d-38bf5674b55mr24331438f8f.25.1737669432092; Thu, 23 Jan 2025 13:57:12 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c4199sm767716f8f.89.2025.01.23.13.57.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:57:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 12/15] target/ppc: Fix style in excp_helper.c Date: Thu, 23 Jan 2025 22:56:06 +0100 Message-ID: <20250123215609.30432-13-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fix style in do_rfi() before moving the code around. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 48e08d65bd7..661d9650d9f 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2481,8 +2481,9 @@ static void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr) msr &= ~(1ULL << MSR_POW); /* MSR:TGPR cannot be set by any form of rfi */ - if (env->flags & POWERPC_FLAG_TGPR) + if (env->flags & POWERPC_FLAG_TGPR) { msr &= ~(1ULL << MSR_TGPR); + } #ifdef TARGET_PPC64 /* Switching to 32-bit ? Crop the nip */ From patchwork Thu Jan 23 21:56:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859400 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494817wrq; Thu, 23 Jan 2025 13:58:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXQdmkQZ5VoEVa2iqTBv1oGcXLmLuZzIxX//5m9r99D0RJsvXm4b7N81ukKVv6e3i68Qo1P/A==@linaro.org X-Google-Smtp-Source: AGHT+IGwoJzG/dzZZ43CvPK7Zjfh+y5Y60POZDbL8xZH0SkMAbb0EXZzkvaoe8DZnGMz0aIquRkr X-Received: by 2002:a05:6214:4988:b0:6dd:5f90:16bd with SMTP id 6a1803df08f44-6e1b22349dbmr419109166d6.41.1737669530442; Thu, 23 Jan 2025 13:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669530; cv=none; d=google.com; s=arc-20240605; b=R03TZzhslBHMYGot0JMoFR/L0BDwycIQnbT5EX3V8E1dkOs51Y5luKe38DftbYLpcE dcKCseGUJbealT3bxeJVijOLFhkivZBaeeJbC5jONZ75JlumUwwqHmiEmPkMHNX8BC3A sypiWEEk+P0BeKKZDDbdxLyBkjRR7xJ6BLqty8VQSg+guL8sqpw8gcQznfIZ4bs+XWR6 Zo/V+aiqGi8pElW+xT7B9Zfb3hL70yZZk4io3OQgEzh0UbHHEEygEiHQCxfK5RfEOaQ7 0BoTyIo4z/XvdhPk2cagwryfCKSNrB7X6ln9PF8g/0H6TZzIZCh05W5RKO2xtgb55Exn uEJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Im7eIVxJk5Ymo2cFyecUnjgdjN1o5ulRwaFN1Y9Xi8s=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=ZiLv6z1PwOhu25J5bp0AQHyvSxOz7645ibfpBqJ7pLdqn3dZe/+OLSPMXPIvNYFd39 smcDzIWBpMgWk0b6sk+iLOzIQv0bnnD3lHCS5tAMsI+H2Jv7FUzwLmqjpp4LDPMlokPf H+Hfg4WsXb/HpBe8gsoIn75ki+Bw2ufA2Uekz+Z2rU0PAc9hxM2zH4NcLigHz17VGyLn aSBkHGMwsN7QWRNx0gerfJEJ87eMAJhaejGtp5zwO6Dmt+elpHyzZKfU94/BMxHeJAQg MGJuzklyc91VVuOcLimeexmkrCD7rGiMm/kgRUw9W7CQj2D2kk2DnWT5liBUpKPwgS/w 4lIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H0hUp4rH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e2061341fbsi6203786d6.462.2025.01.23.13.58.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H0hUp4rH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Cy-0006TU-Cs; Thu, 23 Jan 2025 16:57:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5CS-0005Gb-VS for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:21 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5CR-0002to-AQ for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:20 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-436249df846so9783575e9.3 for ; Thu, 23 Jan 2025 13:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669437; x=1738274237; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Im7eIVxJk5Ymo2cFyecUnjgdjN1o5ulRwaFN1Y9Xi8s=; b=H0hUp4rHxW7HwzkRSha5KxflKZ6IlDcGNXY4/PVJ4Ob6VFyrhX3qAvTA18Dpmf1Gm6 OW+seXtkFNn5oqPCVHDxIu3m3ENYJ3AYLcoT9fvknh4ZaOc1xi9BtmobP+bkG4ByQcZR WfZvcgEJBilOLivQN//oe8uTQWxTam7GsIQG0UwF6azzPWpj9oG59ge58E3KAEPD1u4l IYW2KgyfdHfCSuObKzH6xmW8Pc0h+JPo2u8lTf2IbaO89ieGttVfDl+kxJd4BnajswEb 14K+aOfZc5sqpiggpLM+5M6ef/17RmplWHBTNt0Cvob/YpatV4DWa9PFI7UL55hFcsd4 qKVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669437; x=1738274237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Im7eIVxJk5Ymo2cFyecUnjgdjN1o5ulRwaFN1Y9Xi8s=; b=E4bO7Da8DndpSPmcCgO5VYuNyGH7Fb9izhxg0hGQlATEpRPC77a581wj/ijP/WUKFT EGBwmPtwqfLZumdU1mb9bn24slT21i81oYOPDp8TfZlXA+9UI+CEHDeaF1jJ779mle3X 2ELf3mA30GNx+UOwddpTsA2LnqdwS1OnBmLYNy5IXV0OoIm1VLAhTAVjGbrsdWP8Epnz hC50VAeQzp+U1TNgPm4UI6fpqtWs1A0gVYiPkUn9gCGvRAHEtgSEkRB6lC0SUFJvJ+X1 CcGPKV4TnmcTIlbAk/H6HohjSlWQdvhYFwm3ibost0zr6ji9hICNO55JX+KpUU/Lp5jQ KPaw== X-Gm-Message-State: AOJu0Ywz8Kw7Butk2h7iZQ0Y3Xxbv7SDy//CTDThbmjEt50S+IkW6z0M dmfFHZd/gQ8LIdWHLpfcHbQmFE2w82ensjNtnhYz9y/LlH8Lk+6iXCSdEpGFMtdcgv2Z54SJ53+ YQ3c= X-Gm-Gg: ASbGncs0+TAE/xKf5k41YFdjL24kL1WCFbQXwRsoA8mZPD283j3mrZ7Dx9OT3ACKjGO PGJilIkpUnL1PV8UjwsJixNekAAEJggQaJq6sZIzuoPlnKWFafYat9AcnQn0mw93v6jcft3NsN3 xpYuAqFAzWg5MAQ3J97en6ibk/yWGN1fOCnwG95sSVi+nMyXkme7cSOvGFCFp0QnduWWF5nQkxt f0R2BDBJWrWOl2dSx/Omj5RpZHyMORLA8+0+7kPP3XJ8aK/2AF8uTvqOujn/vIAOwxvxg5JFxyP kEplH1r1JbPnLGy1xRkcVjf7JQSLbSoNxBpULjISRmWm0I3Y+p7Ork8= X-Received: by 2002:a05:600c:450d:b0:436:840b:261c with SMTP id 5b1f17b1804b1-438914340afmr234916505e9.19.1737669436711; Thu, 23 Jan 2025 13:57:16 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47f367sm5061595e9.7.2025.01.23.13.57.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:57:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 13/15] target/ppc: Make powerpc_excp() prototype public Date: Thu, 23 Jan 2025 22:56:07 +0100 Message-ID: <20250123215609.30432-14-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In order to move TCG specific code dependent on powerpc_excp() in the next commit, expose its prototype in "internal.h". Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/internal.h | 1 + target/ppc/excp_helper.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 3f9dc6f514e..779305f09d1 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -291,6 +291,7 @@ bool ppc_cpu_debug_check_breakpoint(CPUState *cs); bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason); +void powerpc_excp(PowerPCCPU *cpu, int excp); bool is_prefix_insn_excp(CPUPPCState *env, int excp); void ppc_tcg_hv_emu(CPUPPCState *env, target_ulong *new_msr, int *srr0, int *srr1); diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 661d9650d9f..f0e734e1412 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -1494,7 +1494,7 @@ static inline void powerpc_excp_books(PowerPCCPU *cpu, int excp) } #endif /* TARGET_PPC64 */ -static void powerpc_excp(PowerPCCPU *cpu, int excp) +void powerpc_excp(PowerPCCPU *cpu, int excp) { CPUPPCState *env = &cpu->env; From patchwork Thu Jan 23 21:56:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859396 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494711wrq; Thu, 23 Jan 2025 13:58:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWI2arHAqVVpcZVapsdTh639LrO33bEKxjrEu3UYXCQXm5ovD1Jwz3+Q4sBTJ3/T0prszal4A==@linaro.org X-Google-Smtp-Source: AGHT+IH7OhA9NLcfi8lTkasCaXughEIEpzwD2O0M7lTPS9uT6QAVemCw85aslFbieh8fOHO8ysYP X-Received: by 2002:a05:620a:1b9b:b0:7b6:e20d:2b55 with SMTP id af79cd13be357-7be6324fbbcmr4299240485a.41.1737669507898; Thu, 23 Jan 2025 13:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669507; cv=none; d=google.com; s=arc-20240605; b=ZvdIH+vaFJVs2ID67mS6Y66sxuAF7jZkeXKnlXFQc80K4d8k0PaHfYUd2iLiMuOiE6 KfR/7OPOQnaEf2VjmRd/4XCnIKMOhIsqW8sHkNUq/9r+XOhi1s6nH1F6ygsYdVQSIz2i GpCHMTqw0Smma5+yqEgQSVGJdoGwsKNxTsxXbjYAwt5YV7yEwdMxXIMo1WELXltrMZ3l Ad5QgZjjqP1kOxItJ187ZSezeMzh3rIrdjEx/So2901tdTez8AXQ/H0UubwBkbRhv+IW /eNwyE3Thh+Wh2oeosB+RdJ1XSSlURCTEd7jRTLz58F2vDBG+FwfDQy5jqrNmyIISKdI H51w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qQvGQxqb2s4eo/Vg/P6MC8jMAn7f9RTwB8e0Ug3F7Es=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=SuW30c4iUKXNc09yupv3DGf6EcNR1hfCkCrLanR3i00hun8zptFK7BVv2pk3e7hxpl QWvy8ciT26W+EjzempOfw0YcE4Z3d7VYtXFuXg2SWJ3MUz+Nf1mJ+oEttMKqPwnWIL9e kTEcJF/hTgTD5bHyS78p7zA/i707TgwaS+bwm93RA7WZMTZaTg/ZbHx28ayr8ZuS52y+ fA9betVN/EeulwT7ashW3ucHed/nJPo+27tNDuLlj9UuZcJ1HLEFwxCTCe0sYOSOhn0n jMo7R+YnbWCnPNYJkSBMt3rnN7qoS/BDOCcEMBYDhITRqMUVxzG7zXuOu4IplVHsMFUX ne4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PnEWl4Nn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be9aeee111si64460385a.396.2025.01.23.13.58.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PnEWl4Nn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Ct-000614-Vh; Thu, 23 Jan 2025 16:57:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5Cb-0005TG-CV for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:35 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5CV-0002ue-CY for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:28 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-38a8b17d7a7so674748f8f.2 for ; Thu, 23 Jan 2025 13:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669442; x=1738274242; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qQvGQxqb2s4eo/Vg/P6MC8jMAn7f9RTwB8e0Ug3F7Es=; b=PnEWl4Nn79P9Lh74eUdSRw5oi56PYciNQUiyicf6srMoMdcqGe96MMb/4wmKiWxmVz Za/hfkZiZnoRKWXD2VmT+qQTeZ5J/q5L1kIf8LjPxxFJdjzKuEcQIwCRtmR1ptXPZqJM 6qva8C8TXDfIGECWkiqfmHTN2mMokK3PE2PflndPHFo5XJq6znkU70LjuL+yD7Vuk4Kd fpD7wKeV2vL2DhOBBnZ6Q/EdcyhQgcEz8ftdSJWOj1GfEW6U7B1VRVExB2QL53G6eKE2 HHbwLcCeRHpIzO3fyscLSJD4jvNBjDJQOU0oPNEpYOW4SSK1q0AT/Ug6F6m2N6KW8HOj sf5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669442; x=1738274242; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qQvGQxqb2s4eo/Vg/P6MC8jMAn7f9RTwB8e0Ug3F7Es=; b=bHko8z30D4T6vy81YvR8OtVfrtm5rpbF5yYF90k5AKckS3Jc4cM/k5gdHL/bx3Pq6H 7+WFQv/vl7agRg0giiEIv1j7Kx2x0n6Tx8uAhJqB4I2BR+cih3aIjOFV1lotoU3MgUxq D5m8+/Jc+ZNRfX2vgPiW+8AxeAWMY+xGYuQWVpL6MxhD4gppOiFHCMdawsYd7Oth+ooC Zm/GeYJJgYyX7bexueImjfZJbZ4Z+aD1ch43tgT/HUxdV6RKkCHFEOyBhf3z2HQAy4Oe OR7HdwOCXUk7if/ewVMCpZufqb2scDjYAJ1XiW+ipFbiyKXmgxgJsBLRc1GKHTm3ArLS vN6g== X-Gm-Message-State: AOJu0Yz2A/6mWIqyeF8VzrSyudekS2MdhW2EfS1vbzw480ot0xWjD2S5 fwoh3wviRxzawxrPOFYD6sDv340DQDZ/Bje8KZYVU1ezZl2K6hxfj6gWPsCUmCvlym0zvseaeLG wn3k= X-Gm-Gg: ASbGncv+1JT26h0NccsVhe1TWQ1SsLf8eccLmyKr8HYfycstIBu6iAEvlXn8gZP7r2w l2jYvvQs5RbsBdo72G5pgyQHvldGtMwDHSMsV05rDSEqX/yuX0f5Rtl0R+BwBDO7dSq5w9hI0wA XrW2mqh/Zqdz20tpf5/h28oZRp3jobuQdvQovLEIDVi8FHQRb4cMJNIirJpUYxJrJY1lgCiMrkI erQuOx5f1ND6DYxIetXQg8zlgkjr8T8eugxiQmeJQcQv9+TYwWPsqWQkStXPIVZP5GU5TpE0Ggi u4x0z4QfBDe0J3rFo+3Eo93T+X/hfJYeYMY2ccrYKomHjty1pBwGXgU= X-Received: by 2002:a5d:588f:0:b0:38b:e109:1e0d with SMTP id ffacd0b85a97d-38bf57b9dffmr24983892f8f.49.1737669441428; Thu, 23 Jan 2025 13:57:21 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a188d5dsm822998f8f.55.2025.01.23.13.57.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:57:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 14/15] target/ppc: Restrict various system helpers to TCG Date: Thu, 23 Jan 2025 22:56:08 +0100 Message-ID: <20250123215609.30432-15-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We don't need to expose ppc_ldl_code() anymore. Similarly, make raise_exception() scope local. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/cpu.h | 1 - target/ppc/internal.h | 2 - target/ppc/excp_helper.c | 414 ---------------------------------- target/ppc/tcg-excp_helper.c | 416 ++++++++++++++++++++++++++++++++++- 4 files changed, 414 insertions(+), 419 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 4ca27d6b389..ca5bbd263cb 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2752,7 +2752,6 @@ static inline void cpu_get_tb_cpu_state(CPUPPCState *env, vaddr *pc, } #endif -G_NORETURN void raise_exception(CPUPPCState *env, uint32_t exception); G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exception, uint32_t error_code); G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exception, diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 779305f09d1..adb7a5c20d2 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -268,8 +268,6 @@ static inline void pte_invalidate(target_ulong *pte0) #define PTE_PTEM_MASK 0x7FFFFFBF #define PTE_CHECK_MASK (TARGET_PAGE_MASK | 0x7B) -uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr); - #ifdef CONFIG_USER_ONLY void ppc_cpu_record_sigsegv(CPUState *cs, vaddr addr, MMUAccessType access_type, diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index f0e734e1412..2d4d47ee384 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2426,417 +2426,3 @@ bool ppc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) } #endif /* !CONFIG_USER_ONLY */ - -#ifdef CONFIG_TCG - -#ifndef CONFIG_USER_ONLY -void helper_store_msr(CPUPPCState *env, target_ulong val) -{ - uint32_t excp = hreg_store_msr(env, val, 0); - - if (excp != 0) { - cpu_interrupt_exittb(env_cpu(env)); - raise_exception(env, excp); - } -} - -void helper_ppc_maybe_interrupt(CPUPPCState *env) -{ - ppc_maybe_interrupt(env); -} - -#ifdef TARGET_PPC64 -void helper_scv(CPUPPCState *env, uint32_t lev) -{ - if (env->spr[SPR_FSCR] & (1ull << FSCR_SCV)) { - raise_exception_err(env, POWERPC_EXCP_SYSCALL_VECTORED, lev); - } else { - raise_exception_err(env, POWERPC_EXCP_FU, FSCR_IC_SCV); - } -} - -void helper_pminsn(CPUPPCState *env, uint32_t insn) -{ - CPUState *cs = env_cpu(env); - - cs->halted = 1; - - /* Condition for waking up at 0x100 */ - env->resume_as_sreset = (insn != PPC_PM_STOP) || - (env->spr[SPR_PSSCR] & PSSCR_EC); - - /* HDECR is not to wake from PM state, it may have already fired */ - if (env->resume_as_sreset) { - PowerPCCPU *cpu = env_archcpu(env); - ppc_set_irq(cpu, PPC_INTERRUPT_HDECR, 0); - } - - ppc_maybe_interrupt(env); -} -#endif /* TARGET_PPC64 */ - -static void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr) -{ - /* MSR:POW cannot be set by any form of rfi */ - msr &= ~(1ULL << MSR_POW); - - /* MSR:TGPR cannot be set by any form of rfi */ - if (env->flags & POWERPC_FLAG_TGPR) { - msr &= ~(1ULL << MSR_TGPR); - } - -#ifdef TARGET_PPC64 - /* Switching to 32-bit ? Crop the nip */ - if (!msr_is_64bit(env, msr)) { - nip = (uint32_t)nip; - } -#else - nip = (uint32_t)nip; -#endif - /* XXX: beware: this is false if VLE is supported */ - env->nip = nip & ~((target_ulong)0x00000003); - hreg_store_msr(env, msr, 1); - trace_ppc_excp_rfi(env->nip, env->msr); - /* - * No need to raise an exception here, as rfi is always the last - * insn of a TB - */ - cpu_interrupt_exittb(env_cpu(env)); - /* Reset the reservation */ - env->reserve_addr = -1; - - /* Context synchronizing: check if TCG TLB needs flush */ - check_tlb_flush(env, false); -} - -void helper_rfi(CPUPPCState *env) -{ - do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xfffffffful); -} - -#ifdef TARGET_PPC64 -void helper_rfid(CPUPPCState *env) -{ - /* - * The architecture defines a number of rules for which bits can - * change but in practice, we handle this in hreg_store_msr() - * which will be called by do_rfi(), so there is no need to filter - * here - */ - do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1]); -} - -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]); -} - -void helper_rfebb(CPUPPCState *env, target_ulong s) -{ - target_ulong msr = env->msr; - - /* - * Handling of BESCR bits 32:33 according to PowerISA v3.1: - * - * "If BESCR 32:33 != 0b00 the instruction is treated as if - * the instruction form were invalid." - */ - if (env->spr[SPR_BESCR] & BESCR_INVALID) { - raise_exception_err(env, POWERPC_EXCP_PROGRAM, - POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL); - } - - env->nip = env->spr[SPR_EBBRR]; - - /* Switching to 32-bit ? Crop the nip */ - if (!msr_is_64bit(env, msr)) { - env->nip = (uint32_t)env->spr[SPR_EBBRR]; - } - - if (s) { - env->spr[SPR_BESCR] |= BESCR_GE; - } else { - env->spr[SPR_BESCR] &= ~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 = env_archcpu(env); - - /* - * 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 == POWERPC_EXCP_PERFM_EBB) { - env->spr[SPR_BESCR] |= BESCR_PMEO; - } else if (ebb_excp == POWERPC_EXCP_EXTERNAL_EBB) { - env->spr[SPR_BESCR] |= BESCR_EEO; - } - - if (FIELD_EX64(env->msr, MSR, PR)) { - powerpc_excp(cpu, ebb_excp); - } else { - ppc_set_irq(cpu, PPC_INTERRUPT_EBB, 1); - } -} - -void raise_ebb_perfm_exception(CPUPPCState *env) -{ - bool perfm_ebb_enabled = 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 /* TARGET_PPC64 */ - -/*****************************************************************************/ -/* Embedded PowerPC specific helpers */ -void helper_40x_rfci(CPUPPCState *env) -{ - do_rfi(env, env->spr[SPR_40x_SRR2], env->spr[SPR_40x_SRR3]); -} - -void helper_rfci(CPUPPCState *env) -{ - do_rfi(env, env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1]); -} - -void helper_rfdi(CPUPPCState *env) -{ - /* FIXME: choose CSRR1 or DSRR1 based on cpu type */ - do_rfi(env, env->spr[SPR_BOOKE_DSRR0], env->spr[SPR_BOOKE_DSRR1]); -} - -void helper_rfmci(CPUPPCState *env) -{ - /* FIXME: choose CSRR1 or MCSRR1 based on cpu type */ - do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]); -} - -/* Embedded.Processor Control */ -static int dbell2irq(target_ulong rb) -{ - int msg = rb & DBELL_TYPE_MASK; - int irq = -1; - - switch (msg) { - case DBELL_TYPE_DBELL: - irq = PPC_INTERRUPT_DOORBELL; - break; - case DBELL_TYPE_DBELL_CRIT: - irq = PPC_INTERRUPT_CDOORBELL; - break; - case DBELL_TYPE_G_DBELL: - case DBELL_TYPE_G_DBELL_CRIT: - case DBELL_TYPE_G_DBELL_MC: - /* XXX implement */ - default: - break; - } - - return irq; -} - -void helper_msgclr(CPUPPCState *env, target_ulong rb) -{ - int irq = dbell2irq(rb); - - if (irq < 0) { - return; - } - - ppc_set_irq(env_archcpu(env), irq, 0); -} - -void helper_msgsnd(target_ulong rb) -{ - int irq = dbell2irq(rb); - int pir = rb & DBELL_PIRTAG_MASK; - CPUState *cs; - - if (irq < 0) { - return; - } - - bql_lock(); - CPU_FOREACH(cs) { - PowerPCCPU *cpu = POWERPC_CPU(cs); - CPUPPCState *cenv = &cpu->env; - - if ((rb & DBELL_BRDCAST_MASK) || (cenv->spr[SPR_BOOKE_PIR] == pir)) { - ppc_set_irq(cpu, irq, 1); - } - } - bql_unlock(); -} - -/* Server Processor Control */ - -static bool dbell_type_server(target_ulong rb) -{ - /* - * A Directed Hypervisor Doorbell message is sent only if the - * message type is 5. All other types are reserved and the - * instruction is a no-op - */ - return (rb & DBELL_TYPE_MASK) == DBELL_TYPE_DBELL_SERVER; -} - -static inline bool dbell_bcast_core(target_ulong rb) -{ - return (rb & DBELL_BRDCAST_MASK) == DBELL_BRDCAST_CORE; -} - -static inline bool dbell_bcast_subproc(target_ulong rb) -{ - return (rb & DBELL_BRDCAST_MASK) == DBELL_BRDCAST_SUBPROC; -} - -/* - * Send an interrupt to a thread in the same core as env). - */ -static void msgsnd_core_tir(CPUPPCState *env, uint32_t target_tir, int irq) -{ - PowerPCCPU *cpu = env_archcpu(env); - CPUState *cs = env_cpu(env); - - if (ppc_cpu_lpar_single_threaded(cs)) { - if (target_tir == 0) { - ppc_set_irq(cpu, irq, 1); - } - } else { - CPUState *ccs; - - /* Does iothread need to be locked for walking CPU list? */ - bql_lock(); - THREAD_SIBLING_FOREACH(cs, ccs) { - PowerPCCPU *ccpu = POWERPC_CPU(ccs); - if (target_tir == ppc_cpu_tir(ccpu)) { - ppc_set_irq(ccpu, irq, 1); - break; - } - } - bql_unlock(); - } -} - -void helper_book3s_msgclr(CPUPPCState *env, target_ulong rb) -{ - if (!dbell_type_server(rb)) { - return; - } - - ppc_set_irq(env_archcpu(env), PPC_INTERRUPT_HDOORBELL, 0); -} - -void helper_book3s_msgsnd(CPUPPCState *env, target_ulong rb) -{ - int pir = rb & DBELL_PROCIDTAG_MASK; - bool brdcast = false; - CPUState *cs, *ccs; - PowerPCCPU *cpu; - - if (!dbell_type_server(rb)) { - return; - } - - /* POWER8 msgsnd is like msgsndp (targets a thread within core) */ - if (!(env->insns_flags2 & PPC2_ISA300)) { - msgsnd_core_tir(env, rb & PPC_BITMASK(57, 63), PPC_INTERRUPT_HDOORBELL); - return; - } - - /* POWER9 and later msgsnd is a global (targets any thread) */ - cpu = ppc_get_vcpu_by_pir(pir); - if (!cpu) { - return; - } - cs = CPU(cpu); - - if (dbell_bcast_core(rb) || (dbell_bcast_subproc(rb) && - (env->flags & POWERPC_FLAG_SMT_1LPAR))) { - brdcast = true; - } - - if (ppc_cpu_core_single_threaded(cs) || !brdcast) { - ppc_set_irq(cpu, PPC_INTERRUPT_HDOORBELL, 1); - return; - } - - /* - * Why is bql needed for walking CPU list? Answer seems to be because ppc - * irq handling needs it, but ppc_set_irq takes the lock itself if needed, - * so could this be removed? - */ - bql_lock(); - THREAD_SIBLING_FOREACH(cs, ccs) { - ppc_set_irq(POWERPC_CPU(ccs), PPC_INTERRUPT_HDOORBELL, 1); - } - bql_unlock(); -} - -#ifdef TARGET_PPC64 -void helper_book3s_msgclrp(CPUPPCState *env, target_ulong rb) -{ - helper_hfscr_facility_check(env, HFSCR_MSGP, "msgclrp", HFSCR_IC_MSGP); - - if (!dbell_type_server(rb)) { - return; - } - - ppc_set_irq(env_archcpu(env), PPC_INTERRUPT_DOORBELL, 0); -} - -/* - * sends a message to another thread on the same - * multi-threaded processor - */ -void helper_book3s_msgsndp(CPUPPCState *env, target_ulong rb) -{ - helper_hfscr_facility_check(env, HFSCR_MSGP, "msgsndp", HFSCR_IC_MSGP); - - if (!dbell_type_server(rb)) { - return; - } - - msgsnd_core_tir(env, rb & PPC_BITMASK(57, 63), PPC_INTERRUPT_DOORBELL); -} -#endif /* TARGET_PPC64 */ - -/* Single-step tracing */ -void helper_book3s_trace(CPUPPCState *env, target_ulong prev_ip) -{ - uint32_t error_code = 0; - if (env->insns_flags2 & PPC2_ISA207S) { - /* Load/store reporting, SRR1[35, 36] and SDAR, are not implemented. */ - env->spr[SPR_POWER_SIAR] = prev_ip; - error_code = PPC_BIT(33); - } - raise_exception_err(env, POWERPC_EXCP_TRACE, error_code); -} - -#endif /* !CONFIG_USER_ONLY */ -#endif /* CONFIG_TCG */ diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 124a81fd699..072a7fd0947 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qemu/log.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" @@ -61,7 +62,7 @@ void raise_exception_err(CPUPPCState *env, uint32_t exception, raise_exception_err_ra(env, exception, error_code, 0); } -void raise_exception(CPUPPCState *env, uint32_t exception) +static G_NORETURN void raise_exception(CPUPPCState *env, uint32_t exception) { raise_exception_err_ra(env, exception, 0, 0); } @@ -209,6 +210,8 @@ HELPER_HASH(HASHCHKP, env->spr[SPR_HASHPKEYR], false, PHIE) #ifndef CONFIG_USER_ONLY +static uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr); + void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) @@ -415,7 +418,7 @@ static inline bool insn_need_byteswap(CPUArchState *env) return !!(env->msr & ((target_ulong)1 << MSR_LE)); } -uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) +static uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) { uint32_t insn = cpu_ldl_code(env, addr); @@ -497,4 +500,413 @@ void ppc_tcg_hv_emu(CPUPPCState *env, target_ulong *new_msr, *new_msr |= env->msr & ((target_ulong)1 << MSR_RI); } +void helper_store_msr(CPUPPCState *env, target_ulong val) +{ + uint32_t excp = hreg_store_msr(env, val, 0); + + if (excp != 0) { + cpu_interrupt_exittb(env_cpu(env)); + raise_exception(env, excp); + } +} + +void helper_ppc_maybe_interrupt(CPUPPCState *env) +{ + ppc_maybe_interrupt(env); +} + +#ifdef TARGET_PPC64 +void helper_scv(CPUPPCState *env, uint32_t lev) +{ + if (env->spr[SPR_FSCR] & (1ull << FSCR_SCV)) { + raise_exception_err(env, POWERPC_EXCP_SYSCALL_VECTORED, lev); + } else { + raise_exception_err(env, POWERPC_EXCP_FU, FSCR_IC_SCV); + } +} + +void helper_pminsn(CPUPPCState *env, uint32_t insn) +{ + CPUState *cs = env_cpu(env); + + cs->halted = 1; + + /* Condition for waking up at 0x100 */ + env->resume_as_sreset = (insn != PPC_PM_STOP) || + (env->spr[SPR_PSSCR] & PSSCR_EC); + + /* HDECR is not to wake from PM state, it may have already fired */ + if (env->resume_as_sreset) { + PowerPCCPU *cpu = env_archcpu(env); + ppc_set_irq(cpu, PPC_INTERRUPT_HDECR, 0); + } + + ppc_maybe_interrupt(env); +} + +#endif /* TARGET_PPC64 */ + +static void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr) +{ + /* MSR:POW cannot be set by any form of rfi */ + msr &= ~(1ULL << MSR_POW); + + /* MSR:TGPR cannot be set by any form of rfi */ + if (env->flags & POWERPC_FLAG_TGPR) { + msr &= ~(1ULL << MSR_TGPR); + } + +#ifdef TARGET_PPC64 + /* Switching to 32-bit ? Crop the nip */ + if (!msr_is_64bit(env, msr)) { + nip = (uint32_t)nip; + } +#else + nip = (uint32_t)nip; +#endif + /* XXX: beware: this is false if VLE is supported */ + env->nip = nip & ~((target_ulong)0x00000003); + hreg_store_msr(env, msr, 1); + trace_ppc_excp_rfi(env->nip, env->msr); + /* + * No need to raise an exception here, as rfi is always the last + * insn of a TB + */ + cpu_interrupt_exittb(env_cpu(env)); + /* Reset the reservation */ + env->reserve_addr = -1; + + /* Context synchronizing: check if TCG TLB needs flush */ + check_tlb_flush(env, false); +} + +void helper_rfi(CPUPPCState *env) +{ + do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xfffffffful); +} + +#ifdef TARGET_PPC64 +void helper_rfid(CPUPPCState *env) +{ + /* + * The architecture defines a number of rules for which bits can + * change but in practice, we handle this in hreg_store_msr() + * which will be called by do_rfi(), so there is no need to filter + * here + */ + do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1]); +} + +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]); +} + +void helper_rfebb(CPUPPCState *env, target_ulong s) +{ + target_ulong msr = env->msr; + + /* + * Handling of BESCR bits 32:33 according to PowerISA v3.1: + * + * "If BESCR 32:33 != 0b00 the instruction is treated as if + * the instruction form were invalid." + */ + if (env->spr[SPR_BESCR] & BESCR_INVALID) { + raise_exception_err(env, POWERPC_EXCP_PROGRAM, + POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL); + } + + env->nip = env->spr[SPR_EBBRR]; + + /* Switching to 32-bit ? Crop the nip */ + if (!msr_is_64bit(env, msr)) { + env->nip = (uint32_t)env->spr[SPR_EBBRR]; + } + + if (s) { + env->spr[SPR_BESCR] |= BESCR_GE; + } else { + env->spr[SPR_BESCR] &= ~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 = env_archcpu(env); + + /* + * 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 == POWERPC_EXCP_PERFM_EBB) { + env->spr[SPR_BESCR] |= BESCR_PMEO; + } else if (ebb_excp == POWERPC_EXCP_EXTERNAL_EBB) { + env->spr[SPR_BESCR] |= BESCR_EEO; + } + + if (FIELD_EX64(env->msr, MSR, PR)) { + powerpc_excp(cpu, ebb_excp); + } else { + ppc_set_irq(cpu, PPC_INTERRUPT_EBB, 1); + } +} + +void raise_ebb_perfm_exception(CPUPPCState *env) +{ + bool perfm_ebb_enabled = 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 /* TARGET_PPC64 */ + +/*****************************************************************************/ +/* Embedded PowerPC specific helpers */ +void helper_40x_rfci(CPUPPCState *env) +{ + do_rfi(env, env->spr[SPR_40x_SRR2], env->spr[SPR_40x_SRR3]); +} + +void helper_rfci(CPUPPCState *env) +{ + do_rfi(env, env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1]); +} + +void helper_rfdi(CPUPPCState *env) +{ + /* FIXME: choose CSRR1 or DSRR1 based on cpu type */ + do_rfi(env, env->spr[SPR_BOOKE_DSRR0], env->spr[SPR_BOOKE_DSRR1]); +} + +void helper_rfmci(CPUPPCState *env) +{ + /* FIXME: choose CSRR1 or MCSRR1 based on cpu type */ + do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]); +} + +/* Embedded.Processor Control */ +static int dbell2irq(target_ulong rb) +{ + int msg = rb & DBELL_TYPE_MASK; + int irq = -1; + + switch (msg) { + case DBELL_TYPE_DBELL: + irq = PPC_INTERRUPT_DOORBELL; + break; + case DBELL_TYPE_DBELL_CRIT: + irq = PPC_INTERRUPT_CDOORBELL; + break; + case DBELL_TYPE_G_DBELL: + case DBELL_TYPE_G_DBELL_CRIT: + case DBELL_TYPE_G_DBELL_MC: + /* XXX implement */ + default: + break; + } + + return irq; +} + +void helper_msgclr(CPUPPCState *env, target_ulong rb) +{ + int irq = dbell2irq(rb); + + if (irq < 0) { + return; + } + + ppc_set_irq(env_archcpu(env), irq, 0); +} + +void helper_msgsnd(target_ulong rb) +{ + int irq = dbell2irq(rb); + int pir = rb & DBELL_PIRTAG_MASK; + CPUState *cs; + + if (irq < 0) { + return; + } + + bql_lock(); + CPU_FOREACH(cs) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *cenv = &cpu->env; + + if ((rb & DBELL_BRDCAST_MASK) || (cenv->spr[SPR_BOOKE_PIR] == pir)) { + ppc_set_irq(cpu, irq, 1); + } + } + bql_unlock(); +} + +/* Server Processor Control */ + +static bool dbell_type_server(target_ulong rb) +{ + /* + * A Directed Hypervisor Doorbell message is sent only if the + * message type is 5. All other types are reserved and the + * instruction is a no-op + */ + return (rb & DBELL_TYPE_MASK) == DBELL_TYPE_DBELL_SERVER; +} + +static inline bool dbell_bcast_core(target_ulong rb) +{ + return (rb & DBELL_BRDCAST_MASK) == DBELL_BRDCAST_CORE; +} + +static inline bool dbell_bcast_subproc(target_ulong rb) +{ + return (rb & DBELL_BRDCAST_MASK) == DBELL_BRDCAST_SUBPROC; +} + +/* + * Send an interrupt to a thread in the same core as env). + */ +static void msgsnd_core_tir(CPUPPCState *env, uint32_t target_tir, int irq) +{ + PowerPCCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); + + if (ppc_cpu_lpar_single_threaded(cs)) { + if (target_tir == 0) { + ppc_set_irq(cpu, irq, 1); + } + } else { + CPUState *ccs; + + /* Does iothread need to be locked for walking CPU list? */ + bql_lock(); + THREAD_SIBLING_FOREACH(cs, ccs) { + PowerPCCPU *ccpu = POWERPC_CPU(ccs); + if (target_tir == ppc_cpu_tir(ccpu)) { + ppc_set_irq(ccpu, irq, 1); + break; + } + } + bql_unlock(); + } +} + +void helper_book3s_msgclr(CPUPPCState *env, target_ulong rb) +{ + if (!dbell_type_server(rb)) { + return; + } + + ppc_set_irq(env_archcpu(env), PPC_INTERRUPT_HDOORBELL, 0); +} + +void helper_book3s_msgsnd(CPUPPCState *env, target_ulong rb) +{ + int pir = rb & DBELL_PROCIDTAG_MASK; + bool brdcast = false; + CPUState *cs, *ccs; + PowerPCCPU *cpu; + + if (!dbell_type_server(rb)) { + return; + } + + /* POWER8 msgsnd is like msgsndp (targets a thread within core) */ + if (!(env->insns_flags2 & PPC2_ISA300)) { + msgsnd_core_tir(env, rb & PPC_BITMASK(57, 63), PPC_INTERRUPT_HDOORBELL); + return; + } + + /* POWER9 and later msgsnd is a global (targets any thread) */ + cpu = ppc_get_vcpu_by_pir(pir); + if (!cpu) { + return; + } + cs = CPU(cpu); + + if (dbell_bcast_core(rb) || (dbell_bcast_subproc(rb) && + (env->flags & POWERPC_FLAG_SMT_1LPAR))) { + brdcast = true; + } + + if (ppc_cpu_core_single_threaded(cs) || !brdcast) { + ppc_set_irq(cpu, PPC_INTERRUPT_HDOORBELL, 1); + return; + } + + /* + * Why is bql needed for walking CPU list? Answer seems to be because ppc + * irq handling needs it, but ppc_set_irq takes the lock itself if needed, + * so could this be removed? + */ + bql_lock(); + THREAD_SIBLING_FOREACH(cs, ccs) { + ppc_set_irq(POWERPC_CPU(ccs), PPC_INTERRUPT_HDOORBELL, 1); + } + bql_unlock(); +} + +#ifdef TARGET_PPC64 +void helper_book3s_msgclrp(CPUPPCState *env, target_ulong rb) +{ + helper_hfscr_facility_check(env, HFSCR_MSGP, "msgclrp", HFSCR_IC_MSGP); + + if (!dbell_type_server(rb)) { + return; + } + + ppc_set_irq(env_archcpu(env), PPC_INTERRUPT_DOORBELL, 0); +} + +/* + * sends a message to another thread on the same + * multi-threaded processor + */ +void helper_book3s_msgsndp(CPUPPCState *env, target_ulong rb) +{ + helper_hfscr_facility_check(env, HFSCR_MSGP, "msgsndp", HFSCR_IC_MSGP); + + if (!dbell_type_server(rb)) { + return; + } + + msgsnd_core_tir(env, rb & PPC_BITMASK(57, 63), PPC_INTERRUPT_DOORBELL); +} +#endif /* TARGET_PPC64 */ + +/* Single-step tracing */ +void helper_book3s_trace(CPUPPCState *env, target_ulong prev_ip) +{ + uint32_t error_code = 0; + if (env->insns_flags2 & PPC2_ISA207S) { + /* Load/store reporting, SRR1[35, 36] and SDAR, are not implemented. */ + env->spr[SPR_POWER_SIAR] = prev_ip; + error_code = PPC_BIT(33); + } + raise_exception_err(env, POWERPC_EXCP_TRACE, error_code); +} + #endif /* !CONFIG_USER_ONLY */ From patchwork Thu Jan 23 21:56:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859399 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494777wrq; Thu, 23 Jan 2025 13:58:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWkqzUkppRo3iAFgDXCtSyipqyT++N1WYVebjPH4+sXaXC/wqIlTbv5FAYIA5xywHxChtZvuw==@linaro.org X-Google-Smtp-Source: AGHT+IFvMqT/WsLtsHCVnALZmI5/1NvPN4xzzOF+l0v3IResj+nwNUbxnVLYRlBhHEwceSQ9fPT4 X-Received: by 2002:a05:620a:2686:b0:7b6:7257:1359 with SMTP id af79cd13be357-7be6321afe6mr4643882885a.13.1737669523143; Thu, 23 Jan 2025 13:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669523; cv=none; d=google.com; s=arc-20240605; b=S8xyqC5K/umQi8/Ya07yWaqdaEJmYl9/NQgR087306McYJqyYM6JaR9hyTcVKvR7u8 h9GQagor6F8foPrk1z4PBVR3R7n5amVixhHyvEk9SqRo1p3j70gJFJzAnMY9/j8pODRU rL0T68MVhJGugy+Gz04i1WRhaVdS7745p8tJMCY9PlNDVSYjbr8bl77/sPLVLWUxsFbW E2E+wQda0XxBqXoATpJM+ml85iz0VGHGGOT9yvG7PZYo76RWyciiYfZ8jVCP+FPXOIwo VSJiz0o+8px0zr+wuSt7ps5yVb31cLS0jXG1iIV6sjVd9n9VMUIVizEQLoAfTe8IzxPv mBGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tD14boF6dvwaWjMp/PPnzVj7/mx2oVtmk8yCDrx4k5w=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=jA85fa1jo5Gfjil7n2zapFEN6yLVe/cIehyvTcN7VBhkNUORRz/SXS6WckBJ6VWaNx //xJp7B6Lnu1UG579NNoPWsGRhsJ//OrJGCexYcFWoHik6f4B59Qchyd32pPdJhjBkv1 m4QGtETszApfHsZSNjektVYka3QB5yAn4UTNWJAX11A/kGY9tQ6dFhHHjOXQK2sJAZ/k DhTT+2FBfQz3JI8z2+lP3xX0nicrDeL78uceAQ+rHqv7H/oWAfaZugItCB5kPuIU+cOd x2rLAHJpqR+0XSlMZgSYh8yBfSQGQyhL7FlvpZojIYgnccSeHmovrcVCDlwclopaNvRO uF+w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gOcW8hXx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be9af2ada7si70637785a.614.2025.01.23.13.58.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gOcW8hXx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tb5Cv-0006Co-E4; Thu, 23 Jan 2025 16:57:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tb5Cc-0005TO-OG for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:38 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5Cb-0002vX-5L for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:57:30 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3862b40a6e0so1055329f8f.0 for ; Thu, 23 Jan 2025 13:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669447; x=1738274247; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tD14boF6dvwaWjMp/PPnzVj7/mx2oVtmk8yCDrx4k5w=; b=gOcW8hXxo14Z8UGAeDg456xJDs+77hBiN2N6Z5P7bFVR8CBVqNQYzmSNKDFtaANeYQ vmasrmIxM5Bunk++tWPhJU4jHjq8VOfw6mBWuhumknWn+B9fWhqPXyyj4NgN4MG3Rb2G 43QGinRo51B2FTxwufFzIKYuZO+jP1AvcbpbDrr3+awXj95Qmnh01kRYUpmlT370A+jn 6h/JjCMXpGW8VQ3VNrrXZunY8py9rX/RYmNk9ZUJXdZ5v920T+0lHiRpGUnkvBWdsE2n T5s8XcOWFIDArpFeTzhFOBjbWHtfXFlLbSsR4W8FBK3t/qyy3jlKjryvZ7SvL/yeRfBc +Ryw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669447; x=1738274247; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tD14boF6dvwaWjMp/PPnzVj7/mx2oVtmk8yCDrx4k5w=; b=Z+wy1Q6/WNSROyiRUvF8F+MEDO4HYMOlLhkbVFDEHG86K1q+w2P+H0paEhRJJYekyf FSdNPmHALMgHMoIg8mmaor2gLrYW11/3lauTm4d1RbY43hgacYsrrs/72yjg6jRmH0cN 7JtwmAO5VO2ig0dnxSduMGIeZyvSGQVnQLJTTdN7eQbQxAMuNougj2WzJmEbTh4Q6e9m cAXTD3UeWGUJKGQkxHHTBQ3qK2KAvlrqbfuHD13r5eFmQ9BkOAPu/LIVXzi49xId5bPm UsDmsLp2cTr1cIvCu3DYMLdkr6kxzIdV9MgnIe+McXqcVVtkwfY0yTx/lRhltQ3HrZIA v31A== X-Gm-Message-State: AOJu0YxGcDVRBSJzX5AG4GsLBGngmFfrXEB5UYRptgbkQ76pYejcJ8wy QCIz2mW9jO9xLv6ErL7Kh5120zrD7t+lO1G2ScfSdkUrDiBvRbLAPJ9GH1l3Iet3hzFswUqtcJd 2Vr4= X-Gm-Gg: ASbGncuNU+wWzl21znDMfnGV5QGORTAE3mkFI/07dqZFB/9Bp6aCStdzsu1tb5U3rqs epibzuHV9USNIP2lQyHmF9M+RJwzU6ZPp2gNxdMf7bqYW7jjnkLIoyBh+eDqCsAdQirIqen2nDR mU/QIDvM2SbWg5TKtplnhMc0nv1iFv+Xqu96iiCLX2G0zCST48pfGNERVThbmtNbl0h2cBDucSu 8rIbHftE+zOXaOmzWyZWOkzlV9RBYMyteF7dQYfZdlkSG7MXjg5tAznBNxkqpJSFw8qLYYHA87Z /sxfGaIsAqCpZ8rocP2kM/dJE1QTHjAOtvG5K3L0zd2mSl0QJ+RZhlk= X-Received: by 2002:a05:6000:144d:b0:385:e01b:7df5 with SMTP id ffacd0b85a97d-38bf565c2d0mr29569150f8f.14.1737669446797; Thu, 23 Jan 2025 13:57:26 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17d6e2sm802184f8f.23.2025.01.23.13.57.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:57:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 15/15] target/ppc: Restrict ATTN helper to TCG Date: Thu, 23 Jan 2025 22:56:09 +0100 Message-ID: <20250123215609.30432-16-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move helper_attn() to tcg-excp_helper.c and make raise_exception_err() static. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/cpu.h | 2 -- target/ppc/excp_helper.c | 20 -------------------- target/ppc/tcg-excp_helper.c | 13 ++++++++++++- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index ca5bbd263cb..35b56368eac 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2752,8 +2752,6 @@ static inline void cpu_get_tb_cpu_state(CPUPPCState *env, vaddr *pc, } #endif -G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exception, - uint32_t error_code); G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exception, uint32_t error_code, uintptr_t raddr); diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 2d4d47ee384..eedfa2d1de1 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -31,11 +31,6 @@ #include "trace.h" -#ifdef CONFIG_TCG -#include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" -#endif - /*****************************************************************************/ /* Exception processing */ #ifndef CONFIG_USER_ONLY @@ -400,21 +395,6 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu, target_ulong vector, env->reserve_addr = -1; } -#ifdef CONFIG_TCG -#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) -void helper_attn(CPUPPCState *env) -{ - /* POWER attn is unprivileged when enabled by HID, otherwise illegal */ - if ((*env->check_attn)(env)) { - powerpc_checkstop(env, "host executed attn"); - } else { - raise_exception_err(env, POWERPC_EXCP_HV_EMU, - POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL); - } -} -#endif -#endif /* CONFIG_TCG */ - static void powerpc_mcheck_checkstop(CPUPPCState *env) { /* KVM guests always have MSR[ME] enabled */ diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 072a7fd0947..b6765835683 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -56,7 +56,7 @@ void helper_raise_exception(CPUPPCState *env, uint32_t exception) #ifndef CONFIG_USER_ONLY -void raise_exception_err(CPUPPCState *env, uint32_t exception, +static G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exception, uint32_t error_code) { raise_exception_err_ra(env, exception, error_code, 0); @@ -544,6 +544,17 @@ void helper_pminsn(CPUPPCState *env, uint32_t insn) ppc_maybe_interrupt(env); } +void helper_attn(CPUPPCState *env) +{ + /* POWER attn is unprivileged when enabled by HID, otherwise illegal */ + if ((*env->check_attn)(env)) { + powerpc_checkstop(env, "host executed attn"); + } else { + raise_exception_err(env, POWERPC_EXCP_HV_EMU, + POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL); + } +} + #endif /* TARGET_PPC64 */ static void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr)