From patchwork Mon Jan 9 20:18:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 640695 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2340679pvb; Mon, 9 Jan 2023 12:23:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXu4P8RQ15wbbSD63KFRz9LzxquSa7TGg6/HJClPUXEdNw3bKBv59BsxgauMH5MAYT1tRQxR X-Received: by 2002:ac8:138c:0:b0:3a5:758d:8f5e with SMTP id h12-20020ac8138c000000b003a5758d8f5emr524545qtj.19.1673295827789; Mon, 09 Jan 2023 12:23:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673295827; cv=none; d=google.com; s=arc-20160816; b=kSzn1mDeHkIxm3MZPbL5x4uvBkQz1fCA3fkf0VMS/QbX35cmPXbsA9KXCE+VQ7/3O0 bME0AczpCI8zuLSIbYMnCtVSCEjr6KFu43/c+oJovJKI3ThYzX2Vecz3X+ZQWhtdq2L2 nlcOigUpWOG9VJQhQffUv9Q7g3XR17JUzBKTBiV01cikhEMrr/lsKgyjfDe52T3JQzKk ilxOCkyL6rWm4HHKqJm9V3iErznGcOseWgwSPiT2VardX5Fo/JeGbfnyGvvVOawrR5a6 KTm7lHjWst0k3kgr52Y/QDGEdyXszVDUNQft+IlKgMyhnnznpvrr2RZb0QdxYn/530Dm Ft8Q== 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=8X0Lb47wJgNa3+w7lfIg0QENGe9Mb2V6lxaP2jwNHKI=; b=cwAnED57adIHnGujxeHWeS/zOUcwszej1yOmPQNmYQ90/fJ+WTJ9Qe6BkHZcpbLmhn ay5HKca/CiXGg/6nsBVyISsH+CShudBDpvzt2tsjE/OB5QCOimqAV0Sq4mOKBjJKmbO9 9Z4EJ59+SnHAtIme/+euy2YE+h6/crqeRUs8TV1OIRXjtUuE0h+SZmYsoMKIxWymBErI TC+5LLdekYi/BPll/9KnmPSXYL4B9YkgOiJUo8iMdkdgsyqDx+0bTgQ4OuOUml7cJpnV YdkFQY6MEmrUZeWmEYSZwaoc/MLI1BGTWOz+9Y8ar4Ux1fkLKfUwj8fqJFUPpB0AYZNo VCsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=twr0gZmU; 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 q15-20020ac8450f000000b003a7f0fdcfeesi4978609qtn.687.2023.01.09.12.23.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 12:23:47 -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=twr0gZmU; 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 1pEybs-00059s-HI; Mon, 09 Jan 2023 15:19:08 -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 1pEybq-00055S-Nj for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:19:06 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEybp-00054Z-0J for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:19:06 -0500 Received: by mail-pg1-x532.google.com with SMTP id 7so6704976pga.1 for ; Mon, 09 Jan 2023 12:19:04 -0800 (PST) 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:subject:date :message-id:reply-to; bh=8X0Lb47wJgNa3+w7lfIg0QENGe9Mb2V6lxaP2jwNHKI=; b=twr0gZmUV6fN+Du5d91yAjQ9SBJfYyWIm83jMP8+H/BeeqVEcWQKuh95m21ouP3fJQ eCljOTwCRh9/anUBrMNRRuo/MqpodU7bTaKIkUiXsgLaNp++8dxCgec+3pHHsD73F2oV unXdYO/U+9oK81QvLP6z5O/Xp8UCpd1Xz/wKaj7/kKpicp9VN/75h14o0K+J3C+ywqIt kBdnnBKPMTDx8bRNiJgUW8YrKDXStwZ354ax2m1lyddNAQw4i4mh16xwPu1D6Mq91U+j W4a1t2GQPkQ6YsljwCCZKwfaxq2FgsQWDojrIGRAXbuIyQtw1hEant1SoBjPrwa75xeS Tz5w== 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 :subject:date:message-id:reply-to; bh=8X0Lb47wJgNa3+w7lfIg0QENGe9Mb2V6lxaP2jwNHKI=; b=EE8f2jPtkhGtACOrKER74LOCM94FE7GVOe7A2dQIydWpTovUxWraSoKSkJPOmoCUbL 8q9eUd1SdOs2nD7nGjcJE1o94YXL5MPGsIChyTlfJPtdGM0Vp4wiKOrV6y4Pl91DLM+w D+RzBL3nO0PrNKBsIs8fVqwCaLD8WdslzJvMhXNE0dzBiMXngDVIR4IP8ASD2ewO5hyG fVdFxz38uCxJBRnYg4StWdy6ag6PsSVq9rrYSGsWZo+W/spOr0LlcXaaY5A0PKogkE/1 cJWyhfcJwuWSn2YLPqqXTw2J+kg4YziDecazNltXgs7Su2x4flawbvWH+gXGr5OX4HFB 1zBg== X-Gm-Message-State: AFqh2kpkiONagJW/cPlwRbO6g+TPdNPAiYyR+3ns0ib3kBZ3paoRgGfV JukV2Coa0EaJ8mmo20Dm34E8FyP5EuJJyUhs X-Received: by 2002:aa7:8286:0:b0:57e:c106:d50c with SMTP id s6-20020aa78286000000b0057ec106d50cmr71768699pfm.17.1673295542129; Mon, 09 Jan 2023 12:19:02 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id c132-20020a621c8a000000b00589a7824703sm1470972pfc.194.2023.01.09.12.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:19:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: david@redhat.com Subject: [PATCH 4/7] target/s390x: Tidy access_prepare_nf Date: Mon, 9 Jan 2023 12:18:53 -0800 Message-Id: <20230109201856.3916639-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109201856.3916639-1-richard.henderson@linaro.org> References: <20230109201856.3916639-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 Assign to access struct immediately, rather than waiting until the end of the function. This means we can pass address of haddr struct members instead of allocating extra space on the local stack. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/tcg/mem_helper.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index 0f2830f87c..59237fe7de 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -176,39 +176,35 @@ static int access_prepare_nf(S390Access *access, CPUS390XState *env, MMUAccessType access_type, int mmu_idx, uintptr_t ra) { - void *haddr1, *haddr2 = NULL; int size1, size2, exc; - vaddr vaddr2 = 0; assert(size > 0 && size <= 4096); size1 = MIN(size, -(vaddr1 | TARGET_PAGE_MASK)), size2 = size - size1; + memset(access, 0, sizeof(*access)); + access->vaddr1 = vaddr1; + access->size1 = size1; + access->size2 = size2; + access->mmu_idx = mmu_idx; + exc = s390_probe_access(env, vaddr1, size1, access_type, mmu_idx, nonfault, - &haddr1, ra); - if (exc) { + &access->haddr1, ra); + if (unlikely(exc)) { return exc; } if (unlikely(size2)) { /* The access crosses page boundaries. */ - vaddr2 = wrap_address(env, vaddr1 + size1); + vaddr vaddr2 = wrap_address(env, vaddr1 + size1); + + access->vaddr2 = vaddr2; exc = s390_probe_access(env, vaddr2, size2, access_type, mmu_idx, - nonfault, &haddr2, ra); - if (exc) { + nonfault, &access->haddr2, ra); + if (unlikely(exc)) { return exc; } } - - *access = (S390Access) { - .vaddr1 = vaddr1, - .vaddr2 = vaddr2, - .haddr1 = haddr1, - .haddr2 = haddr2, - .size1 = size1, - .size2 = size2, - .mmu_idx = mmu_idx - }; return 0; }