From patchwork Fri Oct 15 04:10:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515828 Delivered-To: patch@linaro.org Received: by 2002:ac0:da11:0:0:0:0:0 with SMTP id d17csp148936imi; Thu, 14 Oct 2021 21:43:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkmx8BJ9g7KO9YiDFfqRmxBfhVU8q5vDn9LbrePDbkxdJcYnVURtRnMu5xfeBiznW163jY X-Received: by 2002:a25:e697:: with SMTP id d145mr10068023ybh.4.1634273011889; Thu, 14 Oct 2021 21:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634273011; cv=none; d=google.com; s=arc-20160816; b=qXp/Cet0Dpg3fw1qBpG06ELqWrRS235DU8i7XrK3yp9gL4ZzvPRKInD9WnFIUKQ6aP FzqRtr90o2V/zYJkJnBF7M0dQ+ocxJD+sAk5rcUhxRkEoKhNlof9SiGEY/p7ChKejulS wuUvge1h+coBWPYPEtvioq1fMjv8/Km6WE0oYXubB+ieBLN1iu6i7Bxo9VlCTPe2nkT1 sF2MOQDWmIz3K8Db6Kf/5GHzUw1dVRgdXd+qGSz6CQG1UCs2+oS13msSGQ/1hP/yqyjF CFdQEmsG3YwJ8IvtYH2VNSNugmbn67nCacVdulo0h0EGiGMIHHoIaJn1ebHZoKkydldc 0lzg== 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=muffzeHX3yZuoAcxrWs0UhKgv9u/j8rmCNk7xQHU/Hc=; b=iHGNGCcTkVh4zEAMsllmZjR6xQaYk1nB+cpt8pYLlRVUWYpXGJX/cNysClwYYP976e 8mdrVaq2ysGiewAP3t1QOP50LZwQf4t8ttmcJKdcqzkMiDjNeE2uvjXdvZr2Z7uaJtFQ 059d5U8GhubLT7qyN9keVnAFPcH7kQgPXdF2lSPrT5Utsz0ZvJYl5F7qLuJmmviXk4x1 qi7F0ebDFvdtXwTvHTb1ocBV39MhgA3DTlHQQ1wBBy3xjvgL4zbkOz3oTyPq2SOBYpg5 mRSijkZirtoYDAq8o8dToL4ubP1BGKUpXmj+SRGcz/P3BxRYVDiN2CG5XYT+vPeoZG4g 0cKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=W4LeJ9a2; 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=fail (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 y2si4915630ybg.51.2021.10.14.21.43.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Oct 2021 21:43:31 -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=fail header.i=@linaro.org header.s=google header.b=W4LeJ9a2; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbF47-000096-5E for patch@linaro.org; Fri, 15 Oct 2021 00:43:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbEcF-0006ub-95 for qemu-devel@nongnu.org; Fri, 15 Oct 2021 00:14:45 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:37551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbEcD-0002w2-KU for qemu-devel@nongnu.org; Fri, 15 Oct 2021 00:14:42 -0400 Received: by mail-pf1-x433.google.com with SMTP id q19so7313409pfl.4 for ; Thu, 14 Oct 2021 21:14:41 -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=muffzeHX3yZuoAcxrWs0UhKgv9u/j8rmCNk7xQHU/Hc=; b=W4LeJ9a2EKradOZjo4wTuB8xqkNzf2KdkMde9V6GZwVepTf93PrFCJ7GPovl6AMirM midF8TuBN6hjPUiNdG1PF5HSd0HpGw8r2+F25/rLP/SiFkktHj7/RE5UY6VpA0iRVP05 mKwe+lvis30h42xwgbYNYrl+GO7EqM4hxg2Ad64jqliABa1Lbg594rNd1jMvZtKwB6fh 8DnywRUl/WMPkVvS8ZY5OP2ikhv1AesClKhjY5I/gkKd1K9DKIl8X79hgn5onURepMMP awkRuMvS6nEyNJ8TwhyBWjCgm3M1k4QzMAH2UrX7Nf6MMcwq3Ja7yv8WE6C9vIrdrkoj vYPA== 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=muffzeHX3yZuoAcxrWs0UhKgv9u/j8rmCNk7xQHU/Hc=; b=j3Sm+Qtq+3xxFwZ8Ra7KMi7y1yktYJ2UTSp9XNhh+YVEKOE/UXMziGjEJKZopGbfPT RA0RKMdPpZBgyhYJUqCU3sP1bsr8OukfuLhhS8NdQ/5gD8eR64LpYlUy5dkzzLd88yTJ 6kRyjue59g7jAnk+ybgUSd3taafvIZrYl0tTgF9spTiNOI6heycFrfBlIfmX/4qicdqH HNUZq2/yf3a0MUkOszvGq4sgNjdKg/nmM62bO27LkmkuRoPA4THLWS2nq2ZCkP3cuq7B uuuUpdc9V9r68wO9wGwhcs4IHr2tqzqu4eAPs/NUwGNfh9jBpIpi3+QREr1Kh6H+jw2R h+yw== X-Gm-Message-State: AOAM531vOxn8ZVup055L4N7jCgZKAXONVYppO5Qg2P4pdHIAOWi86Xi5 It03T7PJzvg7o/WCZWgkXOl67NOMK64zkA== X-Received: by 2002:a65:6aa8:: with SMTP id x8mr7419834pgu.136.1634271280135; Thu, 14 Oct 2021 21:14:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id q8sm10236885pja.52.2021.10.14.21.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 21:14:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 57/67] target/sparc: Set fault address in sparc_cpu_do_unaligned_access Date: Thu, 14 Oct 2021 21:10:43 -0700 Message-Id: <20211015041053.2769193-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015041053.2769193-1-richard.henderson@linaro.org> References: <20211015041053.2769193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 , alex.bennee@linaro.org, laurent@vivier.eu, imp@bsdimp.com 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 0549b6adf1..a3e1cf9b6e 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 */