From patchwork Thu May 2 05:44:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 794088 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp77823wrr; Wed, 1 May 2024 22:45:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXB1qZGTpGizqp0mwV9Lqlvc5IW+eWzhX56eqaZ9foHN4kq4bO2oFW74vglwPdtlf+eDQF2571FWZWgXcGxbMOZ X-Google-Smtp-Source: AGHT+IGrUqYvnS9r/E8M59dQ6CZn/Hux2grBFCkKi+znLKG1yATLZpcUT9agckT6MCpaALJ2xRtA X-Received: by 2002:a05:6808:14d3:b0:3c7:4e35:7e22 with SMTP id f19-20020a05680814d300b003c74e357e22mr1501709oiw.1.1714628726014; Wed, 01 May 2024 22:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714628725; cv=none; d=google.com; s=arc-20160816; b=v7s3xPKneMwfNngLZlDGPfXL9uE3P3VoPA2PVCPsm3EEKahSfnPt1rHgvoAcsY2Hr4 ZBN7Cte/zzJrLlYf4Pw6J6e3PgthjN1mwWr1ceIUFwEe4kjQWzthvTkchW7xMu/Ywnnr b2za9D745a85CfdlwxYdpZEeM1LqHdRuF4jifFCx5edcRdMEx/hpgXDyIIcEeHIhPAzq pMDes0YiUTKRjhOMdJiY39/1wdCKTvD3fMZEmZO33Nc1aE2mHjY1Qi0PtTFOILSKrW4W Fj2WXMTuDqKSAUh/KL9yoM6JyZiqfLtGiEMo6qfodg7TbKvas7QNFJ6d9ScPsyIZGL3i mr+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Uh/e9AC7IaGAogX1ZpLqkQ+Kxck2qAEP70TLZWNb2mc=; fh=vvIHVEExtoxBacLa1w/xvEOdET6IjbTxlMJ0GExg4HQ=; b=0Y0Chk4VsRP7mp7/HaxJseF3frmD/XkVVV69tazFtJlfr+blVonKOgpym453tNgRpp UNnDJ8JgudvYFB5lajf73XMjE2pItCeHRe3tueXuItKV86491sSei7IW+ZWXfqGdA/MR sX7uYw5an8bQhidX3N7L7W0dYhRC7AhIfpqggtHPbcTQ9+J2yqGq0hg/85Bs0IskRRoc nJS2ZwQh0e8FzAvGm1xWNl97xSp22BXZ3J9VTBBk7EEKTBIAjg2WzjJl3b/oKoso/oju 6taMK+DS7ZWPSfIv2Vvh3D4fSzdZC7KW4GYz2jm2Xf5GV+yaFUlerjG5rk7Rt5iPTHUz qGew==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f3YtZMG4; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wg11-20020a05620a568b00b00790f7d2d50bsi253735qkn.142.2024.05.01.22.45.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 May 2024 22:45:25 -0700 (PDT) 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=f3YtZMG4; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2PFC-0008NW-35; Thu, 02 May 2024 01:44:34 -0400 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 1s2PF5-0008MK-MX for qemu-devel@nongnu.org; Thu, 02 May 2024 01:44:27 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0: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 1s2PEz-0002bD-NA for qemu-devel@nongnu.org; Thu, 02 May 2024 01:44:27 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6f2f6142d64so7057737b3a.2 for ; Wed, 01 May 2024 22:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714628660; x=1715233460; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Uh/e9AC7IaGAogX1ZpLqkQ+Kxck2qAEP70TLZWNb2mc=; b=f3YtZMG4iJkLd5jv6GCJVHedFCOfbsSPTHNh+jXqpT7qvJsqdrXt0nZRG/wRJ+PeRw 7P9R3aRaiuJQhCS6NE995/lPIG07Xvr2xR0IdTihs5wqdMBeaayD0RGCVcjuJt6UH4Qv AHcmx5rptkSIagrkV0RdBOLfkxjLQJjDRa1txg59kJK3W2jd3FlX38Fqgj0Y2qit1oeJ mouD3/uP1me2dE6V/AlKRczfnAHVRb8hrhUnBN5xinULShFe5Q7kP7wwdQ9swXkulWyi ldQjXah0VPRGn2JUPlLZ/5iQs6Wm66BwICIp/Fiy2kDjpBytnTssHd+E8tQ+68dS0xZA i4pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714628660; x=1715233460; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Uh/e9AC7IaGAogX1ZpLqkQ+Kxck2qAEP70TLZWNb2mc=; b=crl3g345oN/RTEKbIoUKG/sV2pfF+AxTLSpUr6V7BSrtNKbUjOGpqaHiU/+vgSHesS cZt/w1KBbj8swlkK3TD476BR2WKi0sSIcUKhok9zuR7g4hSEaByLTm4/PK4dOjWNfwTF fvH86wwmNzt/BbdYZA9AH+fTIqtPQR8wywtNfYmtQvOLZKs68hrrqm+MO83DZGm06Eqn c1V1op99KpK8cdMJiozDTdK1ij0GAdqOApPJ2vhAsAnl0N4N1xl/6eVymcneA7UPo28E Dnw6moyy/FOmi0DULsWsuE11riGyTuNT+Hi1N+o3PgMVUt8Gmtd1tmqQqVpxorHEhS/N HUjA== X-Gm-Message-State: AOJu0YyZjxcc15t1ZRxSO3v5JuCwCkU1oRUb7E3ON5yOgO3yyhu0Ylqv 4DbOL/wl0YRewy6FRxRUBGuYj+YhpJrpE53bvAak69eESLkzSfRFJYUepJUwl6NIzpU3VMpGLdZ V X-Received: by 2002:a05:6a00:3a16:b0:6ec:f9d3:d0c6 with SMTP id fj22-20020a056a003a1600b006ecf9d3d0c6mr1381405pfb.16.1714628660012; Wed, 01 May 2024 22:44:20 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id e18-20020a656492000000b006089cf2cde5sm294401pgv.26.2024.05.01.22.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 22:44:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, iii@linux.ibm.com, david@redhat.com, thuth@redhat.com Subject: [PATCH 00/14] target/s390x: Fix and improve PER Date: Wed, 1 May 2024 22:44:03 -0700 Message-Id: <20240502054417.234340-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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, T_SPF_TEMPERROR=0.01 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 Split out from v1: https://lore.kernel.org/qemu-devel/20220906101747.344559-1-richard.henderson@linaro.org/ v4: https://lore.kernel.org/qemu-devel/20230220184052.163465-1-richard.henderson@linaro.org/ after I noticed that the testcase, https://lore.kernel.org/qemu-devel/20221130174610.434590-2-iii@linux.ibm.com/ does not actually work under KVM. In fact, support for PER_CR9_EVENT_BRANCH in TCG is broken. This cleans it up and improves things so that when only one PER bit is set (what I assume to be the normal state of afairs), we have less overhead. I'm not sure that all of the interactions are correct, particularly with multiple PER triggers or other exceptions. For that, we'd need a more complex test case. But at least branches match hardware now. r~ Richard Henderson (14): target/s390x: Do not use unwind for per_check_exception target/s390x: Move cpu_get_tb_cpu_state out of line target/s390x: Update CR9 bits target/s390x: Record separate PER bits in TB flags target/s390x: Disable conditional branch-to-next for PER target/s390x: Introduce help_goto_indirect target/s390x: Simplify help_branch target/s390x: Split per_breaking_event from per_branch_* target/s390x: Raise exception from helper_per_branch target/s390x: Raise exception from per_store_real target/s390x: Fix helper_per_ifetch flags target/s390x: Simplify per_ifetch, per_check_exception target/s390x: Adjust check of noreturn in translate_one tests/tcg/s390x: Add per.S target/s390x/cpu.h | 83 ++++---- target/s390x/helper.h | 8 +- target/s390x/cpu.c | 36 ++++ target/s390x/tcg/excp_helper.c | 2 +- target/s390x/tcg/misc_helper.c | 68 ++++--- target/s390x/tcg/translate.c | 248 +++++++++--------------- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/per.S | 82 ++++++++ 8 files changed, 302 insertions(+), 226 deletions(-) create mode 100644 tests/tcg/s390x/per.S