From patchwork Tue Aug 23 21:38:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599476 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp2724633mae; Tue, 23 Aug 2022 14:39:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bq8CizsxJhysplSYmDSng8fzArzHqP+9T8nhikpAPHSP9XmcQo9YLFCUXOf8Q34vv6v6D X-Received: by 2002:a05:622a:649:b0:343:7b74:5cd1 with SMTP id a9-20020a05622a064900b003437b745cd1mr21708911qtb.407.1661290741275; Tue, 23 Aug 2022 14:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661290741; cv=none; d=google.com; s=arc-20160816; b=osSfbbdfamZQJIrHtxI9Mu2RkTqk3q1e9TsTbvcNHH4eG3EZ/4mBFxbaKyMLP/MDAj UQDfFCchJ/4ZlD4JIO/s3pj9PGTePSS8r9ngHiP6LtpWwWGsP044tIN4G4aNupnmisO/ nR7aH5Y4saM6pudjVcDLBKiAgInpCkIqfFEyY1CE3vrs52ZLawdlYen18fTqWBDkMXYc c0dtwIVmtNFmvnesScsMWulneV8zzDdvZrIN1+da6vtqp6zjkUFXO40ZelxKaF4dUpiX +OBZIYe8PIm+jV0XBLAGTWNxQiXg+K/COsMDngBhYizEhj4TUIRo29MXbXsJZmp6gz/8 VfRQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1wC40Txe5zJ5ok4xl905SAO8DYChZ8Ztlm4id2EmYkU=; b=bKkmHU1MawfCnoSdTTvFp6H/xzl/x/btZJ3Rxw1pfbr2CLM3Fz20aWJgwzaCrwGrgW s+PvD0DEuuZ0UYTvYSD6ohSQt7mPTQ11YZzRe/1EPRX5ndNE8b426tgw41LAT/AHV712 iHfsVPXX3GX6GWoy2IirLpsDpC8LZsMIE4RrQNzSna6IxB23JROf7hc6BO0rQTpfENv4 YmQHQzd7WRY1cJSBhAfLP0SxcNxZn0ucPHirL4C6p9p3tMikZdORDOXjWVGSjSJz3d4d 9YghKJH2+4eWFTudUoVEAuV5ifLleQNkpwz/ekxpsUd4DsPp7WaDDuiPvIMaQDyLeOti RXzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jikUyGdI; 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 e9-20020ac84b49000000b003437ba56c2esi6306925qts.475.2022.08.23.14.39.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Aug 2022 14:39:01 -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=jikUyGdI; 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]:43590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQbbw-0000r7-Sd for patch@linaro.org; Tue, 23 Aug 2022 17:39:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQbbA-0000ie-Vc for qemu-devel@nongnu.org; Tue, 23 Aug 2022 17:38:12 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:45712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQbb9-00060t-5U for qemu-devel@nongnu.org; Tue, 23 Aug 2022 17:38:12 -0400 Received: by mail-pl1-x630.google.com with SMTP id u22so13953838plq.12 for ; Tue, 23 Aug 2022 14:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=1wC40Txe5zJ5ok4xl905SAO8DYChZ8Ztlm4id2EmYkU=; b=jikUyGdICV1jmwScfFClC1NRzjd5JLpR4Bflu9jcLq+KAglZXaSxwM3alX085mK2XO jEmmi9lNgF4PsUwsgD4q7phYptXMU2LHiT1rYIJzi45QXZGYn42gdeH7Yv01jPjOvJza 14mcJLNxXzDyuPimyyT2I/X0Vcq0aIrQGcwvXsY/j2OcZNSUm6aKXrcqmzPpr0WoDckh rGjUME0o7n3sFtFVBuds/cDEEcD1HsZTUDEJ7fTNHiw97IZZ6vy/ohNr7gUAGVzG7Uhd Uq5+KGvmiakozrumD/GEofbO8GYDe3/mWVOu54NamzqbGhEHVMl/31LtT/ae0zrYMZ6I iIoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=1wC40Txe5zJ5ok4xl905SAO8DYChZ8Ztlm4id2EmYkU=; b=XaB8jofsisz0ltJO7U0M8sQyNjvnJJjl9NqX9azZ0uZ7VOVJ3pwbQuy7eZ0GPjabR3 u6NcGRuKPszmttQ0zv4Z44yWar05KYNNOD6iESH+cJukdGW5uTj/IobHamNLbgYapPFI ZS/39fTsKpX0xmVNiZOXjAkp3HI3jsjn6v+1QOOOshqjtpuNREKqciOCN5L0hmIvrPJ8 XCDmAw7PWIGUe8+9p6iAlzEdVdLjx48MTMv+YG8ILST8r5XooRTKv1ldEuzTH0+iUsJY leuymVmfRYRc+IdRxy8Md3sjDBIuVYjeg7NHZeNfZkskeod6hn4sXR8lYJT4l5j8prIb HNuA== X-Gm-Message-State: ACgBeo13WMb5CEUgcfojIgyyxiKQn8u+Ar6vrX0r9qc63HG4v8zGLudi f2Qyc++M79glyYzCg/nESF4KZu74+gTCWQ== X-Received: by 2002:a17:902:e94c:b0:171:3df0:c886 with SMTP id b12-20020a170902e94c00b001713df0c886mr26393020pll.39.1661290689810; Tue, 23 Aug 2022 14:38:09 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:46f9:77b4:ec0a:c2d9]) by smtp.gmail.com with ESMTPSA id s19-20020a635253000000b0040d75537824sm5366403pgl.86.2022.08.23.14.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 14:38:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: david@redhat.com, qemu-s390x@nongnu.org Subject: [PATCH 1/2] Revert "target/s390x: Use probe_access_flags in s390_probe_access" Date: Tue, 23 Aug 2022 14:38:04 -0700 Message-Id: <20220823213805.1970804-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823213805.1970804-1-richard.henderson@linaro.org> References: <20220823213805.1970804-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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, T_SCC_BODY_TEXT_LINE=-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" This reverts commit db9aab5783a2fb62250e12f0c4cfed5e1778c189. This patch breaks the contract of s390_probe_access, in that it no longer returns an exception code, nor set __excp_addr. Reported-by: David Hildenbrand Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/tcg/mem_helper.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index fc52aa128b..4c0f8baa39 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -142,12 +142,20 @@ static int s390_probe_access(CPUArchState *env, target_ulong addr, int size, MMUAccessType access_type, int mmu_idx, bool nonfault, void **phost, uintptr_t ra) { -#if defined(CONFIG_USER_ONLY) - return probe_access_flags(env, addr, access_type, mmu_idx, - nonfault, phost, ra); -#else int flags; +#if defined(CONFIG_USER_ONLY) + flags = page_get_flags(addr); + if (!(flags & (access_type == MMU_DATA_LOAD ? PAGE_READ : PAGE_WRITE_ORG))) { + env->__excp_addr = addr; + flags = (flags & PAGE_VALID) ? PGM_PROTECTION : PGM_ADDRESSING; + if (nonfault) { + return flags; + } + tcg_s390_program_interrupt(env, flags, ra); + } + *phost = g2h(env_cpu(env), addr); +#else /* * For !CONFIG_USER_ONLY, we cannot rely on TLB_INVALID_MASK or haddr==NULL * to detect if there was an exception during tlb_fill(). @@ -166,8 +174,8 @@ static int s390_probe_access(CPUArchState *env, target_ulong addr, int size, (access_type == MMU_DATA_STORE ? BP_MEM_WRITE : BP_MEM_READ), ra); } - return 0; #endif + return 0; } static int access_prepare_nf(S390Access *access, CPUS390XState *env, From patchwork Tue Aug 23 21:38:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599477 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp2724662mae; Tue, 23 Aug 2022 14:39:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR7WrAXcQ48011n9HtSEhWN9L24fjJLJndd0V/TnzhdN2P2CEpHr9Np5NfJ+1id/SDwneZbm X-Received: by 2002:a05:622a:183:b0:343:7d49:e60f with SMTP id s3-20020a05622a018300b003437d49e60fmr20959942qtw.600.1661290743020; Tue, 23 Aug 2022 14:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661290743; cv=none; d=google.com; s=arc-20160816; b=AUrES5ggxZh+2CZ2FAvEvw9WxWj2F2EaK/b5dyZ2LXrNJCwtku1rUPBS+RU6pwvsJz A5KmPIXd5HrUWM+rKSYrSoGWjlA30ga3CBm4+a26J7CvTmtRRjbxPAPYVit1LYnZgYF/ mmdLB/XN6xG/TGEM3rdMeozxceu/GNRzewcG9z/qGB2FEr1SgrPs0hLw436dNOzeSXMM aVKu9s44Xz1i05Wan1KuQoVyQW0FczoT99X/9Ygk4qlFBfSs+BazPoaeVFZCqWYhZpZN IbHE+MNvyfqFp9iprfDVKx1l9vCu1lcWUJkdEK3UkxCJzzos8McONAZ15JwbPt9gag23 stbA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+L96YrL5vlt2Q3Y2tUcm/tGygoK05LHKMQNt/eOvkUg=; b=yL82jekHZdM4+ECl0F1kY4ufwDwN8jOKHc1qUjtpks2Y5S7A9iYEsTGMxbPhBX3/jK 50PnH2K8qS2ucMTABxJRJFjQs+VMTL0huBlGXdeH72enbG2KeXEy297AI4eqQAbyqLaE UI/0Ze+g/x2djMS2WORLK6PSIazD1kZuINMEYh31mwmFyREVZ24Y3zHQcg9HWrup0OTk Wz+fvT5qlFuGho4fJvCzhViUkIvnRQ2nCxeFv7s0OEDNA2GQ50VGI8qObgPVa+e9CYB2 fvn1ASispZwRYVxH6Rzm9Q5JLd9x9fw7cjHfGGmOp8+eKuz9LHFNE67qqbUFEcofjYD7 H3Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OUlqXMve; 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 eo8-20020ad45948000000b004970e349083si799262qvb.433.2022.08.23.14.39.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Aug 2022 14:39:03 -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=OUlqXMve; 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]:43592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQbby-0000xA-L5 for patch@linaro.org; Tue, 23 Aug 2022 17:39:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQbbC-0000jT-9z for qemu-devel@nongnu.org; Tue, 23 Aug 2022 17:38:14 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:41944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQbbA-000617-Bj for qemu-devel@nongnu.org; Tue, 23 Aug 2022 17:38:14 -0400 Received: by mail-pl1-x62c.google.com with SMTP id p18so13962976plr.8 for ; Tue, 23 Aug 2022 14:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=+L96YrL5vlt2Q3Y2tUcm/tGygoK05LHKMQNt/eOvkUg=; b=OUlqXMveUb6x9TzHuLBtapl+VJf+4CqHvWR6Mq/7az8xShV6xu6+9pWzkFFiAZqmH+ z+T56DBgxExn+xmNEIjiJBlM3QJNZ29aOkzzShikg774+WM+lxoxDvdln61KxDtVv+F4 H338OnTgfDye5n87sxoiYf/r6xIwBI8yzRqcFgPwpyY2EExb0fgTw68sDtXwtbsLk9LA ix/OTM6vsk2AydILxob8MzardArq66Cj7raHL6YXi0dvnBJNrN9+u7V/z2+C4bNKONX9 7knJKRT/qBBSjvREmtkdLqOs65e4sJNEW/bPNYIvmpwZgac+xqcwPkZuLKMfuqu+ZkLC enKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=+L96YrL5vlt2Q3Y2tUcm/tGygoK05LHKMQNt/eOvkUg=; b=AZfWQ9Y14xhthjO1U3XsK9NDLXHdT9yYVu4/cvSQHpN0y19omXT3SUN8d3ZPyBcHfp NOhnXvpHyksb85J0/onVcYc21two9qYjYJZdZ1NwfrmzSYv0T+B0TKx/LfOrQ/9LV4OI FfaxL3O8Bv7MJYIe6N+TOqHro3UMofCJMDfaiayzbQMOwYcBo0QeEEr4PvxgZ2uQkotK xyfp+8MbJtcDebUyHbxL/s4uZpNhStD5I4AuXmMMhV2GBRjFHpw9ZZAyIzLC1Np1PYo2 VYn0mZ1qPytDKCJxFKJ2oTpA7uBGhGjDbUWkQbccuRhNNssS2yijoNnED5gd2et8YY+7 PAcw== X-Gm-Message-State: ACgBeo1oh34q5K07s8RlLw2YHAhCmlcvoXQzXyr5up1vJq4c4J2TIcyg mzNI/J7fyN3iLx9flPxFcBm+M/YHBY9C+A== X-Received: by 2002:a17:902:f60f:b0:172:86f6:241b with SMTP id n15-20020a170902f60f00b0017286f6241bmr26015662plg.162.1661290690956; Tue, 23 Aug 2022 14:38:10 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:46f9:77b4:ec0a:c2d9]) by smtp.gmail.com with ESMTPSA id s19-20020a635253000000b0040d75537824sm5366403pgl.86.2022.08.23.14.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 14:38:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: david@redhat.com, qemu-s390x@nongnu.org Subject: [PATCH 2/2] target/s390x: Align __excp_addr in s390_probe_access Date: Tue, 23 Aug 2022 14:38:05 -0700 Message-Id: <20220823213805.1970804-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823213805.1970804-1-richard.henderson@linaro.org> References: <20220823213805.1970804-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Per the comment in s390_cpu_record_sigsegv, the saved address is always page aligned. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/tcg/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index 4c0f8baa39..19ea7d2f8d 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -147,7 +147,7 @@ static int s390_probe_access(CPUArchState *env, target_ulong addr, int size, #if defined(CONFIG_USER_ONLY) flags = page_get_flags(addr); if (!(flags & (access_type == MMU_DATA_LOAD ? PAGE_READ : PAGE_WRITE_ORG))) { - env->__excp_addr = addr; + env->__excp_addr = addr & TARGET_PAGE_MASK; flags = (flags & PAGE_VALID) ? PGM_PROTECTION : PGM_ADDRESSING; if (nonfault) { return flags;