From patchwork Thu Nov 14 20:59:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843193 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp503799wrc; Thu, 14 Nov 2024 13:01:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWbM6VNYNM7NnZ5XmHCmilUz3lhsfJNGGuP3vzaPvMnWHIdkMbYO3w/eohNYrflGP3Sewk8VQ==@linaro.org X-Google-Smtp-Source: AGHT+IEneHWfcW3yDsEmKvQDBX8sN0GO8lr/J+4vkW8UfgvSbD8+oEow+Q59Kr49tWDdFtSgt2tT X-Received: by 2002:a05:6102:6c1:b0:4a4:841f:bb98 with SMTP id ada2fe7eead31-4ad62c8bcd0mr610175137.24.1731618065613; Thu, 14 Nov 2024 13:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618065; cv=none; d=google.com; s=arc-20240605; b=ZOrDuKfCmEgfw7s2sZL0zeLkZXXweBem0IPjNbTaQVXuJen0pkWGEepXaFyoQU5uFZ 2QWdscJvLSkbECHiYUTfGtdCYQjAc+nY023QX+zpWJ/hWrbQs26uqNLes4us9vIhQNWZ tuZQoQzg0C01X2kMw191p5/RIPSP5tcJcHNUT1L/D3S95HywVdELhQQkt1BtGsTzEkIp ynCu2pSXTrBdrmwFcmwOQ3MjvPq+5iEz7pdHhadYdYhx0KjZfRDR/UmZW1fo2SjNcq3+ KmMcTOr0eukrVR1HGN+Rjbcj2HlMM0/FQtLgcGT5VtAJwqUhnWX9XEzPxcNap1CW5prh Sjvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dxalhuJA3V9Mf8DxAADrs85j1mYwG4uCtR+wwxiXnFU=; fh=5jk8UxAyCIlFm5FJTrcugn+mYgKxg5oCAlh/+aIwL9w=; b=UYj7XGWvx/4x9ei4yCF81YYkGou4pwblB2yUS+oB8b9EY5iBDEWYGl498Yqeq8p78+ e7UhPuX444EOsbcLPQMSdT+BL4pl0AE8dA3Kb83bETAL7sg5/p0Otb160nB/ros3FNFC tfsPtSpvrfI9dofz2LijyQ695EPv1Sccs3btT8OYa/C+5EXDKAmDkzf6z/TDLMnj0cqN tVpfWZt/NQuPSgTNDUXLEIIujqdII6Gj9gHhK9WAchIL7CTpZ2v73qZ25of4gtP+YD1A UHSw7RTMxL0T5giJO3UuWWm1TPX+ak4aFcFSl/yq+L6M3Sho+/Sfiqqi8OOx2HvyN//N Q4nQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cx41yGx3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ad646f9b47si7723137.47.2024.11.14.13.01.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:01:05 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cx41yGx3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgx2-0008EL-OO; Thu, 14 Nov 2024 16:00:28 -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 1tBgx0-0008CK-G8 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:26 -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 1tBgwz-0007uP-05 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:26 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-382026ba43eso737315f8f.1 for ; Thu, 14 Nov 2024 13:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618023; x=1732222823; 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=cx41yGx3ew8rlJ4Cxv3ogkRDgC2SfNrX8u9YYSdhNhtU90cxa6DMlk1hHC/ciKbvpj ZiHmSkfWi7s8mIiLrD3zw0U2g6vtxkEjbpWJN3nLp6st7LzDjQHL8BQdmpZBg7u9kc8S 0ZsDMM5yRMOIn/RMhjWZvLTL1SABDonCfXbVziTGQf4knd6NWHGhdKzSQ6ZsO6TVnvF7 HxAwxjOK0puUh7Z5kwx+FQ2kvqAvi01LnQ2LfJzdsCtvAQ5auEQwInwlJxDnnFltURlF 2rXfLxuom5oLX+/8WhZEh+6UPlaql/oq4W4HA1zqA0ZPcssklYtVQGCnyTLOWs+YcW/l DBxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618023; x=1732222823; 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=u22N0COEbxiaFtygexT0+Txv9vus5+9wNCqRU7B63PGbOPO0QaCpMHRD4hnzjRAcz1 eLhwBtpQdMjOvF04bX/BdIqW7ePiw4Ijq/1NhMVqQx3YRGFTYb1qXrFCMqkZHtNILTPv pCGowmB+uFOc0/KApMrnzk0Gp+zCQNgPW9zEjr7z+ya07lQGIBh914IopLrJsA6SvNFe Ywm3JKf6G9oQ+xKUiC4YqW5uP7fMGgdYvH2STYLZ2VEQ6XlX2MLL/7oZlpP6A4Ok2OzY EYT0SD5Bp9KqzYHn3SCJvmQ+urzAdXyaOhBX1Okv2o+uNskdkXhTnICatDe9FXzskJW9 ZvpA== X-Gm-Message-State: AOJu0YxHEpcLocg3O3FT6W2ymK7qpwNNtEgOntfyxfys3y5uYWxOKMO1 2N5mDjKsjqf3iMqEJxQz6EFDr7gs/fe2JRAbPvncfopTEg9F0YbBIhPajkKcVj/RO7gsgoZQoc1 a X-Received: by 2002:a05:6000:2a01:b0:37d:4332:e91d with SMTP id ffacd0b85a97d-38225aa6246mr158254f8f.52.1731618022950; Thu, 14 Nov 2024 13:00:22 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ada2da2sm2430618f8f.15.2024.11.14.13.00.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:00:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH RESEND v2 01/19] hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit Date: Thu, 14 Nov 2024 21:59:52 +0100 Message-ID: <20241114210010.34502-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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 = { .read = uart_read, .write = uart_write, .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, .valid = { .min_access_size = 1, .max_access_size = 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 = { .read = pic_read, .write = pic_write, .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, .valid = { .min_access_size = 4, .max_access_size = 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 = { .read = eth_read, .write = eth_write, .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, .valid = { .min_access_size = 4, .max_access_size = 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 = { .read = timer_read, .write = timer_write, .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, .valid = { .min_access_size = 4, .max_access_size = 4 From patchwork Thu Nov 14 20:59:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843208 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp506046wrc; Thu, 14 Nov 2024 13:05:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVHmNMUJAeZAtowtmUD7Pwv1U29FRSXQe8DxnOL5uWmMY81TwzIXfoXUZCRIiSAW3Lg8nJo/w==@linaro.org X-Google-Smtp-Source: AGHT+IHgXdF/Oo5XWMwP82e15N4BKIGcak1hLi0GReXGkYnXsbDBWvE5FDmGy7Wcd9ELlEITaga9 X-Received: by 2002:ac8:6909:0:b0:460:ad75:300a with SMTP id d75a77b69052e-46363e924a3mr3791941cf.37.1731618305474; Thu, 14 Nov 2024 13:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618305; cv=none; d=google.com; s=arc-20240605; b=F7X9XDxCz4KQHgUxEB9sgI8pIjrm1v581cihruCURtxpa/RIlC4k5klH45MZTK4drl 4WPYZU2iJ6+LOqmWBCd7Qtx2VYGChOt3xp6u83KAk3rrVD16mnRAZkTtpTnxkLjAW6hN Rezu3fPjwaSmC3Doi9rpWCE5WSt2bDy3EXDsHAQ0uLPsVvN4pXvEJkotvIURu1tNZ77G kainQn+ZvDRC1vLtL6mA/CEHIxoT+1S4hqv06B7KXAJtUZwQYhDijLdVB5ESB3lmyLGQ VtWFiNifsXk0/S9QSlyrEm0rX9JqWzAO12EkqF/+BMCzkA8HYmStlvB1PXRRkEzXweIF WORw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YlgtA2w+nkGpq6odlZPv7GuJkitbYlthMfvxp2Wzgbg=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=LoRUaH11LoQlQvnrg4iCYO3zb1Ij6fahGSVmQg5h3wYNyA9kYwgLvo1H0RCtldSsml rsz459d0xVipRAhkhYVboitq+ghCXAT5UfOnVU80ygZBZRvSH90zvGyTDHBBS2rXdhz2 vnlG6zOWaAydaxLL/x5Jdxny7nW2EhIUaucZm7N/dj53I8Yru4hA/zRiGuIe3YVd9MPX fztdrm8FaDDeSIHONWeLHEnrnI6pZ4q/rXBBY3vf+DvkVidh5H1MiJSL0k3PAbPUwV/7 NUVOLssmgkMYjltLhId0mJ9SAvORgfCISlJJ9I6KJvCiLhsjilNeqjPAUudl501Ata2i vJSA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zvaJYErv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4635aaedc0csi18162171cf.462.2024.11.14.13.05.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zvaJYErv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgxK-0008VM-5P; Thu, 14 Nov 2024 16:00:46 -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 1tBgxD-0008SH-1L for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:39 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgxB-0007wQ-8U for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:38 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-37d495d217bso862914f8f.0 for ; Thu, 14 Nov 2024 13:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618031; x=1732222831; 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=YlgtA2w+nkGpq6odlZPv7GuJkitbYlthMfvxp2Wzgbg=; b=zvaJYErv6yAaQHqckRPX1UP5Y7IdpEwqrsrbq9Ey+Obw9tvf5QuP6V1o0wki/qJCOZ rECy69YCd83DvWK1eq7Aq4Ebmi8dfD6zFi//piSW5QRY8+9DUNEwy8IXD8YGjbc+EYc1 8JmDe7nXzNedO0WAEvaW6YC7skJ8BqmN7ovwdGuxPuY+mWPuiseDVs35BehWivGMX/MK 0hbiwRchaqZU8rh/pXqG9oFOWVIm64zocaaoz0r5l8EfNMh2SqSir5+WmHvcaktxO4Fx oCHGOP3fPQA61yMJ3urKnnNA1EXBnTFWDJAkYa01TG3hXcFqZ8q/4brCWzOYdYjpO9/6 37DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618031; x=1732222831; 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=YlgtA2w+nkGpq6odlZPv7GuJkitbYlthMfvxp2Wzgbg=; b=VHk2sXVF5Mv8bSfIH2Ujn5b68ynj+g51xY9VciADbS7h0N0cBNK2BTk0FE09BxLfNL qiyefAJdylz5IYRPQF6xyEzeRWVWI/GvDON1e3u3eRBmVrLSoUJ/cBGkvJg/5Ij/lB2H 5F3KkbJD4XwXMtSeQ3FD7kh/Kk3wGHvuWWaY2LOV6QMCSk4LML/lZDui5xvV5K11xxAb jUI4Jbqib3PtPYwOfKOae4P0YKOCR8deHLJPdxQwx+EnBpl2ryvt8rF3VB+3IPmngU7R r1h6SGlTLPlsXUd5v9UmIOTldATDb4RsyeLd+804L47C/hGa/HGpMMvDFrOaWVDDyB9i 2i3g== X-Gm-Message-State: AOJu0YxaD32yk7ZQENo3K3ljfCPodXwMhTcNzuFRcfSrzi+dwDAJ0JX5 zBmqbA8anJMvaNHfmaXcmUERwn2eeEsSPoit5fAFhScXUS0N6NRK3ty2Ftli0bX6RDGtgOYPrww s X-Received: by 2002:a5d:5e02:0:b0:381:f603:ff62 with SMTP id ffacd0b85a97d-38225a454ddmr179821f8f.20.1731618030678; Thu, 14 Nov 2024 13:00:30 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae16827sm2464974f8f.76.2024.11.14.13.00.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:00:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 02/19] hw/net/xilinx_ethlite: Convert some debug logs to trace events Date: Thu, 14 Nov 2024 21:59:53 +0100 Message-ID: <20241114210010.34502-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé 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" #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; 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; } D(qemu_log("%s %zd rxbase=%x\n", __func__, size, rxbase)); if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) { - D(qemu_log("ethlite packet is too big, size=%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 int 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, const 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 status %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 From patchwork Thu Nov 14 20:59:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843194 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp504271wrc; Thu, 14 Nov 2024 13:01:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVoCn5IXhbxBFjgXElMtBaoQpXBVYkfxKJmWAcst6v8aeBTei1l72rEVXwNgxkI+eCqYuRmmQ==@linaro.org X-Google-Smtp-Source: AGHT+IGeUf5F/93b+4v32ilQI8O3TgEypKJ8ELQQzFruyKRqnQKRworLxR19QRXG/B4HPsIcFNz6 X-Received: by 2002:a05:620a:2945:b0:7b1:5763:4ba2 with SMTP id af79cd13be357-7b3623311c3mr48536085a.40.1731618111843; Thu, 14 Nov 2024 13:01:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618111; cv=none; d=google.com; s=arc-20240605; b=FyyXTmfobFI7ZAW3Fdc89E2KI6fJMj8dDn+VZ9VhH1Ppx7ocKlGQGtda9AiTk9J4zr U+TnECjbHI+P/aTwIQ2bp6CmpZadbBIHZzLizY5aOjGl6m0VszKZxyiMzsIOUZxZnpoB qZW4Uv+3gqi5rThJJWktN9AkJvLyT9mPezRbZrglc1D2WF8FapxVHNgj7b+1ZLunMMsZ 6Zj+6j2EQd4wno3CIdk1yq86d33IyUZKd1FDr8muhJyBjywib0aJwBynSmbcFDmcxs9B il60HnlUNeSB1UQYr3BIVeeMJLtBHso09fEhmMKp6t17MF3Z+VR7La8KPf382FxZOc4/ 6FWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yTK4l6Ykvzc6k9RKpIP/b45MtLRJEjbQSCPD8FRx8u8=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=Pwr6FgixJl4lp9gbBzCsViLDlBkAJd0h/N+iB2EcLnHK7RULhYSmWAxfXbGjIUtEZp 1SLUvwDORPDWE7126/UzDeQzOQsTqyqlq1SQPuXNOQVCdYs3W8aocIOwnN5mQLFS/Enm BHQV2Q/xVGqwRJZWyb9TZT2DDOZSWvR4BaJcpZwk0EPPaf/ylp2AGkZuZA+oiaa/jmEW 5tIaue8fn4GzAncwlM+Q088JCciZLSVci6IV+CtEpfXf8N5ownKRR7BLtXtTl9U2kAoO XiZMsvqPwwewXEFxZPE2VlfWgBZto8cLwg3uSQJT7yPSlDD4dMaZScIcxYBl82rRaj0W EzQw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TyK9DdyM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b35ca61101si207324285a.381.2024.11.14.13.01.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:01:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TyK9DdyM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgxM-00007b-5u; Thu, 14 Nov 2024 16:00: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 1tBgxJ-0008Vt-9l for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:45 -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 1tBgxH-0007xF-Q6 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:45 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4315839a7c9so9716365e9.3 for ; Thu, 14 Nov 2024 13:00:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618039; x=1732222839; 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=yTK4l6Ykvzc6k9RKpIP/b45MtLRJEjbQSCPD8FRx8u8=; b=TyK9DdyMLdDpCdVXRdDCIUA50tx6gjaIyGyC+TfQPC45tdMvcY3tAmK3323mEddyQq 8Tr+5svujKLfIeZWYnSpgxDnPniU9ll0s+Xtq7G7rLpR8MvtHz3p2MUiLqNveF5nwmHk CgWV2Q9PrdvIx+IljndKDGcF0E+PezDOD8BkaKI2H1TJp7No/4QrMwVl0W60NoP1UoTr t7WzNXx0JGHYkSUg3uwqGR1J5rdUFHd7mZEpnGGwiK9ur8EZ1TyvfQxPXXiBiohPw8lp Y1hlA34jkic2DgivY0FcTjvGcPyj4mEl219hODnHklFJjkkkyWyaKCELK6Sp/Q97JVIM mU8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618039; x=1732222839; 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=yTK4l6Ykvzc6k9RKpIP/b45MtLRJEjbQSCPD8FRx8u8=; b=U/lmuqtFkGqOZG1i4ogF2xWVIdeJTYPXV9XVGEPJpURa/dzuv2zOuekfVywl4kFDP9 T4l4FY2kBvXzmxcCkFDwli4J92bY8QJZfsy62MBI1bwfruIolckPEhH8TNxo4TS/JyIw 3c+Pj7OM1L3A/PaptbpXB5rm4ysvcudUPotlQRqBEhbJAH4NqoOZxI0FD2xGNwL0Irs5 zY2r3GR7fA0A/TT2wKlMRm5fbNkbTydXyYoJy9TIIy5OtvKC/Y0Cm0KkHSYg1oq0Uqcl w/P4KiYnD/joK9AOzEzrb0w+0uutvM+QioDCtIM+G0Od1Z30J3hpROHQGuYHcj7bWEkF 1lkg== X-Gm-Message-State: AOJu0YzSJ2tuZmkH0/4ZQbOD8NhCa6pO3MYlCqwK5aBjFh/+dbVz3lyE XzcHz9cfeYenjuxQ32/Mr/Ooz22IPSUrT3QpjxM8mIsaf9lgbz52RPyC5R1JBYf19Shb46MdYD7 t X-Received: by 2002:a05:600c:1e18:b0:431:5df7:b337 with SMTP id 5b1f17b1804b1-432df7286ffmr1612705e9.8.1731618039000; Thu, 14 Nov 2024 13:00:39 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da27fe73sm35686565e9.20.2024.11.14.13.00.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:00:38 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 03/19] hw/net/xilinx_ethlite: Remove unuseful debug logs Date: Thu, 14 Nov 2024 21:59:54 +0100 Message-ID: <20241114210010.34502-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé 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" -#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 = s->regs[addr]; - D(qemu_log("%s " HWADDR_FMT_plx "=%x\n", __func__, addr * 4, r)); break; default: @@ -126,13 +124,10 @@ eth_write(void *opaque, hwaddr addr, if (addr == R_TX_CTRL1) base = 0x800 / 4; - D(qemu_log("%s addr=" HWADDR_FMT_plx " val=%x\n", - __func__, addr * 4, value)); if ((value & (CTRL_P | CTRL_S)) == 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)) == (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=" HWADDR_FMT_plx " val=%x\n", - __func__, addr * 4, value)); s->regs[addr] = value; break; @@ -203,7 +196,6 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) return -1; } - D(qemu_log("%s %zd rxbase=%x\n", __func__, size, rxbase)); if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) { trace_ethlite_pkt_size_too_big(size); return -1; From patchwork Thu Nov 14 20:59:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843195 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp504290wrc; Thu, 14 Nov 2024 13:01:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUtCU1WZtpPfGIg59Sdxwrkm9mV0itgV6gDPFhDBqgjyYCes/H9wr0felnD6exSfI3eh1t+kQ==@linaro.org X-Google-Smtp-Source: AGHT+IHJlVpY9kBiAcEnNtWHj+emOR9r+w/KzGFXkACIFYPWPVQzPmxRA7F6Sdlirl9d/Wd2vnJT X-Received: by 2002:a05:6830:3592:b0:718:9c32:9fbf with SMTP id 46e09a7af769-71a779cd1f3mr430200a34.22.1731618113677; Thu, 14 Nov 2024 13:01:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618113; cv=none; d=google.com; s=arc-20240605; b=ZVnbGcAylydC2kxuw4ovjZA4HOKf0bVRV6Z8KymKT4lxqy9PQCU9Ol2NO3IweArUl4 7i5+klXPaDHQ4oDaGDKv6NU45qPWUIxh0OV9IQw5vQ5hJBxE8bBAWDuxCkhM/j6AQl47 QcFGLVo5PP42NTmG0FrYNm8MZw/sF++r3lhY4jZMSkdBPhOdmuGxYR7rLkBD0UxsZKBE Pq/Zy/MENziFItjW6zquo0SWXupbuQpfVzLsg58oliKeYXpKMnd+bCUqmYa6ubAYVkIT dO2ZgDlbX1BECVmgP2hBvI1EygU5Ep3VcJjcODWrbdioxDFNvVOpBeYFhmwShaR4SVN9 dFYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GtXVKpSIpZsJQkvyHDSbG39GxcMu+Qe8sXh7gatQ/Yw=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=GQzmPXz/cnkXgFtRb9kd33hy5OE9K44BFm5GHNRU/Raw/Ol+rHZ1TQXWQXCsAbpAej 78eNmSfEao8Mid3JesNBFKZkVSCEDYcIssywo/d2isF/lx977kVgAM7entShpuMCK/03 30pNygXFSt3G+XWv+H6X4f0kG0fr94m+ftNE5rNxJ/0cJWmh9e1Cr6UEVQeZOb4ZHOa8 zTBFk0UQJVlJl2WBM7kv4Dn52tvi0nXifLISClMQBSshnLatfV9SmVAZF4sS5BJ/7zsb jIaIrWY76j4RK9Xxj8SEp9g5DcUR1NoOZIGukj/8li5iLnHcXCsefHcfO2kAYNdyKe4x tl+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OcCip/nh"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ad648634f6si6662137.218.2024.11.14.13.01.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:01:53 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OcCip/nh"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgxV-0000LR-RP; Thu, 14 Nov 2024 16:00:59 -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 1tBgxQ-0000CL-9z for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:52 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgxO-0007xz-M4 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:00:52 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-37d3e8d923fso778236f8f.0 for ; Thu, 14 Nov 2024 13:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618046; x=1732222846; 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=GtXVKpSIpZsJQkvyHDSbG39GxcMu+Qe8sXh7gatQ/Yw=; b=OcCip/nhNJYtRhxSs8lcP6uelVtv/Lp1HC1kFAx+utq7H1B25Yi8fSkkvfama6PNxN VrEUFU+dx/jsmixZ9MQhYvyaW4fUPHKxJt7d+rdtWKWwm4fSKb4i8V8ylkzZxZX7hm+A emNb7R1ZXfyj+m/GOGfb/ssNa7rmG5EButEMVS19TulhJ5enpG724L58ibx4bhpcp0l2 S8RWIJ6zoDnU9d2pgThwvrS+KtM21B8L8csVYUJq3hpz9/bdgwPFGM/1aM+lkhd0fVyf x/lFAvCMDJngG/ghB20cxBv+/6hXH5ulJb0xNQNLOLlxeGX/Lqe0ieGBTiZ2u+MJYXu7 INZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618046; x=1732222846; 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=GtXVKpSIpZsJQkvyHDSbG39GxcMu+Qe8sXh7gatQ/Yw=; b=GRRbkVb4cToqGEt9nfDyUvLrqGpfFRQaDl7zcikYHbGSQUAn5ICs+4zF+WqxkG1aU7 OQoG9RKPf6EGZL3dsIfYCPCAzSj7qC54LQYWOKeMEUfEck3gNdMJlSc2nNDkGiBLIfgS km4r4J+5rmitq16vusGDZyVZG1kbxfaE4bIJphd7iSSBTV5I2IqDbscDclSVRh76bAWV hBAFeLAyg3XoTuA/0kU2W9XjxJ9C4R+2ky0gEkVTFCoIrif5zoTeS+PSO7TKzQT1xMve jiajSS4edFvFTmMADO+1vOiqQKfJ3Nks7qc+WrbkAwBf+gDFe4+GFwbp2+rldDEH7hQz zj9g== X-Gm-Message-State: AOJu0Yx46Rj+7eFRw9iJycloPffBT/k2q6/Yk1JVFqRM5qaw7KCOEESi jT9XvWsyCTSJbASCrvs418ko8NuIQuY6UL2quAdCW5IQzgbf6IiKiLiBIlzs2ZMJWi2vI1vLXhv u X-Received: by 2002:a05:6000:460f:b0:381:f603:73f2 with SMTP id ffacd0b85a97d-38225a4a6f4mr142215f8f.35.1731618046233; Thu, 14 Nov 2024 13:00:46 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae311fbsm2403600f8f.95.2024.11.14.13.00.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:00:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 04/19] hw/net/xilinx_ethlite: Update QOM style Date: Thu, 14 Nov 2024 21:59:55 +0100 Message-ID: <20241114210010.34502-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use XlnxXpsEthLite typedef, OBJECT_DECLARE_SIMPLE_TYPE macro; convert type_init() to DEFINE_TYPES(). Signed-off-by: Philippe Mathieu-Daudé 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 #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) -struct xlx_ethlite +struct XlnxXpsEthLite { SysBusDevice parent_obj; @@ -73,7 +72,7 @@ struct xlx_ethlite uint32_t regs[R_MAX]; }; -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 = opaque; + XlnxXpsEthLite *s = opaque; uint32_t r = 0; addr >>= 2; @@ -112,7 +111,7 @@ static void eth_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { - struct xlx_ethlite *s = opaque; + XlnxXpsEthLite *s = opaque; unsigned int base = 0; uint32_t value = val64; @@ -176,7 +175,7 @@ static const MemoryRegionOps eth_ops = { static bool eth_can_rx(NetClientState *nc) { - struct xlx_ethlite *s = qemu_get_nic_opaque(nc); + XlnxXpsEthLite *s = qemu_get_nic_opaque(nc); unsigned int rxbase = s->rxbuf * (0x800 / 4); return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); @@ -184,7 +183,7 @@ static bool eth_can_rx(NetClientState *nc) static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { - struct xlx_ethlite *s = qemu_get_nic_opaque(nc); + XlnxXpsEthLite *s = qemu_get_nic_opaque(nc); unsigned int rxbase = s->rxbuf * (0x800 / 4); /* DA filter. */ @@ -214,7 +213,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) static void xilinx_ethlite_reset(DeviceState *dev) { - struct xlx_ethlite *s = XILINX_ETHLITE(dev); + XlnxXpsEthLite *s = XILINX_ETHLITE(dev); s->rxbuf = 0; } @@ -228,7 +227,7 @@ static NetClientInfo net_xilinx_ethlite_info = { static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { - struct xlx_ethlite *s = XILINX_ETHLITE(dev); + XlnxXpsEthLite *s = XILINX_ETHLITE(dev); qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, @@ -239,7 +238,7 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) static void xilinx_ethlite_init(Object *obj) { - struct xlx_ethlite *s = XILINX_ETHLITE(obj); + XlnxXpsEthLite *s = XILINX_ETHLITE(obj); sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); @@ -249,9 +248,9 @@ static void xilinx_ethlite_init(Object *obj) } static Property xilinx_ethlite_properties[] = { - 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(), }; @@ -264,17 +263,14 @@ static void xilinx_ethlite_class_init(ObjectClass *klass, void *data) device_class_set_props(dc, xilinx_ethlite_properties); } -static const TypeInfo xilinx_ethlite_info = { - .name = TYPE_XILINX_ETHLITE, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(struct xlx_ethlite), - .instance_init = xilinx_ethlite_init, - .class_init = xilinx_ethlite_class_init, +static const TypeInfo xilinx_ethlite_types[] = { + { + .name = TYPE_XILINX_ETHLITE, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(XlnxXpsEthLite), + .instance_init = xilinx_ethlite_init, + .class_init = xilinx_ethlite_class_init, + }, }; -static void xilinx_ethlite_register_types(void) -{ - type_register_static(&xilinx_ethlite_info); -} - -type_init(xilinx_ethlite_register_types) +DEFINE_TYPES(xilinx_ethlite_types) From patchwork Thu Nov 14 20:59:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843196 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp504319wrc; Thu, 14 Nov 2024 13:01:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWBUmzrpGdaT7cmov/saT4ibm2LvFuDGlsLP3CGeRQ7OxOOurVCsgIBk2+UE/b6n+E6Sebu5Q==@linaro.org X-Google-Smtp-Source: AGHT+IG1w/21jzUYXE+D5Anj+qxdukGWZ+J5r9IYpXm7eheTxnn5Z6fivkmWnbf/UASMXUTvWp8F X-Received: by 2002:a05:6808:1a2a:b0:3e6:569e:4601 with SMTP id 5614622812f47-3e7bc7a8ef1mr382654b6e.3.1731618117479; Thu, 14 Nov 2024 13:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618117; cv=none; d=google.com; s=arc-20240605; b=J5Vt+/ziPgfkaZGWD3BbOGQdbLOQ32AiPm2Ph8X8HfVOVZmgVfg6jUqCD6IXgddlS+ ErOP6N2WRaOwEmvjmCVa3N9tBQ9xQsom/eIt4stV3Fcirn3XRYOLhxFYQf1ThfzpP4ix nfiBkVp4584yKJJqhylGSBzYKOwXxTxmyDOsjsZeffZHh/2xdGkNvtrDRjCeN7zDDNzq RnHcH1CKYabpXHd2WcmbWd9rlrJOIEdt/aQh6lMRVsccUAyt9EMxs6hIpVCxPmq69mDx U9qsstBB+zaI6ARCwzgxbFGQCPAVKoMvRkYWyFc6M8tDnYPL05zDHu1QFTqx9cuVIgN8 LgKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wG+1NC98eSptDZUHUCzND7zjX1Tqst1VgWsS8j/5siQ=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=hMWXogueVYpuM0ysokIABS1Rl1BihawVzLItVNhCw6AY+6lUbsJG03agCCgF1Bf4s8 C/l4p173W4ZmpEoHzeFRaKLT3ivGV8JckgXETprzjS+5nHSNoGeGDOaApk9hJZRnPdZT 8cHJJkx63n43Bs+joxaHcNT6g9JnzZQgpGvAOMFRBIsCZq1cymtBScK+VIREcMS8VOyU fH2/IlU5iMkOCiCH9FVfHx/dnHe3dlVLJxclQqN2SoluU3oxu9C6dX1QhWIOy8wjdZxZ Y+tJ4pO+oGau+w8eJEvowiEdcxsy/pKVBE3Stl+/x1L+mNrPHB/KJrbIUILjMS5uJaAd FzGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PLHF8DTF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ad646f6008si9620137.78.2024.11.14.13.01.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:01:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PLHF8DTF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgxv-0000ZU-7w; Thu, 14 Nov 2024 16:01:24 -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 1tBgxZ-0000Nn-8C for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:01 -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 1tBgxX-0007zZ-IJ for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:00 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37d447de11dso18963f8f.1 for ; Thu, 14 Nov 2024 13:00:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618054; x=1732222854; 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=wG+1NC98eSptDZUHUCzND7zjX1Tqst1VgWsS8j/5siQ=; b=PLHF8DTFh4adtJPQ+/g9H9pbrTPsO8PfRFaNY6YPGJMBGyVsFqplpj5TfPGC9pFS7S CsR1SJERx0U33ypYV7nAgco0w2rlUCUJTkiIMGjhp08Yf3oePBBZp2lc3Nj7k+JDGgCH jkTtZ3CI7BFThD4kyF/H/dhxBw0jzsORCcP7xDHJUKt2630PTD14jq7zTB9eMY/3RxbF /l7FjwLpvQjsbd9qJ7pBSIALS7UWmC3SRnrqYjAr11QKgrKR3jaidxJy73QiK8S4AR8U y0lnbfp4sAQMvdsgtsgnq5zYxBeK/3rVP4H1lWRm9tsOVISIwNiBC7ehCPtc2BnaDl0N YYIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618054; x=1732222854; 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=wG+1NC98eSptDZUHUCzND7zjX1Tqst1VgWsS8j/5siQ=; b=w0XnlEeIQN2FLAoTVCaDFf67TjfAVhXdvYioNaDc2asmycfNqwWhtkIMnkx2Pb3v5v IV59MRZ0s2CjzoRZyDHIp2Kq7rLesHX8m2Uqg8muT6yb8OWeykiLh14Q6khaYtDQCHsZ l8yUDmAnf4XPtc3GJkMIyNMdoo2inFYEsJaDUHXv7zbUvjhH0Ryhq3X2nW9ZoJLjaVvh XiFkoep4jYWys8L5VInS1O+neMWcm3iNTb3f7K7ARxyIlbcp7DQG+C1EySYaYgZC6LeS 3oeLBtID8Ngc+JkBVU6GrNfb0qGNHmAqjeChBJ1L58ZxSiiXj8OSENBwxBcqHxAiJx1D 0qrw== X-Gm-Message-State: AOJu0YwoSDYx4OCdTBbajn+x1TtFmzexdf/Mx1TpaRzA8ZmawtkrPmEs vPtwNzL7KbRuHZ8dOQWlgQvJZnrqlTSx7Y5eGU00say+c7NufvHg/NmYNMCanSyhL8C5db8iRsQ E X-Received: by 2002:a5d:6d01:0:b0:37d:4d80:34ae with SMTP id ffacd0b85a97d-38225901fe2mr147742f8f.4.1731618053653; Thu, 14 Nov 2024 13:00:53 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adbbca7sm2492439f8f.47.2024.11.14.13.00.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:00:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 05/19] hw/net/xilinx_ethlite: Correct maximum RX buffer size Date: Thu, 14 Nov 2024 21:59:56 +0100 Message-ID: <20241114210010.34502-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The current max RX bufsize is set to 0x800. This is invalid, since it contains the MMIO registers region. Add the correct definition (valid for both TX & RX, see datasheet p. 20, Table 11 "XPS Ethernet Lite MAC Memory Map") and use it. Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daudé --- hw/net/xilinx_ethlite.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 0f59811c78..0df962cd22 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -3,6 +3,9 @@ * * Copyright (c) 2009 Edgar E. Iglesias. * + * 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"), to deal * in the Software without restriction, including without limitation the rights @@ -33,6 +36,7 @@ #include "trace.h" #define R_TX_BUF0 0 +#define BUFSZ_MAX 0x07e4 #define R_TX_LEN0 (0x07f4 / 4) #define R_TX_GIE0 (0x07f8 / 4) #define R_TX_CTRL0 (0x07fc / 4) @@ -195,7 +199,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) return -1; } - if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) { + if (size >= BUFSZ_MAX) { trace_ethlite_pkt_size_too_big(size); return -1; } From patchwork Thu Nov 14 20:59:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843200 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp505093wrc; Thu, 14 Nov 2024 13:03:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWiN/1XL9YZwjSxOmkPRzbpZ+Xr7FjG5xnmmo/+J2rb1sepCUvQi5Cc6h/6nl+4cdgygQ1FfQ==@linaro.org X-Google-Smtp-Source: AGHT+IF5dhPSxII6llwiS7Tfj6Qi0fkbS/j0rKM4hG0frLRxjX1okboBVS2eXjMe3wZdV9ZCrO4u X-Received: by 2002:ac8:5f0b:0:b0:461:190f:98ab with SMTP id d75a77b69052e-4636350bda0mr9116231cf.3.1731618195774; Thu, 14 Nov 2024 13:03:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618195; cv=none; d=google.com; s=arc-20240605; b=ANrOfvKEbzyelc73dmFK7AWAnWPHumqE3n6MftUw8IussmnBbU7At6ZzY9IoPI6fvG Gr5yDyfHr4Ck+Hk7UbCbU19kAOzcvDYLIWkIujpo5tPbILYw7YjHYEzcKARaEDIOmie0 X9F5bRKWOzLIfL6jz7j8CQSJjIGF3hLJ8sFzY9uVKHa4gHq9Zs4JDVFy4rb4q+0Knt+l 6c6BlFcdY090l4RPcjk8mjX1N6AzccISuRNJ56san/YLkQ94wJm2cezTdVhYr/C0M1Dc G3jV8cTMye/oqla4dHp+zbFTPGGSVNMAX/aCO5u8UHDoNGCie0JF9tlzp1Tc7gK92W2M SXjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w7oaVYUllzOyksXJ6qk0wfeCGOBTZK5l45Wvi+e1fAY=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=X6zAdC9D/nLG4KO1n9lG30AsSyVlOQerghUzW1rZcfrRuaaclYcBbiomUrWwOzYzFl h3zHFwp8E+tWY+qWOCYyM7UKxubXTEgAaGfZG/2i6i/lcY478rCgVZwL4OA08HtW1LcN idgeLiHN1BQbkOp/CaSjm+it73GFNntjb4mCpOpjQrJK9yE6sBe68PrZC0G9pyLC0YDg S4lq++BGf2VDS67CQTImso9tkiSb1gld8BUy/zhhYiJFKPRX93AszR2302qcuugCxvyt wnzhgq72y/1J2Vu1nB+sGKReAJWJRLTxUUvkOqZ8Plu8nWVN5UtdabZ9Iw5nS+bxqvFC KKWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SQdtn/DO"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4635a98d2dasi20657561cf.139.2024.11.14.13.03.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:03:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SQdtn/DO"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgy7-0000pc-RP; Thu, 14 Nov 2024 16:01: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 1tBgxd-0000ZR-Vd for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:07 -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 1tBgxc-00080P-DM for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:05 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4316a44d1bbso130685e9.3 for ; Thu, 14 Nov 2024 13:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618061; x=1732222861; 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=w7oaVYUllzOyksXJ6qk0wfeCGOBTZK5l45Wvi+e1fAY=; b=SQdtn/DOCu4HhcM4Zfw5Au3sWhe9VKBJIDA9iK3KcfzRGq9OQHeDip868oGqKFylXH T8aXTJ0/l16tDBlmHX7Wuvw22PH7+E1BePuL2k4SsPfAzuTOaQkxMoY8XRYQU2CT7Kew xuKb3S6cjW8pb7X7te3WaJMDhXQ5ERjXmyBEUk6O0BxG/Yo+WqIfIMsGb3sa04b8SeOu nuPz+ORei0gVE+S5d4UaZWFVoH0WRZIJIpSAngZzKdbeqDmgtbdlzVepXCinfMESbeLM TYEAk/NEISh5DBSHAtTcoZaXe3S41CYMyUwS9VwxJtYOXa6s4jT49lOQ5t2CK1NGzZss I0Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618061; x=1732222861; 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=w7oaVYUllzOyksXJ6qk0wfeCGOBTZK5l45Wvi+e1fAY=; b=rBrTHeUWhsE46Fc14SqzOJwqENF+h+1N50Z1Jsc7J9mWEatcb6BO9zm6H8Ar+ibC5j 0klThYDKPwEvvT6JAZbSi12WOxugt6WvbN+q9b5acZMTrONq+hftX21mp7zo80SzypY1 BBEq0/KUdIptC9I2h9PJPK472OsIGLRKmb/YzQDRRhHdPRVhxsOlENSQtxbiTKezMMvd lUgbGQakYj2YeLzdBlXLwwduKkBJCZO26JhU2bQ+W4A0eCPPc8vekMfub9O1ZKg3uxwU +3srKTTk/HeonNA/5JJ5GR4XJDoZ7W5xNm83Ur34OZL7mBRTEWAWPqJSIfjxmsu8UMAF uEwQ== X-Gm-Message-State: AOJu0YzqrfUEIXYEHLZhCU5k0qjMfziPZgfgDxO731uemjzp0WxcBM+E 5TWze/NE3V8PtnV1cu/NzvcuHnUIV+SUfc90ty9IET7pRdI4iBD82Y3j0LWRu3cEBnQ9nzuVJWz l X-Received: by 2002:a05:600c:3b03:b0:430:52ec:1e41 with SMTP id 5b1f17b1804b1-432df74de50mr1780655e9.17.1731618061061; Thu, 14 Nov 2024 13:01:01 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dac1f94asm32089465e9.39.2024.11.14.13.00.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:00:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 06/19] hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented) Date: Thu, 14 Nov 2024 21:59:57 +0100 Message-ID: <20241114210010.34502-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than handling the MDIO registers as RAM, map them as unimplemented I/O within the device MR. The memory flat view becomes: (qemu) info mtree -f FlatView #0 Root memory region: system 0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite 00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio 00000000810007f4-0000000081001fff (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007f4 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 0df962cd22..8de3131408 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -28,15 +28,18 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qom/object.h" +#include "qapi/error.h" #include "exec/tswap.h" #include "hw/sysbus.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/misc/unimp.h" #include "net/net.h" #include "trace.h" #define R_TX_BUF0 0 #define BUFSZ_MAX 0x07e4 +#define A_MDIO_BASE 0x07e4 #define R_TX_LEN0 (0x07f4 / 4) #define R_TX_GIE0 (0x07f8 / 4) #define R_TX_CTRL0 (0x07fc / 4) @@ -73,6 +76,7 @@ struct XlnxXpsEthLite unsigned int txbuf; unsigned int rxbuf; + UnimplementedDeviceState mdio; uint32_t regs[R_MAX]; }; @@ -233,6 +237,14 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { XlnxXpsEthLite *s = XILINX_ETHLITE(dev); + object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, + TYPE_UNIMPLEMENTED_DEVICE); + qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio"); + qdev_prop_set_uint64(DEVICE(&s->mdio), "size", 4 * 4); + sysbus_realize(SYS_BUS_DEVICE(&s->mdio), &error_fatal); + memory_region_add_subregion(&s->mmio, A_MDIO_BASE, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0)); + qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, From patchwork Thu Nov 14 20:59:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843209 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp506076wrc; Thu, 14 Nov 2024 13:05:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXVTy1kfHY08K2Fi4ba5L8trTWjtO6hVa325Kh+zFwvAOJNuVaU5QktxngC1LuYU2mj6lttrg==@linaro.org X-Google-Smtp-Source: AGHT+IG0Fhi++HdDlLuCn1XDpPFvtPbMZozbYHzqMH4w9GB8aPvQV5PVLqAI28aWQEBq9yfpzv5w X-Received: by 2002:a05:6808:f06:b0:3e6:2889:5fa7 with SMTP id 5614622812f47-3e7bc85401cmr369225b6e.27.1731618310673; Thu, 14 Nov 2024 13:05:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618310; cv=none; d=google.com; s=arc-20240605; b=VPKUTutN7t6mQ0g775nrj0K4FWUKmTHc4Wdv6mcwyQL4usT4sz5eQQIMOGfPQOYxlv 2u5cs2XX4UXrWjHEnUw8154cYA5uLWCd9qCI6SFiHPul78aQbr0ChtKK7fQLAUQlUFNp pkzGHcQMUIEhXDmb0diULf4W4/6cniI1/rBEzEmaHJEEGNDXkiJRadxsBQ3vOzkRcr6/ aclf3Sz/FqkYTJtMwzIHiEgP4k4GCAxBQzU8UmzSVT7z135yV2Ax/znHa3gIc4q+QPLq XLuCSuR71EdDkAjgo5YdJub/uRp9JWfmrdj2r2RNGvA4qEe7XdLdOrjsmBRYikaEHD+v 3iyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7vs9ivF9siaWRamWv2mgjjJCogSIQAiZCiYH/706wGI=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=A6M0/3DJixW2v5lGgyFLDqj8CsH1Bocky2Iy+HUYIwKaic1yT8GUYFKOOgdG34u2ZO jc/7VhEm6s3/EsdX9UWtnBJf5zMh5p6ykvcGAZ93484a9Hvadq/lBV+gqU0g0vzmqfrc S9fX94G0+ARJLiZnJoVPvWI1N0jt0CrP93Vg3QeciLqZoMmTGPaZk2pEqJjpjwSs7CTo 0R66mlyBEdWGkSLVwnUvbxotbnDvyScxbBZNbyikL8BpNcrmerviX1qmB0v9AxoqWJaY zunqkTkv1doZrGS0a7ZvCuG0f+OyWXUSNjbCD2dDF46b/zkQ1XnZYjaoIzUFb66GCVZH 5l6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CES7arhh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51479ccb5casi27839e0c.279.2024.11.14.13.05.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:05:10 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CES7arhh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyQ-0001Yn-0v; Thu, 14 Nov 2024 16:01:54 -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 1tBgxl-0000hj-Ni for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:22 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgxk-00081Q-7Q for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:13 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-382171e1a83so779688f8f.0 for ; Thu, 14 Nov 2024 13:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618069; x=1732222869; 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=7vs9ivF9siaWRamWv2mgjjJCogSIQAiZCiYH/706wGI=; b=CES7arhhgG9nZYxKTyw324Pcg3sZRE2UhT17gN8kxW3ZXcOU3tTWvbXqaS23CtZ/+d twbkQzaoHbHiGaoI2hyk3RotoUhQ71np4Fk5CIaK9VrSLUXxgh1HnThJhKwgCqnAyr2B XxxR+Omk6wahPzTl/oknfd1epaJmn9hz/KVHgvhMRrqvJ6fYUNwkqYV9Za4vFMiv5p13 gryqhuOZ2t2mLXT9Jx8VGtwZYrvPcryWaQgenUtXoBIN7Dwrw8dD+WLGv709lu9OK5gI NS/Ewfkmo4NegJeFBU0CSXLoEZwu8LyLieO0CxH+GPDw9qCjhuv+SkQ7T0es0FXCpDcZ Q7yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618069; x=1732222869; 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=7vs9ivF9siaWRamWv2mgjjJCogSIQAiZCiYH/706wGI=; b=hXx6pUim4JavA3v3rcfxByC0OKjihUc/hmi8GFNOjrnT08HLPxR4g9Oh2MRS5Mjkhw 2SNlfF122YYr3NjHbduvBjcXNReLYUagNi0BJXVIJFKfhy6QxP40uTxui0Nd9QCy4LgU 7uy1vdvT7gDKUVTs0mZ2YwglOolV+nM3qnrnDVfM+Kl7Lww1xguMjMXwIOlIXDSnKgai vdWBzzoGd+mH0fA4eyZ1b+YYSIaPwy2OL9sR0C+1cfBc9vUP9ng7/aFT5iix2mkIb6FM 7HMMfNFwR+wY4p6h4nOpICkOBUCGQK12J+f2TFcKUY4ITwBnn4zGyRn8N6pGQH7tESer 2uug== X-Gm-Message-State: AOJu0YwmTRD4tITpVa/KupJ69mH8gKRSxnaaE+ked39tywkZcSIIETLf iJyLsG53VhuPZCwyIvaydo+jJePJCrzD9+UFgB7lzo4axRNfSx/sF8F/49Gwd25HiqTFSWFJe1N F X-Received: by 2002:a5d:59af:0:b0:37d:43d1:2064 with SMTP id ffacd0b85a97d-38224fd2443mr330814f8f.30.1731618068708; Thu, 14 Nov 2024 13:01:08 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae154c3sm2442016f8f.67.2024.11.14.13.01.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:01:07 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 07/19] hw/net/xilinx_ethlite: Rename rxbuf -> port_index Date: Thu, 14 Nov 2024 21:59:58 +0100 Message-ID: <20241114210010.34502-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 'rxbuf' is the index of the dual port RAM used. Rename it as 'port_index'. Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daudé --- 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 8de3131408..7a14f4edea 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -73,8 +73,7 @@ struct XlnxXpsEthLite uint32_t c_tx_pingpong; uint32_t c_rx_pingpong; - unsigned int txbuf; - unsigned int rxbuf; + unsigned int port_index; /* dual port RAM index */ UnimplementedDeviceState mdio; uint32_t regs[R_MAX]; @@ -184,7 +183,7 @@ static const MemoryRegionOps eth_ops = { static bool eth_can_rx(NetClientState *nc) { XlnxXpsEthLite *s = qemu_get_nic_opaque(nc); - unsigned int rxbase = s->rxbuf * (0x800 / 4); + unsigned int rxbase = s->port_index * (0x800 / 4); return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); } @@ -192,7 +191,7 @@ static bool eth_can_rx(NetClientState *nc) static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { XlnxXpsEthLite *s = qemu_get_nic_opaque(nc); - unsigned int rxbase = s->rxbuf * (0x800 / 4); + unsigned int rxbase = s->port_index * (0x800 / 4); /* DA filter. */ if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6)) @@ -215,7 +214,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) } /* If c_rx_pingpong was set flip buffers. */ - s->rxbuf ^= s->c_rx_pingpong; + s->port_index ^= s->c_rx_pingpong; return size; } @@ -223,7 +222,7 @@ static void xilinx_ethlite_reset(DeviceState *dev) { XlnxXpsEthLite *s = XILINX_ETHLITE(dev); - s->rxbuf = 0; + s->port_index = 0; } static NetClientInfo net_xilinx_ethlite_info = { From patchwork Thu Nov 14 20:59:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843197 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp504621wrc; Thu, 14 Nov 2024 13:02:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUI6RzazhkE/qeh9APxTZfIKP7F66djNkbGDAmA6QObslJucwM+DCEoLcWpa9IUoj9swq61tw==@linaro.org X-Google-Smtp-Source: AGHT+IH7ttJcXFnM8JKjTszT5ZSziqCaf0St8YGABtHmBlLzzlR9YSmVXtZVEqtkvBLyTYBs2Hgu X-Received: by 2002:ac8:7fc6:0:b0:461:48f9:44eb with SMTP id d75a77b69052e-46363e23ccdmr3470391cf.25.1731618146819; Thu, 14 Nov 2024 13:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618146; cv=none; d=google.com; s=arc-20240605; b=PDGgYJSMY6a6dMyTG3FqOpYkTPRujb07QZ2B92XlL/3g7kGGMWEmVYnXy2oTURVF/e CQ1Zm+4mzGr7ogeXYplAFX68MK1mqjEP3HCbfkkzIaMHy6iCVwWM6chfLtGVr56uZg9M IYoYbdyr38f6olC7LM60nr+3ODsvmEbwkqHe1ZAWVBiCTbzj+Q8HMzTraalXDoe8an+S ktVjLbkFZRWA5KPI1+h5JHYTbkO/IYZSrBo6+bO4ztW5hPicJ1J508du5mDUAMB7ofur GKeh1/p/jtIWUXCeYyN2k76Vao1YZpN4DCAqo/upuXUNw/ivVBJG1gCiazvOC+WJJ1ZK 9wAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N6+gSXBoOBmz0VjYZ13ccRnCNyVzdwJCJ6CvUinNnmk=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=Wp+4Zo1BLBvXxxhp35bd7XfwReejiQf2BP/9o5efE98HKXhNHd6H/KQLCEpjk9Tgw3 Pvj1IV9kUVYspqw31t9rTgViJOuw2Bpl1yd/vPpY0t1grdVw/9TihUZN7Yiug1rxC7Bd Ruy4JeunILr+0ScTOQj3ItcQC0B4PBmkgK+Z9wJW/10IAxUTPLMZHutxZvxkuTQKMG6y tbifXAg7+VMFrODiiLO/6uBivCHfk57y5/Pr/nogMQ2qN6WX5ZsEEZeeyKI87JgjEMRp ktu5QqLRzJCrYhU+aRNTRebSZfChGbIs42o/H9Xx9HnWGQBPG6vQsxziRQfaQ2frJwLb wTZg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PlE4oywo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b35c970810si188396085a.77.2024.11.14.13.02.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:02:26 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PlE4oywo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyI-00011O-BU; Thu, 14 Nov 2024 16:01:46 -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 1tBgxs-0000id-Hx for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:24 -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 1tBgxr-00082H-1J for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:20 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-382242cd8bbso159185f8f.1 for ; Thu, 14 Nov 2024 13:01:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618076; x=1732222876; 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=N6+gSXBoOBmz0VjYZ13ccRnCNyVzdwJCJ6CvUinNnmk=; b=PlE4oywofk4ddAaqv3b+ARg1DHZbkgWBNhTR6TEAq0jh5WRAzM/CK03j3oSzHXFTnZ bL4uACj45+PNJbqNI6GoROV2QjPABkhjTwRBkM6vniILaNqZsF3MCNHnxKujSpfYGEBX f/pYQS4Jjs/+gSIe0D9CahCXlvLpGFQHF7szo0gnwIOCvwkkTwINatsetmO4oqDibG8s sNvYfYX5BMzkJku1KZv13uKOnvpmYRWtiThSR7JcLqAM3f4QbY9+rgupAdDSOtV23/Sh 92wOD4mywj8w7XNAEXgIfVOxvfRv8xU9xsxDnyuajq1rhZDi0MxM5l2x6AdgVWmJwpih 8aQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618076; x=1732222876; 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=N6+gSXBoOBmz0VjYZ13ccRnCNyVzdwJCJ6CvUinNnmk=; b=fV5vr/JHzpOnVfv6VAxZq5JArDV1TYC97V0bJqYz91Anocwlr2ytXg+bOe/cxoPjfI FZDYc9H2OcFN6bUu2GuWn0JH/V4VSq/5Oden2nZon5W0uDNFEqH6PVHipMWeqaurLbLg +Fk9X/YK4eRIKB1TYX+Js7BTOPGZOc+z9U+0c9RsqRCK0DF5wLuSTWm0E26AVHi7M65a TQamd/Fw6DHLRy7+sM0c7YyjYta/9HZ+x9PNQRkNn3jQGB9jhEm+lBCWTAMl85+WoENn STHjWelJmvamCjTqkJsQi7YjyMzmAGTSmpYVCwjYu6Qdb31WHw0vQ4DoK6LaAPwdTY7Z 7t4w== X-Gm-Message-State: AOJu0YwpLbj2Yo40zrtgXHBiUKvR7M2s1oAECi9jEdIMUlJ7wwmmSRyI cpq4gW3F4WnINd66qAV0HN2vwdEtOfXxs4HN0Il5AWJ/J6IGjzL7Iqt/ikLnc/QevlmqVb7UJEV M X-Received: by 2002:a05:6000:480d:b0:382:24e6:fce9 with SMTP id ffacd0b85a97d-38225ac4abdmr145054f8f.58.1731618076339; Thu, 14 Nov 2024 13:01:16 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae1617bsm2481527f8f.72.2024.11.14.13.01.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:01:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 08/19] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper Date: Thu, 14 Nov 2024 21:59:59 +0100 Message-ID: <20241114210010.34502-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org For a particular physical address within the EthLite MMIO range, addr_to_port_index() returns which port is accessed. txbuf_ptr() points to the beginning of a (RAM) TX buffer within the device state. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 7a14f4edea..21ce2a112c 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -27,6 +27,7 @@ #include "qemu/osdep.h" #include "qemu/module.h" +#include "qemu/bitops.h" #include "qom/object.h" #include "qapi/error.h" #include "exec/tswap.h" @@ -87,6 +88,18 @@ static inline void eth_pulse_irq(XlnxXpsEthLite *s) } } +static unsigned addr_to_port_index(hwaddr addr) +{ + return extract64(addr, 11, 1); +} + +static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) +{ + unsigned int rxbase = port_index * (0x800 / 4); + + return &s->regs[rxbase + R_TX_BUF0]; +} + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -119,6 +132,7 @@ eth_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { XlnxXpsEthLite *s = opaque; + unsigned int port_index = addr_to_port_index(addr); unsigned int base = 0; uint32_t value = val64; @@ -132,12 +146,12 @@ eth_write(void *opaque, hwaddr addr, if ((value & (CTRL_P | CTRL_S)) == 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)) == (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); } From patchwork Thu Nov 14 21:00:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843198 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp504832wrc; Thu, 14 Nov 2024 13:02:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXuvx1aHuTjlhc+yOs4yGSs/E4LCb31dwmBu7qbwJN6Pd8PKgGef/Pw5Tvc3srFqrjiiI0EbA==@linaro.org X-Google-Smtp-Source: AGHT+IHsbVfpaQStGp285N5uqDv4nkgE0pqz5J0GntniRaObquzeZTFwgynz5UPfZ1VaBjem/x6v X-Received: by 2002:a05:622a:1654:b0:461:2a3c:c1f with SMTP id d75a77b69052e-46363ec8e05mr3699331cf.52.1731618168385; Thu, 14 Nov 2024 13:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618168; cv=none; d=google.com; s=arc-20240605; b=C2I2pN785bXi/aa6k1yq8nG1Yt2y0/BoLuXQiIVkglqH6zl21SIaV/pBDNvxlb+DB3 jTxDEE5N0NLtfWbbSzH3/LPgkgTVihJkxeG2XO3nnC3RLEE9gWrLJhP57BQanEObJy53 gl7dpPKJnC3ng375f2mRDlTddKR/5Ckv14NQb97rprNfzhhKlJoIH5P4RGyUgYPwhk1G 4K9eXGynDQ5RisS9WrQh7Bn0ycVTo2RJZdN+ag3flaJOzPWXlL6rE1uE1vEWZ9bXQE7w m/rL6yJR7SuFL7hBmP/cNDKnv3+StdGllDAfcxwnfYeu9WWojvGe+2lGHeQr0CBDt+F/ ZN2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dRoZ7cwroZSiGL3yaDx0dNBCN/zDvjhHMaiZQ6yO+wI=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=iz6PUDcXKCJSnvLv2jiyqIf2SJfjzyh9xJXXzPp6Rwd00yIOwcP9hhGixINeaBA1J6 MnU+1LCDfcrx6oUrAf9VobUm5PKAYV3sr5usXWA1CUxFFjtHnyB2l6I9mpw/Z+LBfxeh TGFJ5GRQWyAsd/wbOLH7E7oABXpdHwqEI7NMZSsFwx0WEPmDqo5c4fHWqDggwVThY2IT y+0Jp80HN4ZFNzrwEUFPOavU02723PevfzmJKWM+RJaNsZh/UUCxecPfkF8uz4G4BQk8 P0PQzeQp9zkw3U2A92l+fqc3kHP5/qkS4kh7gIsYJq1dpAetwsWMEfDgWJKo3meg+UeM 1VSg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dNBagkX5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4635ab30728si18036931cf.536.2024.11.14.13.02.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:02:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dNBagkX5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyP-0001Us-16; Thu, 14 Nov 2024 16:01:53 -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 1tBgy2-0000vd-UL for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:34 -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 1tBgy1-00083i-84 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:30 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so196405e9.1 for ; Thu, 14 Nov 2024 13:01:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618084; x=1732222884; 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=dRoZ7cwroZSiGL3yaDx0dNBCN/zDvjhHMaiZQ6yO+wI=; b=dNBagkX5m/FX7t7T5jQoZQhUA40uCypjD5dZzCYGcBQjMlwKuG8kUEXdvCuY4HEhDm qEhzVZSMzvT+/f3cN39lTtiKoVJ3yJwMYklbaL6GccDNcZBoEGbisVJ1IlYBAy7SNA8A 2w11FYXgboJu3XxX5zaVg4TYsJcaplp67BJLZzq3EoYQMNkpUkWB3J+ppp4Z/C6H6xt5 kK7ZUNBlMWSxC+x4g6SHjCE+OcQHcRf7FGn03RvfkdCReCKfyjbjv5IUzv4Wk7D0411y 0oaQNuXS9zUlwSl6QY7toIDVU6sttt+gXF6QapwDEAAIuQNaroUH5PVL9xnWYJIDRtBv nmAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618084; x=1732222884; 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=dRoZ7cwroZSiGL3yaDx0dNBCN/zDvjhHMaiZQ6yO+wI=; b=MMzd5qJJ+GawgBYprlVlqY/LwP0XjpH75ya/kjs8BOtOOnA1K1YqvKQxM+S7Iqg2Nr ta8JiRhyQf//8yMaszpua0w5dMquV6VpB+WyL5ug1fIDLxPiU1CaZ9GWFA/ZXorSBu7a IOJhgWWoPMF4HB8BzjN1niFa74OB8e1RM8pAj6CXuqaIXns9Qir33GBgwSOUL2Pi6xqo OhozjU0gAhP85IyzcF+g+gpxB6AE74WsUOMze9K5yRshFKF4NC0IBJhNU4QhGlcV9rtG 5L+JktbCH3L/Tfsrn5eycEpjTb9lRgdXGYcLv8YlClQ6m26ow8V/wrO+htq7MR7staog LE/A== X-Gm-Message-State: AOJu0YwdBd1uBTA3odIA0+L3DE/yhZaN+xYrR3/R7mNZUSXACUhlgmuA TwvYGhW0JQaGoJ14PucsC52BUwvMzgA9heWLJiSEFwLj1POpkRhWExzLos2cpGFdIFRLq+SX3v9 I X-Received: by 2002:a05:600c:4e08:b0:431:1512:743b with SMTP id 5b1f17b1804b1-432df78b038mr1278145e9.21.1731618083769; Thu, 14 Nov 2024 13:01:23 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adad238sm2417922f8f.25.2024.11.14.13.01.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:01:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 09/19] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper Date: Thu, 14 Nov 2024 22:00:00 +0100 Message-ID: <20241114210010.34502-10-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org rxbuf_ptr() points to the beginning of a (RAM) RX buffer within the device state. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 21ce2a112c..a993cb8bb9 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -60,6 +60,13 @@ #define CTRL_P 0x2 #define CTRL_S 0x1 +typedef struct XlnxXpsEthLitePort +{ + struct { + uint32_t rx_ctrl; + } reg; +} XlnxXpsEthLitePort; + #define TYPE_XILINX_ETHLITE "xlnx.xps-ethernetlite" OBJECT_DECLARE_SIMPLE_TYPE(XlnxXpsEthLite, XILINX_ETHLITE) @@ -77,6 +84,7 @@ struct XlnxXpsEthLite unsigned int port_index; /* dual port RAM index */ UnimplementedDeviceState mdio; + XlnxXpsEthLitePort port[2]; uint32_t regs[R_MAX]; }; @@ -100,10 +108,18 @@ static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) return &s->regs[rxbase + R_TX_BUF0]; } +static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) +{ + unsigned int rxbase = port_index * (0x800 / 4); + + return &s->regs[rxbase + R_RX_BUF0]; +} + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { XlnxXpsEthLite *s = opaque; + unsigned port_index = addr_to_port_index(addr); uint32_t r = 0; addr >>= 2; @@ -115,9 +131,12 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) case R_TX_LEN1: case R_TX_CTRL1: case R_TX_CTRL0: + r = s->regs[addr]; + break; + case R_RX_CTRL1: case R_RX_CTRL0: - r = s->regs[addr]; + r = s->port[port_index].reg.rx_ctrl; break; default: @@ -167,7 +186,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 = value; + break; + case R_TX_LEN0: case R_TX_LEN1: case R_TX_GIE0: @@ -197,22 +218,21 @@ static const MemoryRegionOps eth_ops = { static bool eth_can_rx(NetClientState *nc) { XlnxXpsEthLite *s = qemu_get_nic_opaque(nc); - unsigned int rxbase = s->port_index * (0x800 / 4); - return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); + return !(s->port[s->port_index].reg.rx_ctrl & CTRL_S); } static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { XlnxXpsEthLite *s = qemu_get_nic_opaque(nc); - unsigned int rxbase = s->port_index * (0x800 / 4); + unsigned int port_index = s->port_index; /* DA filter. */ if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6)) return size; - 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; } @@ -220,10 +240,10 @@ 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); - s->regs[rxbase + R_RX_CTRL0] |= CTRL_S; - if (s->regs[R_RX_CTRL0] & CTRL_I) { + s->port[port_index].reg.rx_ctrl |= CTRL_S; + if (s->port[port_index].reg.rx_ctrl & CTRL_I) { eth_pulse_irq(s); } From patchwork Thu Nov 14 21:00:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843202 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp505708wrc; Thu, 14 Nov 2024 13:04:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXtKRpbPrw7QtytuORXcCWn2vltXEbD1vfBcIh7OSpDjymhkMCj1IroghLJN6wzOSDMgQb8cg==@linaro.org X-Google-Smtp-Source: AGHT+IEZeAB0rkJ2IcN2Nr43oG8+NoW95fHUukM+6PotDyRIaA22urztg7W7ziNEl6IUbXchXIUX X-Received: by 2002:a05:6214:5c02:b0:6d3:e9b0:30a7 with SMTP id 6a1803df08f44-6d3fb778a63mr2068276d6.15.1731618263501; Thu, 14 Nov 2024 13:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618263; cv=none; d=google.com; s=arc-20240605; b=bNPrDUlduY+EkTD849GdYWHOC1PY7rh/AggcqRfA12W+rLnOufmgTSHsAFRcBC1E4K Mo8IdOgQFYY2FWWOeMr5NBnIg3C23NA49ykRn3XA+95Oi/xXoVuEGA+Ftjh+07WVsCLe /F+vij4o3z7lq/ASlB6TzlTjZb2FZWvQthSCMYddkcfZI3vA6g4IoSHyTRlzRSU4l8SD IpS/ggPN3p0y10e2thMV9pkp6s0HWk051tsc7KdGGQByQ4jLeCTB3SmKo3zucRjr+nvh qlf7Z5GIVIaWgLCREfAbYgyw+0V3wCcZzqWHVZSaEKnxSlz3JS82K9OSugwxBLy2Kiy6 N5oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0lO9X8AE/ryeO7HxuWic/CLRGMSwtdVOkVYKrQN4QhM=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=T7emFvwiyQZwMjJm84OnaEbKa5MX21yZI5+XsCpcufVb3s06d7PqlUwtdNDt99QWG+ KVpdhz1TokySNiFJPAQg/6+e0idNRriY8DFiZ1ZAt6kSsExBBSTPQJ020h266mRJ4ZWQ JC+Bcj+/YMdy+hNxpSP8YOtG/u/GLF97auyRsWZDPPKZ7fvabpCIytbbb8Hsh+m/TY0c CxyB5ouvmvkwguIlp8u09JuFBIoZtA2dVUF47Q3M/nlDKOqnKYyYplNl4xRKTlIl1BaP 0Ht6Q3oyglqLakqH4aZIiVCTmWX+qucNXdOudY4Oo5P5YPpjbBY3msbVWdJPNFnNKPkY CgGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uzW0K7gJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d3ee9f5cd7si20419776d6.498.2024.11.14.13.04.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uzW0K7gJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyU-0001tz-Cy; Thu, 14 Nov 2024 16:01:58 -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 1tBgy8-00010u-1m for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:38 -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 1tBgy6-00084Z-GJ for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:35 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43163667f0eso9152545e9.0 for ; Thu, 14 Nov 2024 13:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618092; x=1732222892; 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=0lO9X8AE/ryeO7HxuWic/CLRGMSwtdVOkVYKrQN4QhM=; b=uzW0K7gJAgWh3T1E18wJjujQuRgvut0dAt83GUssTjWJ9JmrGPpCKF3b/IAEGJhqnD eRx02FtOCbqlMNxneES+ne3xPmdQOkrTy91tnNDB6TY6Rwiq25Hagnj7zTJqroSz8q+S DTv2U0FrsPg6jvMFjhWf9povc3izq54z84MUV19PaelUICOpmmlEK8uvm7eWcLCfh1QF BiCCnw8VMaz8vers9M+rflg7vVrsyp7cSTP/1URWBNLfSfcIc94GXimyEdZE9ZeoB1kE aWHbPQwkyJwu+jDO7nD8SuSqcgQTVGMpn4Qr8TTYlD58GCVi1rm2EviKnmGYaJ3NIDzG 8UyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618092; x=1732222892; 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=0lO9X8AE/ryeO7HxuWic/CLRGMSwtdVOkVYKrQN4QhM=; b=GrhRfEn4DDPQPqfp4hyWM4vdzwyynwvtpOynSDrbXHIGGh1vNVZh3O3RioHndoSFWf zaajJAwh9DfqWMMMg2DOgcTziL/AQH56tkpiBcSf54aa6GIOt0VUWDUkk7ctXPCstipr 1Ys4CULeSDw3V076p9pjHbuxgPLEmAn5cs640J6DBYf6T7Sn5rsyJgz47rx/ZAHs5QFR OxIjMfVLbZKjyFUILl/YlWOE5sigoqIauUSjXt9Rgv/+3wrFLXbl7or64cAc1cWPwfo+ 6Tj6CNz/CwGXTCo4+E28lkyRHzC0jCCpBjp7LZHx8i7JFHKL+tX4Bt/0vD9CZ8xEG9k0 droA== X-Gm-Message-State: AOJu0YwZyPAJwrKjpLvsMFJR5hFRgx72ILpCgHueINSmAVOG+tjlEe6A YcPDpj9vgoCdLYxQNZVfe5GR1CAQX1zReU5D1BqZMkWBD+OnR3F4W6KUQZ4TIZrQCwHLIwiCVdl h X-Received: by 2002:a05:600c:4589:b0:431:52cc:877e with SMTP id 5b1f17b1804b1-432df77a843mr1346225e9.20.1731618091829; Thu, 14 Nov 2024 13:01:31 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da244cb6sm36527525e9.0.2024.11.14.13.01.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:01:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 10/19] hw/net/xilinx_ethlite: Access TX_GIE register for each port Date: Thu, 14 Nov 2024 22:00:01 +0100 Message-ID: <20241114210010.34502-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than 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é 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 a993cb8bb9..36ac8097af 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -63,6 +63,8 @@ typedef struct XlnxXpsEthLitePort { struct { + uint32_t tx_gie; + uint32_t rx_ctrl; } reg; } XlnxXpsEthLitePort; @@ -91,7 +93,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); } } @@ -127,6 +129,9 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) switch (addr) { case R_TX_GIE0: + r = s->port[port_index].reg.tx_gie; + break; + case R_TX_LEN0: case R_TX_LEN1: case R_TX_CTRL1: @@ -191,10 +196,13 @@ eth_write(void *opaque, hwaddr addr, case R_TX_LEN0: case R_TX_LEN1: - case R_TX_GIE0: s->regs[addr] = value; break; + case R_TX_GIE0: + s->port[port_index].reg.tx_gie = value; + break; + default: s->regs[addr] = tswap32(value); break; From patchwork Thu Nov 14 21:00:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843211 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp506314wrc; Thu, 14 Nov 2024 13:05:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVG5jPzn1GbNi0I3Z0om5VRtqLMx8K5qAqdyiDqkrPUNEk2LOWbWP/PddmHlPh8FiIMBnKmRg==@linaro.org X-Google-Smtp-Source: AGHT+IFfmZH5xqnm05ALp6HFka6qHRS41okpVG0GOvHX8NrvYXHzbtTP9Jk6oP2bFPRX8l5gjBTd X-Received: by 2002:a05:622a:2b0e:b0:45d:82a0:5028 with SMTP id d75a77b69052e-46363df181bmr3409821cf.1.1731618338672; Thu, 14 Nov 2024 13:05:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618338; cv=none; d=google.com; s=arc-20240605; b=AVsB4+Y795u+cJ5sjzXgwtuLoq3VXmWIDEKTU7Cud6OSnkbACsTSetQlTpZ0SuQO4N cVrV9rP9ohoDEMk6l26qO9KCqYHsj595jG0NNe3FmekLdgV4IwoibHpp7UYvaVctqg9g 13O0YbQbO1uCHlC1mhkALlY9S7ZLlF4XvdDUCEAoC5IROGhO/fSH9iY8o9nZVeAMo4Br cDHtl+sa7gTbsLLITvS8lPC1zo1xQTNkHiCw5VFRkGO6ryTkSKZh9iwgaVmMxnIEwkdA qLz1qdwohHBKM7wci1zcguK8+BYIzZ5Lc2CGIyoG8BWjsXhnSraiuEE7iX5XKd2feLp5 dYNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=trKZIqBS/vvTexwy29kgOKpXSiuRtzrN3KiHsscp0eY=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=ihYSKCOrlU2FU++uCHVsbNXlLzF6rLTKs1BD4qHKtK95VOnYxOcxR3llzxb2PzLYK9 931UE3DM4t8NAZTGIgNU9SFVHH4Y1zi7FIPUyEUS5T8UhBVt8qqasco/UUJO9Gys63a2 myI19mT3LmKXkIM9T2x5cZcL47xaMqwiaRaI3Tnezi82PScEzlaYG0Ay4mfWDeolwxLC oRlOl/Tbv4RdG5NjFibxGohipg1OZzpZlg2LTE7UtfgHWjFYRdVqMEO7ZYVlFbTobZi1 ykWXAvxsujwVFCcOWlJt9M15PUYxRjEzWJM4NSH/VIf86kIvv5Knuve6OQtGmf7ea+Wb 6K5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UOncNcMa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4635ab79dfcsi18228251cf.698.2024.11.14.13.05.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:05:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UOncNcMa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyQ-0001eK-6e; Thu, 14 Nov 2024 16:01:54 -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 1tBgyJ-0001HB-Pm for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:47 -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 1tBgyH-00085p-Rw for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:47 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-38221500c2bso437193f8f.1 for ; Thu, 14 Nov 2024 13:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618100; x=1732222900; 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=trKZIqBS/vvTexwy29kgOKpXSiuRtzrN3KiHsscp0eY=; b=UOncNcMaWl/KXWMQBfS2aIgL0IwvIvIq5XxjwrQLB9tOI1LqwH4f3DLyhGbaIlyH3X XwIqBtl0ib2/Bq0E7xK7RrAt+OFxs3Pg4nOm8yYGtDM9GnmdciVJWTPqZQSNoioYEdvb 4kGMCFk/0WCLorP5eDyBR3DUpJGZdXrOWjGVBptvU43r/lTUwAwP98JotOWHuiPD87KF vF4kGbgC+e/w7nDuEIng5RIIYse/eWbi7iJa4XiArMIMN018iM6cYNmmc7abMzy0O03W xj0EmN5q1t8+BGeDfVdY5bTCui9VpciwZqtpoqdCNDXORMu81lpCQ5JwVhQUpimcyrsz vSzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618100; x=1732222900; 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=trKZIqBS/vvTexwy29kgOKpXSiuRtzrN3KiHsscp0eY=; b=Kaha2pSl54dGdYBRi09SB2fwW9Dqx4lNzg7W+BaEgE+KUJB1lwAiRTIvl/qdaD/hz9 BPOIRXYrHGrwkmbmzGPKQ4YBvBk4A/MsXjykY0nKDrvyLYNof2xFCCUFbK+UKZgY2xNA zzvvdtTZxjVkBJOzbzRiW6lbE/jmAnSTuMx0cTlW/CzvmJmK2KJeX4TGaylYfarFX0WL shWvntkz83C+ohfBmoujOmpYeR8jq3vBWWzZIaoUuXcbZl+g8htnPHiu6cDHq+iA4EuX uuY/odQRN2OKRcHDB0Yc8hB6A7JlBMUjyjsjz+fhZDv+AYaAkMewL6e4imYwYD9d826q mRNw== X-Gm-Message-State: AOJu0YyHxgV9od+o8BgFD6+6E56ozs6ckE2WzA2ZS4GAVCVpEc7Yh1k/ yvpqs28QycJI90Ww1rloUFK5xSnE837eKBEAVjis2l9Ngp48fGMWLDBOjSumAcJ3SB3lon/MNLk o X-Received: by 2002:a05:6000:691:b0:37c:cc7c:761c with SMTP id ffacd0b85a97d-38224e531b7mr487963f8f.3.1731618099808; Thu, 14 Nov 2024 13:01:39 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adbbbbdsm2441261f8f.50.2024.11.14.13.01.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:01:38 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 11/19] hw/net/xilinx_ethlite: Access TX_LEN register for each port Date: Thu, 14 Nov 2024 22:00:02 +0100 Message-ID: <20241114210010.34502-12-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than accessing the registers within the mixed RAM/MMIO region as indexed register, declare a per-port TX_LEN. This will help to map the RAM as RAM (keeping MMIO as MMIO) in few commits. Previous s->regs[R_TX_LEN0] and s->regs[R_TX_LEN1] are now unused. Not a concern, this array will soon disappear. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 36ac8097af..06da940303 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -63,6 +63,7 @@ typedef struct XlnxXpsEthLitePort { struct { + uint32_t tx_len; uint32_t tx_gie; uint32_t rx_ctrl; @@ -134,6 +135,9 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) case R_TX_LEN0: case R_TX_LEN1: + r = s->port[port_index].reg.tx_len; + break; + case R_TX_CTRL1: case R_TX_CTRL0: r = s->regs[addr]; @@ -171,7 +175,7 @@ eth_write(void *opaque, hwaddr addr, if ((value & (CTRL_P | CTRL_S)) == CTRL_S) { qemu_send_packet(qemu_get_queue(s->nic), txbuf_ptr(s, port_index), - s->regs[base + R_TX_LEN0]); + s->port[port_index].reg.tx_len); if (s->regs[base + R_TX_CTRL0] & CTRL_I) eth_pulse_irq(s); } else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) { @@ -196,7 +200,7 @@ eth_write(void *opaque, hwaddr addr, case R_TX_LEN0: case R_TX_LEN1: - s->regs[addr] = value; + s->port[port_index].reg.tx_len = value; break; case R_TX_GIE0: From patchwork Thu Nov 14 21:00:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843210 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp506278wrc; Thu, 14 Nov 2024 13:05:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWzOg9ELp2i5UduPx97+xR3jckSvRmiVAFPGPNfXbjWVbuSRaKKXjKYefAeznvlRVirvPCHpA==@linaro.org X-Google-Smtp-Source: AGHT+IHLoyUrpO6meNZjQAu5oYueKCMCZChgFC57x03fVQc0Ezzhl9sMOg7BBvoznxZtl0uMH3o7 X-Received: by 2002:a05:6122:1d47:b0:50d:39aa:7881 with SMTP id 71dfb90a1353d-51477c9a10fmr964514e0c.0.1731618334880; Thu, 14 Nov 2024 13:05:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618334; cv=none; d=google.com; s=arc-20240605; b=MXnDXQ7Slt1IsiXkd3UHU661/ZtLUi5o7iN2lyn3wWw5OxRG324BS37czrXkIE3uCv bxLdgxAnHpkY0xB3HzuOP3GURYqRw9hFHzTq81GDz6IVytvWgbADRviOKDlTkQba6k9O eer4+F0WC5pfCVaj9NjW92nzF1JUFsa43ypB2J8EVC/X7dnbaitCFPjFE17GfeHlf2lM GuGdf4u0qOJ7aDlommG9m3tiVry1DSeZbHuD9pwhZ76BOBMqYL8wI/fXfvOYDGQYKrmj Gp6SOZM3Mv/xXBgZrrYBqftXPYYZbWrzoiBbATQW8eHR1XT5/etx4JbOba2n12aqAp64 WtwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b8zvUlfKjuVL1gQONPCLSNzp6FDlA5idGOeDaT6LkvA=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=ZJybVHDEXL5aS//UE2GjEpfmZYOxtCmAnp992NHWVmlZe/BOmqmQYwzOWwcOwzsLdp QPb1pjYOuFPzZl8B+s8j12wWPqZQl5sxfZcG5Pr93QaKGk2p/9igmN+PCpgjv38qxW0l hMnkfhunS7azQKEYTKumQqFCqBu1tAmn1sJkGR2KKkQYcw4u/KLghr7F4/R8yKdmIPH+ Yh06wCPDzJqHdCbcoOhZJQBhOeq3kHoANXaR4NfuDv1fqC3YD4andGqQbG86qeLv9XMU 9qJn15G553l691eCm24f5p5Cc7WabVHeouyEDfDrdl+6XZT1woVAxq2Z7PWxpNur55Kh SYQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fwqkHPne; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51479c0c535si37244e0c.122.2024.11.14.13.05.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:05:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fwqkHPne; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyR-0001iC-5E; Thu, 14 Nov 2024 16:01:55 -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 1tBgyO-0001Xb-5J for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:52 -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 1tBgyM-00086T-BK for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:51 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37d4b0943c7so725096f8f.1 for ; Thu, 14 Nov 2024 13:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618108; x=1732222908; 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=b8zvUlfKjuVL1gQONPCLSNzp6FDlA5idGOeDaT6LkvA=; b=fwqkHPnevinQ5zkPmmwuHieP7VzqLULaY+cdqLvhbdsEg0iew3+KwYZZ1M3zpIZva7 fhZEigj34ZWx22W6e2XyQJJHnWtgy/e+8Xfl2pjjSNhMRUc8M0yFVlTyXLf8HmbDFs3a thyUn41JY/PPmi7jVzTKZMF4BzW6BCwaf247mpKOUR6hal7BzPIyG8qXU52z8/iugNfT PYCvPCFBdTDUwIxUSzkfCfA0rXxf2BswpxUAIvnNtC7+5xJGsooasPxktfTtxviKxmLj +XHlLQcD0ueIoV6INjz73gIWE+TAdf27d5jhXVyzzw2DqWygzUix55nGbxVxu22tLGd1 3Taw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618108; x=1732222908; 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=b8zvUlfKjuVL1gQONPCLSNzp6FDlA5idGOeDaT6LkvA=; b=l463czOGPFVlbvMGyhxSsyQWyrlnpErWOfr1LEvZhRkOTNPBOBSjLT8kztnNrmVlAv RrsRz7dHCsz3gP1n1PxqURW9kXCD1Gt4TFEzl5X7p0BIA5zDNW/z+H/UVG7rfYdv/vez 1yzmPZ+SWGahT+lFocUh6hJ31sGI0nOVBsviyBZsZwk64VcspvxEyfg3hje8hZTdRZaT I7cxR5tUhT14l9kt1UKcq2Djnud14UzhkshHtNxEY0DIIueQuhw9JiktjkfZbwaezoGN dzY7qBnWVEiWoDjHGwnZb1Xb1LB7uW8JJYWTYukqa1KKE9ZxMLQdAWCz3+rBQ6IEY+cQ pVEw== X-Gm-Message-State: AOJu0YyEsblOrLSDYynLsr47wt6D9Yk1SkSE747S6+iFJw2208/x8GxD jARKJmecP9Wn8Ye5cf3Qm85cId707O4SfP4nPw/uCd5IyFuKlPUQs+qRL7CdwARp+7b0kKfPaP8 e X-Received: by 2002:a5d:5f91:0:b0:381:f443:21ca with SMTP id ffacd0b85a97d-38225ab4db7mr129227f8f.58.1731618108071; Thu, 14 Nov 2024 13:01:48 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adadba4sm2423628f8f.24.2024.11.14.13.01.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:01:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 12/19] hw/net/xilinx_ethlite: Access TX_CTRL register for each port Date: Thu, 14 Nov 2024 22:00:03 +0100 Message-ID: <20241114210010.34502-13-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than accessing the registers within the mixed RAM/MMIO region as indexed register, declare a per-port TX_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é 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 06da940303..674f805d76 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -65,6 +65,7 @@ typedef struct XlnxXpsEthLitePort struct { uint32_t tx_len; uint32_t tx_gie; + uint32_t tx_ctrl; uint32_t rx_ctrl; } reg; @@ -140,7 +141,7 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) case R_TX_CTRL1: case R_TX_CTRL0: - r = s->regs[addr]; + r = s->port[port_index].reg.tx_ctrl; break; case R_RX_CTRL1: @@ -161,7 +162,6 @@ eth_write(void *opaque, hwaddr addr, { XlnxXpsEthLite *s = opaque; unsigned int port_index = addr_to_port_index(addr); - unsigned int base = 0; uint32_t value = val64; addr >>= 2; @@ -169,24 +169,23 @@ eth_write(void *opaque, hwaddr addr, { case R_TX_CTRL0: case R_TX_CTRL1: - if (addr == R_TX_CTRL1) - base = 0x800 / 4; - if ((value & (CTRL_P | CTRL_S)) == 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)) == (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); + } } /* We are fast and get ready pretty much immediately so we actually never flip the S nor P bits to one. */ - s->regs[addr] = value & ~(CTRL_P | CTRL_S); + s->port[port_index].reg.tx_ctrl = value & ~(CTRL_P | CTRL_S); break; /* Keep these native. */ From patchwork Thu Nov 14 21:00:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843201 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp505117wrc; Thu, 14 Nov 2024 13:03:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW6/HEtV57bk+s+QhTGA0Iuxhh5PR+NleNJBHuAlPj1Zi+San65U0FeZbHWIZVokXFXuA8jOA==@linaro.org X-Google-Smtp-Source: AGHT+IH44bEtP7a8hs1HriE3UkwN2vBze3TPeOepJ7dixWdFNegASyAFg1xLUk2nbimRDXeFHhAO X-Received: by 2002:a05:622a:1791:b0:463:60a9:74ba with SMTP id d75a77b69052e-46363ec10afmr3379541cf.55.1731618198468; Thu, 14 Nov 2024 13:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618198; cv=none; d=google.com; s=arc-20240605; b=R7Z9TutkSNdNFygJX1ydCPJ/EBnzSE8i88JJaWqBYCG4fV2jNco/hhlyJNcmYLVd6j qlNv51eQCtNzFZHecc3HRj/+7BIT1VYFTYKgzHddUCljY1AQXb5o9eMWr23b/vub3Sjb J9EKV85m1e9vpEXTMkz0pKX0IDzzdDOn70Rm+hYzEPQNmcxqvzeqD3XrsVEU42FFhPqh I8fQmkKOXFdSZV7VpN8+qH0pURmyuZvwK0vdpn2G0FRz0Lnm2h9tAI8L3rKK2JKkfk1d Iih3JglGfEMHGvZ9tD/IWRcpHnJaob8lIwVYqVrvi0UUVMK41dTtm/cHPECHsWVrl7MU JBHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LMLXteKzNxHurRj29HFY+TepUdXjvjn4u+eJ/Foyx5Y=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=UEggstRh1EgmBaQReAxa5QweKZox6ytmhnPK/WeSx7WZlRgIL2EWEQI7GafWyO7B4f vCwTVc2bHBzjVTT/put/82gi1pj39ReWTzrnw9+pQbwu+YhwI44FEKnexeen7mf1LsBi puex1N71eAfkU0jShV4p+9l4fVGmcUWezTkkVznSL5sR3KoDhxH4D2bL8fIHPBUtzGky CpOxTrw2xvwL/AxpgzxquWMFBGhTR/p2+AIbZ12cFETEebtok9EWXS4hTcGoSVTxQj5V vR9ciCNJsaK5IUoPSRF+r7JxJOsBLNbINXY/iyHJ1tpb2CZVCK5JpdepEoiUopKmOKBk xKIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QXR8PiYR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4635aaeb359si21387171cf.424.2024.11.14.13.03.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:03:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QXR8PiYR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyc-0002PG-7I; Thu, 14 Nov 2024 16:02:06 -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 1tBgyX-0002A9-1B for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:01 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgyU-000888-Oz for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:00 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-37d4fd00574so649567f8f.0 for ; Thu, 14 Nov 2024 13:01:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618115; x=1732222915; 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=LMLXteKzNxHurRj29HFY+TepUdXjvjn4u+eJ/Foyx5Y=; b=QXR8PiYRp/nNe2kza3DZTzPsMSADTAzU5bqFSK3aZZFKmCPQ7sd4ucNt96VS+HkZuI KhDgueRTCFK5cFAUUG8PNaVfcYRJhh94bNW2f8pbAFkYMlkLhicWQj/6DzsjaBqI2QpH kGIJ/yEsWXgBui0cUVnMIj84SKFMu9P75XVwW30MnEn7z/97UvgQxB/hNLQZUmxt+8rr 0vMY/N2AMeQwoImM1s28G/q4A92bQo6WfxPmlRs7sm/u68r2lRzOLgjCFdLZcpCtx2Vu 7Z80rwsmt+C4DJx4OZz6/MobKKFlIXiHl/WfMz0SVv9YHcRNC8RLF5O3Lr42hcWivyz9 x3lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618115; x=1732222915; 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=LMLXteKzNxHurRj29HFY+TepUdXjvjn4u+eJ/Foyx5Y=; b=pjMYLxAx5p8S/d/X8J5JDzAQLbkFqvW7OsnvjRhxiikehKoKZvF/Z1puRDHN31Xac/ 8fQJO1uDARz1hE/+sIZk7+06rHyI/C+Kxje+PBA9/VoVaAYYPz5bg2te7Qay9eqxPZ3y G2Suqr1Q5neNPtKKojGpiJD/VQiyt/x+n2BxuDA898waj1W6KWzpV1Y8wVim6ymrOYfO L2PpctJBXlut4N6/kC9Say7BmDmZn87dZ5pCro0uMlonq71FfTLc4ZUGS2m+E61Ihtk9 WG/ZQ2qmAooM2qPGd1exBa74EnKKSPfzQZaitwgkyjtXmXZ196s3JwSh+1kt5XKCCYHK /vLA== X-Gm-Message-State: AOJu0YzePl4MwJbUSzTk1zCkI878vCwWpMrwSxICJiEHBAlUQM0OZM0s bMfvUXoyApI9AFV9OLLzZgRr3VZqwmvnPtvqcll/OjkG8WvamVawN8X4EYKSMtD/wxg2wYmXtfn D X-Received: by 2002:a5d:5c0f:0:b0:37c:ffdd:6d5a with SMTP id ffacd0b85a97d-38224e54560mr447248f8f.6.1731618115295; Thu, 14 Nov 2024 13:01:55 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821d0ea3e2sm2085593f8f.109.2024.11.14.13.01.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:01:54 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 13/19] hw/net/xilinx_ethlite: Map RX_CTRL as MMIO Date: Thu, 14 Nov 2024 22:00:04 +0100 Message-ID: <20241114210010.34502-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Declare RX registers as MMIO region, split it out of the current mixed RAM/MMIO region. 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-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 Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daudé --- hw/net/xilinx_ethlite.c | 82 +++++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 15 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 674f805d76..d8f5a06182 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -49,11 +49,16 @@ #define R_TX_CTRL1 (0x0ffc / 4) #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) +enum { + RX_CTRL = 0, + RX_MAX +}; + #define GIE_GIE 0x80000000 #define CTRL_I 0x8 @@ -62,6 +67,8 @@ typedef struct XlnxXpsEthLitePort { + MemoryRegion rxio; + struct { uint32_t tx_len; uint32_t tx_gie; @@ -119,6 +126,55 @@ static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) return &s->regs[rxbase + R_RX_BUF0]; } +static uint64_t port_rx_read(void *opaque, hwaddr addr, unsigned int size) +{ + XlnxXpsEthLite *s = opaque; + unsigned port_index = addr_to_port_index(addr); + uint32_t r = 0; + + switch (addr >> 2) { + case RX_CTRL: + r = 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 = opaque; + unsigned port_index = addr_to_port_index(addr); + + switch (addr >> 2) { + case RX_CTRL: + if (!(value & CTRL_S)) { + qemu_flush_queued_packets(qemu_get_queue(s->nic)); + } + s->port[port_index].reg.rx_ctrl = value; + break; + default: + g_assert_not_reached(); + } +} + +static const MemoryRegionOps eth_portrx_ops = { + .read = port_rx_read, + .write = port_rx_write, + .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + }, +}; + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -144,11 +200,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) r = s->port[port_index].reg.tx_ctrl; break; - case R_RX_CTRL1: - case R_RX_CTRL0: - r = s->port[port_index].reg.rx_ctrl; - break; - default: r = tswap32(s->regs[addr]); break; @@ -189,14 +240,6 @@ eth_write(void *opaque, hwaddr addr, break; /* 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 = value; - break; - case R_TX_LEN0: case R_TX_LEN1: s->port[port_index].reg.tx_len = value; @@ -289,6 +332,15 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) memory_region_add_subregion(&s->mmio, A_MDIO_BASE, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0)); + for (unsigned i = 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 = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, From patchwork Thu Nov 14 21:00:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843205 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp505855wrc; Thu, 14 Nov 2024 13:04:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXDY+GSR0+6qekhqtwF7essPcR+itsQOjb2Ci9ktv75FdZfSpO2CH+a1sEQub2/PYZQ1rplTA==@linaro.org X-Google-Smtp-Source: AGHT+IGtJW2QHqz14zXmXo3M8BUdREEX60L0jl5fmwn5VF3sHNY3ub4F2tL9ot+AImczUQl8OO51 X-Received: by 2002:a05:6830:618c:b0:718:9c03:d216 with SMTP id 46e09a7af769-71a7794717bmr507581a34.15.1731618284105; Thu, 14 Nov 2024 13:04:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618284; cv=none; d=google.com; s=arc-20240605; b=h4YaHw/cZlAgj1NUnweytpil4FBxdAbJlyBJ4tHrbXNVdgX53fSxV2scNRageSPgcr if/wygNvRzFWnwanvg/gNjwEcBCR7Mp5qK8FQp/kohkfL2zIlsAl4tYIBGUWNtnh8/SD c0y8NQdqPVjk0MqlvWBPvkhWQGIJAmqT8ikk/YGkh0YdWKk0IE3XbwL0gRSu7I+okEqR thwKOuae05w/eEInh8sIdTpQuaFsBs1M9SnK/mAJ1+K1p1PHPPBSWm/mCQnnO49Afqes g+6qew0GeCRoHDDsQ98Z02V28OcvBfTAu2UtjXXlSPwBQe+mxoJx8LV6uo3FwlhQX9OE j2Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WHsXd+6nklg/Fen/qM8UGXgjnDFu4CazQunEUxBn5NI=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=k9Va+3si9/w0T2LXKuJxZQrXrdq2mjGWzZBsOyYDjrrNzxuByrRIpYgLUwKbtV1Y9G b/xuKZYyWPF9MdDfJEOqDlpIFS4tqs+2uhvUPzA03MsOzCQtyuRJrQtnKwq+FU/Xq2Y6 erq7NH3EmdQjFNgXi25JXB6rTEUQ1MnkS5yBvJaleEwBvq3JRDFLBRMl4tz9o/bPzMRz pmNjJwbu72EdpH7PkSsS/7hfIscg9hONVIFTInntDJ/nM4KAl/e/Qa7ZAvWEavtMagYv TjDVxVzGQo+slm0nJJERRKsIUUw791r5weKYTOa6EcJOQ1dpNm8/gyWGa5LSojgD5A0N 7Zkw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mb9848ZR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ad64867441si13079137.305.2024.11.14.13.04.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:04:44 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mb9848ZR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgyi-0002x6-3Y; Thu, 14 Nov 2024 16:02:12 -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 1tBgye-0002aL-8W for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:08 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgyc-00088x-CW for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:07 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso10053045e9.0 for ; Thu, 14 Nov 2024 13:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618123; x=1732222923; 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=WHsXd+6nklg/Fen/qM8UGXgjnDFu4CazQunEUxBn5NI=; b=Mb9848ZRBfIgcRmkLoRzj/OJ7cmWmcTKAzeSn4hKOxguOdYAmfvO3hlZc48C+6t26U dKK6Pqcte53LY5N9auqAcYL9vdNfEpkeTyoH1Pvm7ifeN1/h26D2UUczBj9XEG625HIy qGzhNArFKhTpvFqCrhE7fJtOXKBIUPmOfoX4o+bq4h0qE+HweHJYiC39PomhumOdeUB3 JzSX5gzulXBnGHxcRyPsu6BdP4BfXuoCT14kue2mh64LgCxhHGCoc1ppx4sI+N4k6BQV j9CmOdHDj7yjW87yZmZdCzXRkVBT9dLdKMpaeZiSvTyL1YKrIRbK/1R8haqXP0UNPaey FoKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618123; x=1732222923; 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=WHsXd+6nklg/Fen/qM8UGXgjnDFu4CazQunEUxBn5NI=; b=w+MFYSdX472DX4K/3uziPOqm+Fn0TVv/bmP1jF6ON/xvm2ZOGjo1TRNbQ4Odnziq6N KU732ILzZy67UE5z9uSUVGc7k4LvMh2JJ96UKwQwYLFz/Ccn7mA1y5yEH41Ykx5Vp7Yg mcJk6hMnEbcHyDlJ1s5mA9PNBi50wwB0SCFeu3ZC9AJ2ZZtvNmB/y2Afs+uDDOgVnF0L uHEG0Mej3uSUENpgwfcS/7TLjRKKzPSloxVMIXcVjJZnOJll/mmNCdF+reK3wIWLOyTp tneIcywQk2WVI/io+ImD5i6f6ZQQF0Xp/t/8hhGmFNUYXygYUmh6Pk8kqhjjIBWZ2B9U vNaA== X-Gm-Message-State: AOJu0Yx9+MPyf074ESQYcoIJHvpxoh13/EijO+/90/zlQakhz6XO1ODI Z7sHfaGdbSZzCQaf4pFgLFwm0acu8aslPbSVV9b7ZyeBiPsEwhr8oDdNO/P32h1oVsrJnVlMhIk l X-Received: by 2002:a05:600c:34c3:b0:42f:8229:a0a1 with SMTP id 5b1f17b1804b1-432df793c74mr1277045e9.33.1731618123191; Thu, 14 Nov 2024 13:02:03 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae313a8sm2402592f8f.105.2024.11.14.13.01.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:02:01 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 14/19] hw/net/xilinx_ethlite: Map TX_LEN as MMIO Date: Thu, 14 Nov 2024 22:00:05 +0100 Message-ID: <20241114210010.34502-15-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Declare TX registers as MMIO region, split it out of the current mixed RAM/MMIO region. 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-00000000810007f7 (prio 0, i/o): ethlite.tx[0]io 00000000810007f8-0000000081000ff3 (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007f8 0000000081000ff4-0000000081000ff7 (prio 0, i/o): ethlite.tx[1]io 0000000081000ff8-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000000ff8 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é Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 73 ++++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 12 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index d8f5a06182..b105fb7524 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -41,11 +41,11 @@ #define R_TX_BUF0 0 #define BUFSZ_MAX 0x07e4 #define A_MDIO_BASE 0x07e4 -#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) #define R_RX_BUF0 (0x1000 / 4) @@ -54,6 +54,11 @@ #define A_RX_BASE1 0x1ffc #define R_MAX (0x2000 / 4) +enum { + TX_LEN = 0, + TX_MAX +}; + enum { RX_CTRL = 0, RX_MAX @@ -67,6 +72,7 @@ enum { typedef struct XlnxXpsEthLitePort { + MemoryRegion txio; MemoryRegion rxio; struct { @@ -126,6 +132,52 @@ static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) return &s->regs[rxbase + R_RX_BUF0]; } +static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size) +{ + XlnxXpsEthLite *s = opaque; + unsigned port_index = addr_to_port_index(addr); + uint32_t r = 0; + + switch (addr >> 2) { + case TX_LEN: + r = 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 = opaque; + unsigned port_index = addr_to_port_index(addr); + + switch (addr >> 2) { + case TX_LEN: + s->port[port_index].reg.tx_len = value; + break; + default: + g_assert_not_reached(); + } +} + +static const MemoryRegionOps eth_porttx_ops = { + .read = port_tx_read, + .write = port_tx_write, + .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + }, +}; + static uint64_t port_rx_read(void *opaque, hwaddr addr, unsigned int size) { XlnxXpsEthLite *s = opaque; @@ -190,11 +242,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) r = s->port[port_index].reg.tx_gie; break; - case R_TX_LEN0: - case R_TX_LEN1: - r = s->port[port_index].reg.tx_len; - break; - case R_TX_CTRL1: case R_TX_CTRL0: r = s->port[port_index].reg.tx_ctrl; @@ -240,11 +287,6 @@ eth_write(void *opaque, hwaddr addr, break; /* Keep these native. */ - case R_TX_LEN0: - case R_TX_LEN1: - s->port[port_index].reg.tx_len = value; - break; - case R_TX_GIE0: s->port[port_index].reg.tx_gie = value; break; @@ -333,6 +375,13 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0)); for (unsigned i = 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", From patchwork Thu Nov 14 21:00:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843206 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp506025wrc; Thu, 14 Nov 2024 13:05:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWU0K2QrXiVSxL1gIWZm532xGUu3HJ5RxfLvs8swrPlhYcH49YAezRriEnZPO4nw1zJeK0DKg==@linaro.org X-Google-Smtp-Source: AGHT+IFXWE6RxfA5/0zOSZdaKhTdwvITDisbx+pDA7kEzqArX52PzOVwvzERQ4AgxlTTcmEGg5pw X-Received: by 2002:a05:622a:5597:b0:462:c473:94ee with SMTP id d75a77b69052e-46363ec0cffmr3223161cf.49.1731618302876; Thu, 14 Nov 2024 13:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618302; cv=none; d=google.com; s=arc-20240605; b=lzps21/hdJmvTnebCfTiH9DKwbwNMzxQCAezmFExfsY/zzyYzbhCIvGxgxAUEKcnoJ G9ZQBwC+xOkY5WUXSaz0iRY1xzQRHDVmvWLe7eSMv47myvEuFMK1UmEQMzJ/Z6Q/0FtO hvD+5cjcNDW6+3ZyoUX9c5e69xdzazS3zQyWxf+ekCuvAgCpW8WcFXRBDxo6og+sPpau RW0IfxQw0tLKdsYkh1CCoo8FPUWwUxnwhXK3vaav8KksIXuVY/lEXhvnjLKBNQA6V5Fc rz33sWdPgv311I6yzYhKbijzKZRtaXUbq/wIw1VUv6hPYbi8EWq5JR0IxwXKtnZHJ3wn 39mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MF3SHGsIbIScsd8jKkxhhWNAqHynObedVS2I49WJ1Qw=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=EhLYxHeRVNQSiCc7F6TQvYSrvnM+sTW6irsIHtBYkinU9AQIdP+PEy5veoC0hxIHlj nibrVelVdqTK5f1lfeApJSYcS6O7LUm5TTpYMfEKjXfbJBdY4VDY+Xt9VuLsl26si18E VfiN3YNX0582k6+6Rp6Ojp5lQ2u98MxS6UC0nK2f6sJ7uLq0AKj088Ho1rAsgOVDOXSQ XjKJ2Qr3qycfIxEnSOUTp6hX0VdBONXadyUkjCLQLzaTsw5PSo+pJLfTAHNdgI9XPt5p Z00agsXCP9P4nCRp0yklIovYBTz+gzQNdl9b3jFrccXoVRYt6bMxF6zzoc9ChJQeJkaC iOGQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YTyS8V87; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4635a9c77a8si20807041cf.170.2024.11.14.13.05.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:05:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YTyS8V87; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgz1-0003g1-Td; Thu, 14 Nov 2024 16:02: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 1tBgyo-0003Ua-F5 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:20 -0500 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgym-0008AQ-Ri for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:18 -0500 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2fb5740a03bso12069641fa.1 for ; Thu, 14 Nov 2024 13:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618131; x=1732222931; 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=MF3SHGsIbIScsd8jKkxhhWNAqHynObedVS2I49WJ1Qw=; b=YTyS8V87ArGz807cKXlKjjpSQA9ChBj0Esk0ihUk4uaMZAMH8SrZfjbQo+HLClPZnD yg75mAQqwv1dBJi5dw/GLNR2rBiYAHtwmVGePMcU1bBwv0rBot8ZxvE0cJUtrul03u9r ldOnXNQcVbtuqJwvAyaM6kpr4NodT0QqlzE9GjhkJZQlOWW6SUuPsehaidXPBjL/bslZ q1yKYtawWpFrx7+SKPYwmCI5VyLcsTliDAUXf+DV0d5CAxHAiOrp2GwolzqrveMj3NsV za5kDuCuAP1+fk+s8u7wCZEErJvK3QvVX1AkfryP4CRcNnlaZkcFPNYFcD2CK/fyDdHZ VOPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618131; x=1732222931; 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=MF3SHGsIbIScsd8jKkxhhWNAqHynObedVS2I49WJ1Qw=; b=EuW6VbAOQB4xe6aS8edaZTtbvxBNByRRZL1+iBndGF/JXAEt7MghWNqZHqZe6+8XMK yMbQzdd9iZNPnsUOxFzaLVOfrwkeuNzfK5RqxTQgC7zDcRDI4rfQn7lDJhjoMeQL5rWK J7V0LZBdypmJljZ22Bdu2y3bahn0JYR/6K2Y8Wy3Ha4jwHeQWHROmtZ96uM46+Z6/lRA 5b6eyQFlFhmKyo2xlzuaINL7ZCTFd+Or1SWxHi8zN7WVjyiX7VCeihR8X9qCH6dHQxrG xcwILBrifxK2W2/+kbsmlsUr+qCfdKsUgJ2YIsskB/66rx7JNW7DyyYNhGl104Ne1Q2k mPdA== X-Gm-Message-State: AOJu0Yxko3xJ/fMTS5c1LNJ9NyzvdEjrscGw4dtsp744DDJOfQfVraxX rXmcwdXcSDQqLxmtnqDtLUzq1O2/+32NluFAibTRfcGJiMn/jJnJ951jj1u2AzFZta/WvaTun6E t X-Received: by 2002:a2e:9fc9:0:b0:2fb:556c:fe0b with SMTP id 38308e7fff4ca-2ff606deabdmr2503881fa.26.1731618131571; Thu, 14 Nov 2024 13:02:11 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dab80869sm32110865e9.22.2024.11.14.13.02.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:02:09 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 15/19] hw/net/xilinx_ethlite: Map TX_GIE as MMIO Date: Thu, 14 Nov 2024 22:00:06 +0100 Message-ID: <20241114210010.34502-16-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=philmd@linaro.org; helo=mail-lj1-x230.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. 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-00000000810007fb (prio 0, i/o): ethlite.tx[0]io 00000000810007fc-0000000081000ff3 (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007fc 0000000081000ff4-0000000081000ffb (prio 0, i/o): ethlite.tx[1]io 0000000081000ffc-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000000ffc 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é 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 b105fb7524..038e81dcae 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -42,7 +42,6 @@ #define BUFSZ_MAX 0x07e4 #define A_MDIO_BASE 0x07e4 #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 @@ -56,6 +55,7 @@ enum { TX_LEN = 0, + TX_GIE = 1, TX_MAX }; @@ -142,6 +142,9 @@ static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size) case TX_LEN: r = s->port[port_index].reg.tx_len; break; + case TX_GIE: + r = s->port[port_index].reg.tx_gie; + break; default: g_assert_not_reached(); } @@ -159,6 +162,9 @@ static void port_tx_write(void *opaque, hwaddr addr, uint64_t value, case TX_LEN: s->port[port_index].reg.tx_len = value; break; + case TX_GIE: + s->port[port_index].reg.tx_gie = value; + break; default: g_assert_not_reached(); } @@ -238,10 +244,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size) switch (addr) { - case R_TX_GIE0: - r = s->port[port_index].reg.tx_gie; - break; - case R_TX_CTRL1: case R_TX_CTRL0: r = s->port[port_index].reg.tx_ctrl; @@ -286,11 +288,6 @@ eth_write(void *opaque, hwaddr addr, s->port[port_index].reg.tx_ctrl = value & ~(CTRL_P | CTRL_S); break; - /* Keep these native. */ - case R_TX_GIE0: - s->port[port_index].reg.tx_gie = value; - break; - default: s->regs[addr] = tswap32(value); break; From patchwork Thu Nov 14 21:00:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843204 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp505833wrc; Thu, 14 Nov 2024 13:04:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWh1pPU+5oaCwl8TeHMWtm9Rd/RHyIIw2EUWQ0A4RVZbb8n1W/ywi7bjyVDnR+jg8vM7CTRtQ==@linaro.org X-Google-Smtp-Source: AGHT+IGk9k4oTeirr6J6PsZXjrxrdosGuXSqk8J4hS3i2sg2HnKZwi6LsaydsT4mDeVm9EBdorz1 X-Received: by 2002:a05:6214:5541:b0:6d3:6542:848c with SMTP id 6a1803df08f44-6d3fac11f99mr8240156d6.1.1731618281608; Thu, 14 Nov 2024 13:04:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618281; cv=none; d=google.com; s=arc-20240605; b=fglg12N6i3QET3D6cEZrHSu1RXdF1/soUzblAcwYLz7l3jJel8mFlkKE1/Fu1ew4IG DL5e3EbD9xpx6NeV+g1htIevXEsmbJHPrQfK+eW5CkKibyZSGZOWYINEQkQlqBN+YXOJ 113VARttKSTj49+yIe+NDyO73ihGr8LUgpwFq3LuY+HY35SkXyF4seXl2nSdcJeHMgtU 0fQaHHBmnFYWPD8hlIfkGbJotFIBIu28G6mIRlmKTMNvJXkXEn0Qs+0PY+wGcTesz2js iUjFkE75VF2ARw1mL+eFOT1tIj9tuir1fB9rtUIFBCTXJx8No9fRsde0B588JeYAYrwU iw5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YrNmzpyBj8jJaMk8J310GpURg0YUYlZP1LiDoI08wTo=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=HeXIsM5fjf3NMT/MMlzDfbzDcGul/iqdBH/ddMPoZzbQmHLC8XTomy2Z0JoEcmdYBS sohiu94mPqhP71HV/cra5hHQoYrt4rg/7SCCPoD7CZKjv4ppAoCBtlF5am67/7pTAuy2 iSL65k1ZK8nzGpGcAuBfoey3pkzxfdU+N5TMBT+th1LDP6AUeHDzaQ1dG4HXSBuqnZAu lkvLKlsc2hF+DbyaWRUz5cqsEA3BZWXzKQWqXmjOsBvSHbZrEqBrtJkv744gkdS73Zs2 0HDrDAkl10I3TOeAbraIGibr1Dr1LvoH3OuR6EJE0SWWALGYEbzbMWHA3P08PJgS3H1W WeFg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v3XrjUf9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d3f941c815si6640166d6.399.2024.11.14.13.04.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:04:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v3XrjUf9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgz5-0003no-4l; Thu, 14 Nov 2024 16:02: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 1tBgyu-0003b2-MW for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:26 -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 1tBgys-0008Au-J8 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:24 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43162cf1eaaso12256265e9.0 for ; Thu, 14 Nov 2024 13:02:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618139; x=1732222939; 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=YrNmzpyBj8jJaMk8J310GpURg0YUYlZP1LiDoI08wTo=; b=v3XrjUf9km15ZkJA25dcnxJExd5GFZKSBsWoc7BXyWHJpzi6EGmmvao5VqP3Rw0Tem iLhzGsQhDbMxj+QthcUnq9zoX3zfnREHcobwZKTixDYkP4hiat9p57/R9W5/JNv0dvEk dn/KQNZczglLSSjjbKYu9Aq8+tozus78707dpl9zyfQhJ3IpEWaVJxg8m0Y/kVUXJ8Fp Omq8FSufTqTlSjt1VYZw/KrIaaIwHBMGf/RMRiTBX5Li1YyiP8fCHZl4qc6bHvMsUa/r 5TkBKRBUwgR17JdF4KEPeUL7xcWWeDmWZ46g5KtbRlRi2VG250Rf+IXZYWnhi/NZycUB ZfOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618139; x=1732222939; 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=YrNmzpyBj8jJaMk8J310GpURg0YUYlZP1LiDoI08wTo=; b=w8bAuSCmMULb9an+DliZOKIDwecMP/4Kitpd57jLBax92p5Ga3cRszfp5lThTrpxBH sqUxDbEco7RAcCNjPWkLcuoUYmxYd+rZKevYqU/zaTiqpZ5JgPDne/MguFKH5Nk90Kk0 DcCM66JRq0E2VZVev7npLEB3Qqubf74g60W/S3i8ZyjU4hRiNS9Q6uVIgfiykOI1NOa4 pA7PJX2MPkdwB0eyfBEgKddtBVBk3KLjZU5NtdlPEmibA9yJ63MXMybJVqzE3ZeT0IrX VS5XHjcMjynCHDuzXXl0SI/rT+d/mL8mnH3b4oC/VXcglJ1Obh2afYbkdg7CE7ZSCP5X pD+g== X-Gm-Message-State: AOJu0Yx+KxTBgjQ+AT33swjil2HPrTJpoytUTPzZAFcWYquK+ZGVivoW FMwVhiFq3nEo1IdAfwH0BEf5HhKlfxiA/SqJJb0A+0RYxGWjmtOICmGN7PVZLQjj0Jd8IXcvB4O c X-Received: by 2002:a05:600c:1ca9:b0:431:557e:b40c with SMTP id 5b1f17b1804b1-432df7937bcmr1608075e9.27.1731618139303; Thu, 14 Nov 2024 13:02:19 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ada3f91sm2493726f8f.4.2024.11.14.13.02.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:02:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 16/19] hw/net/xilinx_ethlite: Map TX_CTRL as MMIO Date: Thu, 14 Nov 2024 22:00:07 +0100 Message-ID: <20241114210010.34502-17-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add TX_CTRL to the TX registers MMIO region. 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-00000000810007ff (prio 0, i/o): ethlite.tx[0]io 0000000081000800-0000000081000ff3 (prio 0, i/o): xlnx.xps-ethernetlite @0000000000000800 0000000081000ff4-0000000081000fff (prio 0, i/o): ethlite.tx[1]io 0000000081001000-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000001000 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é Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 54 ++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 038e81dcae..c710857cfd 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -42,10 +42,8 @@ #define BUFSZ_MAX 0x07e4 #define A_MDIO_BASE 0x07e4 #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) #define R_RX_BUF0 (0x1000 / 4) #define A_RX_BASE0 0x17fc @@ -56,6 +54,7 @@ enum { TX_LEN = 0, TX_GIE = 1, + TX_CTRL = 2, TX_MAX }; @@ -145,6 +144,9 @@ static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size) case TX_GIE: r = s->port[port_index].reg.tx_gie; break; + case TX_CTRL: + r = s->port[port_index].reg.tx_ctrl; + break; default: g_assert_not_reached(); } @@ -165,6 +167,26 @@ static void port_tx_write(void *opaque, hwaddr addr, uint64_t value, case TX_GIE: s->port[port_index].reg.tx_gie = value; break; + case TX_CTRL: + if ((value & (CTRL_P | CTRL_S)) == 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)) == (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 = value & ~(CTRL_P | CTRL_S); + break; default: g_assert_not_reached(); } @@ -237,18 +259,12 @@ static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { XlnxXpsEthLite *s = opaque; - unsigned port_index = addr_to_port_index(addr); uint32_t r = 0; addr >>= 2; switch (addr) { - case R_TX_CTRL1: - case R_TX_CTRL0: - r = s->port[port_index].reg.tx_ctrl; - break; - default: r = tswap32(s->regs[addr]); break; @@ -261,33 +277,11 @@ eth_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { XlnxXpsEthLite *s = opaque; - unsigned int port_index = addr_to_port_index(addr); uint32_t value = val64; addr >>= 2; switch (addr) { - case R_TX_CTRL0: - case R_TX_CTRL1: - if ((value & (CTRL_P | CTRL_S)) == 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)) == (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 = value & ~(CTRL_P | CTRL_S); - break; - default: s->regs[addr] = tswap32(value); break; From patchwork Thu Nov 14 21:00:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843199 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp504975wrc; Thu, 14 Nov 2024 13:03:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXl+BHIEb7SDl0/z32ecVZ40oq+gwz6UD3d2647xoma9vcQU1ixeC2D6uNvIm0NZUw9X8s35g==@linaro.org X-Google-Smtp-Source: AGHT+IGYzN+U+VdlMNBN+XkKDxzZ0RO8jfKUI5qLLJWZrcL6vqpKK4ZskJXYnxmABqxvmnM/Xenp X-Received: by 2002:a05:620a:c4d:b0:7b1:ae66:e8cd with SMTP id af79cd13be357-7b36234f778mr57255085a.44.1731618183445; Thu, 14 Nov 2024 13:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618183; cv=none; d=google.com; s=arc-20240605; b=Ly5okJ5tMMc86t6dKghSCNPnSzR/Bw6jcRgyFUCPKfhL2thk1lC4j/nKLOB1oRkfyi e640dGCWo3BeGBpE/JqOhU292K1jFLnGM4UxswF+IFkT+2uZsWWXBjVKJu79WggYS8xk ebU15bYpuH2Zi7eg4ExSy96O8o5kiPXDMaSa82QuK+pMljYFl/9hgAqtRmxx7ReMAxt9 tmGIT9QHL/jrnmyYuyNuh38DWZrkBaozhJjgc3vN/Hf6cq2Jcts7TVK+QW2a/0GKbjao GSZlfRBvfEz+nKKomEwh/4xFSTw7SVIlJ5lxdkxzoTkxB9vvwiil+sQwRUILEt8x5O5O U7oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zyez6NwJ+NWOqgUSWAy7md/NK0fDCEDRWAipgrG6RPE=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=lr4f+RMHilav0p5Bx6LjNGWu5Vljs95MsVCocSQpXOjwYU8GABNLhjpWBhyTk3p8U4 tXYu4yioFtuooTsRo6Zkix9o6Hxq36igviEApsgJBt+DzVrwyCuYXggya0nkewcxOZu2 WVqq06Wk3oD4H2tDWk3r6gFHawqn2zPPlTsRsxaYmxOBaCAFwqA4q1PYttB4BBupC3Ie FF5s2bgyo1JAJzVKsWvr/NWOollJXSI51edJD5hTqZSpnx3DDJz0QsZDqypFBSKgWKyQ YQtNMCskmA5UbWzawEaCjFqJPuAsaaJ+pki7BrrXOzSiVWmjLnA5fKWUKaG/6AdTuOWh /aDg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="UIC/4e0/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b35c96f8a2si196188285a.112.2024.11.14.13.03.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:03:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="UIC/4e0/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgzJ-00046T-Rk; Thu, 14 Nov 2024 16:02:56 -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 1tBgz3-0003nZ-Bs for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:34 -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 1tBgz0-0008Bn-7u for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:32 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43161c0068bso9090315e9.1 for ; Thu, 14 Nov 2024 13:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618147; x=1732222947; 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=Zyez6NwJ+NWOqgUSWAy7md/NK0fDCEDRWAipgrG6RPE=; b=UIC/4e0/GdnWeKfivzM3hhUIqCrlR4PCtR3dA6cjOKM2efERnjFVraCzLRqirPU7Lk gz/vK98Fel3crvQQLpxstgioOyPTMZFXv2yNN5F2pjQyEHQVl7dy6/jRxqolBZpqOsnf TQlAWFPrsK2o5eEhMUR3iFTLjRfzC6zx+st4Y0A5jyfTcF7LzjI6D7O/0tp6fpYG+cGH j4t0TJwqHsDOg6s5MJuRDfphuZjDhLCgCtQOdYkXtqU1togbHDgHQVY5QoVS+pd6VbD0 40LPKtXyvXIepMWMt5VR5zxzhqIMIohWEwfb5ekG1X8awcXnWCGSRh3U5iauEhiErcMN PQ/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618147; x=1732222947; 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=Zyez6NwJ+NWOqgUSWAy7md/NK0fDCEDRWAipgrG6RPE=; b=pFIRoq+l9rjhKobr/IjQ1qqrWcuNnZooymY3CDuxVUILl3jHq0hAZq/5mmBPzXpO6K zYIE+OsJVZCtoixvej4rLFO4dab6Ap4u2zZa4qauuG3tT6uP/TKI+WVUMJXqkVyskosy b3e67wSXicn2SQp4H9hXQcolEa2RXqoAudRxl+dW12oLKt2vw2WRBDkF++v8YMJFcAX7 bybJIEZm9guD01jVhiFsO6j3iC/cNz/HMVEoNxhc0+PWka3jKeO5nigtHgO1C4nl9CF7 1I+Qe/cRM5BnL3EPO7qK7l4B8jH+Nzjaqppfgfwh+WQOXZWXyztMyJ1qRf47b+BFqene nBbA== X-Gm-Message-State: AOJu0YyhgBZCO9RvKSJs+ASf2HSE34v3LnYNlh2G/zatT3tT0qxPwByh +N/EG/Xt2bhX+fc4FVX+vT2aTMp1bHVmimUHLsNTxZ8XA9ZYXrPkdsf8UJEuVha8zEws/MnHXL3 Z X-Received: by 2002:a05:600c:46cc:b0:431:52f5:f48d with SMTP id 5b1f17b1804b1-432df78d75fmr1538675e9.31.1731618147481; Thu, 14 Nov 2024 13:02:27 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dab78918sm31872625e9.17.2024.11.14.13.02.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:02:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 17/19] hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region Date: Thu, 14 Nov 2024 22:00:08 +0100 Message-ID: <20241114210010.34502-18-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. The "xlnx.xps-ethernetlite" MR doesn't have any more I/O regions. Remove the now unused s->regs[] array. The memory flat view becomes: FlatView #0 Root memory region: system 0000000081000000-00000000810007e3 (prio 0, ram): ethlite.tx[0]buf 00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio 00000000810007f4-00000000810007ff (prio 0, i/o): ethlite.tx[0]io 0000000081000800-0000000081000fe3 (prio 0, ram): ethlite.tx[1]buf 0000000081000ff4-0000000081000fff (prio 0, i/o): ethlite.tx[1]io 0000000081001000-00000000810017e3 (prio 0, ram): ethlite.rx[0]buf 00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io 0000000081001800-0000000081001fe3 (prio 0, ram): ethlite.rx[1]buf 0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io Reported-by: Paolo Bonzini Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daudé --- hw/net/xilinx_ethlite.c | 81 +++++++++-------------------------------- 1 file changed, 17 insertions(+), 64 deletions(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index c710857cfd..0d445653b2 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -2,6 +2,7 @@ * 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 @@ -30,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" @@ -38,18 +38,12 @@ #include "net/net.h" #include "trace.h" -#define R_TX_BUF0 0 #define BUFSZ_MAX 0x07e4 #define A_MDIO_BASE 0x07e4 #define A_TX_BASE0 0x07f4 -#define R_TX_BUF1 (0x0800 / 4) #define A_TX_BASE1 0x0ff4 - -#define R_RX_BUF0 (0x1000 / 4) #define A_RX_BASE0 0x17fc -#define R_RX_BUF1 (0x1800 / 4) #define A_RX_BASE1 0x1ffc -#define R_MAX (0x2000 / 4) enum { TX_LEN = 0, @@ -73,6 +67,8 @@ typedef struct XlnxXpsEthLitePort { MemoryRegion txio; MemoryRegion rxio; + MemoryRegion txbuf; + MemoryRegion rxbuf; struct { uint32_t tx_len; @@ -101,7 +97,6 @@ struct XlnxXpsEthLite UnimplementedDeviceState mdio; XlnxXpsEthLitePort port[2]; - uint32_t regs[R_MAX]; }; static inline void eth_pulse_irq(XlnxXpsEthLite *s) @@ -119,16 +114,12 @@ static unsigned addr_to_port_index(hwaddr addr) static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) { - unsigned int rxbase = port_index * (0x800 / 4); - - return &s->regs[rxbase + R_TX_BUF0]; + return memory_region_get_ram_ptr(&s->port[port_index].txbuf); } static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) { - unsigned int rxbase = port_index * (0x800 / 4); - - return &s->regs[rxbase + R_RX_BUF0]; + return memory_region_get_ram_ptr(&s->port[port_index].rxbuf); } static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size) @@ -255,53 +246,6 @@ static const MemoryRegionOps eth_portrx_ops = { }, }; -static uint64_t -eth_read(void *opaque, hwaddr addr, unsigned int size) -{ - XlnxXpsEthLite *s = opaque; - uint32_t r = 0; - - addr >>= 2; - - switch (addr) - { - default: - r = tswap32(s->regs[addr]); - break; - } - return r; -} - -static void -eth_write(void *opaque, hwaddr addr, - uint64_t val64, unsigned int size) -{ - XlnxXpsEthLite *s = opaque; - uint32_t value = val64; - - addr >>= 2; - switch (addr) - { - default: - s->regs[addr] = tswap32(value); - break; - } -} - -static const MemoryRegionOps eth_ops = { - .read = eth_read, - .write = eth_write, - .endianness = DEVICE_NATIVE_ENDIAN, - .impl = { - .min_access_size = 4, - .max_access_size = 4, - }, - .valid = { - .min_access_size = 4, - .max_access_size = 4 - } -}; - static bool eth_can_rx(NetClientState *nc) { XlnxXpsEthLite *s = qemu_get_nic_opaque(nc); @@ -357,6 +301,9 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { XlnxXpsEthLite *s = XILINX_ETHLITE(dev); + 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"); @@ -366,6 +313,10 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0)); for (unsigned i = 0; i < 2; i++) { + memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev), + i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf", + BUFSZ_MAX, &error_abort); + memory_region_add_subregion(&s->mmio, 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", @@ -373,6 +324,11 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0, &s->port[i].txio); + memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev), + i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf", + BUFSZ_MAX, &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", @@ -393,9 +349,6 @@ static void xilinx_ethlite_init(Object *obj) XlnxXpsEthLite *s = XILINX_ETHLITE(obj); 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); } From patchwork Thu Nov 14 21:00:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843207 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp506028wrc; Thu, 14 Nov 2024 13:05:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWjzVQZZF65g3WrZ5GoDTvNRvIXBp1Z8Px1svPOhD6ePJ/FV7ywkiCm7L2lO5oCLm44uqDUsg==@linaro.org X-Google-Smtp-Source: AGHT+IFdnjwtOjggiMxmGKLmXourCrXiRn76UpSyIIIqe8xaDqdhecWlxfDYz4dGH5AEVmDtjGFd X-Received: by 2002:a05:6358:728d:b0:1c3:8f64:add6 with SMTP id e5c5f4694b2df-1c6cd0a32fcmr70668655d.3.1731618303201; Thu, 14 Nov 2024 13:05:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618303; cv=none; d=google.com; s=arc-20240605; b=Sp5yITbk9ADpOK8CNfdrJOoFReycAT8b9aT9ZIfPXXHroNqXbwm1MBmeLMF2EWsUjG iiNBPauBs9D2Vyx8delw5KCI53pJ+hmOKX07fnWUiUgn/0naI7fAd79i11dBrmWiyVtf yQvRHzI9tvU/oKYTSXMnie8C5Kd+ZCnBRKVfaDPbNdSfaEr3Zw63r9/MlgcX+5YtLMF2 7se1k8oQKWSVIyPNtsyVih1nO1haFi8x2mfB06nQp7aW6XdlGAQTWCIuKyDW3qLQ6zCR r/mzFWryuZxUMfAsAvWnST/nl7hJJOxpP++XUakeKFf3q/o0KUZBVf1EzfjomNWinN4i HKKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8xMxbLuqYUOAO97RnSz2IGo3OvTtmoe9G2YVBXewgY0=; fh=IRuGWMvTeecxgxjKSI7QmRflMkYktes0sVu/RVhAZQM=; b=Gj4HWqAiBIS56JEU1jRpJVs5EHe8Fzujmmt14CqSAcKpldUIhfmFSuVpmPEsWGfLEV 6+hHb3KDuZeiWuQMojEPPDBVe768XoViSttZWXbgYDFRi2NWlWJ4+qEV5/hk7Ez15WpA GKSQg0xSi/90hapYqPrzcMNa8BgdDny6wzRO9NTTmzDcypKM+hpQRwp6sov+lkDznGAE jwDPiliV+Og8Pt99tMgAUYmWxzhOar6ziuJ70hQG4pvvcCdSQds5OwehW5kH2m7bQa08 MRSlJ6VtCkumHa70ScuBL1DUa4DSA0gXHHDu1+0s0JpqRD4xuS/a35DZtFkjk9WCZANo QYUA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aqOqZqyY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51479b130bcsi58987e0c.90.2024.11.14.13.05.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:05:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aqOqZqyY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgzh-0004b2-3o; Thu, 14 Nov 2024 16:03:13 -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 1tBgzA-0003zl-PB for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:42 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgz9-0008Cu-4i for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:40 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-37ed3bd6114so611782f8f.2 for ; Thu, 14 Nov 2024 13:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618155; x=1732222955; 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=8xMxbLuqYUOAO97RnSz2IGo3OvTtmoe9G2YVBXewgY0=; b=aqOqZqyYm2rOA2dmzZdBoWBqf5yH/U/fszhfrCX8evsWgh9dzssPdNJaSaSj+Rw3nW da+rMJ8lqhpsCod6/9oYzzvNcG7EmcLFClv89VRgWUY8zF8NvV8SXpZqh+zk/8z+CGZz 6FKF8eZtfqijLOurKM4FtwuVmYCYQY0kJDBs+KvZXF0ZOM2Ia/PqHxs9dyE8HlCt3H08 k1Vw+9n/YUMWUdktA1TUhhHB+2WSAOPWNt5xDDxSQLUlePFzZWaDXRb25cBmIMB2QPm7 KrVz7s7VoDHmRsF5f/UppOOOR+8CE7CD7b3bBs69yv43xbIhgT22B9QrNT1V5eobZIpJ NYYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618155; x=1732222955; 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=8xMxbLuqYUOAO97RnSz2IGo3OvTtmoe9G2YVBXewgY0=; b=p5BZL3ZuWPWrd9LFk0V/P/nC34WoaRltvCIAGvgKRVS2wiqBZ8IKbW/15TPhTP7gCC hNg4Zx4OAqiQdsJYC8Iazld96ggKoDfY9etLppPIz9+TNZgM5ZfTW5atpyfzWx7lx+Ex saQbgPBVx/U6I4uX+UTI2Ljc20rULsLtRYBJ3GoZrU66ysfKYRhq19xMidtZSF+Pxjh9 vQPxRdeUQ6vIJTMajRdDq5tx5ybb2EzoMyajl/RYzAqD8r06BdgYxcMXBP+6LgrF77L1 1CoQ0Lq1CVG9ENfKJpS4xr9FFIHrM8CA65dFqho8UNork8cp64FZpDibjpI7F8YUxEL1 vx3g== X-Gm-Message-State: AOJu0Yw5szrONy1MggdaL+uADV/G5XfWgJ8K8mHf5JfW1WzCTmNsy/uV RmUUhBX7nrxk7uV6Dg7LOR8vHyaxEqJENsrIco6Rx482W4+zycoMldTY6lwm4lf9zOifmqs+au8 T X-Received: by 2002:a05:6000:98e:b0:37d:54d0:1f20 with SMTP id ffacd0b85a97d-38225a04975mr160037f8f.24.1731618154983; Thu, 14 Nov 2024 13:02:34 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adbbc4fsm2453941f8f.46.2024.11.14.13.02.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:02:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 18/19] hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container' Date: Thu, 14 Nov 2024 22:00:09 +0100 Message-ID: <20241114210010.34502-19-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Having all its address range mapped by subregions, s->mmio MemoryRegion effectively became a container. Rename it as 'container' for clarity. Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daudé --- 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 0d445653b2..5f1ff7b712 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -86,7 +86,7 @@ struct XlnxXpsEthLite { SysBusDevice parent_obj; - MemoryRegion mmio; + MemoryRegion container; qemu_irq irq; NICState *nic; NICConf conf; @@ -301,7 +301,7 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { XlnxXpsEthLite *s = XILINX_ETHLITE(dev); - memory_region_init(&s->mmio, OBJECT(dev), + memory_region_init(&s->container, OBJECT(dev), "xlnx.xps-ethernetlite", 0x2000); object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, @@ -309,31 +309,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)); for (unsigned i = 0; i < 2; i++) { memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev), i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf", BUFSZ_MAX, &error_abort); - memory_region_add_subregion(&s->mmio, 0x0800 * i, &s->port[i].txbuf); + 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_BASE0, &s->port[i].txio); memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev), i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf", BUFSZ_MAX, &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_BASE0, &s->port[i].rxio); } @@ -349,7 +349,7 @@ static void xilinx_ethlite_init(Object *obj) XlnxXpsEthLite *s = XILINX_ETHLITE(obj); 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); } static Property xilinx_ethlite_properties[] = { From patchwork Thu Nov 14 21:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 843203 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp505847wrc; Thu, 14 Nov 2024 13:04:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUvMpH24b4GD82bNOwQsKCS/VXk7ww+iejQjgvQHiHWRth5y462bPbmX8yfAE/MOMFky2v3rg==@linaro.org X-Google-Smtp-Source: AGHT+IFWCh+s0qd/wYanYoOUih6wjQ1Kz8DeI8fP/dKaM9OXNaQfsCvkqA9UqGy+QGOlVFv2G8aq X-Received: by 2002:a05:6122:65aa:b0:50d:53ab:3d0c with SMTP id 71dfb90a1353d-5147853ff1cmr580128e0c.2.1731618282853; Thu, 14 Nov 2024 13:04:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731618282; cv=none; d=google.com; s=arc-20240605; b=MFUcIaaTGFzfgDLW4NZ4pqCnHRu0WGnvkEBXgEmemDz2zXf88NkSX+NBQAiA6qE/Lg z4X5xOKv0m0Md9Nmp0jnbOzMs+l/nLn4W4tOtX4Op2viiY18YokjPN94xn37JS0HrPuT 0qsLl1zSpCiKsgR15N/glJ44It3bv2Mr1N2N7HOoTtdR65ZpXf6Sbw96NgiDtCMvHEzj 9y9CbkCxQCQ/XopzmLs9WWaIuwUOLQ83bZ5buAVEVGB2z67t19lTE1z71V81VI4KKUp+ DAMzqNfm3paQQPSLQPMwBjx5rXCd9rpwXIRNqzuLkLftiQnNJGuJQjk6IbnaJCPELeIP +qvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nb6BGc20Jrn3ivl3e3d8GrejdUgzYW7qbVEFEk+JhnM=; fh=5jk8UxAyCIlFm5FJTrcugn+mYgKxg5oCAlh/+aIwL9w=; b=jzXQfn1FDsDwCeDE1aGwK+etRPW9SmC3bl+BF3pDdXBEBcbnoRbAyyAtKhrvvcxGq8 7L+qeAR76pofaSUSk4tEcTO8DNYHmRR6/WCZP2Yx/+RHgCHmQOiBUqktULYp3ZpScZGb CbHM6W0DbPzTbP3mgVVD70t92L6CWKes+MtxS9DcR0UTi10Fjm5WIY44nTqYbMxEScmk YTvEdHikaQxrCJVnz4KObLS5S3+02pT57V82G95guMqJ+yQP0ILYz+ObXFYfLC7XdtgF pgRRn9egwfqU5hN3Bsr97VZGXDOn7PVaL0cgt894ZaQMVoRY6UWbvBWhOHZQDZZ1oUCu wPJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cVQVwNdC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51479dc54b1si27204e0c.285.2024.11.14.13.04.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 13:04:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cVQVwNdC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBh06-0005Ty-Ry; Thu, 14 Nov 2024 16:03: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 1tBgzG-00046G-Pg for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:47 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgzE-0008DN-A1 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:02:46 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so281095e9.0 for ; Thu, 14 Nov 2024 13:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618162; x=1732222962; 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=Nb6BGc20Jrn3ivl3e3d8GrejdUgzYW7qbVEFEk+JhnM=; b=cVQVwNdCq9YmOJpndZNgMxTLc6xKryNpSLUVIi/5DcY/MzYsrQVHTH3BNMmiXC8EE+ 9D2sqJEuPxGUcpVNeJYFHPx896SKtIBBSfXzet8momMNk9DhgCMfzjfFeWMKSATnbFLL uAdXgHT35qUsZa2Ux0iDR+eM3D4JILOhoSEAUNvGdBJhfjoiP8Cd67wMSu6rt2OiQK9B 7+LV3CkgNCztat93Mq0kAynJ7YDN7bOnWxvQ/0D7N+FlcVbYB5vgisqBJy3V17bi/rJK zeZaUbBRkJLlnF1PyIsRfG0O69hNk3wwD3oKLY1SzGKR4fm/XcANmZx8/PZnKQBbS3HP rjRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618162; x=1732222962; 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=Nb6BGc20Jrn3ivl3e3d8GrejdUgzYW7qbVEFEk+JhnM=; b=v7ZT6ERgMPUnK2+hFACv/dfvCAOoUpyVCc9NjzkBppJ+hMzFQNnMuA07BmW7RBIHIX /xct2KxpOSQ21sbgnHhg4ck0WgfT+BLt/EXj1wgH/WPLiX131bw8adUZ6sBtIXqc6PlR fnujxxl4VKcR8l+5/v3kCbfFNcf4HM7u/64mk0hXGSynU4QonX1ssHa9+y5/dxWibH1c VFBFGjNrSfJgytN38W2xdcX1lJ2Vq3I8bqzuvBpzQkKCPdCUoCwAiFcls8v6hvPiSG+V yX3cIE7q07DkwYnypjxfzK7/fkXMXSghMKJUdw5+hk0AjSZcTUd3u2tl6gZ9GvhNEmY4 Cf/g== X-Gm-Message-State: AOJu0YzX82hLWh8+M92qELCKJJXXHfLeETXKHRq6nJZbe/Y3GfZnvAyS +HUqBhUzBWB/n5k/VY30SRVq3pg5dS3BTIcApUEzC5krsMfVqkIPmg2EZrtmXmFswULMOucAghe D X-Received: by 2002:a5d:5f43:0:b0:37d:48ec:547 with SMTP id ffacd0b85a97d-38225a32a44mr185997f8f.29.1731618161876; Thu, 14 Nov 2024 13:02:41 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38221c9d838sm1380709f8f.6.2024.11.14.13.02.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:02:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , Peter Maydell , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH RESEND v2 19/19] hw/net/xilinx_ethlite: Map RESERVED I/O as unimplemented Date: Thu, 14 Nov 2024 22:00:10 +0100 Message-ID: <20241114210010.34502-20-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In order to track access to reserved I/O space, use yet another UnimplementedDevice covering the whole device memory range. Mapped with lower priority (-1). The memory flat view becomes: (qemu) info mtree -f FlatView #0 Root memory region: system 0000000081000000-00000000810007e3 (prio 0, ram): ethlite.tx[0]buf 00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio 00000000810007f4-00000000810007ff (prio 0, i/o): ethlite.tx[0]io 0000000081000800-0000000081000fe3 (prio 0, ram): ethlite.tx[1]buf 0000000081000fe4-0000000081000ff3 (prio -1, i/o): ethlite.reserved @0000000000000fe4 0000000081000ff4-0000000081000fff (prio 0, i/o): ethlite.tx[1]io 0000000081001000-00000000810017e3 (prio 0, ram): ethlite.rx[0]buf 00000000810017e4-00000000810017fb (prio -1, i/o): ethlite.reserved @00000000000017e4 00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io 0000000081001800-0000000081001fe3 (prio 0, ram): ethlite.rx[1]buf 0000000081001fe4-0000000081001ffb (prio -1, i/o): ethlite.reserved @0000000000001fe4 0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io Signed-off-by: Philippe Mathieu-Daudé --- hw/net/xilinx_ethlite.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 5f1ff7b712..1be38c44dd 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -95,6 +95,7 @@ struct XlnxXpsEthLite uint32_t c_rx_pingpong; unsigned int port_index; /* dual port RAM index */ + UnimplementedDeviceState rsvd; UnimplementedDeviceState mdio; XlnxXpsEthLitePort port[2]; }; @@ -304,6 +305,16 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) memory_region_init(&s->container, OBJECT(dev), "xlnx.xps-ethernetlite", 0x2000); + object_initialize_child(OBJECT(dev), "ethlite.reserved", &s->rsvd, + TYPE_UNIMPLEMENTED_DEVICE); + qdev_prop_set_string(DEVICE(&s->rsvd), "name", "ethlite.reserved"); + qdev_prop_set_uint64(DEVICE(&s->rsvd), "size", + memory_region_size(&s->container)); + sysbus_realize(SYS_BUS_DEVICE(&s->rsvd), &error_fatal); + memory_region_add_subregion_overlap(&s->container, 0, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rsvd), 0), + -1); + object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, TYPE_UNIMPLEMENTED_DEVICE); qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio");