From nobody Sun May 19 23:41:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1682355125; cv=none; d=zohomail.com; s=zohoarc; b=AsgwWxcnyfSOmc56zVj46ZnB88zaubfqFrwDVTV8en2eSfdDt+ILbT4fYEqO6EngRJq2Wfl7JeW74la5ho7J46G3wQvsbWstMtMMYeUZhZrU19n2rAZ2drDjhR0q3w3FIE42aEYFVrP7Sbu4/gI5HxaB9ia/udfh63cGCi1Xqwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682355125; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M0ZbXxb0hmj0vZqrNkooEeAN2y7lCrT/j7W1IOTwXQ4=; b=HHT0pYpleNonuEsWaX/zHL2ESL/OnRqZcvmb+m12fVoCjOiY32W2EUt2LBSv80MII2e5Bs0pf2SYNOc0p4L68cbUhOYvcxXo9B04QfJpabACgftGIGKVlAdEGtiJDUlOXNUtlBPQ39xZZIMaReC8VcsMvt6x3Ls5ZqqL73ITAvE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682355125460690.4628134813075; Mon, 24 Apr 2023 09:52:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqzPA-00038F-Oc; Mon, 24 Apr 2023 12:51:08 -0400 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 1pqzP4-00035J-CM for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:51:02 -0400 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 1pqzP2-00029l-25 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:51:02 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-2f3fe12de15so2833151f8f.3 for ; Mon, 24 Apr 2023 09:50:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id b5-20020a056000054500b002e5ff05765esm11211279wrf.73.2023.04.24.09.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 09:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682355055; x=1684947055; 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=M0ZbXxb0hmj0vZqrNkooEeAN2y7lCrT/j7W1IOTwXQ4=; b=p665vZMaDiTOgl6tOWtCZi/7VVua0cSUHcT1Rlo/pV6W+KE9RkRUmKjmvF/QJEieGC C0QGaMuwYwejXa+LcrvNJF1bGAkv8Ro7cZAdfe99mdapNIW6PK0NrWmvY0myT/d7B53P AmV6d6Eb2zKtq8NZHTHXwjjrbARAcq+3xdBi6OeOd9P6y8trB9MgFfnwLZ9z2NVNydSc Lza0Aip6E09eJtIA5oAqMla/N/jjiFGBM7P8X7dIMuR3Xh5Qpxud6KyJgTqapTyQByV9 jFcz2EoNScNe/RDD+YPzMlhA50H7hdaHRMTlxtMA1cbHl4x3Ck3vGwy6ovnzOwbcsWv0 KP/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682355055; x=1684947055; 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=M0ZbXxb0hmj0vZqrNkooEeAN2y7lCrT/j7W1IOTwXQ4=; b=MgEJ4GsgSLzYJtnBSHpAYfw5FRDpcKNSAmjmdCeSjOG7OJSLnZPyZbO3gSzUu8yQYR OGVKUklOT7nL9cSlCNxJXoakRvhQ5ygI+ayXShIo5Ad3mOIyz7JUtr8jXUmqq2pZ418n 9jH1rTMdYlTkLGpiRt/8VkkP6TK/1Q7X6X3YFWnjhYAxi2lHRY7kH0z+A7PkjNyYnjsz yElKRl5knbynTRREZN60O29sJ+ME3dy+bMLOMXKFalVVzxV23dZ8fiWyMd2VKhOEx78H vTiq/Nit0OBtd2Bub31/sl9hdkHt/WVCLodGdD1C4LXpsfWDLW3PuZ5hjsiIXU5Bum/A PRnQ== X-Gm-Message-State: AAQBX9ccUALPLA9cGCZi4IwTYRMH83h2JAiTDHStbF8RD0+X1YrmykUr jj0ZZeMEVCZ15iRZQx/8saeYug== X-Google-Smtp-Source: AKy350aCAPk2+X+aTXAlVLuCljHEARlkrGrqRFn9wNROAjyqAXddl+O9H+KCSekpkqioyo1V67uAYA== X-Received: by 2002:adf:e686:0:b0:2ce:9877:84ae with SMTP id r6-20020adfe686000000b002ce987784aemr8693521wrm.16.1682355055722; Mon, 24 Apr 2023 09:50:55 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Beniamino Galvani , Strahinja Jankovic , qemu-stable@nongnu.org Subject: [PATCH 1/2] hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields Date: Mon, 24 Apr 2023 17:50:52 +0100 Message-Id: <20230424165053.1428857-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424165053.1428857-1-peter.maydell@linaro.org> References: <20230424165053.1428857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1682355127915100003 Content-Type: text/plain; charset="utf-8" In allwinner_sdhost_process_desc() we just read directly from guest memory into a host TransferDescriptor struct and back. This only works on little-endian hosts. Abstract the reading and writing of descriptors into functions that handle the byte-swapping so that TransferDescriptor structs as seen by the rest of the code are always in host-order. This fixes a failure of one of the avocado tests on s390. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- hw/sd/allwinner-sdhost.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index 51e5e908307..92a0f42708d 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -302,6 +302,30 @@ static void allwinner_sdhost_auto_stop(AwSdHostState *= s) } } =20 +static void read_descriptor(AwSdHostState *s, hwaddr desc_addr, + TransferDescriptor *desc) +{ + uint32_t desc_words[4]; + dma_memory_read(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words), + MEMTXATTRS_UNSPECIFIED); + desc->status =3D le32_to_cpu(desc_words[0]); + desc->size =3D le32_to_cpu(desc_words[1]); + desc->addr =3D le32_to_cpu(desc_words[2]); + desc->next =3D le32_to_cpu(desc_words[3]); +} + +static void write_descriptor(AwSdHostState *s, hwaddr desc_addr, + const TransferDescriptor *desc) +{ + uint32_t desc_words[4]; + desc_words[0] =3D cpu_to_le32(desc->status); + desc_words[1] =3D cpu_to_le32(desc->size); + desc_words[2] =3D cpu_to_le32(desc->addr); + desc_words[3] =3D cpu_to_le32(desc->next); + dma_memory_write(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words= ), + MEMTXATTRS_UNSPECIFIED); +} + static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, hwaddr desc_addr, TransferDescriptor *desc, @@ -312,9 +336,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostS= tate *s, uint32_t num_bytes =3D max_bytes; uint8_t buf[1024]; =20 - /* Read descriptor */ - dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc), - MEMTXATTRS_UNSPECIFIED); + read_descriptor(s, desc_addr, desc); if (desc->size =3D=3D 0) { desc->size =3D klass->max_desc_size; } else if (desc->size > klass->max_desc_size) { @@ -356,8 +378,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostS= tate *s, =20 /* Clear hold flag and flush descriptor */ desc->status &=3D ~DESC_STATUS_HOLD; - dma_memory_write(&s->dma_as, desc_addr, desc, sizeof(*desc), - MEMTXATTRS_UNSPECIFIED); + write_descriptor(s, desc_addr, desc); =20 return num_done; } --=20 2.34.1 From nobody Sun May 19 23:41:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1682355131; cv=none; d=zohomail.com; s=zohoarc; b=d0a2et8VR3SyYPUbuu0zpx+t/OVAgIjdfLg6ci+swNywhoNsFqbL0v+tY5UX9AmD/ehYaFA+RxDhBRB7ESttXg64PS8MoDE1Qk5jgcnt5EmbgYesZ/5sRWJEtt7vZGM3j64mlVESNAY6R3mIifAzNJ+UVyXdSflegRjZLMlaF6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682355131; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KDoq9PyOjHZooAPOHtlklGAcY5q2//1VIptVhgf5CWk=; b=Oyp5+orQTp2U+vVj4zjW+9bc7l/QU6/mOp4sI6ss0nIosDYpYI+PgRo9iHcsJx1bE46n5lkw2zyKYTYY/zcmF4bfX8g4a2dvegXnxRHL45t+JmFVfyPkOrNGW6MdFAYxZEk5wbz2lt7/y/WBD2RRMueb7jxO9tOKNUn2RzJvZdw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682355131584644.4145101617502; Mon, 24 Apr 2023 09:52:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqzPB-00038p-6q; Mon, 24 Apr 2023 12:51:09 -0400 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 1pqzP4-00035I-Ba for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:51:02 -0400 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 1pqzP2-00029y-4Z for qemu-devel@nongnu.org; Mon, 24 Apr 2023 12:51:02 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-2f833bda191so2834620f8f.1 for ; Mon, 24 Apr 2023 09:50:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id b5-20020a056000054500b002e5ff05765esm11211279wrf.73.2023.04.24.09.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 09:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682355056; x=1684947056; 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=KDoq9PyOjHZooAPOHtlklGAcY5q2//1VIptVhgf5CWk=; b=aYR9K/U7r7GLAzB34mn7InSVi3oVnx1JTcFGS4b0CC7uUm6knh0ACuI83LDhm76UK4 6ILiOkySMs0RZxyPr9hTJyxxHO9p1f3vnjwwrcZzQIcngY2A2bGO+JWVlF29UlKsbAcl qalN+lQvr8l+2HZoW2ipOZKhgvg0rItvSz+xY7uYz2byCd//1oQ/tGAbVmSYdjkoF/wP o0Cyuj7Tzq7hcdv8hszOTeTRrtc8ZH69K5cfZJBzOfIE1N2rnRDqKic9ld2bi2ex4G+i yWnStC6wTDibl27/Gc7ramsfWGrNrgSLFvZgIcTynn4rfIGIN9VWn4HPneVel9Fpcp5r 3Qwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682355056; x=1684947056; 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=KDoq9PyOjHZooAPOHtlklGAcY5q2//1VIptVhgf5CWk=; b=QFJLd6J4go6CXCvKrL2I6kZzADMFMK53xl+iloTB0lBaeYhIzsHYGPfPcjN2PrJQ+u SfrFzBL5TVNH7iweOXOgkUB+YVh1CoCHusEQ4BdWtOr5FBQwO/oMNrkJbDxb2Ww31JyU dUUonedhjiKsn3ahuUsuzZj5UOAhyl48oI9VoRxxenZtlJdkqnlEODEcVsGrRFHvs4cE 15DIhdwtvu8xD2a/4IasuOqyoX6Q5HdbHRzb7RabYx5gypcbWlAtZECiyJqNtTRRuMze bajs/2jsAqx8JdUNwueCiLlUwMrZXX63BgEI4DS3KIT7a10b3Zng27zBf6xYQVjKN13o NjxQ== X-Gm-Message-State: AAQBX9fJ5qYHnc3NBGKk9SuMFogig4XFB95WW/Q9Lo2geZOuaFiLiQSl W3DrHUK0urFMmih38v26lfGw/A== X-Google-Smtp-Source: AKy350YUC5ZiwtPzQ0dtq0m3kk6F4JiZy5arR8XedZL40NN82KJ5wCv7b9XIR+bCIwd8pYQhj68cvg== X-Received: by 2002:adf:e54c:0:b0:2fb:ca40:e42c with SMTP id z12-20020adfe54c000000b002fbca40e42cmr10097973wrm.6.1682355056231; Mon, 24 Apr 2023 09:50:56 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Beniamino Galvani , Strahinja Jankovic , qemu-stable@nongnu.org Subject: [PATCH 2/2] hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields Date: Mon, 24 Apr 2023 17:50:53 +0100 Message-Id: <20230424165053.1428857-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424165053.1428857-1-peter.maydell@linaro.org> References: <20230424165053.1428857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1682355132630100002 Content-Type: text/plain; charset="utf-8" In allwinner-sun8i-emac we just read directly from guest memory into a host FrameDescriptor struct and back. This only works on little-endian hosts. Reading and writing of descriptors is already abstracted into functions; make those functions also handle the byte-swapping so that TransferDescriptor structs as seen by the rest of the code are always in host-order, and fix two places that were doing ad-hoc descriptor reading without using the functions. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- hw/net/allwinner-sun8i-emac.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c index b861d8ff352..fac4405f452 100644 --- a/hw/net/allwinner-sun8i-emac.c +++ b/hw/net/allwinner-sun8i-emac.c @@ -350,8 +350,13 @@ static void allwinner_sun8i_emac_get_desc(AwSun8iEmacS= tate *s, FrameDescriptor *desc, uint32_t phys_addr) { - dma_memory_read(&s->dma_as, phys_addr, desc, sizeof(*desc), + uint32_t desc_words[4]; + dma_memory_read(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words), MEMTXATTRS_UNSPECIFIED); + desc->status =3D le32_to_cpu(desc_words[0]); + desc->status2 =3D le32_to_cpu(desc_words[1]); + desc->addr =3D le32_to_cpu(desc_words[2]); + desc->next =3D le32_to_cpu(desc_words[3]); } =20 static uint32_t allwinner_sun8i_emac_next_desc(AwSun8iEmacState *s, @@ -400,10 +405,15 @@ static uint32_t allwinner_sun8i_emac_tx_desc(AwSun8iE= macState *s, } =20 static void allwinner_sun8i_emac_flush_desc(AwSun8iEmacState *s, - FrameDescriptor *desc, + const FrameDescriptor *desc, uint32_t phys_addr) { - dma_memory_write(&s->dma_as, phys_addr, desc, sizeof(*desc), + uint32_t desc_words[4]; + desc_words[0] =3D cpu_to_le32(desc->status); + desc_words[1] =3D cpu_to_le32(desc->status2); + desc_words[2] =3D cpu_to_le32(desc->addr); + desc_words[3] =3D cpu_to_le32(desc->next); + dma_memory_write(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words= ), MEMTXATTRS_UNSPECIFIED); } =20 @@ -638,8 +648,7 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque,= hwaddr offset, break; case REG_TX_CUR_BUF: /* Transmit Current Buffer */ if (s->tx_desc_curr !=3D 0) { - dma_memory_read(&s->dma_as, s->tx_desc_curr, &desc, sizeof(des= c), - MEMTXATTRS_UNSPECIFIED); + allwinner_sun8i_emac_get_desc(s, &desc, s->tx_desc_curr); value =3D desc.addr; } else { value =3D 0; @@ -652,8 +661,7 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque,= hwaddr offset, break; case REG_RX_CUR_BUF: /* Receive Current Buffer */ if (s->rx_desc_curr !=3D 0) { - dma_memory_read(&s->dma_as, s->rx_desc_curr, &desc, sizeof(des= c), - MEMTXATTRS_UNSPECIFIED); + allwinner_sun8i_emac_get_desc(s, &desc, s->rx_desc_curr); value =3D desc.addr; } else { value =3D 0; --=20 2.34.1