From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435121; cv=none; d=zohomail.com; s=zohoarc; b=oBTnlmwYF5cvkgWdv/7eQS8YGZavcyddXJmq0ogE6jnDN9cjZiH9FnXqwqRcXnvt21VKxQg7RunV9GHGfYle/9YbcAeEGXt3Xz1o+wZKq384dKzenWyGYhqkBfxh6wSqwKfJ75WBSt6CHy/31sg9hBWwNgH4PG6B1GYvKMQ55hU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435121; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dxalhuJA3V9Mf8DxAADrs85j1mYwG4uCtR+wwxiXnFU=; b=j1vtxTaWsbo6+XutktFdO5TDqNNyBT0p/VG6vuKbLHMUpQV3oUb9N+TXSeKb1LzEqtFLHhSvrUk+2rFSYXNZp93R2KYSHxOElVDmNcSEtYcCVtxAywRsCRVWXQMMAVCDYLnakXNZCJwAAqpRcGgDnc+2KDLUVb/TF3qttf6BQjU= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435121224484.7584250605854; Tue, 12 Nov 2024 10:12:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvLy-0004v4-3l; Tue, 12 Nov 2024 13:11:02 -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 1tAvLv-0004ua-4K for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:00 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvLt-0001rt-LU for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:10:58 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-431481433bdso52753045e9.3 for ; Tue, 12 Nov 2024 10:10:57 -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-381fbf416c6sm7670380f8f.54.2024.11.12.10.10.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435056; x=1732039856; 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=dxalhuJA3V9Mf8DxAADrs85j1mYwG4uCtR+wwxiXnFU=; b=lJ9Cm2iSSpxyAnKMuBy2DLAaFLsRlBMED2NZzfuO6wzTcf390IK9pOi003279rU3dd xoSiRnZDmMeC6INBC0WySIbN5vQfmpDBg0u55uV0/mZgWLxrnPkcoq/oxSygcKT0MaB5 Fw8VTOfkN+8duGSHY4lvXINHnTWz89srKQQZadJ5Xrz3CY6+/tkFhamiR5mTHxeKSZuj 6L/A925S3s9mPJlZa2P1+hs0dBrNqp43UzyyCxEJB4FMTORAoajKhSBEgqgZxPPn6SWL ooRCYm3LImHma2WaxPU+0p+ACNkhPOXdfDvts5Yj9Qr9BiKe75VB8a0Lo40/mdS5iZCr N/gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435056; x=1732039856; 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=dxalhuJA3V9Mf8DxAADrs85j1mYwG4uCtR+wwxiXnFU=; b=N9cjj8Ra/r2tLCYcHKa9vZLJx7eKnYBcUQoQYZgl1TsPEcbEAzp2hh8OnY9bTfoycA Sc/F6d0iao+faz62+oLXyB3+Gb3a6kKfZ0S7yqX3goqLQdLvzHu4vCjdyuRo2KU+gD3/ ENowNVyPoLgchS8JQeHSIVF3zDHOeRRYIdQEyjG1Z5vY6Gkne+chjZpRpS484CzuainK kaVxKyVMHrgsX/XdB1UwheQ12RbfTht/dFMlAxHZJgyhkg8mhSZqBvwwsycuu9qXoecf OBW7kQgXTWM7NY7AqjbLMKfVPQovQJUk9HX+Ka8uqdzfHH5FvDe00dK2cgBXMQPmaiGJ 3wmw== X-Gm-Message-State: AOJu0Yz8BdyD/559CGQj2Po6iJ/QeFFWjspWXBzY4XlMSCvsCzz4KwiK gNjkiBaKLnqeJHNuVdUQsfFaew7mPo1xc2dJXKHuw5TPRDuHrvTiLh2abSUYjKc6333AyRghOVs X X-Google-Smtp-Source: AGHT+IE1RMTlteHBip9Rxda8l4wZD/cMs42SVMF3WUfCg/p+fK8AYVp0J+9LlfWdcF8vngwDlGpqEA== X-Received: by 2002:a05:6000:184c:b0:37d:238:5a84 with SMTP id ffacd0b85a97d-3820df71a37mr43757f8f.15.1731435055659; Tue, 12 Nov 2024 10:10:55 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 01/20] hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit Date: Tue, 12 Nov 2024 19:10:25 +0100 Message-ID: <20241112181044.92193-2-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435122749116600 All these MemoryRegionOps read() and write() handlers are implemented expecting 32-bit accesses. Clarify that setting .impl.min/max_access_size fields. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Anton Johansson --- hw/char/xilinx_uartlite.c | 4 ++++ hw/intc/xilinx_intc.c | 4 ++++ hw/net/xilinx_ethlite.c | 4 ++++ hw/timer/xilinx_timer.c | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index f325084f8b..3022b3d8ef 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -170,6 +170,10 @@ static const MemoryRegionOps uart_ops =3D { .read =3D uart_read, .write =3D uart_write, .endianness =3D DEVICE_NATIVE_ENDIAN, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, .valid =3D { .min_access_size =3D 1, .max_access_size =3D 4 diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c index 6e5012e66e..8fb6b4f1a5 100644 --- a/hw/intc/xilinx_intc.c +++ b/hw/intc/xilinx_intc.c @@ -144,6 +144,10 @@ static const MemoryRegionOps pic_ops =3D { .read =3D pic_read, .write =3D pic_write, .endianness =3D DEVICE_NATIVE_ENDIAN, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, .valid =3D { .min_access_size =3D 4, .max_access_size =3D 4 diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index bd81290808..e84b4cdd35 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -170,6 +170,10 @@ static const MemoryRegionOps eth_ops =3D { .read =3D eth_read, .write =3D eth_write, .endianness =3D DEVICE_NATIVE_ENDIAN, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, .valid =3D { .min_access_size =3D 4, .max_access_size =3D 4 diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c index 32a9df69e0..383fc8b3c8 100644 --- a/hw/timer/xilinx_timer.c +++ b/hw/timer/xilinx_timer.c @@ -193,6 +193,10 @@ static const MemoryRegionOps timer_ops =3D { .read =3D timer_read, .write =3D timer_write, .endianness =3D DEVICE_NATIVE_ENDIAN, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, .valid =3D { .min_access_size =3D 4, .max_access_size =3D 4 --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435152; cv=none; d=zohomail.com; s=zohoarc; b=l62nhNXI2KjebdibMR5PlRhSKYborTRxtjH1uTva7l4bf+NA8alfRpqYgwS9GWaPOWX8SXkUSJ+4N0InN/+WKZXD2mnKX0St9MnIKpIkXvWLgtgM7HOW3rqxY+O2rQelXmARbWnR5NqW735qEevaPKbjM43PKQRCx5YcwsWpHac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435152; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZQmPPVoGs75Oc0X7p2l9C1PUIeVlzMNRobjeBMri9rg=; b=HwbLx9YZqMcnIdap3z53Fd9NCuTSHeZWUo8iggOzuwzNDQaCT9d7989SozQIgWmHcVwVhogFZZMhOvGDle3zfe6knToFq8TOfh3j++6Z7KAPLMqc2c+mFIv8Twzm0AMWSFxZTEcukBAFsPixqpITSr1lSl3uAW29qIAlTFf2Y6M= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435152178922.3317189639301; Tue, 12 Nov 2024 10:12:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMK-00050w-GH; Tue, 12 Nov 2024 13:11:26 -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 1tAvM7-0004xB-Rj for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:13 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvM2-0001sj-Sw for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:10 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-539f72c913aso10478719e87.1 for ; Tue, 12 Nov 2024 10:11:05 -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-432aa737c86sm262860325e9.38.2024.11.12.10.10.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435063; x=1732039863; 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=ZQmPPVoGs75Oc0X7p2l9C1PUIeVlzMNRobjeBMri9rg=; b=Bkuy9+OPXMZT9cbrByOma1Ovv+5ysola10Jw57nqWV/59MX5oTDfkNHRdn1E+kVNLx FWRsYbOqaMnYaSxYg/athElhWxfT7fvNCdzQqtMyM7WptTXoKHgnxVb9Xno4cJDJ8GQx vLXxkLUsAV0DEz0++rWJnHXteX2V4wvO1In+6Gb/1j9NGwdXU0xFObPd+eHnJ2pSXYKi u1BE7u5oKPCqikc1mHHZNhtAFSszUeeP6jCwMekcaru3/XZC8PP/VQbG6rG1ZJS5uDHU lvo6wSyVx/R3dJBmIsRgEDCOBftewe/Mx5TLntrPwwzb5xeI3rtXsXHKiTMWVWp/puRp 57bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435063; x=1732039863; 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=ZQmPPVoGs75Oc0X7p2l9C1PUIeVlzMNRobjeBMri9rg=; b=KwozNpoEABOsWw6nAupyn0oyZ8gn4Yy77dJJkH2974x6yYWld+aE1+PTPFyahGYRWY l3gDAWXN2ilACgeMnDxJaKSWsVHuHHnC7LtDdH4zazQHwAZEy9MJ5yi5azo4f4/Gzhkq XPnH004/S8zsBoYqeBg94TJETgAPUiiVK49heLIKsg05qw0hQ9z0JVSo5UrPHbBLVSYL VpwFzR4GHpWJHrvSP5dqyqOowdqTjcAuQ+gX5X0GJL9S+Y5hexlbzFe74VNEzYrjubS/ eSyJ2tzJNUUQRsaDXdOGf+KrK2eVXLyFv4fhXrhgBtq5zZ3iCMgzHxYAtL8HgSYaCSAm B3AQ== X-Gm-Message-State: AOJu0Yyk7nb3ysU1f/cuiWCldXwrRLzFq1Dj97NoKcjC/uZB8xd+NVsw az4PKv225XicJ0pnOFvKDBzOAPBotlNxaugCB4FdH19S7X2jEkIdfiuoedJNr2DaRp73RzhcKm8 3 X-Google-Smtp-Source: AGHT+IFZWKbdEW9hPzJFEVzeUgKYL+XJ6A+Y/g4rxQpqBUcX/s3/vMv6nOdTkznz39rzBBl5m4Alig== X-Received: by 2002:a05:6512:1042:b0:539:e60a:6dd0 with SMTP id 2adb3069b0e04-53d862f8170mr8876660e87.51.1731435061922; Tue, 12 Nov 2024 10:11:01 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 02/20] hw/net/xilinx_ethlite: Convert some debug logs to trace events Date: Tue, 12 Nov 2024 19:10:26 +0100 Message-ID: <20241112181044.92193-3-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435152951116600 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 5 +++-- hw/net/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index e84b4cdd35..bb330a233f 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -30,6 +30,7 @@ #include "hw/irq.h" #include "hw/qdev-properties.h" #include "net/net.h" +#include "trace.h" =20 #define D(x) #define R_TX_BUF0 0 @@ -198,13 +199,13 @@ static ssize_t eth_rx(NetClientState *nc, const uint8= _t *buf, size_t size) return size; =20 if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) { - D(qemu_log("ethlite lost packet %x\n", s->regs[R_RX_CTRL0])); + trace_ethlite_pkt_lost(s->regs[R_RX_CTRL0]); return -1; } =20 D(qemu_log("%s %zd rxbase=3D%x\n", __func__, size, rxbase)); if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) { - D(qemu_log("ethlite packet is too big, size=3D%x\n", size)); + trace_ethlite_pkt_size_too_big(size); return -1; } memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size); diff --git a/hw/net/trace-events b/hw/net/trace-events index d0f1d8c0fb..2b36cd967e 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -511,3 +511,7 @@ xen_netdev_connect(int dev, unsigned int tx, unsigned i= nt rx, int port) "vif%u t xen_netdev_frontend_changed(const char *dev, int state) "vif%s state %d" xen_netdev_tx(int dev, int ref, int off, int len, unsigned int flags, cons= t char *c, const char *d, const char *m, const char *e) "vif%u ref %u off %= u len %u flags 0x%x%s%s%s%s" xen_netdev_rx(int dev, int idx, int status, int flags) "vif%u idx %d statu= s %d flags 0x%x" + +# xilinx_ethlite.c +ethlite_pkt_lost(uint32_t rx_ctrl) "rx_ctrl:0x%" PRIx32 +ethlite_pkt_size_too_big(uint64_t size) "size:0x%" PRIx64 --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435543; cv=none; d=zohomail.com; s=zohoarc; b=BF6MbBzIXJCb/BqaN7U5sdPyyFgWiZX/iJoAJgRVO0uVYdqJ5j7y947/wyHwDByHy8YQQyDEe4kwggVw3lzesjWxdrUh2zT/+8niowsmQVWlWPVyPLbjXqDfl9ufgbK9weos4OxyNIyOIL4TW3Q/aRscnRN4BH1VRjkEslnM9qQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435543; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oH/SQSX4OUP5TxQrfvghzIartXS3npm2RFGdjSdA9Ng=; b=kVK59SmZN4XxEvC6b/kO4wBCrCnZt9MzoYtnJ4KPcgO1benNB/wlL8boAHloCCiptAqX3RoSNJWsJUS5N/dSBrbbhxgEUMnLzRKbvCulCd5xe7AxWDMIBW2ykX+nUYVFIAyhS6aFJI8m5BNl5aVsD7BDEeDU0RFWfwuwWNC/iPw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435543554915.4514609941949; Tue, 12 Nov 2024 10:19:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMI-0004zV-FF; Tue, 12 Nov 2024 13:11:23 -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 1tAvM9-0004xu-O2 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:14 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvM7-0001t7-KW for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:12 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-431688d5127so47752925e9.0 for ; Tue, 12 Nov 2024 10:11:09 -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-381ed97e46bsm15765702f8f.30.2024.11.12.10.11.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435068; x=1732039868; 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=oH/SQSX4OUP5TxQrfvghzIartXS3npm2RFGdjSdA9Ng=; b=BsBqowxgsurXN+MW6A3LRV+KZr5BOOdjPGZucOjzunOoUzzFfggFvN7yKNzSwsnej2 jxdN/eIYLa3CgaDZHa/TMjgpN1bFfsxI933n5lCbRGMEHivZWxxjsLnEsxS31Lcq+pLb 7mBbZPbm8QijRukU32EyHrwrMX3Kfv95I8JJpSqir2Qt0n58AXnlq5M96SPEPfkUO2gu TnIib27NBNKlzng0Kzb42CkNtlIdVDJrQc+526oo7eVa9/0wi18uNB9TYT5BS5pSYQYH fGJ1oyY1FPhzZv7QDEwkIerWu31gpIITRYW1SLFKq7PVMJvyISezcsGBVYk3NKq/FFib TepA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435068; x=1732039868; 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=oH/SQSX4OUP5TxQrfvghzIartXS3npm2RFGdjSdA9Ng=; b=HeakYu8Ii0R75PDPv7vFcDPyb3AIRzzxqcUdSRw/kCaU6xlq0V8w9g9QL8t07oooca RIUHq2f1PIDBz5gLE2wZ819K7TL2tVDWP9UbNfaYjzusReDkixNmbmHJ6UafCLJKJ05i DboUnOlqIMBfjDk6vdk9Ie13Y6JUGIPI7tpUka5+dwrGvui0N5um8n70eZ0zmHwesAsm 7x5BHPw2JcupCgwSOUgGFpVTxLGDJ3rSvLHhmv1rnL+mFqa/dia8Kz0LFZdl4Cc7zyPU /o3WvkCKaLERvMlIRNO4waMg4WdwQK5iLwrtqQ2+P6w2vAy5AWB54ZBOiDnHIHfcXdgw hTRQ== X-Gm-Message-State: AOJu0YzC6ANSVdkehh2UqUUtO8w6coOWZjGn9/D0FzjiMdqlbFoG0ZPO 61FLALHSEmVoqJ8bmodXM7ke1UHRvBVmz9JM8CBi8S1GGkfXDGfSNQ9eFY9/cYt64jAg8bRnYtf h X-Google-Smtp-Source: AGHT+IF2xSYolMBrVK6spGZeNQNxHkxgEzy+QkyG2R1yz5ZQTHw2BiN0KyGisHgaggMhDQscr4gvLA== X-Received: by 2002:a05:600c:510a:b0:42f:7c9e:1f96 with SMTP id 5b1f17b1804b1-432b74fdee3mr147919705e9.1.1731435068020; Tue, 12 Nov 2024 10:11:08 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 03/20] hw/net/xilinx_ethlite: Remove unuseful debug logs Date: Tue, 12 Nov 2024 19:10:27 +0100 Message-ID: <20241112181044.92193-4-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435544516116600 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index bb330a233f..2b52597f03 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -32,7 +32,6 @@ #include "net/net.h" #include "trace.h" =20 -#define D(x) #define R_TX_BUF0 0 #define R_TX_LEN0 (0x07f4 / 4) #define R_TX_GIE0 (0x07f8 / 4) @@ -100,7 +99,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) case R_RX_CTRL1: case R_RX_CTRL0: r =3D s->regs[addr]; - D(qemu_log("%s " HWADDR_FMT_plx "=3D%x\n", __func__, addr * 4,= r)); break; =20 default: @@ -126,13 +124,10 @@ eth_write(void *opaque, hwaddr addr, if (addr =3D=3D R_TX_CTRL1) base =3D 0x800 / 4; =20 - D(qemu_log("%s addr=3D" HWADDR_FMT_plx " val=3D%x\n", - __func__, addr * 4, value)); if ((value & (CTRL_P | CTRL_S)) =3D=3D CTRL_S) { qemu_send_packet(qemu_get_queue(s->nic), (void *) &s->regs[base], s->regs[base + R_TX_LEN0]); - D(qemu_log("eth_tx %d\n", s->regs[base + R_TX_LEN0])); if (s->regs[base + R_TX_CTRL0] & CTRL_I) eth_pulse_irq(s); } else if ((value & (CTRL_P | CTRL_S)) =3D=3D (CTRL_P | CTRL_S= )) { @@ -156,8 +151,6 @@ eth_write(void *opaque, hwaddr addr, case R_TX_LEN0: case R_TX_LEN1: case R_TX_GIE0: - D(qemu_log("%s addr=3D" HWADDR_FMT_plx " val=3D%x\n", - __func__, addr * 4, value)); s->regs[addr] =3D value; break; =20 @@ -203,7 +196,6 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) return -1; } =20 - D(qemu_log("%s %zd rxbase=3D%x\n", __func__, size, rxbase)); if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) { trace_ethlite_pkt_size_too_big(size); return -1; --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435128; cv=none; d=zohomail.com; s=zohoarc; b=My3SGBgeR/tAA2R3/i7RaHT6YbfMQ4F8nJhBKsfB+WHiQjTYOnA+ZtxXIKfqufykXQNUgIMupzE7ulOC+ALiPsDJct/kmz0p539f1qpFk8/U8S5mv3pjrRi8mOFR/PBryvR+2uRYR9fBOaZVGaFlLFo8nZ3sCbEf2XGflueAM4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435128; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9vHIdtfs7hylvYAHt1fb/5wAWL2WHXc3GjbNq8ajJe0=; b=i3JonPL/TT6kq72PLOkjuc86YP6SO3tI9gKebsd/N32RdDwZiMOdtT1peNN8IbFVudg2LctXLE4tZbqVVMF6zl8u8hjMSyh2AiQ6FlbEabNDAAdOK6ZEOmSsFeIBrWIrHPA/856Nh0s1iAeC9lpNiax/hj0mNn2B7b5kWmvzkEQ= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435128214548.0382156620692; Tue, 12 Nov 2024 10:12:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMS-00052O-WC; Tue, 12 Nov 2024 13:11:33 -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 1tAvMF-0004zL-N6 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:22 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMB-0001tm-TC for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:18 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-38207c86695so910310f8f.2 for ; Tue, 12 Nov 2024 10:11:15 -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-381eda03e8asm15986444f8f.90.2024.11.12.10.11.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435074; x=1732039874; 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=9vHIdtfs7hylvYAHt1fb/5wAWL2WHXc3GjbNq8ajJe0=; b=bcaPTC0VbWlVEW0pXDWB13g7nGlvX6bgmgfe1P3veS0eq8291p9oHTJKZftonxWekT TTy87ZtdW0OEeJO/kyH+5P80K7TXTs7FVsJvjFXquKsz0BLCEX1HTPFeZoVmiJ9N6Cej 6tfLUK1Qd+3hEU88JsyAHRKya2cVRCp17KkFTJCESnfW5lWy/gj9EWxrGrOppTmH5N0P ydPld5W/kAGs+VP/sy/3P/gjIsxsR685l76pOxU6PcUHdIOB3P5NbE4kyMEiVS5tVV+n KPzEvqbIiIuxf8hmqxNAJpspZXroeBonNqMucvp5ef19omrSXx6oyMnJbK/Y2ishAEL8 sV1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435074; x=1732039874; 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=9vHIdtfs7hylvYAHt1fb/5wAWL2WHXc3GjbNq8ajJe0=; b=rRdkWLKBdqDgjUvr4jCsrG1Y8izFqsnnlue8OD57ZHVOU0Xt/6e6Tx64N+m6Kyq1ME sBRP0vztKsIFh1RXheNN8FnJJ6b794gaOaJzN/sjlKXIZO98gsrHgqirxcw+82zBqmWE 8boYcXt9U3GfVrweBM7CXL/vZEmECrE0xWIbZDOVno/BmRS44ntj/6xKsJRAAQnkkyjo 6+cPxA76cEBKAMjcqWf14OKII9JZGvaezzvcL2/alKzcrcyivCeVL5h2bMuP5Xmrifu2 8bfSaGZsQ29dfaKEEmlwzpEfeUAVF1poyZ9UhTmhhowOr5qY/NdSG9iMpZT/kpNNIrvY br3g== X-Gm-Message-State: AOJu0YwK+kpm6WKZNbFaHsDw+Sdb1l8jb6Ut506QssnieZ5CoN4LCR5u PZZU+x+s6SFIWTcWEJ5sm8o5krxiRbav2gUcajj31/haG2DnorHPvL+R9fSojCFVxeC293ZiX0q M X-Google-Smtp-Source: AGHT+IEa9eolNpml3bWXBu/wVzVylLcVLUzgMqxXd3ZeArJKM+zjODJkM2l2qX9oNER3+BKsvDJ5mg== X-Received: by 2002:a05:6000:2588:b0:381:c8fe:20b1 with SMTP id ffacd0b85a97d-381f18855b8mr14253688f8f.42.1731435074007; Tue, 12 Nov 2024 10:11:14 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 04/20] hw/net/xilinx_ethlite: Update QOM style Date: Tue, 12 Nov 2024 19:10:28 +0100 Message-ID: <20241112181044.92193-5-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435128753116600 Use XlnxXpsEthLite typedef, OBJECT_DECLARE_SIMPLE_TYPE macro; convert type_init() to DEFINE_TYPES(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 48 +++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 2b52597f03..0f59811c78 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -53,10 +53,9 @@ #define CTRL_S 0x1 =20 #define TYPE_XILINX_ETHLITE "xlnx.xps-ethernetlite" -DECLARE_INSTANCE_CHECKER(struct xlx_ethlite, XILINX_ETHLITE, - TYPE_XILINX_ETHLITE) +OBJECT_DECLARE_SIMPLE_TYPE(XlnxXpsEthLite, XILINX_ETHLITE) =20 -struct xlx_ethlite +struct XlnxXpsEthLite { SysBusDevice parent_obj; =20 @@ -73,7 +72,7 @@ struct xlx_ethlite uint32_t regs[R_MAX]; }; =20 -static inline void eth_pulse_irq(struct xlx_ethlite *s) +static inline void eth_pulse_irq(XlnxXpsEthLite *s) { /* Only the first gie reg is active. */ if (s->regs[R_TX_GIE0] & GIE_GIE) { @@ -84,7 +83,7 @@ static inline void eth_pulse_irq(struct xlx_ethlite *s) static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { - struct xlx_ethlite *s =3D opaque; + XlnxXpsEthLite *s =3D opaque; uint32_t r =3D 0; =20 addr >>=3D 2; @@ -112,7 +111,7 @@ static void eth_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { - struct xlx_ethlite *s =3D opaque; + XlnxXpsEthLite *s =3D opaque; unsigned int base =3D 0; uint32_t value =3D val64; =20 @@ -176,7 +175,7 @@ static const MemoryRegionOps eth_ops =3D { =20 static bool eth_can_rx(NetClientState *nc) { - struct xlx_ethlite *s =3D qemu_get_nic_opaque(nc); + XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); unsigned int rxbase =3D s->rxbuf * (0x800 / 4); =20 return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); @@ -184,7 +183,7 @@ static bool eth_can_rx(NetClientState *nc) =20 static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { - struct xlx_ethlite *s =3D qemu_get_nic_opaque(nc); + XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); unsigned int rxbase =3D s->rxbuf * (0x800 / 4); =20 /* DA filter. */ @@ -214,7 +213,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) =20 static void xilinx_ethlite_reset(DeviceState *dev) { - struct xlx_ethlite *s =3D XILINX_ETHLITE(dev); + XlnxXpsEthLite *s =3D XILINX_ETHLITE(dev); =20 s->rxbuf =3D 0; } @@ -228,7 +227,7 @@ static NetClientInfo net_xilinx_ethlite_info =3D { =20 static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { - struct xlx_ethlite *s =3D XILINX_ETHLITE(dev); + XlnxXpsEthLite *s =3D XILINX_ETHLITE(dev); =20 qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic =3D qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, @@ -239,7 +238,7 @@ static void xilinx_ethlite_realize(DeviceState *dev, Er= ror **errp) =20 static void xilinx_ethlite_init(Object *obj) { - struct xlx_ethlite *s =3D XILINX_ETHLITE(obj); + XlnxXpsEthLite *s =3D XILINX_ETHLITE(obj); =20 sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); =20 @@ -249,9 +248,9 @@ static void xilinx_ethlite_init(Object *obj) } =20 static Property xilinx_ethlite_properties[] =3D { - DEFINE_PROP_UINT32("tx-ping-pong", struct xlx_ethlite, c_tx_pingpong, = 1), - DEFINE_PROP_UINT32("rx-ping-pong", struct xlx_ethlite, c_rx_pingpong, = 1), - DEFINE_NIC_PROPERTIES(struct xlx_ethlite, conf), + DEFINE_PROP_UINT32("tx-ping-pong", XlnxXpsEthLite, c_tx_pingpong, 1), + DEFINE_PROP_UINT32("rx-ping-pong", XlnxXpsEthLite, c_rx_pingpong, 1), + DEFINE_NIC_PROPERTIES(XlnxXpsEthLite, conf), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -264,17 +263,14 @@ static void xilinx_ethlite_class_init(ObjectClass *kl= ass, void *data) device_class_set_props(dc, xilinx_ethlite_properties); } =20 -static const TypeInfo xilinx_ethlite_info =3D { - .name =3D TYPE_XILINX_ETHLITE, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(struct xlx_ethlite), - .instance_init =3D xilinx_ethlite_init, - .class_init =3D xilinx_ethlite_class_init, +static const TypeInfo xilinx_ethlite_types[] =3D { + { + .name =3D TYPE_XILINX_ETHLITE, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(XlnxXpsEthLite), + .instance_init =3D xilinx_ethlite_init, + .class_init =3D xilinx_ethlite_class_init, + }, }; =20 -static void xilinx_ethlite_register_types(void) -{ - type_register_static(&xilinx_ethlite_info); -} - -type_init(xilinx_ethlite_register_types) +DEFINE_TYPES(xilinx_ethlite_types) --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435162; cv=none; d=zohomail.com; s=zohoarc; b=XumaqrfiEDJwdlNZWKi5uE90rdj97EJ9Fp8B3uG0w23WudGvtkLcBCCEZCHuXC1d9a3Et7cvtrwm1MyLZCqZR+iEQAzuYTbTu0ezyijX6ifWg5597jnwN+qEa8YTtEwLnclrOeSe3+wG8DkZVHk/y1vNJtUqxl7jYD0LsVpjXA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435162; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qd9qxHlovWjmh8ObGWU7tF9VLM9MT0KfWhMQvBKNL6I=; b=QKm491qGidz0D9szun6AWR5GtfBQkTFAK4BqEwxYNv28dBYGxbgzWyyUXHGJbgA/40mhMOPW4MCawopFGd0iJyYIFIA3vXwM/mcBz0kuLQos3QCvdKsQkOxYL4ClLLGJMRpnCKsJFga+rwWvWXnp1W20GM7oElNAvXBs4/I9Asw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435162195997.9307691833604; Tue, 12 Nov 2024 10:12:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMV-000542-E1; Tue, 12 Nov 2024 13:11:35 -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 1tAvMO-00051W-BZ for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:29 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMJ-0001ua-Cr for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:25 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4314c4cb752so52779805e9.2 for ; Tue, 12 Nov 2024 10:11:21 -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-432b05e5f82sm222757955e9.42.2024.11.12.10.11.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435080; x=1732039880; 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=qd9qxHlovWjmh8ObGWU7tF9VLM9MT0KfWhMQvBKNL6I=; b=Kt84ReZ/6DIX+8ABwBG38Mtlg/aIFM274wqIVOEhwPPgKY6fPLUglZBkSGPyGeq7D0 rMvtWHHDhsifmPb578v7lbQRaTbVOhgZ2YOiMC1MtBdkA8zF5qK/ZyexieYvPiSqU7gw SUavSVUDizQ+lR4Ok2bKU08lAXYD0ggXLKp3xPsgbIgJvlMx9SzeEGu1Fg8+MuY/TAFU hWzOYPL2IfGvIMBBbeLbZ811wIsrs2SETFXfYU1YM8kFZshPDRBVPrAnXIx2An44O4k9 +wt7+YTApTZyCj8zJjStwFxJkM3TvmVOOA/ny/1GzahgYpbuAjnT+3LpdCrdzqWPlrlf AEbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435080; x=1732039880; 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=qd9qxHlovWjmh8ObGWU7tF9VLM9MT0KfWhMQvBKNL6I=; b=gq0dTcUU4ucTWHiV0fYBAKpexj9gz/q//Dk/7VAZE19yHppd+lTbh4jVfNv0CGQQ9W dPewJaybhqkXzrZB9JkwpeX/1R8IN89jQh1sfMjKb0buTBmvHq67bCPLYQruM9atpZN6 iU9rdQ6RWC7w2xo7VG+LWJnnWrD5SPV++HsAv/s44BHPTay2FtOf8oGA0MI38x45d9f7 IwFc7zPlCE01IC4DxZ100KnFMrfiQSZjVOI6P6hxWupQwRP/0ogz+hG+4Gw4QP+vSdLa FLF80Cx1HUPo/CFyDOSL8OOoQzeFArEj7wEPXidwIydyPFPyuNrbwxo7QSroEOCkSDPh RxYQ== X-Gm-Message-State: AOJu0YzwmMRFrIzBCEWkE5BgRS8dDCkvQfw+mleSXWXko1w96f2E4coT wx4mP09M0NQX0wz1Dj2yFVKaZJ/8UAZZvTF0VZuvzYANZQfyqY9U7DypYRtI36zFE+AWE9O8WvQ m X-Google-Smtp-Source: AGHT+IHQZlg5SFriemGlfj7YjAGdzfrrI6cHbHPA3UvTD7AFZQTkfBKAGW4h5qAf185PTItlxISwzA== X-Received: by 2002:a05:600c:3d05:b0:431:7c78:b885 with SMTP id 5b1f17b1804b1-432d4aaa11emr816505e9.4.1731435079902; Tue, 12 Nov 2024 10:11:19 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 05/20] hw/net/xilinx_ethlite: Correct maximum RX buffer size Date: Tue, 12 Nov 2024 19:10:29 +0100 Message-ID: <20241112181044.92193-6-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435162998116600 The current max RX bufsize is set to 0x800. This is invalid, since it contains the MMIO registers region. Add the correct definition and use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 0f59811c78..e6f6179fce 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -46,6 +46,8 @@ #define R_RX_CTRL1 (0x1ffc / 4) #define R_MAX (0x2000 / 4) =20 +#define RX_BUFSZ_MAX 0x07e0 + #define GIE_GIE 0x80000000 =20 #define CTRL_I 0x8 @@ -195,7 +197,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) return -1; } =20 - if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) { + if (size > RX_BUFSZ_MAX) { trace_ethlite_pkt_size_too_big(size); return -1; } --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435346; cv=none; d=zohomail.com; s=zohoarc; b=nIwhLejrlG6rTcqQak2NUBuLBRx23q/2Qra31N1quUaGFr84UPk3kMw20gJCEXwriZ40ivBgxY+TADUNHnSx/cRQ3A4Of/gNirE1MSUIF5xM0mOuLlzfyvUggiWwPfmbZmVBG6hW5AK7MyX4qocdTxPHiCYgEiZC/OkO8E68KRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435346; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xM2ZSeJRoX/j6Un6zic7nNQ/NMvb/n81U1A/iot7Isw=; b=f+jbV1w5WoySskuQbzCb6LnHG7JQJHzsZ/KfAklkOzVXRVw7258vjsybm/RAVcB8M5tGE73isSneZS0sWT3fD8Rw3wnDMIFONb0JbT1jEuT1TrG8dLC6LwFqMi8hVfEe3xUc44m2JrkWk5kaQMebNMiut6qmm60orgtAiKGfuwE= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435346868308.0544226830974; Tue, 12 Nov 2024 10:15:46 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IG9uVZEhBAhRnBex9WXjjO3XeEIQrZQVWx7UHJ5Ux2BernQ7Du9ektBAkKzRc+mtRVP9N5U4A== 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) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435347770116600 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=C3=A9 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" =20 +#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; =20 + UnimplementedDeviceState mdio; uint32_t regs[R_MAX]; }; =20 @@ -231,6 +236,14 @@ static void xilinx_ethlite_realize(DeviceState *dev, E= rror **errp) { XlnxXpsEthLite *s =3D XILINX_ETHLITE(dev); =20 + 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 =3D qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435483; cv=none; d=zohomail.com; s=zohoarc; b=ga7N8p27BChKyvDvD6L4hPCSmQNyu/ynyWq4/nl7/nJNlbLSmOKK2Yr437JmVN/VBVfmQtvtb0fgLbRDtSg7qFnWA1zeeu9r0sd3LtxVtBNcTz6CWHtm2b1oMNG5Z9pzDVKSukUKmwekioEXXpn6U6oQBGOFVX9IMVPRc+r2xZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435483; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S0A+XO8SEDEpUXfiyI42zPsZnM8n4BbkRd6mjrTW2c4=; b=c6fwh0HKLs9sPdJ5pthYU5SkECkI0vB1hwjW2ZNCXcmMfdNQ5/Lku/Pou5hmdfN45A7wrzjS5RbF0CvwSuHrI8f6pi2M9oaGbsFdwFhLX+R2pwSdMI49ukHDYi9flX/meW2EI1le/RONIPcrFWKZ+rt8RU2F/0hvzIboh3ng3bw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435483002733.8104565448156; Tue, 12 Nov 2024 10:18:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMZ-0005A6-Uf; Tue, 12 Nov 2024 13:11:40 -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 1tAvMV-00054k-JY for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:36 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMU-0001vs-2t for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:35 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-539f72c913aso10479629e87.1 for ; Tue, 12 Nov 2024 10:11:33 -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-432aa7397e4sm252183635e9.40.2024.11.12.10.11.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435092; x=1732039892; 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=S0A+XO8SEDEpUXfiyI42zPsZnM8n4BbkRd6mjrTW2c4=; b=xqNcY8GRY/9EYPcLNhmwzaEMNRPkvyvvAMy8c37per7ygQ5pI4MURCKpYq9qJh82y/ YJ7KI+jKybXshCZEYtem4m72u1RTakX0+QAMsGsLxfAkl1MeKtLcoktghFUA2Ufmp5WD fo+/l7dFxU8D5Vv9FUSTO2vM9jkT9TlJbHYSwC1+/LrtviSE5Npgq2KjNvm4do0QvRXO UzSqIlAKX6qsKRKpqznkpVyHVtmaiL5hCDyL9EUxAgdwy/hvUk1wKMVP8jBOha5mj74+ bt2GmDJwIBloKfj+Yel69xlBnZvZvf28G+xmsbg7g1hfxoAGPwo2v33AjKNDczrzljZN 8P5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435092; x=1732039892; 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=S0A+XO8SEDEpUXfiyI42zPsZnM8n4BbkRd6mjrTW2c4=; b=PqeUOhQs03nIheivq51Q3DncnWR0ehUcQ4BzapVtYU3O/bp31o38APSEW2eWW1vCGv 3HyPUZ3Gmz530ZYAVDAASZ2wjF8j0w1T7SZChYqejfwIw9qkpbgYhNM1NbQB4EpvOfkH aczGINr6s8mP853IIFXFi4IPm9unbWACPq693r4XwpnW/9fIk3w6CR39jbH9eBYyiXDe eUjHgnyV1ae9BSMzxkk8JTTzeSxk31UDAF0agUp533WT+I5jgpohZ7NC5L2VdhdoRyvM R37ZFgSs2CcVrDrIsM3Vpx7Rr1VUFZFpQk6tZRmdBzXf8qe6A0FdJR1urRujIyzXAP9h Q1Dg== X-Gm-Message-State: AOJu0YzxErotCV8lVEeRntOCtz3lbB3OUlSUIvP86DsQ/9Us8tBKqGAp NTuJTeoKwOl7080mQNjkTmPcTBpfwAqbetLyGy7OMw+ZIvy4CVdlkwQcDWM97krUotcHJzOpBrj E X-Google-Smtp-Source: AGHT+IF4OGjp6CPOl3a+BdJGRmmk9fZLhrw5YXzty/ZCkxt4492P0CDola6BsjWuyyIC27Aqmx7qfQ== X-Received: by 2002:a05:6512:4024:b0:533:3fc8:43ee with SMTP id 2adb3069b0e04-53d862c6b7bmr9259602e87.13.1731435091801; Tue, 12 Nov 2024 10:11:31 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 07/20] hw/net/xilinx_ethlite: Rename rxbuf -> port_index Date: Tue, 12 Nov 2024 19:10:31 +0100 Message-ID: <20241112181044.92193-8-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::12b; envelope-from=philmd@linaro.org; helo=mail-lf1-x12b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435484269116600 'rxbuf' is the index of the port used. Rename it as 'port_index'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 76b1e7d826..20919b4f54 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -72,8 +72,7 @@ struct XlnxXpsEthLite =20 uint32_t c_tx_pingpong; uint32_t c_rx_pingpong; - unsigned int txbuf; - unsigned int rxbuf; + unsigned int port_index; =20 UnimplementedDeviceState mdio; uint32_t regs[R_MAX]; @@ -183,7 +182,7 @@ static const MemoryRegionOps eth_ops =3D { static bool eth_can_rx(NetClientState *nc) { XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); - unsigned int rxbase =3D s->rxbuf * (0x800 / 4); + unsigned int rxbase =3D s->port_index * (0x800 / 4); =20 return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); } @@ -191,7 +190,7 @@ static bool eth_can_rx(NetClientState *nc) static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); - unsigned int rxbase =3D s->rxbuf * (0x800 / 4); + unsigned int rxbase =3D s->port_index * (0x800 / 4); =20 /* DA filter. */ if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6)) @@ -214,7 +213,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) } =20 /* If c_rx_pingpong was set flip buffers. */ - s->rxbuf ^=3D s->c_rx_pingpong; + s->port_index ^=3D s->c_rx_pingpong; return size; } =20 @@ -222,7 +221,7 @@ static void xilinx_ethlite_reset(DeviceState *dev) { XlnxXpsEthLite *s =3D XILINX_ETHLITE(dev); =20 - s->rxbuf =3D 0; + s->port_index =3D 0; } =20 static NetClientInfo net_xilinx_ethlite_info =3D { --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435447; cv=none; d=zohomail.com; s=zohoarc; b=WbwgLKSYfhPW/6UBcki0s+TG22SLDtLmVoZbqbN19g5yMeUACbroYAjVFJ2/MzLXSS07yuDeBlvC9JGGibHux+h49YJVCd890dDb6VioIz9Uyp7yJBKlaSb1CyS8RifwqP4la7DcKdHKOqmpHjbj/mGa2NPf4qKvX4BYCuMp8ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435447; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VgOSNR6wPQJECLaWUR0U2aDVp6+TXCTXj/l4QB6G0rU=; b=Sr/JEzNkFPUeWfDCbxEGdaORAf1x270F0SM9CJ9KAG4L4v1XWC9kP2rrXGaMQ1hPjvQ3y6nbYmRamxVBhgvYwQVXZNshpu89UAgHEFBb9+tHidgvcFkndtU3SLyeqvys2H3/RVVlZgkGR5jGXjTwqd5LaAJhm8VwNTsUW3nkEsQ= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435447241467.58538858395264; Tue, 12 Nov 2024 10:17:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMi-0005D1-9n; Tue, 12 Nov 2024 13:11:48 -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 1tAvMc-0005BT-C5 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:42 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMa-0001wa-A3 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:41 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37d4b0943c7so3727460f8f.1 for ; Tue, 12 Nov 2024 10:11:39 -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-381eda04211sm15991976f8f.94.2024.11.12.10.11.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435098; x=1732039898; 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=VgOSNR6wPQJECLaWUR0U2aDVp6+TXCTXj/l4QB6G0rU=; b=mPaVWrNODwimrCiGaStTIfjh9I0CStiqM58LF9XK2CPnMtnU5Q1SslHCil/76ryTIM jsXMqMpAUYQeVTWY0b2A8gwvxRP645VkwzKhfDd1bG87nzsNQL0Gw9s5NRnN+kQaTd9h viPYr/r7RojLUWwndqrsSZs4tXQX7/AWK9hLdPTNXtlE2JlORdANyX0etCm9MrrM/oTj gzWqmKujHS3cPtGGNe4suw2GvFAikpQ+U+FfzCJz6PEJ+ICiHtU0VNxG/WPpnn+0Ad+8 qfNuCSkKGbI1FoRMFnAGgbl4GEhggZsUjL+w6CQq07NCMZG0p+U5y7fOO7pbbWEnRX3k PR4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435098; x=1732039898; 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=VgOSNR6wPQJECLaWUR0U2aDVp6+TXCTXj/l4QB6G0rU=; b=fhAFDqHfEAPyIUHlSRxO4VjbTwi4zwEYIrxOuOOFuOPGLPnc5uCHIyAZIa6O0ylgV8 wi97q/qv/IqLTLr3c7IYLfDF09/cM/KrDgLt6sJxK+KbXNY8NJwj8bd0j/frdVde+ndW ApEZ+pQxaBaO3+AR9SmYng8YN7Zg3cegZC4sD0jVZt6czfZ7p51oVMUdLIA4/uKz38rE JWtS1tHd/wZGnTAbRiVMH2ZO8rLxAJnJ3scPQyKIoJ0uo4ygZ6qvap6EVy5OFIMZKrCp u9YwQvRyjubKbWqx62ngM0+6Ql0ko4Y4yqWZ8cIclY4/0jlrhhXbMVXLCeqo56C6PGMZ QLLw== X-Gm-Message-State: AOJu0YxbBA1LnkAybgyvQtkKj7V9x/xIFMZQqYsgBeEPptRfh7h3fWia k3b37cAdvy0Hozidt5Ltimqb3Joyt865OJDuGPBc0pxfUnL6TQPT7aHaK0Jy1MOgxYyfkBVUBa9 7 X-Google-Smtp-Source: AGHT+IFsF4foONjJOW4bmVgnTVFCrHVLZ2H51xCAsRqc7ggHD4LRg+7hZrCxdG0huNvWXUQ9IJgavw== X-Received: by 2002:a05:6000:4028:b0:37d:4cef:538b with SMTP id ffacd0b85a97d-381f1872621mr12245629f8f.26.1731435097732; Tue, 12 Nov 2024 10:11:37 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 08/20] hw/net/xilinx_ethlite: Add addr_to_port_index() helper Date: Tue, 12 Nov 2024 19:10:32 +0100 Message-ID: <20241112181044.92193-9-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435448173116600 For a particular physical address within the EthLite MMIO range, addr_to_port_index() returns which port is accessed. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/xilinx_ethlite.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 20919b4f54..fe91891310 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/module.h" +#include "qemu/bitops.h" #include "qom/object.h" #include "qapi/error.h" #include "exec/tswap.h" @@ -86,6 +87,12 @@ static inline void eth_pulse_irq(XlnxXpsEthLite *s) } } =20 +__attribute__((unused)) +static unsigned addr_to_port_index(hwaddr addr) +{ + return extract64(addr, 11, 1); +} + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -190,7 +197,8 @@ static bool eth_can_rx(NetClientState *nc) static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); - unsigned int rxbase =3D s->port_index * (0x800 / 4); + unsigned int port_index =3D s->port_index; + unsigned int rxbase =3D port_index * (0x800 / 4); =20 /* DA filter. */ if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6)) --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435162; cv=none; d=zohomail.com; s=zohoarc; b=V6fHBk4WB7XnfMJuBqiEfcOgVG2/A9VAibE6SE7w+uAjBRK+61V8P3aEMoAMoq+uddPQVaGaLcFCAFHugkWuxotJsgb0ixTIJS7Os91tZAz6/fy6539QNqA60XaU+LI/VzX5+dV/gVjKlfLyGbkbDDPLXe/0FUVF0nHSqx+VIa8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435162; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IFxTKFQ0DGptUkzLtcja4XwpDLueVdiea1brksjZQow=; b=SHeGZroktpa38mBdbE+t5MIBdMbNndxiXq4TRQFA04JsbMmUQ6/I4ckXuC+jMd9PebWBFIwtUicgn2L1USxbscHsn/EQtGMLRBi+rtEFtyEsAKTOm828sUkJ4I+1PMq8N1PY1TvYMQQ23NmgCkpl9gAU5u1qIuw3cECt8W0HQVs= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435162232119.18107861079477; Tue, 12 Nov 2024 10:12:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvMu-0005It-0G; Tue, 12 Nov 2024 13:12:01 -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 1tAvMh-0005DK-Im for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:48 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMg-0001x1-2L for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:47 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-53d8c08cfc4so3391520e87.3 for ; Tue, 12 Nov 2024 10:11:45 -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-432aa70a234sm257606015e9.34.2024.11.12.10.11.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435104; x=1732039904; 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=IFxTKFQ0DGptUkzLtcja4XwpDLueVdiea1brksjZQow=; b=hmIDoznQjUOntY30qHd+u9u0vWrBM7JY1B/Zq4203nsO6EQXBuKZ/TPTc+eEE8mt6D NK2ADtpA5rJ2fwSiDnUD/Jm2jnKybOkoM+1/S+kY40FuCqW66E3c9s1vi2JHvcevDDTE 6qzrl3s1/Xdo8tcOTmG18i2aaGVq8REx4huk9JIT+nimxVp/ZOOeQ26znMKAZF5psznc 9nVdn3cM0sEuce4xLxFc7sZuyCoWPQQk1IWfFDFXKun055ILPAw80xz82VhsiFDWFujv aBzVXfbPQtxMSUg5Sq8l9Cu6KtqO5c2jDCqJ+gYpbMf2lV7/6Lg9BrA1SjfM5VIJhlev sp2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435104; x=1732039904; 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=IFxTKFQ0DGptUkzLtcja4XwpDLueVdiea1brksjZQow=; b=CRqYFwvd5SGgPctT0tvR8v4Y7tloJj1zqCostETnoMLzAxBEie3RwHuUN2ufWF5FzQ ZbHQ1PXwWjRZpHD0YKWvv1LA82yFur3CWG0cxaAwoh3cN7J+u1IlTs1obdhDs4upJVDW Smo7ullX7JuRFaeYOjH9Doqd1+ffIZMumAwJUz5IfvhjNcvwVgE1u7USQDCTJ1t6mfWo ipAvaWcKK31XPF0oRO8Hk73IhPQgioYdk9HTrLMSmo3zT1/8aqd5aO4cEbOaCZ7P0LR5 hXMm4loi/muEYFpXLVA334n6VoFWMaIqRVJzGXpvu1c9G4ADp2mePWcakRTsNs99PGbZ c9wg== X-Gm-Message-State: AOJu0YwGQXm+B1yKUd2HScZG8mEtqsDq7+aY46C9r18bM5yc5KaZHOrb reE5L0x4VIK8qCLUhJwoKeY/xfpv48QFnUYaHArutDWGFORLQiXleKWNOIyE+QdtcwUwb7ryw3I Q X-Google-Smtp-Source: AGHT+IF3xa6t9VNRXlcqWORMc1/5N0s9zi/mCbru/ds8eBKeP5mJw67TesIirzkRpQWS+paKeTr3Qg== X-Received: by 2002:a05:6512:b09:b0:536:a695:9429 with SMTP id 2adb3069b0e04-53d862cd111mr7578226e87.10.1731435103570; Tue, 12 Nov 2024 10:11:43 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 09/20] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper Date: Tue, 12 Nov 2024 19:10:33 +0100 Message-ID: <20241112181044.92193-10-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::12a; envelope-from=philmd@linaro.org; helo=mail-lf1-x12a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435163050116600 txbuf_ptr() points to the beginning of a (RAM) TX buffer within the device state. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index fe91891310..d4882f43f7 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -87,12 +87,18 @@ static inline void eth_pulse_irq(XlnxXpsEthLite *s) } } =20 -__attribute__((unused)) static unsigned addr_to_port_index(hwaddr addr) { return extract64(addr, 11, 1); } =20 +static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) +{ + unsigned int rxbase =3D port_index * (0x800 / 4); + + return &s->regs[rxbase + R_TX_BUF0]; +} + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -125,6 +131,7 @@ eth_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { XlnxXpsEthLite *s =3D opaque; + unsigned int port_index =3D addr_to_port_index(addr); unsigned int base =3D 0; uint32_t value =3D val64; =20 @@ -138,12 +145,12 @@ eth_write(void *opaque, hwaddr addr, =20 if ((value & (CTRL_P | CTRL_S)) =3D=3D CTRL_S) { qemu_send_packet(qemu_get_queue(s->nic), - (void *) &s->regs[base], + txbuf_ptr(s, port_index), s->regs[base + R_TX_LEN0]); if (s->regs[base + R_TX_CTRL0] & CTRL_I) eth_pulse_irq(s); } else if ((value & (CTRL_P | CTRL_S)) =3D=3D (CTRL_P | CTRL_S= )) { - memcpy(&s->conf.macaddr.a[0], &s->regs[base], 6); + memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6); if (s->regs[base + R_TX_CTRL0] & CTRL_I) eth_pulse_irq(s); } --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435260; cv=none; d=zohomail.com; s=zohoarc; b=ccK3PUh7LfGN9klw06XPDAJ/BbzigBt2XamaFa1RLQav19jgP+nZmG0xpgQ16zIae4Yvb7A7RfISiBsx70o0oh61t2O+cpE5uHoCCsnloLm7ZxshlbLdzzkCdwSOA+CWgGog/x3h9AsprTc9ikun3eU7/6tDphq1LpIo42n+lc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435260; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gI2r50YagKyW5wjp5nKAHhdiWka7DOBUV8IxoWF7VBw=; b=RDTioqZug9T5l2IUhLYa3WiO/qdBMclW7wtlgc8XC9DbdumbuVQScc+rwGSg0nqgftZdMdmg2wRgQyPLdNPlwFbGaKXkvXn7pqAc8+5Ndc/q/L4Z7i8nbsmDZK+R3HLureXMqVSK2MbymT+FAC0UOPGtraODsqE7iVbRAdSUZg0= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435259888287.5384921440609; Tue, 12 Nov 2024 10:14:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvND-0005uu-Ui; Tue, 12 Nov 2024 13:12:20 -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 1tAvMm-0005Iq-U1 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:54 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMl-0001y5-Jj for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:52 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4314f38d274so75421105e9.1 for ; Tue, 12 Nov 2024 10:11:51 -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-381eda0517csm15935048f8f.96.2024.11.12.10.11.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435110; x=1732039910; 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=gI2r50YagKyW5wjp5nKAHhdiWka7DOBUV8IxoWF7VBw=; b=Q5FxZrwrzHcyZsvR2yYfhrNXbeVXyvPScvRu6n9M18XyWEcosFy+Q6REs1W4+0VglH Lu/qS1luLeN9BRD7xm7jaqkf+PDF1jrTU3cwN5vq5Nk5xU+S3hzww1rBJMT5uJ1M+sGl LMyoL0sT8ibwyapp9tg8lRy4aGJvwN5dgU0rL5ToAYLsWnUY/p8KV+RMqwwSHcjDMef7 IWk3/1ED/BaSCTyBbYOyYkODyXEMrEo8ukqaXkK4t/m/mjLSPlGWVKoWxnJzirqRNzQi ceOknAOr6UOWReD1y8fF8k5xFHufvIQaIxc7jzjJ/5wRUay+fel2twTDhXbrtFb58G02 YL+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435110; x=1732039910; 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=gI2r50YagKyW5wjp5nKAHhdiWka7DOBUV8IxoWF7VBw=; b=GHmsQmhD5J2tgGYPuR4vjaxab+8NsXZhHX8oxgXanLgTN+k3diu1A0JIiWcK1xh8ct fcZIcs+ika0LD4T1lfPD/yV+x1F7KHKfOxsQGTfkKGHKdP+XT1y2ye1WOgPyabc3XISF /1qwifA3fbc3g9JpLlAnC2bnGdJH/KhAxSpDMznuJkPywZlJvCDbqJmCDGVFtvEyoSiA Hyw0fFQ2lbNnkXFGWkL3INAStW4/74ZeD6YORUpL2k8P39BNaY3+ycXv8+x5o/c0S2GC kTJB8FY8qNXJomGWu+8ncRKMXOVdXgUQZPcwCnnxfc8ExzyGmb2GQ6L7GHJxCZDaUedv FN7g== X-Gm-Message-State: AOJu0YxLfPwGNz35Bwb6PnNlvVIrUhtB5Ztf2KWLfEBSWaH8u0d10v9i gUTEAZV2dqNIFX+ivt4ajFZl0li0xLEN1Asp79gQhDpO3ZcaLz2Rf43rClG1+VWnxQIkn2qE/IW u X-Google-Smtp-Source: AGHT+IE2DEwwyKjYwPpSKfqMMUyKv2JpripMiiiLbqBcnHO0uOc/QmnUwfSLHMA/F+LMcwCvaB7I3w== X-Received: by 2002:a05:600c:5494:b0:426:59fe:ac27 with SMTP id 5b1f17b1804b1-432bbf6ba6emr171715275e9.26.1731435109702; Tue, 12 Nov 2024 10:11:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 10/20] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper Date: Tue, 12 Nov 2024 19:10:34 +0100 Message-ID: <20241112181044.92193-11-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435261567116600 rxbuf_ptr() points to the beginning of a (RAM) RX buffer within the device state. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index d4882f43f7..fdbf25fd91 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -99,6 +99,13 @@ static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_= index) return &s->regs[rxbase + R_TX_BUF0]; } =20 +static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) +{ + unsigned int rxbase =3D port_index * (0x800 / 4); + + return &s->regs[rxbase + R_RX_BUF0]; +} + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -220,7 +227,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) trace_ethlite_pkt_size_too_big(size); return -1; } - memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size); + memcpy(rxbuf_ptr(s, port_index), buf, size); =20 s->regs[rxbase + R_RX_CTRL0] |=3D CTRL_S; if (s->regs[R_RX_CTRL0] & CTRL_I) { --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435264; cv=none; d=zohomail.com; s=zohoarc; b=DQkP4fh1XPwGHht/DVxcN7sdy8o8OkQyIs9ZHWIH9Hn0ABdhY6j40Bi2kHs60z2hwWDOmECLi6qL76LNHywJMr3zb+a3emrUn6y5AWb7RjKY1D6WhvLXdSSphshE+grUhsTe3Kythhy9MctlFEeN7fu9CaIctw0AWTkBl40EIVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435264; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=90u2pbXGOCmIRt7v1T1RJKt/kgJQ6BpSNcFSvHFisE0=; b=U9R08hJBVQ0v5JuHyiPviDSoU4IFVv2n3UCzrB959zo8R3waMVByclWQLW0K7qxRkVBJG6a/MzSS+giIEa9h5pX3rNqnvgTSf2P1Zk5KnVcGZs1G25Sw2bKxU6ZwYWk7doCSkd4dNTCP4ZYzsCuPhRKWD+Yfjbbv74tOvmeYJ5I= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435264842800.1956712420393; Tue, 12 Nov 2024 10:14:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvNG-00064i-At; Tue, 12 Nov 2024 13:12:22 -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 1tAvMy-0005TV-50 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:07 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMw-0001yi-06 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:03 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4316cce103dso75272755e9.3 for ; Tue, 12 Nov 2024 10:11:58 -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-432b05e5871sm219236105e9.37.2024.11.12.10.11.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435117; x=1732039917; 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=90u2pbXGOCmIRt7v1T1RJKt/kgJQ6BpSNcFSvHFisE0=; b=STnerbudDb1Q7FXX+K8frKsaQz4r7B+S/PkQdELdzfO03HGTBozhsjoTR/i4qG7eiJ aS8IkvFB6CGndI3zTB6oEYtp5HLjYR6V8aUqF+qu5I7AI6Tr1LVSkxuW8Act0oO9rAaC Gecuyqa7V49bnFKxPEUm3vAayM/pIv2/xwLgpcfY+T3lUrDgfqDo/bhuu92ptUa5Yv+q 2yNBOBVNBCeqHFcTDrXB65YXvhRXgXPlH5EJAkoJ56qgfSz7lWW0fttl3I9hfiM7umMS 7RxZnU+lbV0Ky5n0pfCZNNP+NnEhhrfLp6/RuR8b94DXUF8P8jJoo6tBRYh/TPoE9jgi a6DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435117; x=1732039917; 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=90u2pbXGOCmIRt7v1T1RJKt/kgJQ6BpSNcFSvHFisE0=; b=PplenUPO2NszqTjVlryzFPIU1iGNXRhBWjxPfZahr+HIQ8ATMb088hRqt6uq5IPLYS BJclMhBu1US+/PnZRF2+tpO6YHSH4FwUV/bjLEDK7FURcFQAlEbPs+UonGH72G3xhQEY gzebZz3hmPMowb6K1hNowiMcwl369UfQC6KnkbsQYIAXO54sDWXrwhnV7mjq6wvpS9wR Y3NmudpYrGy+OZhpY9ThdCzZVpt2FMN5c3beBh21FNY3jQ94C1U7rZ3o4CwZf9V84nmm Wcz5JQFrAG1tdp4jM+k8I3qC+tBojY+89B+T3N/bui+L8dpOBIWniWZbiwbRYjPtMZUD PqEQ== X-Gm-Message-State: AOJu0YzyV4u0fRHbyLXnf3bF4B4esNZL9DgGhnt3uq+OCa5WHYlsGCFv Lm4NXDsHmz8yYqlF0IAdLc0X8XxClX95JzVBJiFhUjmtAn7f6Adwh0ibb/1unGvCxiDQkxXKoMX Z X-Google-Smtp-Source: AGHT+IHtXi8iiUapm1TTUiMS/geV1SJOX6Dj5AuKi6Te8F7KhqH1L0+qYyUQbMzHWeFgLUNZwydJcQ== X-Received: by 2002:a05:600c:3c99:b0:42c:ba83:3f00 with SMTP id 5b1f17b1804b1-432b74febf4mr191045485e9.1.1731435115823; Tue, 12 Nov 2024 10:11:55 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 11/20] hw/net/xilinx_ethlite: Access RX_CTRL register for each port Date: Tue, 12 Nov 2024 19:10:35 +0100 Message-ID: <20241112181044.92193-12-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435265402116600 Rather than accessing the registers within the mixed RAM/MMIO region as indexed register, declare a per-port RX_CTRL. This will help to map the RAM as RAM (keeping MMIO as MMIO) in few commits. Previous s->regs[R_RX_CTRL0] and s->regs[R_RX_CTRL1] are now unused. Not a concern, this array will soon disappear. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index fdbf25fd91..605451a522 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -59,6 +59,13 @@ #define CTRL_P 0x2 #define CTRL_S 0x1 =20 +typedef struct XlnxXpsEthLitePort +{ + struct { + uint32_t rx_ctrl; + } reg; +} XlnxXpsEthLitePort; + #define TYPE_XILINX_ETHLITE "xlnx.xps-ethernetlite" OBJECT_DECLARE_SIMPLE_TYPE(XlnxXpsEthLite, XILINX_ETHLITE) =20 @@ -76,6 +83,7 @@ struct XlnxXpsEthLite unsigned int port_index; =20 UnimplementedDeviceState mdio; + XlnxXpsEthLitePort port[2]; uint32_t regs[R_MAX]; }; =20 @@ -110,6 +118,7 @@ static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { XlnxXpsEthLite *s =3D opaque; + unsigned port_index =3D addr_to_port_index(addr); uint32_t r =3D 0; =20 addr >>=3D 2; @@ -121,11 +130,13 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) case R_TX_LEN1: case R_TX_CTRL1: case R_TX_CTRL0: - case R_RX_CTRL1: - case R_RX_CTRL0: r =3D s->regs[addr]; break; =20 + case R_RX_CTRL1: + case R_RX_CTRL0: + r =3D s->port[port_index].reg.rx_ctrl; + default: r =3D tswap32(s->regs[addr]); break; @@ -173,7 +184,9 @@ eth_write(void *opaque, hwaddr addr, if (!(value & CTRL_S)) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); } - /* fall through */ + s->port[port_index].reg.rx_ctrl =3D value; + break; + case R_TX_LEN0: case R_TX_LEN1: case R_TX_GIE0: @@ -203,23 +216,21 @@ static const MemoryRegionOps eth_ops =3D { static bool eth_can_rx(NetClientState *nc) { XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); - unsigned int rxbase =3D s->port_index * (0x800 / 4); =20 - return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); + return !(s->port[s->port_index].reg.rx_ctrl & CTRL_S); } =20 static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); unsigned int port_index =3D s->port_index; - unsigned int rxbase =3D port_index * (0x800 / 4); =20 /* DA filter. */ if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6)) return size; =20 - if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) { - trace_ethlite_pkt_lost(s->regs[R_RX_CTRL0]); + if (s->port[port_index].reg.rx_ctrl & CTRL_S) { + trace_ethlite_pkt_lost(s->port[port_index].reg.rx_ctrl); return -1; } =20 @@ -229,8 +240,8 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) } memcpy(rxbuf_ptr(s, port_index), buf, size); =20 - s->regs[rxbase + R_RX_CTRL0] |=3D CTRL_S; - if (s->regs[R_RX_CTRL0] & CTRL_I) { + s->port[port_index].reg.rx_ctrl |=3D CTRL_S; + if (s->port[port_index].reg.rx_ctrl & CTRL_I) { eth_pulse_irq(s); } =20 --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435409; cv=none; d=zohomail.com; s=zohoarc; b=iWMSuv3ij5I1A++SOooOa8kQ7tIRtvV7qvNbk0aMWim734svBbn/3fBnYPaGmT0B+FzaabUWS4Z1cOuH/ZIBhoGJL+0YFrRIKzGrS6bhQh+dk0xDFMH3Yp2vaRUxCfE3i68xdmDs18X1c00zCbEg1mn69MHYos7Y4/kQCXFuDlU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435409; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ohlThsqTDYJV0UUntSqhYfwl2qcDxuvkfJ3SWeMXrgc=; b=PWzxGiFdlwd2Ss38aA0tH/PVQL4Du2qAVrsEgiNs/QoN8W3bS2LbDy7GQfC2fVG7vpHOrW5Cc2ehu6P8p75/6L2hw1j/8+CAGhEFmEjPS6lnfa4XbgyI36gSd0yLF3c88Mx4TgU+NL2NT9JFj8XaLGbmwy45vIJCZoy6oGGMzqo= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173143540979833.37488859085215; Tue, 12 Nov 2024 10:16:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvNG-00067N-TI; Tue, 12 Nov 2024 13:12:23 -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 1tAvMz-0005VW-FB for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:07 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMx-0001z4-Tf for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:05 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4315abed18aso51243825e9.2 for ; Tue, 12 Nov 2024 10:12:03 -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-432aa7378e9sm262755635e9.37.2024.11.12.10.11.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435121; x=1732039921; 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=ohlThsqTDYJV0UUntSqhYfwl2qcDxuvkfJ3SWeMXrgc=; b=Jsep8KWXpTFO86G89uvfXeLygnFkwT6sGBjk/7zwky6uTn12iMidNt3iHS0D4zGvUe OOdrcdjX2TUCwNWNyZYHROmJiX1RW40iDEimL4IehIxNqSLozHuS/9kJduPGrboF/Rt5 z1PQTr1Z6pyXP6vFyDbJWiR32EDrTlgc76m6gZ+lX+ApcuGPyg2gH4MSJ5y5IFLIh/cL kPyA/koFKi9WiC9sHcevLfzls5SJMxRxgsWlKNLX8W47hGwTnNCKco8B9c6STA5uePKj ZPwcA+FP30FOygWwLgO91qE2C2k/pu0kmRNNyGiJy/pxf8JCqXGLpru7C0vxw91s18oG p0Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435121; x=1732039921; 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=ohlThsqTDYJV0UUntSqhYfwl2qcDxuvkfJ3SWeMXrgc=; b=j5Ydn3K7/ixAEcTMfO92Sp3kPa/rB7AMQWGNfX8jPKN8wI8wx68MKxN11k+WbvcMWL /ZyG6JxY7TfDnrUwd/euSamNOHpauyhPdSrei5n5mtl46tY+CrXlDAY87Jpno2IEyiFS AOyQo/vGavBIGcT09/u1FLJUWZg0/NPUCO3YXhsHf3kIf/Uy9zpC5vk+bHJlKab0Z+y7 j1j984zfY+gcgCIPL3M+tISMtnoqIEe40bRnwBcxMiZBGEeeeQ1kfsRlbWQ8PibRafU8 aBD8Nd+PdpIBDEVWqKKJqC3xMl4qSgRsggJ+jvUZW6apKwRF2aFpqviEgsYJCMw+KcZ0 yP0Q== X-Gm-Message-State: AOJu0YzswWnW3PH674CrQc1QP5pFbXQvnT0ABCiHcT6sPvmb72TEfihD O0S+F0nIB9t94Wa3Jt3msdAhYwF1DT+AVAlGmOcwIgcvJ7I1zbDLNxo4250ak8zNv0c6gaKFw0l P X-Google-Smtp-Source: AGHT+IHewBgUl/r/rZkSWf1ZAQ5GjFXlyGBqB7iE1gEiy0AGXiFVKe4ZvvipFnchcE1fIifPbdQ1FQ== X-Received: by 2002:a05:600c:4508:b0:431:50cb:2398 with SMTP id 5b1f17b1804b1-432b74fecacmr145637225e9.2.1731435121585; Tue, 12 Nov 2024 10:12:01 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 12/20] hw/net/xilinx_ethlite: Access TX_GIE register for each port Date: Tue, 12 Nov 2024 19:10:36 +0100 Message-ID: <20241112181044.92193-13-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435412273116600 Rather than accessing the registers within the mixed RAM/MMIO region as indexed register, declare a per-port TX_GIE. This will help to map the RAM as RAM (keeping MMIO as MMIO) in few commits. Previous s->regs[R_TX_GIE0] and s->regs[R_TX_GIE1] are now unused. Not a concern, this array will soon disappear. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 605451a522..4cb4781e70 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -62,6 +62,8 @@ typedef struct XlnxXpsEthLitePort { struct { + uint32_t tx_gie; + uint32_t rx_ctrl; } reg; } XlnxXpsEthLitePort; @@ -90,7 +92,7 @@ struct XlnxXpsEthLite static inline void eth_pulse_irq(XlnxXpsEthLite *s) { /* Only the first gie reg is active. */ - if (s->regs[R_TX_GIE0] & GIE_GIE) { + if (s->port[0].reg.tx_gie & GIE_GIE) { qemu_irq_pulse(s->irq); } } @@ -126,6 +128,9 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) switch (addr) { case R_TX_GIE0: + r =3D s->port[port_index].reg.tx_gie; + break; + case R_TX_LEN0: case R_TX_LEN1: case R_TX_CTRL1: @@ -189,10 +194,13 @@ eth_write(void *opaque, hwaddr addr, =20 case R_TX_LEN0: case R_TX_LEN1: - case R_TX_GIE0: s->regs[addr] =3D value; break; =20 + case R_TX_GIE0: + s->port[port_index].reg.tx_gie =3D value; + break; + default: s->regs[addr] =3D tswap32(value); break; --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435213; cv=none; d=zohomail.com; s=zohoarc; b=Lu6lt0JgSmrW7HbtYDVSzLxQ9sA5Iqmvs9cwnCZkfVPXIOdcwwbB/rZHxIaTpp35HjGFnWRKqImcrogW8GEdzLVfb/ujoyiycFA4jxRyj2PaMJXAaIpNv0x7PJgZLnKwYj/NV8qf9ztEhLoZN5pdBXPWZQpebfPITahrF2f1aeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435213; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=o5EaUAp0FQKhEfz/Flp6sGp3H9rqfBlFSfz8Y3bBsgY=; b=RYs0CwvHjFhIG7z9GAcTWHVbTun9s1XasDsGEcfCd5uFRSCAZrgHKNj+hV0VeA5fBV/fM25bQGrgN/AfM3h27bT0ES56RilqixAAK7JchESVJVfViLNPA8vM0HUJwG7N9IypOOytdkonAFWOHKz/Gf7tNSF0ERE/ipN7vmGFKtE= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435213253808.2465185900144; Tue, 12 Nov 2024 10:13:33 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IEebobSzsFsun4JbZxinCAuc6A1UjaC65UnkEHydOZ9bV5XvU+s67e3Svot1TSluzUwyLh6EQ== 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) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435215083116600 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=C3=A9 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; =20 uint32_t rx_ctrl; @@ -133,6 +134,9 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) =20 case R_TX_LEN0: case R_TX_LEN1: + r =3D s->port[port_index].reg.tx_len; + break; + case R_TX_CTRL1: case R_TX_CTRL0: r =3D s->regs[addr]; @@ -169,7 +173,7 @@ eth_write(void *opaque, hwaddr addr, if ((value & (CTRL_P | CTRL_S)) =3D=3D 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)) =3D=3D (CTRL_P | CTRL_S= )) { @@ -194,7 +198,7 @@ eth_write(void *opaque, hwaddr addr, =20 case R_TX_LEN0: case R_TX_LEN1: - s->regs[addr] =3D value; + s->port[port_index].reg.tx_len =3D value; break; =20 case R_TX_GIE0: --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435232; cv=none; d=zohomail.com; s=zohoarc; b=SXlLZy8SYDTR22FUtSqiAO+UOl+EAnE01ezTIGI3mJKI3/dUAGgYCe+iTWLT7Kapr3n51L8oCaM8tokHtP9JSYbPuZNt1ApGxVZTkS7lq1+UPCecY5m2KF/uIYfPdHvW0/SlM+wAzpck/iDV+1C4Xfltwt3Gfshgucqcwnj7O48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435232; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4nCaOfvRzjvZ75Fs3bp8T2IB7oZkyC8yIZExkGUsnvA=; b=n1wP51oG55vt1ktaOXj0MLvo6PCgMP1y7w3bl80R/xg49m0KKXylBk3/MsyCzn8zzjMn6aytxfX+7ie3/ZmYy1w/QweUB7npnPECgeLSU4GVZ9qVfvevqQnpX4vQLRxSicmzSkRXSIz4eaLElTFf4FxHkV6seCsEAhWKA422Lkk= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435231992925.5089210349627; Tue, 12 Nov 2024 10:13:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvNO-0006qM-Jh; Tue, 12 Nov 2024 13:12:30 -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 1tAvNB-0005mP-1c for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:17 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvN9-00021E-8U for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:16 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4315eeb2601so75306635e9.2 for ; Tue, 12 Nov 2024 10:12:14 -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-381ed970e23sm15919690f8f.18.2024.11.12.10.12.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435133; x=1732039933; 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=4nCaOfvRzjvZ75Fs3bp8T2IB7oZkyC8yIZExkGUsnvA=; b=d2E2lzYmUqiAjwmqwWBs/RSvo4TlXudGtwBbeMu8d9HwivQnLRJnSl0CtO/lqGdw5C klQEiEcS/m2GfYmWTyoJ9ltsBaShwoZr6HZTJY4G7hwhFvAWauvh3xljOr2GPAEq/89B 09m53NOh/uo0hawjP4Rsp5W7tIeI9ic1fC/CTev6xNoNuC3Xm3M/mPjFPylfZdk0gUyz ibYwD9Sr4vFhgGEkKDWjW5WOYIzdryeXZOHr322AbsqTlsfNZmgCsUZ6rNHDMJ1dUNqk bb7ih3JeZZdGxgnYMTLFwxE02dygxN1GvAZ4zFFKah2+GA66GujYqt0mKpzBnilQxLiq WAVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435133; x=1732039933; 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=4nCaOfvRzjvZ75Fs3bp8T2IB7oZkyC8yIZExkGUsnvA=; b=TS1o8y7JVXTNW7TvwVUPQl1LX3+OqMumw5m+5yojqdxtNHRtfebWhBjVF+BMDo7Rzl vE4ATTCBJ+CjAHp+q+NCBsQi8Q7b0fczUCsHEw3ouWRDUz2Ww9pba9WQPw73koDSX/PZ TAQxxzO4nKT+OV5mSk9qdYIJi/b1irNv/9a7Xevi1jTFtFbNMaRvD8nWmGVrgP0ONZh+ Tf0EePgA4CvXUPf3JZS7sY7VlAXyv+k0FXzViCLtMru5U8O6gX613ypt16vuuM1HNQd6 lJDyV+sG+r782yltNbUJwOx7Oi5VbqIewwSPGE+GAz3PCrTY2EZFIl8u3mBTgV4cwuiG U7Yw== X-Gm-Message-State: AOJu0YxZpgdYHiUMsdNHJpsXO0R2+hf5h3wkXkVCbO+MO6i7nEoLj98y RG4HQB4bzV1zk2PNW3nfspXVq3bJvg9fx2z1BEBRypRwoBhU8RwEpezyJDD9a/NayKWMwB/A93s 3 X-Google-Smtp-Source: AGHT+IFgpPxUG5b3T9HtrgoCVqOLI4PZbxsGXVj1QmSN+kbygjqdsXMfKmRmS2U5ch4GJzN73psr9Q== X-Received: by 2002:a5d:6d05:0:b0:37d:4c40:699 with SMTP id ffacd0b85a97d-381f1866b54mr19039210f8f.5.1731435133425; Tue, 12 Nov 2024 10:12:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 14/20] hw/net/xilinx_ethlite: Access TX_CTRL register for each port Date: Tue, 12 Nov 2024 19:10:38 +0100 Message-ID: <20241112181044.92193-15-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435233136116600 Rather than accessing the registers within the mixed RAM/MMIO region as indexed register, declare a per-port TX_CTRL. This will help to map the RAM as RAM (keeping MMIO as MMIO) in few commits. Previous s->regs[R_TX_CTRL0] and s->regs[R_TX_CTRL1] are now unused. Not a concern, this array will soon disappear. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 1a3b295b4b..4d86851f38 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -64,6 +64,7 @@ typedef struct XlnxXpsEthLitePort struct { uint32_t tx_len; uint32_t tx_gie; + uint32_t tx_ctrl; =20 uint32_t rx_ctrl; } reg; @@ -139,7 +140,7 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) =20 case R_TX_CTRL1: case R_TX_CTRL0: - r =3D s->regs[addr]; + r =3D s->port[port_index].reg.tx_ctrl; break; =20 case R_RX_CTRL1: @@ -159,7 +160,6 @@ eth_write(void *opaque, hwaddr addr, { XlnxXpsEthLite *s =3D opaque; unsigned int port_index =3D addr_to_port_index(addr); - unsigned int base =3D 0; uint32_t value =3D val64; =20 addr >>=3D 2; @@ -167,24 +167,23 @@ eth_write(void *opaque, hwaddr addr, { case R_TX_CTRL0: case R_TX_CTRL1: - if (addr =3D=3D R_TX_CTRL1) - base =3D 0x800 / 4; - if ((value & (CTRL_P | CTRL_S)) =3D=3D CTRL_S) { qemu_send_packet(qemu_get_queue(s->nic), txbuf_ptr(s, port_index), s->port[port_index].reg.tx_len); - if (s->regs[base + R_TX_CTRL0] & CTRL_I) + if (s->port[port_index].reg.tx_ctrl & CTRL_I) { eth_pulse_irq(s); + } } else if ((value & (CTRL_P | CTRL_S)) =3D=3D (CTRL_P | CTRL_S= )) { memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6); - if (s->regs[base + R_TX_CTRL0] & CTRL_I) + if (s->port[port_index].reg.tx_ctrl & CTRL_I) { eth_pulse_irq(s); + } } =20 /* We are fast and get ready pretty much immediately so we actually never flip the S nor P bits to one. */ - s->regs[addr] =3D value & ~(CTRL_P | CTRL_S); + s->port[port_index].reg.tx_ctrl =3D value & ~(CTRL_P | CTRL_S); break; =20 /* Keep these native. */ --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435283; cv=none; d=zohomail.com; s=zohoarc; b=C3dUvpiLdAmxWSGsXT85c9tpvQn5NpO/LYT19mV6M9h4xTlajl0nFF3oHY11qNkbtOANMZFT7uUm63CYUuHse+1bAG+F8HejRmtCUI0jG3BlYPlBoC/Uu78YGrtKN1DsNEasNcN6j5Df1T/uZqZR8kpq/CPOt13S4KBy601hj08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435283; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=33ai2lENeDpCfbtpntzIEqfDXZ63d2DBrrpSSg3fCCg=; b=cl8I01s9/QRjAVyP4rf+JKn17gy/NhTcyVxlrlat+rrHnrZq4JYwR3uZHHXXCOnU9cpO+60ITG/v1QrXisRCUJKA4klMygr0Ky3TizVCe4HZUrs4OCfkyEwaVqrUxFSSb3etrVUSYTz5Cz1lFWvWmljJ5MZZuxB+hfAMzyN3klw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435283236438.0176651589844; Tue, 12 Nov 2024 10:14:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvNY-0007B2-JF; Tue, 12 Nov 2024 13:12:40 -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 1tAvNG-0006CT-Rr for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:23 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvNF-00021s-8w for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:22 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-431688d5127so47762005e9.0 for ; Tue, 12 Nov 2024 10:12:20 -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-381ed97071esm15832992f8f.12.2024.11.12.10.12.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435139; x=1732039939; 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=33ai2lENeDpCfbtpntzIEqfDXZ63d2DBrrpSSg3fCCg=; b=Y3L9CiDNfV+OM23aekSPqhFEtu4gvBB+r/uRNW8dYTQFWTFRJeHg6v1t3X/egn8tj3 QVEQ7Uhs+3wsDuhv7GwQFpk6o7qs8hGnJDNjnQvCPjW450Ppwj5+73pkPyxe86IY2wya W3c4i8NKIQ4Xun9srLa2iGIxiLPNJ4e+KyBk8WZB790GgP9sRY52VmCHDt0btrYmeGoW QD/BZCbZYAfay0lcEvIqeLmGGgji8VwywkVXVB9e5TxiTw3s3BWv5eaaVw3eqN9Uv3JS xSxdh5yCrjZtA5XL6AfGQwNjvM35wq1wCSaC2+V1LzVzPYVPNUVdPrrI4Tbb8agdBhNa fKiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435139; x=1732039939; 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=33ai2lENeDpCfbtpntzIEqfDXZ63d2DBrrpSSg3fCCg=; b=GPdW76qtjUt4SuctLIgNGxg7fh3D9k71SIXBx6hlh1QsnKGQLC/YyL5EzdpYiLWf79 ReEG2Au7yPS2UFWT3j/ZvRuF76sYLQEierypOf47gUNhD7XpFcrfzXlGiiHvDFjr91v4 bvCoMLThzwNyU5yd5lIr+UUX0b4kyHulEFzyIustX0z5W6p7+pzsM+BQ+kToS+E+nPEZ xhK5L4QX1pY+SqZSxM83Ndp5XF9DsnkuUlQnsDWn3AurvfTp3qwsnfn9VxQFJC34DjmS vhFqLudhTtiwlBizF4zyaxwKbOZw7rtGsF6z9NznN3iqkUgecev2qaaAlEXjU4pwHW2p 1wfQ== X-Gm-Message-State: AOJu0YwyJj1KgTc3VBzjMh3yhyyuQJSWb28Ug5XCFNm2DsAEKsVj2R9N BU6AU3Ah2ysTm8yMI2bPR/4+cqlRgEtnRjRoyxflXU08p6TrJWj4H8MzUJHgn5bjJBzDAcxwXXN Z X-Google-Smtp-Source: AGHT+IHpLteupMmSsopbmh2qzKKmKV0Wv9cZXs7WjQtinWx8atg2Uyt1sVnggiZzkL3xdK/BY56puA== X-Received: by 2002:a05:6000:4107:b0:381:f604:30c2 with SMTP id ffacd0b85a97d-381f6043253mr12399576f8f.35.1731435139511; Tue, 12 Nov 2024 10:12:19 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 15/20] hw/net/xilinx_ethlite: Map RX_CTRL as MMIO Date: Tue, 12 Nov 2024 19:10:39 +0100 Message-ID: <20241112181044.92193-16-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435285453116600 Declare RX registers as MMIO region, split it out of the current mixed RAM/MMIO region. The memory flat view becomes: FlatView #0 Root memory region: system 0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite 00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio 00000000810007f4-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite = @00000000000007f4 00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io 0000000081001800-0000000081001ffb (prio 0, i/o): xlnx.xps-ethernetlite = @0000000000001800 0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 79 +++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 14 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 4d86851f38..161fd97f06 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -46,13 +46,18 @@ #define R_TX_CTRL1 (0x0ffc / 4) =20 #define R_RX_BUF0 (0x1000 / 4) -#define R_RX_CTRL0 (0x17fc / 4) +#define A_RX_BASE0 0x17fc #define R_RX_BUF1 (0x1800 / 4) -#define R_RX_CTRL1 (0x1ffc / 4) +#define A_RX_BASE1 0x1ffc #define R_MAX (0x2000 / 4) =20 #define RX_BUFSZ_MAX 0x07e0 =20 +enum { + RX_CTRL =3D 0, + RX_MAX +}; + #define GIE_GIE 0x80000000 =20 #define CTRL_I 0x8 @@ -61,6 +66,8 @@ =20 typedef struct XlnxXpsEthLitePort { + MemoryRegion rxio; + struct { uint32_t tx_len; uint32_t tx_gie; @@ -118,6 +125,53 @@ static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned por= t_index) return &s->regs[rxbase + R_RX_BUF0]; } =20 +static uint64_t port_rx_read(void *opaque, hwaddr addr, unsigned int size) +{ + XlnxXpsEthLite *s =3D opaque; + unsigned port_index =3D addr_to_port_index(addr); + uint32_t r =3D 0; + + switch (addr >> 2) { + case RX_CTRL: + r =3D s->port[port_index].reg.rx_ctrl; + break; + default: + g_assert_not_reached(); + } + + return r; +} + +static void port_rx_write(void *opaque, hwaddr addr, uint64_t value, + unsigned int size) +{ + XlnxXpsEthLite *s =3D opaque; + + switch (addr >> 2) { + case RX_CTRL: + if (!(value & CTRL_S)) { + qemu_flush_queued_packets(qemu_get_queue(s->nic)); + } + break; + default: + g_assert_not_reached(); + } +} + +static const MemoryRegionOps eth_portrx_ops =3D { + .read =3D port_rx_read, + .write =3D port_rx_write, + .endianness =3D DEVICE_NATIVE_ENDIAN, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, +}; + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -143,10 +197,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) r =3D s->port[port_index].reg.tx_ctrl; break; =20 - case R_RX_CTRL1: - case R_RX_CTRL0: - r =3D s->port[port_index].reg.rx_ctrl; - default: r =3D tswap32(s->regs[addr]); break; @@ -187,14 +237,6 @@ eth_write(void *opaque, hwaddr addr, break; =20 /* Keep these native. */ - case R_RX_CTRL0: - case R_RX_CTRL1: - if (!(value & CTRL_S)) { - qemu_flush_queued_packets(qemu_get_queue(s->nic)); - } - s->port[port_index].reg.rx_ctrl =3D value; - break; - case R_TX_LEN0: case R_TX_LEN1: s->port[port_index].reg.tx_len =3D value; @@ -287,6 +329,15 @@ static void xilinx_ethlite_realize(DeviceState *dev, E= rror **errp) memory_region_add_subregion(&s->mmio, A_MDIO_BASE, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio= ), 0)); =20 + for (unsigned i =3D 0; i < 2; i++) { + memory_region_init_io(&s->port[i].rxio, OBJECT(dev), + ð_portrx_ops, s, + i ? "ethlite.rx[1]io" : "ethlite.rx[0]io", + 4 * RX_MAX); + memory_region_add_subregion(&s->mmio, i ? A_RX_BASE1 : A_RX_BASE0, + &s->port[i].rxio); + } + qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic =3D qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435390; cv=none; d=zohomail.com; s=zohoarc; b=AYZpcQ4yZju7XOVRwrAJSWXl8vItihske/sgEKSWA4BeHGNnhy7tECoNzFfkYe1iSk2duqsEyAYJ7qZ6DHgyLLHffRA/lug53DSukw4EwNLGJvdd3WXIEEfDfgIUBv0yKB/GjG+fpPl4ENSG/Z72gIAZaVyQwPlN6oFTK+T94s8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435390; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vGBo3n6UAnKrx1s/4bgTSsf0dXQKvd5mL1bf1mP4VKA=; b=MYwz8aNhQuHTxcNvyfsy5TDhVeZOQN0Go6vpYwh8PCa92T1r/5Gj4I4qdTHXooZ7a30bZYkRJJSc/rF/+zrWWY6Hl8GZtLJal3CMDxuwRCDhkjb255wLvJzZ/oP2PXUU+uvxJrIerBSn/PgmINrsmjTDDjhI+qFr/aK2ESPwZIw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435390823885.7847981686626; Tue, 12 Nov 2024 10:16:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvNc-0007YO-91; Tue, 12 Nov 2024 13:12:44 -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 1tAvNO-0006uK-OG for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:30 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvNM-00022H-NX for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:30 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-37d518f9abcso4331882f8f.2 for ; Tue, 12 Nov 2024 10:12:26 -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-381fc0f5f91sm7530136f8f.62.2024.11.12.10.12.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435145; x=1732039945; 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=vGBo3n6UAnKrx1s/4bgTSsf0dXQKvd5mL1bf1mP4VKA=; b=qBkdv6jyWCtN8zjpBJWyuWiJX8yGSfdNNvIj9VLOoCk+sxL7ADaniBmSLhIEa5DQ1/ Vypk9eUNaBhsCgj3aagxVVPuJuQFvk4SXo0kVZTtNxm59phJfY8TZyOCGOToQckUET5U mWWf7vCydBRjY+XhosN6ikG3Cv6FeQiic7vDk+yT3E/Nm3x/FRQq5sytVx+BhRfwaF/N JrjIhh7P+Qj2/A2l5M3VBkSeG82108Qx5qJ05Ae2MmGRUZRCSTvT9nQxN7QXbhTxVrPJ LRvTVyqCw/iDYlNBoOsm+4BnZ0wib39+5N64e7BEn8H0+8izT3NGnq0nNAM2bAN7Id+Q A9jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435145; x=1732039945; 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=vGBo3n6UAnKrx1s/4bgTSsf0dXQKvd5mL1bf1mP4VKA=; b=oT+OVxxj/LqxrFOMiNVbxTxfwN3BW/h8UGpwqxXTF+A5uP4uGvYmgFRLe5HGTlJe9y cLB1ytuZw2f7pwU5GHmjgL4jMndwMp3lCrXISaDuKhqxJiDEISZ5hTkuWhG0rAoElKWC 79Qb1/hzGj0pAe9eG8xhr6JM+eWwXRlLolQhhJ5Zo229H//eGLvdtqJ/ZZyRDBIqTFsb lG+elwWZQvF1KVSmf+U5ifKopD27n10lJSZrTxl19jdjZPeSyOQPCUXC2hy5qsm+MF3B GQbNk8uB/T54mxzFVtO1FYJ98wou+KJnSy1z69Ca6ounb1XX0pD+SeVkMObzibCxKdp/ P6zw== X-Gm-Message-State: AOJu0Yw4GT253a3vqVyV9DPLMdhVM3bUWWMSbZcSNK4sSEbfQKvjM9yS ddQ8H+I2AGFz3JlIA3FS+iAZKxAm8TRm+U/AsU7Ag73HN+oEhanQ++AQ03GPkXAidRrj/0SfPR3 x X-Google-Smtp-Source: AGHT+IHAM2pwkgrLR2TnCGdm16wR68240SOagncYTL8Mt//7CKDK2CJti6oNBn9nOlRjKlJhFwVZBw== X-Received: by 2002:a5d:6484:0:b0:37e:d92f:c14a with SMTP id ffacd0b85a97d-381f188583bmr13802823f8f.42.1731435145331; Tue, 12 Nov 2024 10:12:25 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 16/20] hw/net/xilinx_ethlite: Map TX_LEN as MMIO Date: Tue, 12 Nov 2024 19:10:40 +0100 Message-ID: <20241112181044.92193-17-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435391946116600 Declare TX registers as MMIO region, split it out of the current mixed RAM/MMIO region. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 71 ++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 161fd97f06..159b2b0c64 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -38,11 +38,11 @@ #define A_MDIO_BASE 0x07e4 =20 #define R_TX_BUF0 0 -#define R_TX_LEN0 (0x07f4 / 4) +#define A_TX_BASE0 0x07f4 #define R_TX_GIE0 (0x07f8 / 4) #define R_TX_CTRL0 (0x07fc / 4) #define R_TX_BUF1 (0x0800 / 4) -#define R_TX_LEN1 (0x0ff4 / 4) +#define A_TX_BASE1 0x0ff4 #define R_TX_CTRL1 (0x0ffc / 4) =20 #define R_RX_BUF0 (0x1000 / 4) @@ -53,6 +53,11 @@ =20 #define RX_BUFSZ_MAX 0x07e0 =20 +enum { + TX_LEN =3D 0, + TX_MAX +}; + enum { RX_CTRL =3D 0, RX_MAX @@ -125,6 +130,51 @@ static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned por= t_index) return &s->regs[rxbase + R_RX_BUF0]; } =20 +static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size) +{ + XlnxXpsEthLite *s =3D opaque; + unsigned port_index =3D addr_to_port_index(addr); + uint32_t r =3D 0; + + switch (addr >> 2) { + case TX_LEN: + r =3D s->port[port_index].reg.tx_len; + break; + default: + g_assert_not_reached(); + } + + return r; +} + +static void port_tx_write(void *opaque, hwaddr addr, uint64_t value, + unsigned int size) +{ + XlnxXpsEthLite *s =3D opaque; + + switch (addr >> 2) { + case TX_LEN: + s->port[port_index].reg.tx_len =3D value; + break; + default: + g_assert_not_reached(); + } +} + +static const MemoryRegionOps eth_porttx_ops =3D { + .read =3D port_tx_read, + .write =3D port_tx_write, + .endianness =3D DEVICE_NATIVE_ENDIAN, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, +}; + static uint64_t port_rx_read(void *opaque, hwaddr addr, unsigned int size) { XlnxXpsEthLite *s =3D opaque; @@ -187,11 +237,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) r =3D s->port[port_index].reg.tx_gie; break; =20 - case R_TX_LEN0: - case R_TX_LEN1: - r =3D s->port[port_index].reg.tx_len; - break; - case R_TX_CTRL1: case R_TX_CTRL0: r =3D s->port[port_index].reg.tx_ctrl; @@ -237,11 +282,6 @@ eth_write(void *opaque, hwaddr addr, break; =20 /* Keep these native. */ - case R_TX_LEN0: - case R_TX_LEN1: - s->port[port_index].reg.tx_len =3D value; - break; - case R_TX_GIE0: s->port[port_index].reg.tx_gie =3D value; break; @@ -330,6 +370,13 @@ static void xilinx_ethlite_realize(DeviceState *dev, E= rror **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio= ), 0)); =20 for (unsigned i =3D 0; i < 2; i++) { + memory_region_init_io(&s->port[i].txio, OBJECT(dev), + ð_porttx_ops, s, + i ? "ethlite.tx[1]io" : "ethlite.tx[0]io", + 4 * TX_MAX); + memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0, + &s->port[i].txio); + memory_region_init_io(&s->port[i].rxio, OBJECT(dev), ð_portrx_ops, s, i ? "ethlite.rx[1]io" : "ethlite.rx[0]io", --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435486; cv=none; d=zohomail.com; s=zohoarc; b=Qkg/KR9OXDIFHHE9BMusd2QJGaLimiram6vys8afri83JDr5FYjEAGyFnpGryYwn7cK8YuQpccHMlS3vL1LPce1xHMAR+ZoIUos+/3/44onxhmSQqd15jdgWY+W58ttDDj6Yh/8uvrZm1AzwtJHQoNx4uvm7gdyIFeVswmXP8q8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435486; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=u/na/cFd3aGI4M5zTw4TKo5y0iNxB1Ymp8TI8i+fEV4=; b=KE2Bxs9zGzpPQMARuiRI4jpkp4q5GiTYp+ZRR/yLFzggC97y14k4sm6APyWa5jCWOx56LHk7XD3qSPfM8XA0EO1YWM35M/kitv/HJ4b87CEYSJs0Lzj7BbKMDKCxcXj+M74YSBUn+Z+AMRihTIK4CCcelC6VO0WwGFnyjdSK5oM= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435486863508.53497315214713; Tue, 12 Nov 2024 10:18:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvNZ-0007IK-Ot; Tue, 12 Nov 2024 13:12:42 -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 1tAvNS-0006zE-L1 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:36 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvNR-00022w-7w for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:34 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-37d808ae924so3716100f8f.0 for ; Tue, 12 Nov 2024 10:12:32 -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-381ed9ea3cbsm16209684f8f.74.2024.11.12.10.12.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435151; x=1732039951; 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=u/na/cFd3aGI4M5zTw4TKo5y0iNxB1Ymp8TI8i+fEV4=; b=mVAq81diIYIPsWNGD4GYQZVsLHBv29LZSXAZJYOz3Fs723pcHU1Mzw8pSGIZ2Bgp2v Zr4Q+LE9GkRNgVapqz3Q0hikuPEz7wxoltYnj9HiMOKB10NeIrZfAmzw+pqEAYXCmO7L OiB0qrKD3gCbsC3kuuRHLguIhRFoByio8pYbHmdHmIojHtOx0iD7fcf4U6TD8G38eLT1 nLgj3rbOLiKXK6k1ESM1lY1wqj9hdLyyOBEaet8Tr/y5SqbVwwolCvawMkH4JNPvgnga uMYOSIMJqkiSINXZIWjuzds3tLUIFtKCfsxh6qS1SVeOIAZQuzA168px3Zg9nIgvL8AZ nrHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435151; x=1732039951; 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=u/na/cFd3aGI4M5zTw4TKo5y0iNxB1Ymp8TI8i+fEV4=; b=To04jvILIdxtti2hjb64QZbDdaDGMNXVsLTHj8YD7iSlUUV6EzwnJj/C8GJYdgcPKc dEideNLmK/xGxUUAh0y1x9tpK6R7h4kS3qzcbvvL0J9rf3BaCMPtTQoFfeqeKx6m8drL OPo19HAgSgcQwwQvV08VtKLRUa1K7457zeTVZzITAmHmH0ji+3JnMsNSg3UgtZxsEnVm +uLnBuVyxCIHIZRPCMt3mnenk8A7Nz/nTMi5JsTKC80h9HpLPRo/CbtdNJ+zqVZbbcHB 3ZfXSjiLTxljpQ2ZQuxyriXv9d25yN76FkdqFb3Q9uHp/eXfzSveBM2L/Ipyg6QQ7X5b /Dsw== X-Gm-Message-State: AOJu0YxWB+KCNsN1+3e/zKu0i3U9N46DiX7RkWoJokpG6zSqMZ/Hfuas p5n6RaKIj3SiwGJYn6frEqCW1dd1pnWjMefCoh7c2pAnN0duw80VhN+nY1xQ8D/PZiCLicktZZN B X-Google-Smtp-Source: AGHT+IFSHtChdk7z1pSOZh0Fr7pHPMBzU0V4S2O75NrqFDCrY4iRQDDDZoigLKDeSRtAyQmAqaJGdQ== X-Received: by 2002:a05:6000:2d11:b0:381:f443:21e9 with SMTP id ffacd0b85a97d-381f4432614mr9957024f8f.0.1731435151389; Tue, 12 Nov 2024 10:12:31 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 17/20] hw/net/xilinx_ethlite: Map TX_GIE as MMIO Date: Tue, 12 Nov 2024 19:10:41 +0100 Message-ID: <20241112181044.92193-18-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435488328116600 Add TX_GIE to the TX registers MMIO region. Before TX_GIE1 was accessed as RAM, with no effect. Now it is accessed as MMIO, also without any effect. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 159b2b0c64..f7a5b1620a 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -39,7 +39,6 @@ =20 #define R_TX_BUF0 0 #define A_TX_BASE0 0x07f4 -#define R_TX_GIE0 (0x07f8 / 4) #define R_TX_CTRL0 (0x07fc / 4) #define R_TX_BUF1 (0x0800 / 4) #define A_TX_BASE1 0x0ff4 @@ -55,6 +54,7 @@ =20 enum { TX_LEN =3D 0, + TX_GIE =3D 1, TX_MAX }; =20 @@ -140,6 +140,9 @@ static uint64_t port_tx_read(void *opaque, hwaddr addr,= unsigned int size) case TX_LEN: r =3D s->port[port_index].reg.tx_len; break; + case TX_GIE: + r =3D s->port[port_index].reg.tx_gie; + break; default: g_assert_not_reached(); } @@ -156,6 +159,9 @@ static void port_tx_write(void *opaque, hwaddr addr, ui= nt64_t value, case TX_LEN: s->port[port_index].reg.tx_len =3D value; break; + case TX_GIE: + s->port[port_index].reg.tx_gie =3D value; + break; default: g_assert_not_reached(); } @@ -233,10 +239,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) =20 switch (addr) { - case R_TX_GIE0: - r =3D s->port[port_index].reg.tx_gie; - break; - case R_TX_CTRL1: case R_TX_CTRL0: r =3D s->port[port_index].reg.tx_ctrl; @@ -281,11 +283,6 @@ eth_write(void *opaque, hwaddr addr, s->port[port_index].reg.tx_ctrl =3D value & ~(CTRL_P | CTRL_S); break; =20 - /* Keep these native. */ - case R_TX_GIE0: - s->port[port_index].reg.tx_gie =3D value; - break; - default: s->regs[addr] =3D tswap32(value); break; --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435269; cv=none; d=zohomail.com; s=zohoarc; b=kkdIijndXKBgiSydWz3DLTMPVaMegT3jx8g08gYtXW41zSv70FACxlawvaewPaCpK69xshx4RXbhc9DJnuvrutV5gkpxnr/WYxYKKw55KxYE8bL9vSD8kLXkF37FNUK+F3p9nQz6iFGZJiNR3/zBtqVK0eUN8J6A8NwEjUCFeDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435269; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=toHAwahSX4A1oHkXEKjfL9qzsyS5xjf5aUzpCpynlgA=; b=PsZDNIUNqJ1GLl4ZP6ZvIl7R0Wso/MoOZ6si+aXeOW1xNFqGKJ78NoyJNU4mjSkVWYDwT3inhUOoC8atYO9erKnXUoVdtM+k6ZE9zjKyrpYdrjjJnvI516+7WagHiuUeXTQHfCsnj0V3S/IIf5ZQNY2c4H2k0O8k/AsTUWHuTsg= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435269598280.1947412706812; Tue, 12 Nov 2024 10:14:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvNd-0007hv-LQ; Tue, 12 Nov 2024 13:12:45 -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 1tAvNZ-0007PK-Mf for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:41 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvNX-00023a-2Y for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:41 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4314f38d274so75430075e9.1 for ; Tue, 12 Nov 2024 10:12:38 -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-381ed997391sm16150539f8f.45.2024.11.12.10.12.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435157; x=1732039957; 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=toHAwahSX4A1oHkXEKjfL9qzsyS5xjf5aUzpCpynlgA=; b=TPSdYAfRx7LyUYWGUBqiHh39ZfQQ7TC8uyFbtrcx1mEcGs6hzCp0KOasIMWYvequPH Id2EpIeunjLmokLqn2pVaqUY9otbzaJcif8K7jvitypkPgHGsHeaNxQfQTiWIdSEKPjM HVEWUmlMqRcbw4bvTy68QFTiDj5Z72kaDkuuYmAMzlIG1Ev5OaTauAbB/ZSw1a1jiVbj RYsjdbiiaFPwVQKVoKKV/jJVvukuvQk2XQBubZnW9TY/yXCbM9d6NFky622hrP1e4y1u YZbaT77/U2jpcRHoFAYO97vU1dau64GzFSZySMHV0k54jFgQq8qHnibZIsdJFvV9fQsS n80g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435157; x=1732039957; 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=toHAwahSX4A1oHkXEKjfL9qzsyS5xjf5aUzpCpynlgA=; b=b5oSANEZxQZwbIcNdQ0a0FrJUQAvQYqQ2DDlxmWR2uZIiPIJeV30yt+aJEvNJ2Jd/s cy0vsvrInBLBaQbDNzbQwqiCzuBljYWKmc+i1kIbqzTT5R732/aCOIZyaNwaSjBSXoEz UiRxRJUJ6dv2+W1EzcbGxf7wDNqMFzUVbS+LiBvtNGMdx8dsCX1iV4VZ85zhT1azjDGj 0icJ3FmwbrnSEDSRxJf66eq5GEwc00nB5CfyRkA76rTaiSxtDp5r/+6tVRS7mROSgu6X U2/XH8YorTWtoJkUy5MfLvCDUyvAiiJYn1vz+A2x7L1RCPxUludPCSiXmNmOOwKiIbSG CA7A== X-Gm-Message-State: AOJu0YzxQ+ustCw9h6FFhHb8T5XJDjXKrTOmW8eGmaP+ejSrwSTNyZSp JGMLSsHAxldnL7rvxiBn1wj8a1UmqeB8Zl+iMMOLAIjY/yUggyW+1FLw3Sk7eJD0oQ65Cne5dtA o X-Google-Smtp-Source: AGHT+IGJ4C1DA0pFl4GpesJxVHascgNF4xttCRS4MrwMr7gFwJzayFXaOmAREoFpEVQGQPboMhHCPg== X-Received: by 2002:a05:600c:3b87:b0:431:5ba1:a520 with SMTP id 5b1f17b1804b1-432b74fec0bmr196747635e9.3.1731435157152; Tue, 12 Nov 2024 10:12:37 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 18/20] hw/net/xilinx_ethlite: Map TX_CTRL as MMIO Date: Tue, 12 Nov 2024 19:10:42 +0100 Message-ID: <20241112181044.92193-19-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435271253116600 Add TX_CTRL to the TX registers MMIO region. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 56 +++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index f7a5b1620a..f681b91769 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -39,10 +39,8 @@ =20 #define R_TX_BUF0 0 #define A_TX_BASE0 0x07f4 -#define R_TX_CTRL0 (0x07fc / 4) #define R_TX_BUF1 (0x0800 / 4) #define A_TX_BASE1 0x0ff4 -#define R_TX_CTRL1 (0x0ffc / 4) =20 #define R_RX_BUF0 (0x1000 / 4) #define A_RX_BASE0 0x17fc @@ -55,6 +53,7 @@ enum { TX_LEN =3D 0, TX_GIE =3D 1, + TX_CTRL =3D 2, TX_MAX }; =20 @@ -71,6 +70,7 @@ enum { =20 typedef struct XlnxXpsEthLitePort { + MemoryRegion txio; MemoryRegion rxio; =20 struct { @@ -143,6 +143,9 @@ static uint64_t port_tx_read(void *opaque, hwaddr addr,= unsigned int size) case TX_GIE: r =3D s->port[port_index].reg.tx_gie; break; + case TX_CTRL: + r =3D s->port[port_index].reg.tx_ctrl; + break; default: g_assert_not_reached(); } @@ -154,6 +157,7 @@ static void port_tx_write(void *opaque, hwaddr addr, ui= nt64_t value, unsigned int size) { XlnxXpsEthLite *s =3D opaque; + unsigned port_index =3D addr_to_port_index(addr); =20 switch (addr >> 2) { case TX_LEN: @@ -162,6 +166,26 @@ static void port_tx_write(void *opaque, hwaddr addr, u= int64_t value, case TX_GIE: s->port[port_index].reg.tx_gie =3D value; break; + case TX_CTRL: + if ((value & (CTRL_P | CTRL_S)) =3D=3D CTRL_S) { + qemu_send_packet(qemu_get_queue(s->nic), + txbuf_ptr(s, port_index), + s->port[port_index].reg.tx_len); + if (s->port[port_index].reg.tx_ctrl & CTRL_I) { + eth_pulse_irq(s); + } + } else if ((value & (CTRL_P | CTRL_S)) =3D=3D (CTRL_P | CTRL_S= )) { + memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6); + if (s->port[port_index].reg.tx_ctrl & CTRL_I) { + eth_pulse_irq(s); + } + } + /* + * We are fast and get ready pretty much immediately + * so we actually never flip the S nor P bits to one. + */ + s->port[port_index].reg.tx_ctrl =3D value & ~(CTRL_P | CTRL_S); + break; default: g_assert_not_reached(); } @@ -232,18 +256,12 @@ static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { XlnxXpsEthLite *s =3D opaque; - unsigned port_index =3D addr_to_port_index(addr); uint32_t r =3D 0; =20 addr >>=3D 2; =20 switch (addr) { - case R_TX_CTRL1: - case R_TX_CTRL0: - r =3D s->port[port_index].reg.tx_ctrl; - break; - default: r =3D tswap32(s->regs[addr]); break; @@ -256,33 +274,11 @@ eth_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { XlnxXpsEthLite *s =3D opaque; - unsigned int port_index =3D addr_to_port_index(addr); uint32_t value =3D val64; =20 addr >>=3D 2; switch (addr)=20 { - case R_TX_CTRL0: - case R_TX_CTRL1: - if ((value & (CTRL_P | CTRL_S)) =3D=3D CTRL_S) { - qemu_send_packet(qemu_get_queue(s->nic), - txbuf_ptr(s, port_index), - s->port[port_index].reg.tx_len); - if (s->port[port_index].reg.tx_ctrl & CTRL_I) { - eth_pulse_irq(s); - } - } else if ((value & (CTRL_P | CTRL_S)) =3D=3D (CTRL_P | CTRL_S= )) { - memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6); - if (s->port[port_index].reg.tx_ctrl & CTRL_I) { - eth_pulse_irq(s); - } - } - - /* We are fast and get ready pretty much immediately so - we actually never flip the S nor P bits to one. */ - s->port[port_index].reg.tx_ctrl =3D value & ~(CTRL_P | CTRL_S); - break; - default: s->regs[addr] =3D tswap32(value); break; --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435431; cv=none; d=zohomail.com; s=zohoarc; b=O8XOiRGDsaW3AhIA1BH0x6VouWV9Zk6V6JSwpgZgAvgQGqlGCtZRl6G54409FbnZrE6Zq7PCcJfNBfD0Xwx7oiUthhCzhuwvV6dB6ZvYpuxzqD/Bdo9DkOGONKLrP5LdSp2JJQquzIaD3SRiZAR0WzYhX8IkVPMDMXemT7QNMJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435431; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2SAvDiAsNxCj5xV4d5IUtJExFxHe3WGoYxScpi/ms1o=; b=MXlxHj/ZMA6o/gRxuJQhOvnF+SRZ4Q7Gk3fSOkVOaMcTxXvpCVm4omkepUlE8tqYrdkSwrMmp+hdDq7375iQGdmTlEN4f6/H8v6x77ciSqAzSf8lQtoep80Joe1ByHCMXMUR6JaOt+684cI9PdTnGp8VM+PkWaG/GMT6EXicUw8= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435431284331.42011231051526; Tue, 12 Nov 2024 10:17:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvO2-0008S3-F7; Tue, 12 Nov 2024 13:13:10 -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 1tAvNm-00087h-7g for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:56 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvNe-00024U-Iz for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:54 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-431695fa98bso47576605e9.3 for ; Tue, 12 Nov 2024 10:12:46 -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-432aa6bee9asm260965995e9.19.2024.11.12.10.12.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435164; x=1732039964; 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=2SAvDiAsNxCj5xV4d5IUtJExFxHe3WGoYxScpi/ms1o=; b=b1I3AWgJ8fZn9s7dnxtsfBRIdMykYkIzM62I+GwT0GqtXyvIaxGRwhLLlwEJy1DSg5 BAWWd7PN4k5QSLgh28FGcZlC1N3TxjZweX/El6gdgC8utqyYnsShNdUMEQMNrJ2DF3qL 59uAVWo6a52TDWeHEespyTR/u4afsWUWrM+5KbN6sZXgdBBq8vWqUsKaxmtNMx49co4u 0VCWOqDP1j15Vdmt/mNL4fQxNrd4LSyJCpM2zsFZ+SWPCjdUiFDgCsXZhbGCtSl3r+oq chFlyud50KLv6wugtZC99zcfAtEJMkYyr47Eck/k9eJdQiLFfEFkckyFjqN+BZvauqvh FZuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435164; x=1732039964; 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=2SAvDiAsNxCj5xV4d5IUtJExFxHe3WGoYxScpi/ms1o=; b=vJ+z9lhC5+wPxSmTNRbFQS6H7UUr7dT3b9v/lpLFnRjQpfVt0mKJ51U2onOuROjAGU YEnfN3lqp9jZDjXPtW8x87zvbcNzrG7FIqueABdRW85sgp0amORUNCmPSolZVC54zTFO sAoUGTEib9jybqsYOc+BomGrTCofBva4K/bcBdPGAp6kfMmOrAu1WvtWPGHQHM7VBlPn l5h6VW/D1gbBVsfD2pT0rIHV+sEhwIFaLjVarkd/jiX8q5Yasjyqx1i22zLX67rcoOF7 fObO/9EzpfEyr5D+8d3EQI6p9jMuJgku6BJ25+Dq+KAfW3vceJC3dWFBftqcsTs/+VK0 7p3w== X-Gm-Message-State: AOJu0Yyz3Jz7mzb/j+Nivxhu0Vr8lVSaabwAa5yt1iX+TRCzvIbbMFaS wBJm3yMv3wXXdb/YbJvHwWVOyf62BSbBpUs1n5BbIWOw9+4RAyLHZAKyPuhv46QgK6Q1z07Ch7K K X-Google-Smtp-Source: AGHT+IEwhOC/1UmfJ+2BGE6lNRu6lnJ/c8JnaHGRgrzWFLg8ySoUo3+gtz+ldwxPwOx4xqOYNEwd6w== X-Received: by 2002:a05:600c:1c15:b0:42c:a580:71cf with SMTP id 5b1f17b1804b1-432b751e27cmr148068795e9.30.1731435163019; Tue, 12 Nov 2024 10:12:43 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 19/20] hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region Date: Tue, 12 Nov 2024 19:10:43 +0100 Message-ID: <20241112181044.92193-20-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435432257116600 Rather than using I/O registers for RAM buffer, having to swap endianness back and forth (because the core memory layer automatically swaps endiannes for us), declare the buffers as RAM regions. Remove the now unused s->regs[] array. The memory flat view becomes: FlatView #0 Root memory region: system 0000000081000000-00000000810007f3 (prio 0, ram): ethlite.tx[0]buf 00000000810007f4-00000000810007ff (prio 0, i/o): ethlite.tx[0]io 0000000081000800-0000000081000ff3 (prio 0, ram): ethlite.tx[1]buf 0000000081000ff4-0000000081000fff (prio 0, i/o): ethlite.tx[1]io 0000000081001000-00000000810017f3 (prio 0, ram): ethlite.rx[0]buf 00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io 0000000081001800-0000000081001ff3 (prio 0, ram): ethlite.rx[1]buf 0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io Mention the device datasheet in the file header. Reported-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 79 +++++++++++------------------------------ 1 file changed, 20 insertions(+), 59 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index f681b91769..da453465ca 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -2,6 +2,10 @@ * QEMU model of the Xilinx Ethernet Lite MAC. * * Copyright (c) 2009 Edgar E. Iglesias. + * Copyright (c) 2024 Linaro, Ltd + * + * DS580: https://docs.amd.com/v/u/en-US/xps_ethernetlite + * LogiCORE IP XPS Ethernet Lite Media Access Controller * * Permission is hereby granted, free of charge, to any person obtaining a= copy * of this software and associated documentation files (the "Software"), t= o deal @@ -27,7 +31,6 @@ #include "qemu/bitops.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" @@ -46,7 +49,6 @@ #define A_RX_BASE0 0x17fc #define R_RX_BUF1 (0x1800 / 4) #define A_RX_BASE1 0x1ffc -#define R_MAX (0x2000 / 4) =20 #define RX_BUFSZ_MAX 0x07e0 =20 @@ -72,6 +74,8 @@ typedef struct XlnxXpsEthLitePort { MemoryRegion txio; MemoryRegion rxio; + MemoryRegion txbuf; + MemoryRegion rxbuf; =20 struct { uint32_t tx_len; @@ -100,7 +104,6 @@ struct XlnxXpsEthLite =20 UnimplementedDeviceState mdio; XlnxXpsEthLitePort port[2]; - uint32_t regs[R_MAX]; }; =20 static inline void eth_pulse_irq(XlnxXpsEthLite *s) @@ -118,16 +121,12 @@ static unsigned addr_to_port_index(hwaddr addr) =20 static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) { - unsigned int rxbase =3D port_index * (0x800 / 4); - - return &s->regs[rxbase + R_TX_BUF0]; + return memory_region_get_ram_ptr(&s->port[port_index].txbuf); } =20 static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) { - unsigned int rxbase =3D port_index * (0x800 / 4); - - return &s->regs[rxbase + R_RX_BUF0]; + return memory_region_get_ram_ptr(&s->port[port_index].rxbuf); } =20 static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size) @@ -252,53 +251,6 @@ static const MemoryRegionOps eth_portrx_ops =3D { }, }; =20 -static uint64_t -eth_read(void *opaque, hwaddr addr, unsigned int size) -{ - XlnxXpsEthLite *s =3D opaque; - uint32_t r =3D 0; - - addr >>=3D 2; - - switch (addr) - { - default: - r =3D tswap32(s->regs[addr]); - break; - } - return r; -} - -static void -eth_write(void *opaque, hwaddr addr, - uint64_t val64, unsigned int size) -{ - XlnxXpsEthLite *s =3D opaque; - uint32_t value =3D val64; - - addr >>=3D 2; - switch (addr)=20 - { - default: - s->regs[addr] =3D tswap32(value); - break; - } -} - -static const MemoryRegionOps eth_ops =3D { - .read =3D eth_read, - .write =3D eth_write, - .endianness =3D DEVICE_NATIVE_ENDIAN, - .impl =3D { - .min_access_size =3D 4, - .max_access_size =3D 4, - }, - .valid =3D { - .min_access_size =3D 4, - .max_access_size =3D 4 - } -}; - static bool eth_can_rx(NetClientState *nc) { XlnxXpsEthLite *s =3D qemu_get_nic_opaque(nc); @@ -354,6 +306,9 @@ static void xilinx_ethlite_realize(DeviceState *dev, Er= ror **errp) { XlnxXpsEthLite *s =3D XILINX_ETHLITE(dev); =20 + memory_region_init(&s->mmio, OBJECT(dev), + "xlnx.xps-ethernetlite", 0x2000); + object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, TYPE_UNIMPLEMENTED_DEVICE); qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio"); @@ -363,6 +318,10 @@ static void xilinx_ethlite_realize(DeviceState *dev, E= rror **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio= ), 0)); =20 for (unsigned i =3D 0; i < 2; i++) { + memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev), + i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf", + 0x07f4, &error_abort); + memory_region_add_subregion(&s->mmio, 0x0800 * i, &s->port[i].txbu= f); memory_region_init_io(&s->port[i].txio, OBJECT(dev), ð_porttx_ops, s, i ? "ethlite.tx[1]io" : "ethlite.tx[0]io", @@ -370,6 +329,11 @@ static void xilinx_ethlite_realize(DeviceState *dev, E= rror **errp) memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0, &s->port[i].txio); =20 + memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev), + i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf", + 0x07f4, &error_abort); + memory_region_add_subregion(&s->mmio, 0x1000 + 0x0800 * i, + &s->port[i].rxbuf); memory_region_init_io(&s->port[i].rxio, OBJECT(dev), ð_portrx_ops, s, i ? "ethlite.rx[1]io" : "ethlite.rx[0]io", @@ -390,9 +354,6 @@ static void xilinx_ethlite_init(Object *obj) XlnxXpsEthLite *s =3D XILINX_ETHLITE(obj); =20 sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); - - memory_region_init_io(&s->mmio, obj, ð_ops, s, - "xlnx.xps-ethernetlite", R_MAX * 4); sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); } =20 --=20 2.45.2 From nobody Sat Nov 23 20:02:34 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731435311; cv=none; d=zohomail.com; s=zohoarc; b=Z9zZfe0lL/gKKH83PamgK+sKF2DQfAqsQHnRQWluh6VeQpWpHvLU5WHhWbPxZ8dhbhIU135NpPIkJlRY3j7+Pkkj1ccPZi8bEdcJMNTt2ldO26NjVIfboAMBSNo/0rvudN95O7P6+4u4PfaWs1UQjpJ8xzqRwJVcRHqwgvzyci8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435311; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wGd9i6/ENCkloXaai0AVofeTZOoMIoGHzhdQpEJmiRQ=; b=ZKiGG3MldBUDlaXV3r70xy2fXGp+raWRN4REQg87ARiklgAf4N+ZCaE+RDMsOS4r+OemWVwj8N1HNEGIqSprT6VHVMjDh7u9aAiIbZhUSD9O1TNmXmAT3tjPcH4W/+Tuvz+iYaxuCWuq+nenNKuvo1t1gf2cwnPcU03M8G9ZvQg= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731435311227553.695732920598; Tue, 12 Nov 2024 10:15:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvO1-0008Ok-3O; Tue, 12 Nov 2024 13:13:09 -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 1tAvNk-00087C-In for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:53 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvNi-000252-Tb for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:12:52 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4316e9f4a40so52048365e9.2 for ; Tue, 12 Nov 2024 10:12:50 -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-381ed970f68sm16118908f8f.11.2024.11.12.10.12.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435169; x=1732039969; 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=wGd9i6/ENCkloXaai0AVofeTZOoMIoGHzhdQpEJmiRQ=; b=jcFmTIjyoK6xDENyHe5EMZdXQLfagMQVaFfyKWbB+m4++zITs3+AcEg6TEDAyFF9S4 k47+kriwiHweJw8BeUGfGdTiU0Cvfs5VHIUE8M2cVOTGZbpgNPIHUEne3nOt4qz4s2mV LhyuidLH426wrrMa83DmCvVqZ4WqrYIFW3ugjTOlfzUcgylW41RLRljkDM+i/AaBkFLd mMtg0I0Y+ZA6oDbuqPdNEFmgd+lr0EHLq3X3ILPot+UlfE8aCMim+F/dcP7jFZNT27Q4 VFh4m55OKvL1Os8H4GZEHyYRvgWfXMZmqotj0PFYEiaqIGC8RyELGpDrj0bGoCCRbNjd zdoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435169; x=1732039969; 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=wGd9i6/ENCkloXaai0AVofeTZOoMIoGHzhdQpEJmiRQ=; b=I3OD1snQ/tEKdrTH8Xl/BnmW+e4m5IuQT/y4uluLIY5OPO4RiOmLIK1ZiQgnJgHz4A XK/p/q4a4zBYOo8npH0cl9VTnVKGDtU0m0dKAsNQy55Nlc1+TxIsOUjnvxNDfTFKH9h/ HqDnNY1JXAHesijriARq8Xfe8qKZKXIY/r+hSnbOfzt+SmZ51UOnXqkhZYVxpDpjNgfd cl7t/6m6HT6cUEmV65UP3NMGzAavR1YjN0TQXfbCJi5pEfzKT5VN8ZDAVo4BKTxbGxyH GC2qGIc/xWHZpXv8WGakC5nKDAHfPIfjlrsTYMiLlJtMvZ2sI6zekc2fZHX/g38yD3pg hPkA== X-Gm-Message-State: AOJu0YytjEqI+Bd9i55YcD/gMKJM36iQg5g61J/gDJXmgggAVl0fUAT+ RO+nhYkzGlMOpO84bxsEAYPBtKWP5dOo+ME8aWEeM/A8d9otqX1p0mQhodmVlAsERx1GaEnm6Cq F X-Google-Smtp-Source: AGHT+IEj761L13C8DsFW7HfiCrAxRK8vWDbgclnkVXfP1rxIiOBJOrP3g1eMUKWnxff8qFHro/I5yg== X-Received: by 2002:a05:6000:490d:b0:37d:50a4:5da4 with SMTP id ffacd0b85a97d-381f188ca9amr16104373f8f.50.1731435168869; Tue, 12 Nov 2024 10:12:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 20/20] hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container' Date: Tue, 12 Nov 2024 19:10:44 +0100 Message-ID: <20241112181044.92193-21-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 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731435311487116600 Having all its address range mapped by subregions, s->mmio MemoryRegion effectively became a container. Rename it as 'container' for clarity. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index da453465ca..c65001cf46 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -93,7 +93,7 @@ struct XlnxXpsEthLite { SysBusDevice parent_obj; =20 - MemoryRegion mmio; + MemoryRegion container; qemu_irq irq; NICState *nic; NICConf conf; @@ -306,7 +306,7 @@ static void xilinx_ethlite_realize(DeviceState *dev, Er= ror **errp) { XlnxXpsEthLite *s =3D XILINX_ETHLITE(dev); =20 - memory_region_init(&s->mmio, OBJECT(dev), + memory_region_init(&s->container, OBJECT(dev), "xlnx.xps-ethernetlite", 0x2000); =20 object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, @@ -314,31 +314,31 @@ static void xilinx_ethlite_realize(DeviceState *dev, = Error **errp) 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, + memory_region_add_subregion(&s->container, A_MDIO_BASE, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio= ), 0)); =20 for (unsigned i =3D 0; i < 2; i++) { memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev), i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf", 0x07f4, &error_abort); - memory_region_add_subregion(&s->mmio, 0x0800 * i, &s->port[i].txbu= f); + memory_region_add_subregion(&s->container, 0x0800 * i, &s->port[i]= .txbuf); memory_region_init_io(&s->port[i].txio, OBJECT(dev), ð_porttx_ops, s, i ? "ethlite.tx[1]io" : "ethlite.tx[0]io", 4 * TX_MAX); - memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0, + memory_region_add_subregion(&s->container, i ? A_TX_BASE1 : A_TX_B= ASE0, &s->port[i].txio); =20 memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev), i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf", 0x07f4, &error_abort); - memory_region_add_subregion(&s->mmio, 0x1000 + 0x0800 * i, + memory_region_add_subregion(&s->container, 0x1000 + 0x0800 * i, &s->port[i].rxbuf); memory_region_init_io(&s->port[i].rxio, OBJECT(dev), ð_portrx_ops, s, i ? "ethlite.rx[1]io" : "ethlite.rx[0]io", 4 * RX_MAX); - memory_region_add_subregion(&s->mmio, i ? A_RX_BASE1 : A_RX_BASE0, + memory_region_add_subregion(&s->container, i ? A_RX_BASE1 : A_RX_B= ASE0, &s->port[i].rxio); } =20 @@ -354,7 +354,7 @@ static void xilinx_ethlite_init(Object *obj) XlnxXpsEthLite *s =3D XILINX_ETHLITE(obj); =20 sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); - sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->container); } =20 static Property xilinx_ethlite_properties[] =3D { --=20 2.45.2