From patchwork Sun Jan 19 22:59:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Finn Thain X-Patchwork-Id: 1225535 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=telegraphics.com.au 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 4819Vh3xjMz9s1x for ; Mon, 20 Jan 2020 10:09:48 +1100 (AEDT) Received: from localhost ([::1]:54804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itJhR-0005mK-Sy for incoming@patchwork.ozlabs.org; Sun, 19 Jan 2020 18:09:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56284) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itJg2-0004f0-Bm for qemu-devel@nongnu.org; Sun, 19 Jan 2020 18:08:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itJg1-00041A-BN for qemu-devel@nongnu.org; Sun, 19 Jan 2020 18:08:18 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:54734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1itJg1-0003lA-7K; Sun, 19 Jan 2020 18:08:17 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 8469D29984; Sun, 19 Jan 2020 18:07:55 -0500 (EST) To: Jason Wang , qemu-devel@nongnu.org Message-Id: <34caf9dea82cd30dc51b4f8768adb7a90b236bf2.1579474761.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH v3 13/14] dp8393x: Don't reset Silicon Revision register Date: Mon, 20 Jan 2020 09:59:21 +1100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 98.124.60.144 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: Aleksandar Rikalo , =?utf-8?q?Herv=C3=A9_?= =?utf-8?q?Poussineau?= , Laurent Vivier , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The jazzsonic driver in Linux uses the Silicon Revision register value to probe the chip. The driver fails unless the SR register contains 4. Unfortunately, reading this register in QEMU usually returns 0 because the s->regs[] array gets wiped after a software reset. Fixes: bd8f1ebce4 ("net/dp8393x: fix hardware reset") Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 1b73a8703b..71af0fad51 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -591,6 +591,10 @@ static uint64_t dp8393x_read(void *opaque, hwaddr addr, unsigned int size) val |= s->cam[s->regs[SONIC_CEP] & 0xf][2* (SONIC_CAP0 - reg)]; } break; + /* Read-only */ + case SONIC_SR: + val = 4; /* only revision recognized by Linux/mips */ + break; /* All other registers have no special contrainst */ default: val = s->regs[reg]; @@ -971,7 +975,6 @@ static void dp8393x_realize(DeviceState *dev, Error **errp) qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s); - s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */ memory_region_init_ram(&s->prom, OBJECT(dev), "dp8393x-prom", SONIC_PROM_SIZE, &local_err);