From patchwork Tue Nov 12 18:10:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 842716 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp3717626wru; Tue, 12 Nov 2024 10:15:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWv7Ub5mesJkGynuycH2dix0S8J2gbSQYsC5D9bfM6n8xqW1Mx88vc/P+/MixEqtLnkiXwlLg==@linaro.org X-Google-Smtp-Source: AGHT+IGdia9w0UZVH/b8c/IBC0ghHtvOZaB3SpJOX2S+Ik/UN9d9fpyLpBH/LEanv8k2z5XAfq4V X-Received: by 2002:a05:6102:3a09:b0:4a3:ef1e:8566 with SMTP id ada2fe7eead31-4ad4698eefdmr226283137.17.1731435346535; Tue, 12 Nov 2024 10:15:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731435346; cv=none; d=google.com; s=arc-20240605; b=JYUFj+nt/z2EmUWYxXyHGUcNhyv9p9o8HHOgqYGbhFoGn9uDnbs4jFh3gE7wGGHPYL MThf1vZtFuaqZQFOqvSqDKPdqPIlkPfe5DDXa2Oqao2rvhaBDWzQqchnqFCmfwv/Nfzs kMCJ56IVkw48zsPQUam0zFB2yknKvC4tmSRem+H4xlsDK79AzLTE/qgoJJEGjY21abIX NEEfBV9KmBZ8zUGxs1B6r58oY4WdQs5TAaCV8DsHFgxoQ5TN0B4/9l5negpmysxBKBJs 9G/nYzDtZfyj5v6a/wws0CSdjzEKdV36P8Nuj1UuF7TlW83wcUo3vbNv11KaIOR19onV IMdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=xM2ZSeJRoX/j6Un6zic7nNQ/NMvb/n81U1A/iot7Isw=; fh=qmVcbpKGT2NGruxhf8fgQHnlhHRaRjD5ibgD08FHYfA=; b=fqrPDB/A0gmQ5mN/071brw7Tc549/sl2DbzRxqI5HH7rWXBmgHRL4zgG6qtNkTMUzp n4Z8dj322NvkxnB/K7jtt6itkc0C++LN50ErgaBfNzdA/u0l7CPd+LGSVXc8COB9Uthv Dsv6tqOPJC5bcdaxINr1XnMDrzf8YGQSjasJTkcaVkTVZk2Gp0IEG40rckdaSb03e9yI y/jvDR7h7qwu7WOFrmbgXvZlSgYERkPlz8uCQ/KbHMvvNx28l6Rn/LZYK3Mn5Vcjo/uL 6BboonOyJyeSOOM4ObE3DItWvYwFrn1g2n3IufpC35QiHzqlmofiIHIqvdXcRVWIW00Y alKw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qyRe20Br; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4aaa7bfb41esi3192410137.503.2024.11.12.10.15.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Nov 2024 10:15:46 -0800 (PST) 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=qyRe20Br; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMX-00054p-4Y; Tue, 12 Nov 2024 13:11:37 -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 1tAvMS-00052S-3Y for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:32 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMO-0001v5-5l for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:31 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-37d55f0cf85so4004500f8f.3 for ; Tue, 12 Nov 2024 10:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435086; x=1732039886; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xM2ZSeJRoX/j6Un6zic7nNQ/NMvb/n81U1A/iot7Isw=; b=qyRe20BrCStj5hbduR5TLk3vYh4Ma3XGSa817nf0jT0YlPgUUJ+bycGaqIDIFxjESL hJj+KI7r8J8gPpL0xot43Bq1kWIGWUg0LxWSjlgSo8SMDr4adh+vYhnZvh2TY4TWgpTk Ih3W/DUJNksr2c9GIYudxsT4ntUMtsvS0aJUd1giIDjp6i98utZ8ipPixFf42dSlGCaj epXuFNcJ7jBYEgivhvlGlzX4TJeTJeUjjrmDADzmZXY8wqr00c+zCK9ixjN6dczW5sKA eTpRM2qPhq9B99DRgribL7+hu8BYfPqJjFYy/Yf++Bd2w1MQtoSATilnEtZz8yFjCdzt vq4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435086; x=1732039886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xM2ZSeJRoX/j6Un6zic7nNQ/NMvb/n81U1A/iot7Isw=; b=vrAlchPKNHXNxa4b/zhuhba+dgLNjRCNx4rqJjNTU+iA6IcPPWZgCFNNu0hSqewzPC vT1DqC586eDLiHPYV45qPadB019Oe1QfVMWnM0BZGAMFFy2X8Q5OgKZpjgJJg2KSHk4f 3o+CeJHrVlktQXPkpBaD9L7Ok0OGF+4cLuIvZbckYvSXwH4tYPg5ZXMjIuzCjEmeFF+r S8VVPepk1xLKLdyUBkelErDdq3kvaRR49ZevHS2NasYEAc6TsRZPaB7WXOoTsYcHsoSO BiJmDiytKt978S2zIvGvVE/TqjwW3mF272Pa2IgdkNp+ewfJggS/Cxh513vvo/FuujRK b4pw== X-Gm-Message-State: AOJu0YzbeyoY+appPiMpSGdd1bg5ONnv/jVDKq2OTRvy7SVMbttJlD/c p7SoBfiD2hjM0t1cjju1owmdopnNnIXj9D7QtBlLSmv/Ue5I4aADOBtMjFLcVek2sFHWSrW1iYg L X-Received: by 2002:a05:6000:712:b0:37d:4ebe:164d with SMTP id ffacd0b85a97d-3820df7ae61mr55661f8f.47.1731435085814; Tue, 12 Nov 2024 10:11:25 -0800 (PST) Received: from localhost.localdomain (cnf78-h01-176-184-27-250.dsl.sta.abo.bbox.fr. [176.184.27.250]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381eda1433esm15896532f8f.111.2024.11.12.10.11.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Richard Henderson , Peter Maydell , Anton Johansson , Jason Wang , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 06/20] hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented) Date: Tue, 12 Nov 2024 19:10:30 +0100 Message-ID: <20241112181044.92193-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112181044.92193-1-philmd@linaro.org> References: <20241112181044.92193-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than handling the MDIO registers as RAM, map them as unimplemented I/O within the device MR. The memory flat view becomes: (qemu) info mtree -f FlatView #0 Root memory region: system 0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite 00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio 00000000810007f4-0000000081001fff (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007f4 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index e6f6179fce..76b1e7d826 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -25,13 +25,17 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qom/object.h" +#include "qapi/error.h" #include "exec/tswap.h" #include "hw/sysbus.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/misc/unimp.h" #include "net/net.h" #include "trace.h" +#define A_MDIO_BASE 0x07e4 + #define R_TX_BUF0 0 #define R_TX_LEN0 (0x07f4 / 4) #define R_TX_GIE0 (0x07f8 / 4) @@ -71,6 +75,7 @@ struct XlnxXpsEthLite unsigned int txbuf; unsigned int rxbuf; + UnimplementedDeviceState mdio; uint32_t regs[R_MAX]; }; @@ -231,6 +236,14 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { XlnxXpsEthLite *s = XILINX_ETHLITE(dev); + object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, + TYPE_UNIMPLEMENTED_DEVICE); + qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio"); + qdev_prop_set_uint64(DEVICE(&s->mdio), "size", 4 * 4); + sysbus_realize(SYS_BUS_DEVICE(&s->mdio), &error_fatal); + memory_region_add_subregion(&s->mmio, A_MDIO_BASE, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0)); + qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, object_get_typename(OBJECT(dev)), dev->id,