From nobody Fri Nov 14 22:20:18 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1759932965; cv=none; d=zohomail.com; s=zohoarc; b=EwZZHrj0wsZ3zXtbAQ8mX7GGk8I7VfIPbdVAyuPRrIxnOcNar7nmbGc5CPREI+F90eJ4wkOvKwidNZl4QnZDlvEFADMauN1HeuyI821kR+iD5ITVnURKhzFgqYPhGBjoBH5w/TFFG8Q9hrc9sKIdJiBgPGR+Cw7MfVdjnzN3tuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1759932965; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Szppyz1YU92aBnsnHh7hqhpHfCekPYvzL9kvHX4gcP4=; b=m6OhQvEYGMT5Z1Hfse+ggux0I2E4QK0cvwIVZdAmyHIoWTUru8Z/kZwGys2uUxJnHoYV7rs8EbdqwKhmAjzQfpPzVLHTEv1ZiU1oPdzy2HKFEDIt8kNiqHqkQDb3j5n/ywUZQZ7NTykuY6EbJZXIjPzJ5mEUnEOEDI0Sot4O3wU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1759932965705421.73805930623223; Wed, 8 Oct 2025 07:16:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v6UwE-0002HF-Ji; Wed, 08 Oct 2025 10:14:43 -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 1v6Uw9-0002Gt-S5 for qemu-devel@nongnu.org; Wed, 08 Oct 2025 10:14:37 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v6Uw0-0004Ty-JP for qemu-devel@nongnu.org; Wed, 08 Oct 2025 10:14:37 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-46e4f2696bdso90466625e9.0 for ; Wed, 08 Oct 2025 07:14:21 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46faf18bbe7sm1270705e9.20.2025.10.08.07.14.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Oct 2025 07:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1759932857; x=1760537657; 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=Szppyz1YU92aBnsnHh7hqhpHfCekPYvzL9kvHX4gcP4=; b=BP/aaij1BxgB3ppkxks5MuFHl+yOxvHUiYRkkQwUJkE92SNSN9lY/T0n2hgkyrM79m Fk9G4tI+Q/x90uImqBNPK9dcwc1iHTP6l0HeGox+u96+/u4D+JirTV9kNr7BygXdWJm/ JW1+sIaEy41JBgQGgSW03RyW240exqZQLlD7SP8Gn+uB7clw+KHUOHZJ3oieqE3mSUUq o4yskqnNY/bQowNK013nMfmV79Z+G017tRtbQKHuxxXbGp4HI/2U+5BrvsXmk6sv55Ko RFFYhUgSro1l6yEN/k2igUTfCVf8Mf4LDFCOkURkngbObD6oBE80El/YXN59XBZuUmTv 97Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759932857; x=1760537657; 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=Szppyz1YU92aBnsnHh7hqhpHfCekPYvzL9kvHX4gcP4=; b=kykCOvl2dWC5M7TTgz4biu+/1kyEu3D65jCLt2kJ32CVvIWkCppbbZ5NpEQZiZ28Ym mGuizNVjyZq4X/88g12KKkfULVcrenO1+GudVy43UOYRKQQxpkdc6O2UaaId5zHgw4Ic I7Y6TowPaqi8WhjO9yABLvySS53FY2GCdImY9zLXZwwdlbEmYrwSm4jOxUr31HKSBl9s V97SrbnJCZwwOzXfKbl4fj36j1JigcN7hDcUMxKTl+AypbnPxAzptnFirUeGHikTXe01 vn24Ee+F+bJ8S03NtDg/7CNF5NkXYBKb2MpLlLBSqCeDimfqaxkhZxRnweuc/tTIhXWQ YXMw== X-Gm-Message-State: AOJu0YwzbZB937eS+rEwxQkhfnY0RIjSIslELpayhzP9nVDGhpcS47Kw 4pZoXsbmFhRusBujPiX6mvo87Xr+yQW7O0sUbbT0nGMSMNa4rW0jvcTXTZjkOPMknA9wshCiOqG GiGSrkOLrUg== X-Gm-Gg: ASbGncuRjM7Z8hFx5I1atY5pvIob2Przp9D1nB4bI4BP2nrxpsdvGzLbCwtyfM1xRn8 q7FA8arKib+LQT6ufTyXDXq8SHXxC8GmdXYrvzqIInITN/RBkQ1xqrwMOjD7GzxQlW6lF8X2o9x C+J726VpVT9OKpOTeIZy5I+2K4/FrV1QHPJNhLFzY35oo/6sx2rBR8zlc9SIpzUw6yRztqtwcI0 yjSXjxyxcWUB6c2WxQG922lfoIb0/fhIODplXb1jqGA2Xh5+il1pFao8Ttof7DxmTpBZoqzXLZU esjtumpRgGfDZgzz5TfEx+DboA/BGMzse+2K2LZdfstfTI293mJM+3DqkLnx5izxevsZgm0ByOq WR+i5+Og3P0TB9k1GcjZ4VqiJDedwfrDw+pl0BvqrbN9Et/ssdlPSeaWDnjC1cGjosBjJJCw3gF rfPA5bZXS1LEpDph5xwCM6aKBJ X-Google-Smtp-Source: AGHT+IH/Au06/fgW2rLyDS0S298GyKPkoh5iIRGSqZrfOJcRPrhqgTurKnm9lpg87gHYoyMyeGodFg== X-Received: by 2002:a05:600c:3f10:b0:46e:5cb6:b904 with SMTP id 5b1f17b1804b1-46fa9b079f7mr22962925e9.28.1759932856710; Wed, 08 Oct 2025 07:14:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , Thomas Huth , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] target/s390x/mmu_helper: Simplify s390_cpu_virt_mem_rw() logic Date: Wed, 8 Oct 2025 16:14:08 +0200 Message-ID: <20251008141410.99865-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251008141410.99865-1-philmd@linaro.org> References: <20251008141410.99865-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1759932973080116600 In order to simplify the next commit, move the trigger_access_exception() call after the address_space_rw() calls. No logical change intended. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- target/s390x/mmu_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 487c41bf933..22d3d4a97df 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -541,9 +541,7 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uin= t8_t ar, void *hostbuf, pages =3D g_malloc(nr_pages * sizeof(*pages)); =20 ret =3D translate_pages(cpu, laddr, nr_pages, pages, is_write, &tec); - if (ret) { - trigger_access_exception(&cpu->env, ret, tec); - } else if (hostbuf !=3D NULL) { + if (ret =3D=3D 0 && hostbuf !=3D NULL) { AddressSpace *as =3D CPU(cpu)->as; =20 /* Copy data by stepping through the area page by page */ @@ -556,6 +554,9 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uin= t8_t ar, void *hostbuf, len -=3D currlen; } } + if (ret) { + trigger_access_exception(&cpu->env, ret, tec); + } =20 g_free(pages); return ret; --=20 2.51.0 From nobody Fri Nov 14 22:20:18 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1759932974; cv=none; d=zohomail.com; s=zohoarc; b=LosA9UyinoiKpISn65OIoPqL4bR9R46NL6DAWtQwVF92NFbnxutoLVLudrBo+AnY1jR0bEsTFwxTHQZDyvIcsqz9r5Xiw+/phIgBAHBgFLSasqBM3yDaHFeTCjJiYfpHO3IIfe5TY+2QDUCVH/ANeBtdEY2AEGurJ/YBtyyILtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1759932974; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4yM+pXDT0hqzaeBLR0C86iQaEkYCbGu0SVKquEIwttY=; b=lf/g0y6lMY3MS8k6s8TfNRiJh3q263nGlTdgDyz5Li+SnW9DlInHQGq5VeMMLh96Q7jHb2WhRhMFMRzXJzd0SDj0vGSq4YkkzKQLjrY/HBeQOqA0ciH9+WqRDysFzK2M6p9BSJx53uLUvy98kpITC5j6j+qZOBZ2bJffo/xf7dM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1759932974153948.319387814588; Wed, 8 Oct 2025 07:16:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v6UwJ-0002RO-Vk; Wed, 08 Oct 2025 10:14:48 -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 1v6UwB-0002HI-F2 for qemu-devel@nongnu.org; Wed, 08 Oct 2025 10:14:39 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v6Uw2-0004Ul-52 for qemu-devel@nongnu.org; Wed, 08 Oct 2025 10:14:39 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-46e6c8bc46eso48702495e9.3 for ; Wed, 08 Oct 2025 07:14:28 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46faf185c7esm1309775e9.19.2025.10.08.07.14.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Oct 2025 07:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1759932862; x=1760537662; 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=4yM+pXDT0hqzaeBLR0C86iQaEkYCbGu0SVKquEIwttY=; b=Zqan3CsnrtIZU0VONmg9W6llCqXzbvEbfDQI4GmYn059YZ8MJ9pRyvyb1Cem+/bgib 5+ZPOm5z+4T4nRY7nLOKfSeP+k4KWTb8Q5MT6YN8sQmbHKMgGUDSWxBgDoh0Pwa3iKsO g7X/4+PYwZhB6nBf+88M2POd2Cca/LM9WaTH2/MDwW5eLA5GejTVyAPV/SXFcT46OZhB kStvQqvC/pJ1wyqz7TjIsUHXLfNV3pTrENpm62P8U6H+cZLQc1/l/qPH/6bPOH0Qqj2C l+jsj/Qn3ryqcex7MZB1TLsIYzXzp+UIM4bFcxDDFhU3Fbg5jC8+JXr4wmyegP4uBDdA 1yVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759932862; x=1760537662; 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=4yM+pXDT0hqzaeBLR0C86iQaEkYCbGu0SVKquEIwttY=; b=t8o6cgdicDaUMjlgRGbYKC+aFlX3EmrkT18IqKQIK1Ctc9sWJKPV0KcdTdCmTEqDs3 jnAl7SAc7TUCfORF1oQDHxnQBnaFizeuUdA4RR9AJrqDABSxH50oPWA/LTd/TMUMgW/G NKaxKmU7lYReR5GigfU6Gjw7cEGJY9K8TECUcAroslj1x1GP80njqb688YiI9LgZJzmA BZpXiLK4SSudL37Y+m83sv95PFq68HsT5H0CXZnNiRZmBimy+9gKbSMBMw18g1soDESe NAMUsaHrLSY9hcFhDCN1L8VPWY5xmPDShuKMRpjlQDVJQozPt5o4Qj0bQsyV5YM3ItA2 ePOQ== X-Gm-Message-State: AOJu0YyJn7Ks3osAg/oBgtcpH61BmfbqPPT9AmDJbLt3MJMkml+QZ/Wc dWg+c3VyVTWJPKTfPR+EBSC+ABl0hcFvPOOKR9AdKmqyql5k/5mBgr+d4hwKmkSfAStn9MtK+ww j1cdETkF/jg== X-Gm-Gg: ASbGncvhv/52JD1FI7ybVjtFlqAnhtTq7IjYnOKrz+uU5B8gMHmFr2AHNm4axnLy+EH hhRaGCEclOrjUH1XkNDtOLMmvBkhk38EsMO/V1j+VTpz30YuWG0WmHi+IKT7L1xOC+fK6KlOHcM /ePZxmv0oOk+w5YUcV6USinHovUTb1HpciG+JPUt22e3C9nZ6e/WFGJ+TYjfythw/4+x9LlOz1w 2aXa3mDUJ/GeOmj/xAf4LnGvtfiDVgZK6xgDhmR17+jHqoheD8W3wBfo/UIEgpmZLlQIxf2cOA1 4mzBkhw/uUNaa3hnVQUE6/ge7QprzonNwLLH/ceg170rkwp/Ez+J9n6fQtFI8FmRY3q3J8JOyHK bWtJDgQqmOODZ8eEtKXougqfnR0dabdPb1NTHg2A2wMmXGdU5XQLBSwKOVPaF5/LJUwXxJOjG+z SqrCpHeWTzppGZHjadnmz312F3 X-Google-Smtp-Source: AGHT+IFI0ssxCRpnhXfm92OZl54QVm/v6Fat/+Oj+c2gMyyGj+NlbIUTLjia7iKLWTsCb6LoPL0aCA== X-Received: by 2002:a05:600c:3b08:b0:46e:53cb:9e7f with SMTP id 5b1f17b1804b1-46fa9af830fmr27402115e9.18.1759932862063; Wed, 08 Oct 2025 07:14:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , Thomas Huth , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/2] target/s390x/mmu_helper: Do not ignore address_space_rw() errors Date: Wed, 8 Oct 2025 16:14:09 +0200 Message-ID: <20251008141410.99865-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251008141410.99865-1-philmd@linaro.org> References: <20251008141410.99865-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1759932976781154100 If a address_space_rw() call ever fails, break the loop and return the PGM_ADDRESSING error (after triggerring an access exception). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- target/s390x/mmu_helper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 22d3d4a97df..3b1e75f7833 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -546,9 +546,15 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, ui= nt8_t ar, void *hostbuf, =20 /* Copy data by stepping through the area page by page */ for (i =3D 0; i < nr_pages; i++) { + MemTxResult res; + currlen =3D MIN(len, TARGET_PAGE_SIZE - (laddr % TARGET_PAGE_S= IZE)); - address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_MASK), - attrs, hostbuf, currlen, is_write); + res =3D address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_= MASK), + attrs, hostbuf, currlen, is_write); + if (res !=3D MEMTX_OK) { + ret =3D PGM_ADDRESSING; + break; + } laddr +=3D currlen; hostbuf +=3D currlen; len -=3D currlen; --=20 2.51.0