From nobody Tue Nov 26 06:30:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) ARC-Seal: i=3; a=rsa-sha256; t=1709415971; cv=pass; d=zohomail.com; s=zohoarc; b=i8/1djbOsXNbisf2s5YS1zxPW/Uv6rtO0v8QTEdKGdoUD6FCm4L4dmXzNIVDO9Xsu6Yj3AzgaQmOupcW7Sb7gtXiyocQ53A8UKy+cSsv9YjXh8dHmWDL6FQe580qBLRA0BRFtlN8mDqkVSTQL5mkbtjycmfS39XogHlGh6lhX6c= ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709415971; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hyOHtKgXQOPyTvxNxneMckeebvz1U4ZABSpatlZQ1fE=; b=aznlmkxuvg/eti1/lkfHpExnYb0QNsq5+Ih6L4PLQjcEkDhiE7+825JUUYG1Hs6oYaLGd3/VHJtkIK+PKzOBgxHb9532lgAXW3m4dLD97RcJ8w6eSh1txqVAFuV27PSK79MRcPEWVRZUH8ftCem1BAgrR7hDO3CUINa8nCGuKxI= ARC-Authentication-Results: i=3; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709415971337511.96560645959255; Sat, 2 Mar 2024 13:46:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgXAS-0002iR-IX; Sat, 02 Mar 2024 16:45:16 -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 1rgXAP-0002gQ-Hx for qemu-devel@nongnu.org; Sat, 02 Mar 2024 16:45:13 -0500 Received: from bactrian.maple.relay.mailchannels.net ([23.83.214.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgXAN-0002jV-2a for qemu-devel@nongnu.org; Sat, 02 Mar 2024 16:45:13 -0500 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D16A4761EC9 for ; Sat, 2 Mar 2024 21:45:08 +0000 (UTC) Received: from outbound5h.eu.mailhop.org (unknown [127.0.0.6]) (Authenticated sender: duocircle) by relay.mailchannels.net (Postfix) with ESMTPA id 272C476222D for ; Sat, 2 Mar 2024 21:45:08 +0000 (UTC) Received: from outbound5h.eu.mailhop.org (outbound5h.eu.mailhop.org [18.156.94.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.111.52.242 (trex/6.9.2); Sat, 02 Mar 2024 21:45:08 +0000 Received: from mail.duncanthrax.net (mail.duncanthrax.net [130.180.31.158]) by outbound2.eu.mailhop.org (Halon) with ESMTPSA id e8c86e0a-d8dd-11ee-b685-9b9d9be6ef2c; Sat, 02 Mar 2024 21:43:31 +0000 (UTC) Received: from ip-134-003-094-010.um41.pools.vodafone-ip.de ([134.3.94.10] helo=t14.stackframe.org) by mail.duncanthrax.net with esmtpa (Exim 4.96) (envelope-from ) id 1rgXAC-000pgP-3B; Sat, 02 Mar 2024 22:45:01 +0100 X-Sender-Id: _forwarded-from|134.3.94.10 ARC-Seal: i=2; s=arc-2022; d=mailchannels.net; t=1709415908; a=rsa-sha256; cv=pass; b=5aDig8BKFJX4GD7A2j8o5m/6DJlwwoIiM7DT1tZ0netrvhWDck7XUqyM1GryoieSNSZmQx RNu5/Vp89wXKYyqOAeXesxmNcs5Q0jFsi8aDC8irhirM5Cj6ydmYDrXDpOtAhcNEXSXE/z ow+rBPF//MW3uSp1c8+HZE2NcmipemRStvxE1PWEkLhWIpDLUmseZYWVXfthgA1kOZra2F Rfaf1gdP3QFKmrC+byg8SHwk1HdAp2Zs6uYORVigAc1eY3Gu9mvNeAHJra7Bli6LdslPLi kPM9q7V3N76pksZvG6PAqKlsmVwLn/SghETyBw6WPzLdWWjLUZbZ6/j087cM4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1709415908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=hyOHtKgXQOPyTvxNxneMckeebvz1U4ZABSpatlZQ1fE=; b=0aTjFPb3UKKQM/XI+kbYR7sOyVQZ5Np+bUKkYUirBHMMos1ZmNkiuuwDqv+eIw4NbAaju7 mTYEoO1KtnZaQVxNLnUvL0YPmZZ5/c/1hMkuMYnCVOpa/lgKtFuO04DSD96AXIRLNO7y1p c3UC5ecJOE02An6Vthow65eWYJdr94TujNVQ6svi5l52nU4/puS6muqhRdpNfDxkaPJYzq 3eh1SqOvhd3ZTPkfh/CnwxceZjopF31gPJOCJxvb1TUgnYQ14an/+SC+zdUJXi1Of8m6hy qy3ptzpcrqmDjy4NpaGPXTXFIes9JPVmcWidIbYsEk4WCX/1Sn6xTgYXhyicmQ== ARC-Authentication-Results: i=2; rspamd-55b4bfd7cb-2hzk2; arc=pass ("outbound.mailhop.org:s=arc-outbound20181012:i=1"); auth=pass smtp.auth=duocircle smtp.mailfrom=svens@stackframe.org X-Sender-Id: _forwarded-from|134.3.94.10 X-MC-Relay: Forwarding X-MailChannels-SenderId: _forwarded-from|134.3.94.10 X-MailChannels-Auth-Id: duocircle X-Callous-Chemical: 215e06d9701cec0a_1709415908645_415222409 X-MC-Loop-Signature: 1709415908645:3290029914 X-MC-Ingress-Time: 1709415908644 ARC-Seal: i=1; a=rsa-sha256; t=1709415815; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=XmJbL7ycM1Ryy0qAHJ/+06MXVXBUJEojANMhHfUPPXhoqySroUkkUHBC6Sxwr4JMjNuSq7yKBzhB5 laATBV20rHFp5lKDyht67foxY3Nj3dqlLollNCO9zlFkYaOo0viUFGeuiUxuM8H2WyQ1HxqVhXyVDw HLvA/kTRUh+nt6aPf9dEvLpgy2KTJDZ5ADqRhaQP0GDwuiZ6w2heKP94J5xw9bU15LRLA0SPezZf4P rabosC+TDMHes8nHLlE/8PHHTDQhk8Vs9Y7h5uamXiTfNTlGS6hcidFp5N2kp06mPc8z+o9Pe6MvNp G+8831G/BzVpz2Thsj/Iib+RRt6tg0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:message-id:date:subject:cc:to:from: dkim-signature:dkim-signature:dkim-signature:from; bh=hyOHtKgXQOPyTvxNxneMckeebvz1U4ZABSpatlZQ1fE=; b=NOzrl74Qr/ngHbq7aXIAxm0mdclMY1h9YZg4e2UhAEMHj2AXqmOB6pCtkH1VnUntFIWQQDyVp5ys2 1VTZeg6vBnbkh2zo8k18lurq7RUcdox4NbTPOdJRdg2BsM9j5y+cgcJJcWMssFU+ZQ0VxOHtIx6Scg KeBYP/Sgy+kft/tLdCTahu6YQZaTYZxlt2tMEeJvm1vp7PaU5zpwx1yrvjEvoNlJTKFrwNaLFuNrqO evm0zmiZfshT8vFgfcoCVoN4pyTXJ7Z53QlC0y8/wQIeExELSHZrl5f/MbG038msxfQR8U1h7VN+2C PnFQDiwNMy8NBC2LJIPzrjkPS0cBj7Q== ARC-Authentication-Results: i=1; outbound2.eu.mailhop.org; spf=pass smtp.mailfrom=stackframe.org smtp.remote-ip=130.180.31.158; dkim=pass header.d=stackframe.org header.s=dkim1 header.a=rsa-sha256 header.b=O1Pm/Ahm; dmarc=none header.from=stackframe.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackframe.org; s=duo-1634547266507-560c42ae; h=content-transfer-encoding:mime-version:message-id:date:subject:cc:to:from: from; bh=hyOHtKgXQOPyTvxNxneMckeebvz1U4ZABSpatlZQ1fE=; b=XR37sRCjVpYGEwGLCt99dkwjsyqYbrx9xp/8EkKoT4KhbwJW2Eg3tS4F8cpLP2pCaW9uY3vbT1fBC +tRt1ruXH4ClP0EakPP+TrNDElcrM0HTRg6Onfz6B7bpJB5sA3hNIVWojA3ew1DLTvJnCBGjXE0992 X9tFpHvlzt8qCpkA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:message-id:date:subject:cc:to:from: from; bh=hyOHtKgXQOPyTvxNxneMckeebvz1U4ZABSpatlZQ1fE=; b=W0mRdjzDMM07QxqTxu2xm7Qka0flG94xo0ftwe71sEzvAQiPn/9fqPRi+6M9hszdrlyMiEnIVtNPP Nhx+acLlNhnuiAWMlYXq5P/AiOI72KNxAQSXq+x6LCVzs3KF6qRU9k9Gn4B0vzzasAFMFOEAwMH5A2 4LPu0OdqGjlkDiTbLT57V74ExaBaqLLfvHtZYz1VBUMDddilfmU31rHAU8jYVgegeVKuDbLUkHi4QB oglJjPH76tsjVQTCphre1LHdrvi8mzQOW4O13xdEMNLqQhuZUcM2ejKhfSQIFzRYhnVKBM5yJQnGSc vq/fj4wLTbQPaETa9Oema8QckTWlm4w== X-Originating-IP: 130.180.31.158 X-MHO-RoutePath: dG9ta2lzdG5lcm51 X-MHO-User: e8c86e0a-d8dd-11ee-b685-9b9d9be6ef2c X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stackframe.org; s=dkim1; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hyOHtKgXQOPyTvxNxneMckeebvz1U4ZABSpatlZQ1fE=; b=O1Pm/AhmNb+1dO6dz31SDwwbTQ LrTlBpLUXO+c3RRga9GJGDVXz3/td9r4ZXtkw5zL23UKYpF/PfrkTpc+ljuRmdZC6Lj+CDwp6DSYM IovAbUsE2gQ91l14yLJjW4iADLSVOA/BDzMbdnD1ru4CHhG6sAHgNGi0y7RkaCJfOFrU6EYzY8WNU XZZbh9bDvk52NipS4Ku2Yj8L+H2S8CB9xwTSAgC1owTPbc3mU+ZPMrv1J94PGJvMPPMOXKGE5PSab F1wKL0UL6DYoDh64unpG6yxpdrDHue/8uKLprma3bwlAyBd7ysIpOLRs5RRPh6IWBHxFhi2vHJkrA wxVBnKuQ==; From: Sven Schnelle To: Paolo Bonzini , Fam Zheng , qemu-devel@nongnu.org Cc: deller@gmx.de, Sven Schnelle Subject: [PATCH] hw/scsi/lsi53c895a: stop script on phase mismatch Date: Sat, 2 Mar 2024 22:44:53 +0100 Message-ID: <20240302214453.2071388-1-svens@stackframe.org> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=23.83.214.9; envelope-from=svens@stackframe.org; helo=bactrian.maple.relay.mailchannels.net 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, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @stackframe.org) X-ZM-MESSAGEID: 1709415973499100003 Content-Type: text/plain; charset="utf-8" Netbsd isn't happy with qemu lsi53c895a emulation: cd0(esiop0:0:2:0): command with tag id 0 reset esiop0: autoconfiguration error: phase mismatch without command esiop0: autoconfiguration error: unhandled scsi interrupt, sist=3D0x80 ssta= t1=3D0x0 DSA=3D0x23a64b1 DSP=3D0x50 This is because lsi_bad_phase() triggers a phase mismatch, which stops SCRIPT processing. However, after returning to lsi_command_complete(), SCRIPT is restarted with lsi_resume_script(). Fix this by adding a return value to lsi_bad_phase(), and only resume script processing when lsi_bad_phase() didn't trigger a host interrupt. Signed-off-by: Sven Schnelle Tested-by: Helge Deller --- hw/scsi/lsi53c895a.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 4ff9470381..59b88aff3f 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -573,8 +573,9 @@ static inline void lsi_set_phase(LSIState *s, int phase) s->sstat1 =3D (s->sstat1 & ~PHASE_MASK) | phase; } =20 -static void lsi_bad_phase(LSIState *s, int out, int new_phase) +static int lsi_bad_phase(LSIState *s, int out, int new_phase) { + int ret =3D 0; /* Trigger a phase mismatch. */ if (s->ccntl0 & LSI_CCNTL0_ENPMJ) { if ((s->ccntl0 & LSI_CCNTL0_PMJCTL)) { @@ -587,8 +588,10 @@ static void lsi_bad_phase(LSIState *s, int out, int ne= w_phase) trace_lsi_bad_phase_interrupt(); lsi_script_scsi_interrupt(s, LSI_SIST0_MA, 0); lsi_stop_script(s); + ret =3D 1; } lsi_set_phase(s, new_phase); + return ret; } =20 =20 @@ -792,7 +795,7 @@ static int lsi_queue_req(LSIState *s, SCSIRequest *req,= uint32_t len) static void lsi_command_complete(SCSIRequest *req, size_t resid) { LSIState *s =3D LSI53C895A(req->bus->qbus.parent); - int out; + int out, stop =3D 0; =20 out =3D (s->sstat1 & PHASE_MASK) =3D=3D PHASE_DO; trace_lsi_command_complete(req->status); @@ -800,7 +803,10 @@ static void lsi_command_complete(SCSIRequest *req, siz= e_t resid) s->command_complete =3D 2; if (s->waiting && s->dbc !=3D 0) { /* Raise phase mismatch for short transfers. */ - lsi_bad_phase(s, out, PHASE_ST); + stop =3D lsi_bad_phase(s, out, PHASE_ST); + if (stop) { + s->waiting =3D 0; + } } else { lsi_set_phase(s, PHASE_ST); } @@ -810,7 +816,9 @@ static void lsi_command_complete(SCSIRequest *req, size= _t resid) lsi_request_free(s, s->current); scsi_req_unref(req); } - lsi_resume_script(s); + if (!stop) { + lsi_resume_script(s); + } } =20 /* Callback to indicate that the SCSI layer has completed a transfer. */ --=20 2.43.2