From nobody Thu Mar 28 21:10:10 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501112798434.6171613345774; Mon, 18 Feb 2019 06:45:12 -0800 (PST) Received: from localhost ([127.0.0.1]:59733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkAJ-0000Eh-Lc for importer@patchew.org; Mon, 18 Feb 2019 09:45:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwu-0005aW-Ir for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwo-0002dV-7M for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:12 -0500 Received: from ozlabs.org ([203.11.71.1]:34435) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwn-0002b2-Hb; Mon, 18 Feb 2019 09:31:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rd1dRHz9sPd; Tue, 19 Feb 2019 01:30:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500257; bh=4h/n18hAk/nruVa0nkiZdPe+3iWpmQFNanoANbvGypg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqyDbAjZ3t/t3JpFhvN1j9A/jqQ82v6raQBO1I4yWttixSpWDN1jgn80u/pabh6ud StSX6bG1sP3DUclyoACIjt04gnOdOGKPuwOdgDttzPc89xkxtnEYnA+c09WY7KkeGl E8KaTzxlJApJWNtS68/Q+62QjLW0sdBO6g68Wub4= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:12 +1100 Message-Id: <20190218143049.17142-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 06/43] cuda: decrease time delay before raising VIA SR interrupt and remove fast path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , groug@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland In order to handle a race condition in the MacOS 9 CUDA driver, a delay was introduced when raising the VIA SR interrupt inspired by similar code in MacOnLinux. During original testing of the MacOS 9 patches it was found that the 30us delay used in MacOnLinux did not work reliably within QEMU, and a value of 300us was required to function correctly. Recent experiments have shown two things: firstly when booting Linux, MacOS 9 and MacOS X the fast path which bypasses the delay is never triggered once the OS kernel is loaded making it effectively useless. Rather than leave this code in place where a guest could potentially enable it by accident and break itself, we might as well just remove it. Secondly the previous reliability issues are no longer present, and this value can be reduced down to 20us with no apparent ill effects. This has the benefit of considerably improving the responsiveness of the ADB keyboard and mouse within the guest. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/misc/macio/cuda.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index c4f7a2f39b..3febacdd1e 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -97,17 +97,8 @@ static void cuda_set_sr_int(void *opaque) =20 static void cuda_delay_set_sr_int(CUDAState *s) { - MOS6522CUDAState *mcs =3D &s->mos6522_cuda; - MOS6522State *ms =3D MOS6522(mcs); - MOS6522DeviceClass *mdc =3D MOS6522_DEVICE_GET_CLASS(ms); int64_t expire; =20 - if (ms->dirb =3D=3D 0xff || s->sr_delay_ns =3D=3D 0) { - /* Disabled or not in Mac OS, fire the IRQ directly */ - mdc->set_sr_int(ms); - return; - } - trace_cuda_delay_set_sr_int(); =20 expire =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->sr_delay_ns; @@ -542,7 +533,7 @@ static void cuda_realize(DeviceState *dev, Error **errp) s->tick_offset =3D (uint32_t)mktimegm(&tm) + RTC_OFFSET; =20 s->sr_delay_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_set_sr_int= , s); - s->sr_delay_ns =3D 300 * SCALE_US; + s->sr_delay_ns =3D 20 * SCALE_US; =20 s->adb_poll_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, = s); s->adb_poll_mask =3D 0xffff; --=20 2.20.1