From patchwork Thu Mar 11 21:09:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1451533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DxM6R6HL9z9sVt for ; Fri, 12 Mar 2021 08:10:22 +1100 (AEDT) Received: from localhost ([::1]:60990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKSZX-0006bu-6c for incoming@patchwork.ozlabs.org; Thu, 11 Mar 2021 16:10:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKSYw-0006bR-Mo for qemu-devel@nongnu.org; Thu, 11 Mar 2021 16:09:42 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:45437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKSYu-0004xR-T0 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 16:09:42 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MZkxd-1lGzwK0pNP-00Wmud; Thu, 11 Mar 2021 22:09:39 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 2/9] target/m68k: don't set SSW ATC bit for physical bus errors Date: Thu, 11 Mar 2021 22:09:27 +0100 Message-Id: <20210311210934.1935587-3-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311210934.1935587-1-laurent@vivier.eu> References: <20210311210934.1935587-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:wxrnRbg+7k54Zn4OHJr2pWGbUtLEPu6hHngR9kx8JqC8s29tYaZ tqqBuim90p24/wl1PIMUwsjj+OEuQiA/ht1n8cx5w+7D3JzTtnti9fQ6MjWhomjqde4V2pU iIxTLla9JtpjnrJ+xxYkIFscyTsyKIuy87ft41rGjcrNN3/NoP4ZOGAMQwUog8/ZQ26KEBe EfNkus1sSnf65CX/oa2Uw== X-UI-Out-Filterresults: notjunk:1;V03:K0:HnR1wfMOBDE=:wUYMr93OImOHinbPAmphUI WkFkZQSoMPiwM/56WWgm0sFTwD6e8p65MrqlWu3cYFR3q90JJA9lAHlKqfjE0doqZ1FBb1cEk GzvOSmniZmTW5PT7JRrkbD9S/fph2XQv8iUFhoXZYTu3AWMeKn1IwMG5wQfYvyJcy6fDSWiK3 Imca5jQdN3vtx6gVuQBdrfWsUgJJxt/U7n9edwFrg8lzvkamu14zkd656lswJhuadj91JSkk3 ihbYoZ8t/wXqZ6hKYVNIW5peWABfQgkmmVuh8TEQxW0p3ZZu+o32i6xBqmVoYHLer2MitIQwI cp6iHFgWzL5XutiXZsV/WIyr0UkeyI8cYUjrJnmMV6iPUIfaRWuGmx3wBEDXWFsgAN4EupnjS IR2YG+hJsYLZaWrNzTH2x7oFqYFjPeQ15pAea9oonOTPPGHrnTp2OUag3ZLjPEko+OR6qC+qM Zl51YR68hA== Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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 , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland If a NuBus slot doesn't contain a card, the Quadra hardware generates a physical bus error if the CPU attempts to access the slot address space. Both Linux and MacOS use a separate bus error handler during NuBus accesses in order to detect and recover when addressing empty slots. According to the MC68040 users manual the ATC bit of the SSW is used to distinguish between ATC faults and physical bus errors. MacOS specifically checks the stack frame generated by a NuBus error and panics if the SSW ATC bit is set. Update m68k_cpu_transaction_failed() so that the SSW ATC bit is not set if the memory API returns MEMTX_DECODE_ERROR which will be used to indicate that an access to an empty NuBus slot occurred. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210308121155.2476-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier --- target/m68k/op_helper.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 730cdf774445..5f981e5bf628 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -468,7 +468,17 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, if (m68k_feature(env, M68K_FEATURE_M68040)) { env->mmu.mmusr = 0; - env->mmu.ssw |= M68K_ATC_040; + + /* + * According to the MC68040 users manual the ATC bit of the SSW is + * used to distinguish between ATC faults and physical bus errors. + * In the case of a bus error e.g. during nubus read from an empty + * slot this bit should not be set + */ + if (response != MEMTX_DECODE_ERROR) { + env->mmu.ssw |= M68K_ATC_040; + } + /* FIXME: manage MMU table access error */ env->mmu.ssw &= ~M68K_TM_040; if (env->sr & SR_S) { /* SUPERVISOR */