From patchwork Wed Aug 18 19:18:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 498932 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp971243jab; Wed, 18 Aug 2021 12:31:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMDYuOBj4Zv/dzpw8IcvOdW66FnV3jUPF77AAJyB12HIVfrNO4oqhetOsjqsLONGpm9Bat X-Received: by 2002:a50:fe07:: with SMTP id f7mr12047537edt.11.1629315089732; Wed, 18 Aug 2021 12:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629315089; cv=none; d=google.com; s=arc-20160816; b=ZFL+3pZ7C0lhhiZh1XeAN4pDVoynIwEW2Gb3YztcaDFgyU6iVOSefkm7Nx66fTYYuh YjFj3KLnFJRSlTWTeWcVrxgEy+uu914aQJvP6qlhr14ms7Y2b1NqNAqERwFfCNNOoDJW 10EA1JLozCoN82aXtGY+2Ql82GJvpQbKlB6YTpFnUq90hY1B5Slo9SYDDz4GEuVpY+5+ mnlQJHbpHvGKI44R+1jbCu25V+boWsL3btUQ6pSBmmI0FBlomGjvNjt5XMmlPfyUk061 nO1+Gb/tNOnIP7jLJau5ZecWO7tRVaSCxiaDJQaEsXc7ore3OAcE0MlhElY3jHsOxsKF MJxA== 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=N407o9bpjpNHrFay9c2qe28goaY9qdIgGMVcmRi8tog=; b=z8fJFeOLIi+3nLMnvA1j8n9h0eVKQivBy4KUheP3l2F1islK70yM8a7/gg9qPll33D bGIe/Cacl5OgVQZvukAzZxhI4VFadbRAVHZZJbla8zgiVXfZW6agS/PyA/XFZLvp7Lqa 3ELSWZncaYPZZEW+WvZialaH7NyiuiuSOAD2t60oRV5fX71eMNZZXYwXhkeywNxWYXmp KBFUhpiU76F3+/GFcVI7G6yTrtNthku36ayyFG6RlsSV+Cp/TphBZ9ytYM3hF2xBSMJW pQw97E8ON8oNBY6bmi2GBfSrS7KFJrH8XGcIiq+8306Os5wG1SjdY66mA94J3KZa0/MC tKvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RPHK+IX9; 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 bi5si849691ejb.664.2021.08.18.12.31.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 12:31:29 -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=RPHK+IX9; 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]:42272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGRHc-00079Z-4M for patch@linaro.org; Wed, 18 Aug 2021 15:31:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGR6J-0000hz-TF for qemu-devel@nongnu.org; Wed, 18 Aug 2021 15:19:47 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:35397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGR6I-00008I-E4 for qemu-devel@nongnu.org; Wed, 18 Aug 2021 15:19:47 -0400 Received: by mail-pj1-x1033.google.com with SMTP id j12-20020a17090aeb0c00b00179530520b3so9670376pjz.0 for ; Wed, 18 Aug 2021 12:19:46 -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=N407o9bpjpNHrFay9c2qe28goaY9qdIgGMVcmRi8tog=; b=RPHK+IX9gl3c3x7h0A+Xfr4qi3wwFpUvEJRdTHKRf5Ogmg4QoEvPVeJEcUFD4xEdo0 2g7xIDSWEMTpZ2hczR+VvdNbqMrwwohibfGAW+I/7xWkOHbxFNwNrHgOlpKu2tk29Yff fphDJeNmsjbeB0/Gm3oAc1+u7xppA0Mp5S/8AZA+BOKXM9eOqt14JErGfl989SgLDta4 3MQXCSW3UlGB40oCEfuxkH8VBwz70s66UZcgyiTGat9IM+71FuQVdLnGJIlNz7YQB5wi tAFF4BVcAsUXbvPMnEMncFKMIRt6DCICkYW6CEqchIC6oYjbqtuqjcCmXhbwpfusu+Qg Sdhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N407o9bpjpNHrFay9c2qe28goaY9qdIgGMVcmRi8tog=; b=SZtBJZHvR4v0Q0v9TasiqFI4FrEmApIXkmNkr3dUdP9fRVdsEJTfjFgaQ6i/MrNvZY 4oonTeaCzX4PtxW/4GF4FEPjm+KIqN8IVT9ZYa3Gcp1g8qsD/mMLoufGMBJ/hiCEepFE A4pag3AmxJq43rUNsdbSrKfTs+95AsY6lZ2ojYdQIxnyLKGdChLjmuSHGPI1KzA8fUjb S/k7nCRcghXawuGNSZdjYnC4be7TqA9DN90kWAJy6Dd1NI9uxCNXVkuevlZXwbiZZAQL MIDVlmpdR6xDeYIAHbODXhNh5pZ7enW+6/UNVg/wcSXYYmSz/DlGa4pj3YkukUYmhc6m CQxA== X-Gm-Message-State: AOAM532eHJNxZ67mw2ZMzTndQzNPJ3u/SZ7Cmv/s790M7jsCOqgOMVC9 ujw8CgVNcgQGDK/vWLjJZdiwr8dqboB0xA== X-Received: by 2002:a17:903:32c2:b0:12d:ac12:6e5e with SMTP id i2-20020a17090332c200b0012dac126e5emr8366371plr.44.1629314385167; Wed, 18 Aug 2021 12:19:45 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id a6sm524108pjs.40.2021.08.18.12.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 12:19:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 18/66] target/sparc: Set fault address in sparc_cpu_do_unaligned_access Date: Wed, 18 Aug 2021 09:18:32 -1000 Message-Id: <20210818191920.390759-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818191920.390759-1-richard.henderson@linaro.org> References: <20210818191920.390759-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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 | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 13 deletions(-) -- 2.25.1 diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 974afea041..ea163200a4 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 5b2fda534a..2f260b0085 100644 --- a/target/sparc/mmu_helper.c +++ b/target/sparc/mmu_helper.c @@ -946,4 +946,22 @@ hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) } return phys_addr; } + +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 */