From patchwork Wed Oct 13 02:45:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515680 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp6081728ime; Tue, 12 Oct 2021 19:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd03/dAmHdDcrULZQJyNmTyvY38Cqtg/iQdpPVoIUEspb2O5cy5qp91ac7qPIIWvx40TIp X-Received: by 2002:a0c:f489:: with SMTP id i9mr14194862qvm.64.1634093530703; Tue, 12 Oct 2021 19:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634093530; cv=none; d=google.com; s=arc-20160816; b=Ux8FYf8TXdpr92uAkfQO7BDNCyZReMEUb5rFO8BR4GLNy7mNCoXzOjzc96ypqR3f0W ia66Y9OyoCNg+8Rsf72jsZUYXIovYNDxdXu8wrLMpEFx52bC1CUyuBqMsCvqrbmEOFGf 6c89yALq5lxntvQOSX78dybgMy/YeX5tNJgaQpONAA9G8VFpzanac/e135XbsL8OVfvG 8oaOdU2vZu46YZjcaTC0MuHVQj2fkyi5oeMn32/cj3KrtO/eGq1TON+tmSrZc9BCG52d pjfhlez9pQlK5UbLY48VT4ll4pEIf8N7lnGTVE/4Gbd8sP6DI77YCJKDbD4eNcDxZOgy x0DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=cpKP9lLV+B3lJJVGxWZYd41x3ok2BfFIwAyas9V94EU=; b=PzIv7htgJd6Fbo44gQnqQlblvbjQhsjV7M8kt1aJwwh8jD/44S+u3MRkuYIZF+e8Hb kRxwZ+hQeuNhUlpER4SOG1b2kdy3CxINLwUOcekakQ0lLEXl+IlNQmnkxfAHDmG2ANdI SAGg2DjBQm9DlmOzSNmlfDhRxGxejg4CtlIbjr9Yqh9vI3GVNLfsSNrGRCwMMSY+KqTz VooN6vUlelZhjNVyYhVlYJUu8pXpp1YTX5qb38ppfwMVYE0GS59+GkKrHevUxTX3Kd32 naICcD5OZeXFz63SNtPM4bWW3rDTb+JSZRx3OLpH9WJIWaSfgkvqnL4hOddtXpFpqVR2 663Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qNbgAgts; 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 l2si9075118qkj.273.2021.10.12.19.52.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Oct 2021 19:52:10 -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=qNbgAgts; 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]:57832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maUNG-0007bo-6A for patch@linaro.org; Tue, 12 Oct 2021 22:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maUHj-0004bK-Kv for qemu-devel@nongnu.org; Tue, 12 Oct 2021 22:46:27 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:38432) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maUHh-0004ug-S2 for qemu-devel@nongnu.org; Tue, 12 Oct 2021 22:46:27 -0400 Received: by mail-pf1-x429.google.com with SMTP id k26so1157870pfi.5 for ; Tue, 12 Oct 2021 19:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cpKP9lLV+B3lJJVGxWZYd41x3ok2BfFIwAyas9V94EU=; b=qNbgAgtsmxcP/dppXY9myvaF/cqSMVldOv19fEi7f07XGiyc7IuyOTWDOQ4VGs/hgY wdzEK0nErQVlzJCgwfmOyxT5uLi7HwdQT9Cj1fav2BGNMMMJynTvUwcNE0cvjF/vbVFw Fr1B5B4KutUfTDEN4Ug96eyjov9VnC+a1PY2chl3MoA38y0x2wHeE99o4EqSR36AJ5aW WRdw+fqzE7SqXvAKk2wj8t+fYhqx92Lw3YjmvCf1L/FNqT3Fbsrrv5xAMdsv9HCoHOce CgzCnjugRG/nNsq4X6aYraCxDjgWUprWfItAm5zWOeR/melPlRtGj+opTSNZDpMF5CCT n+XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cpKP9lLV+B3lJJVGxWZYd41x3ok2BfFIwAyas9V94EU=; b=R0PbaMD70jN9xLsxBsQhr+2buMj9SuCeoX6JeIC6GIGtucZOcOeuRV64PgZESBWjyp e3A6fG/2hSOiLrf5wDuAcjiCoWlE1i5n8lUkCfAghwMNUIlbLeRoRwzRyYJdL7qkSGc5 4z40/X5sp/XJGDPSarByTcJxL8EPoR0Vv+43kmznhagDkuN3wQWHLYGcGgUtcS5CLPZJ p+Ci+VA/XsEY7NeqLeerh1yhN8fJJbhrn8O0a1OW32eXWuiB9GX0op0emZxOMfp7bLH9 xtZSi/Ku2MkMeAfISRY37gyvPurnzKU60Kjyw8gxe4OvhfR2d9rTskWoXubqbEav28DN rpXg== X-Gm-Message-State: AOAM531Cq/5W4oR86PGlw8SFkpMGiYiQ3tJ2cbiJd85CfsfhC7Y4mPO0 TjITRsEqBi8UDm3XeW4uTUPMRPCcZKc1tg== X-Received: by 2002:a63:191a:: with SMTP id z26mr25169692pgl.373.1634093184614; Tue, 12 Oct 2021 19:46:24 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id qe17sm4855014pjb.39.2021.10.12.19.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 19:46:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 15/48] target/sparc: Set fault address in sparc_cpu_do_unaligned_access Date: Tue, 12 Oct 2021 19:45:34 -0700 Message-Id: <20211013024607.731881-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013024607.731881-1-richard.henderson@linaro.org> References: <20211013024607.731881-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We ought to have been recording the virtual address for reporting to the guest trap handler. Move the function to mmu_helper.c, so that we can re-use code shared with get_physical_address_data. Reviewed-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/ldst_helper.c | 13 ------------- target/sparc/mmu_helper.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) -- 2.25.1 diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 2d0d180ea6..299fc386ea 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -1953,16 +1953,3 @@ void sparc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, is_asi, size, retaddr); } #endif - -#if !defined(CONFIG_USER_ONLY) -void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, - MMUAccessType access_type, - int mmu_idx, - uintptr_t retaddr) -{ - SPARCCPU *cpu = SPARC_CPU(cs); - CPUSPARCState *env = &cpu->env; - - cpu_raise_exception_ra(env, TT_UNALIGNED, retaddr); -} -#endif diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c index 014601e701..f2668389b0 100644 --- a/target/sparc/mmu_helper.c +++ b/target/sparc/mmu_helper.c @@ -922,3 +922,23 @@ hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) } return phys_addr; } + +#ifndef CONFIG_USER_ONLY +void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, + MMUAccessType access_type, + int mmu_idx, + uintptr_t retaddr) +{ + SPARCCPU *cpu = SPARC_CPU(cs); + CPUSPARCState *env = &cpu->env; + +#ifdef TARGET_SPARC64 + env->dmmu.sfsr = build_sfsr(env, mmu_idx, access_type); + env->dmmu.sfar = addr; +#else + env->mmuregs[4] = addr; +#endif + + cpu_raise_exception_ra(env, TT_UNALIGNED, retaddr); +} +#endif /* !CONFIG_USER_ONLY */