From patchwork Tue Nov 12 18:10:37 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: 842709 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp3716434wru; Tue, 12 Nov 2024 10:13:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXNzXXmpU1f5d9Dw9BGxC6ra2I+PZJ4BD3zgGxF48iijmUK8A4cF/woefVauIF4i0gjX+0ILg==@linaro.org X-Google-Smtp-Source: AGHT+IHOPT9EtMhAFxtcddWdEzBHB7PlvM3FH+UmSCLO+7w3vLBXchB05XgVuH0GegkO30Jypkmr X-Received: by 2002:a05:6102:f09:b0:4a9:6359:cd9d with SMTP id ada2fe7eead31-4ac297785e2mr3520385137.1.1731435212963; Tue, 12 Nov 2024 10:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731435212; cv=none; d=google.com; s=arc-20240605; b=C5IZvEn5O/4+rc3O6zRq9L5uBvlMimOm33r5IyJzUxx/HuUAw18c7RdIz179ngH4T2 aApNM3r+8gWrefg5FetQxjdPq5CuzpYB7SmmJI8y59eIli1s2L2PqcWK03x4dyN19zkw K8eRQsmHxXal0hCOtbrPbkb4tmpVfavnMRzM5dAiQbGB4atbLRDb+Ob6erQ2DNdSvAVi qkFs81sI5CMNi3J3AjpqhXq06IDXYMjSgc+4YoY4ZqNXEDwWoymfeJvKuHJAYHabYIt8 /m1Fb3XzIQRVMSIS4cM7k7cgtXXq2BDvRAvubNf2zx5KP/yWk2NPnQ/AmzW1j1JfKOrT KrTg== 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=o5EaUAp0FQKhEfz/Flp6sGp3H9rqfBlFSfz8Y3bBsgY=; fh=qmVcbpKGT2NGruxhf8fgQHnlhHRaRjD5ibgD08FHYfA=; b=LKibusGC5JJDlic4xzd/VfzIyZBigB8/8/8JmlBjpaqHtb5NbeX3+07Dq8M+tUILYd PvDeCDDPM/0jWyiaQjxVJRDG+nYeEzWzW9oSDH2oxu7/FDzcfwePPmZz7tNz0i7i1Ab3 JVQUhqYY7qUxkd6G+7wnBvLmHh33xqMbyyRgWnjQhyic9A2xEX0qPK9rMFXkWTEAXuo2 vIYAn4VwZhZChIUlXd6Iiywd9AmXn5nd30gjoiyDvke14/vcw22zSDZ7siabRQOQep6U kCaUmZIeZvc70Gca2JQic+pK02ygpBdhqWGhDSEXqNR59lwxXnzABWFwYtFuKHJeQAgr Reug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eTmcJfwc; 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-4aa9f02efcesi3207560137.344.2024.11.12.10.13.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Nov 2024 10:13:32 -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=eTmcJfwc; 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 1tAvNJ-0006RJ-1u; Tue, 12 Nov 2024 13:12:25 -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 1tAvN7-0005jy-TL for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:15 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvN5-00020D-HF for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:13 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4315f24a6bbso47654405e9.1 for ; Tue, 12 Nov 2024 10:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435127; x=1732039927; 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=o5EaUAp0FQKhEfz/Flp6sGp3H9rqfBlFSfz8Y3bBsgY=; b=eTmcJfwcJcM6d2xCIH34cFFA3vS3hNbR5L6BqS4hG15v9bbabiv7CIt665KUh8BOTu 3HHO7lrkkl+Xtzwcu0umi8hIYkvuxSB2FNF0WkkN3bdDXXucXVg/2ED5U4EIgZC8e9Pg uokg7ISLVDq+5l2lNEv5vUYDOWyqOsvgMSYo5XWumMeDqjuJlrwyrGIZGxc0F6jnusLS wQD7g1gg6A1F2K+QKhezJW0EzoEMH3i4pcHEBes8XP/X5JGAfpgC7PO1w9VqMDF6LL+N jDHagR2LLl5kp8bJS2WEnGOnJXHvSpLRlpzFLQR07EpwNRPw+iCY5b5CdZc4omRW/2of PXQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435127; x=1732039927; 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=o5EaUAp0FQKhEfz/Flp6sGp3H9rqfBlFSfz8Y3bBsgY=; b=wFdPC+jeM9T/XXhr6WI7z3VYTKxMqkE6Hw6QKpcAdHvLEIMZyn+S+9SztIHlJPf62X tyQPCushIB4p5818Akk1ZsB+EAJM5GEDmiKD8ifeqS8jevH8oODnQznKYxeWWF+MV5kS 9R/3JDcKlG1FZuEG/P10ADoiyi7czpFxG/HzEIRKClghg1cCR70THnWc7PKuDbZRMrpl 5VF4Gth6hQ72mBlTjcylijNDMg8lbEA7wIiuUAi6qGT/7bzC6+Ltiw07zHRCvfXdGP8B qzv1g5q1gO5Y9qd9jgiQU+Sy1byEooKMgxqm7JYZ9Yw3GtTBUFbejgPhA/9hMftX5lJ3 u9rw== X-Gm-Message-State: AOJu0YzFo3nAeKnd7haaERtD2vU0nJcvEqAoQJFjNLlESlHKBrANkL10 9a6j8fFSJTut/oXQTMr66VStAcpwaz6pBE1tPdYufxN9YQo9yiUxzJ9Pyr9RscgaOEr+FpJ9I39 J X-Received: by 2002:a05:600c:6987:b0:426:8884:2c58 with SMTP id 5b1f17b1804b1-432bcafd113mr122514195e9.4.1731435127388; Tue, 12 Nov 2024 10:12:07 -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 5b1f17b1804b1-432b053069fsm222425585e9.4.2024.11.12.10.12.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:06 -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 13/20] hw/net/xilinx_ethlite: Access TX_LEN register for each port Date: Tue, 12 Nov 2024 19:10:37 +0100 Message-ID: <20241112181044.92193-14-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::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than accessing the registers within the mixed RAM/MMIO region as indexed register, declare a per-port TX_LEN. This will help to map the RAM as RAM (keeping MMIO as MMIO) in few commits. Previous s->regs[R_TX_LEN0] and s->regs[R_TX_LEN1] are now unused. Not a concern, this array will soon disappear. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 4cb4781e70..1a3b295b4b 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -62,6 +62,7 @@ typedef struct XlnxXpsEthLitePort { struct { + uint32_t tx_len; uint32_t tx_gie; uint32_t rx_ctrl; @@ -133,6 +134,9 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) case R_TX_LEN0: case R_TX_LEN1: + r = s->port[port_index].reg.tx_len; + break; + case R_TX_CTRL1: case R_TX_CTRL0: r = s->regs[addr]; @@ -169,7 +173,7 @@ eth_write(void *opaque, hwaddr addr, if ((value & (CTRL_P | CTRL_S)) == CTRL_S) { qemu_send_packet(qemu_get_queue(s->nic), txbuf_ptr(s, port_index), - s->regs[base + R_TX_LEN0]); + s->port[port_index].reg.tx_len); if (s->regs[base + R_TX_CTRL0] & CTRL_I) eth_pulse_irq(s); } else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) { @@ -194,7 +198,7 @@ eth_write(void *opaque, hwaddr addr, case R_TX_LEN0: case R_TX_LEN1: - s->regs[addr] = value; + s->port[port_index].reg.tx_len = value; break; case R_TX_GIE0: