From patchwork Thu May 14 14:13:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62D36697 for ; Thu, 14 May 2020 14:15:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39BB420671 for ; Thu, 14 May 2020 14:15:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E1qai1NJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39BB420671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEeP-0001ma-90 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:15:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEch-0007Eb-Kt for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:07 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]:33388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcg-0003lN-UH for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:07 -0400 Received: by mail-lf1-x12d.google.com with SMTP id z22so2806244lfd.0 for ; Thu, 14 May 2020 07:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1PhlQHMBIBZyhaIVdNeOmpiXX6PbldkHvHxVIsbvZwc=; b=E1qai1NJLvdh6rguS0SM/8QbbjRIzvPX+fJFDUh1V03wPnHAzDUXDkBZWDPW5paO9+ CIWG+DVWatL9DJjksyppeThBa/PbDj2OJ8agLhL9rIop18mvddgnAgn/1YLuK9g3oc0H KCQUMIXIGRU/e/KyFBYUQF1dlCEc2tKxLuRK9xDXd915g0VdPjUHO9mH0UO39/FgkcpD 7ggJOAeEsvcfTEsvjlqpYyFgL3ATsO9VPm5z3ZoB/38gOxuzavqkpDNDaDwqBMWmI4UL A667xHgxQzM2SS66rgchhs/L7r8R/t/2Td1gIgAcTVD0tq3PxqTKaViE8kTL3d2iyiUM fhgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1PhlQHMBIBZyhaIVdNeOmpiXX6PbldkHvHxVIsbvZwc=; b=RI59c+RgeSUPqa8dHWhxXZMt7A+/ptFGItF0ikfviyYmDRCAvIGYdhRBDMj9UcSUJH 7OgUEyhp7EJSS5ZUOzqSJr9fQPTE8VJtXzgj6KCfNm0Eq0F+6TegVMESNQbESKVX7XL4 KVP6Ugrl4rD4ORVIfcIGQ6A57bFLpPGAm+kPPaX0mK8Ygu/xsXmNTonbFzhMZIFnAkZx fpwfyNx++9WEARm/iBdms+qujHwaGO2RT+3PhwKqf9jRXkR4aAw23DgPbNE/IHePT7jv emFmKfsHGXaHdGezkqD8bKBzSuk3SKrhj4Up1BB+f6Qbf75+IgBG1jz1tnmXkqe8ZZAE DJvg== X-Gm-Message-State: AOAM533knGv4VFV/20UvQ6tcz4zNEHFE7OApb5UMCdIyHUCO3UNUL+RU Ax++4K2pfZ6pyG9KV1/0OsMF/EoEo5M= X-Google-Smtp-Source: ABdhPJx61lXYooqthv1DVwyn+D+vQxgeA54AujYJpCrFVA0ZMuS2ByV/C4+s5DhM7DpvGQRLZGPVgw== X-Received: by 2002:ac2:599e:: with SMTP id w30mr2757177lfn.188.1589465644922; Thu, 14 May 2020 07:14:04 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id d9sm1917486lfa.77.2020.05.14.07.14.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:04 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 01/14] hw/net/xilinx_axienet: Auto-clear PHY Autoneg Date: Thu, 14 May 2020 16:13:49 +0200 Message-Id: <20200514141402.12498-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x12d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Auto-clear PHY CR Autoneg bits. This makes this model work with recent Linux kernels. Reviewed-by: Francisco Iglesias Signed-off-by: Edgar E. Iglesias Message-Id: <20200506082513.18751-2-edgar.iglesias@gmail.com> --- hw/net/xilinx_axienet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 704788811a..0f97510d8a 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -149,8 +149,8 @@ tdk_write(struct PHY *phy, unsigned int req, unsigned int data) break; } - /* Unconditionally clear regs[BMCR][BMCR_RESET] */ - phy->regs[0] &= ~0x8000; + /* Unconditionally clear regs[BMCR][BMCR_RESET] and auto-neg */ + phy->regs[0] &= ~0x8200; } static void From patchwork Thu May 14 14:13:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96421739 for ; Thu, 14 May 2020 14:15:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6AAEB20671 for ; Thu, 14 May 2020 14:15:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q0yqi/X/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AAEB20671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEe4-0001QR-BM for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:15:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEci-0007Gt-UX for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:08 -0400 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]:39921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEci-0003lV-7Y for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:08 -0400 Received: by mail-lj1-x241.google.com with SMTP id u6so3682402ljl.6 for ; Thu, 14 May 2020 07:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5d6jbtddgGFL5WCJTRJhnSo2ooSc1NJpLI9in/SUXbM=; b=q0yqi/X/LYs4yCqVyIullYi7RDgXfysKHhW4D2zYd49eDkmlR7ImGdFUNcQ3qs1PFx r2CoJDWCgDExyDSM7GD4hCFuoQwm408PXOstqK8a802rjfz1/Qk1KwV3StxZIbjBrZCP FhuHXxyAsTPrlcxauJNp4DxVPkHv2k1HaJAX4iPI4HbBijCUItByc3KrF27mH3kJdzw9 esFGzOVpriCe/MbcxRKySN7ed63spNuPdDdWrchNLAwqavG5/0ujRQxPavelPgjIeeh/ rgHVfTGxZXIy7/Aj5VI1KXvcbpNwBEudwMxmMctiG2LeQmugt90zZJB6LUJiqdTi5IG5 QgMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5d6jbtddgGFL5WCJTRJhnSo2ooSc1NJpLI9in/SUXbM=; b=CoaTVb8m8qVZs2FlinrJ0EZWFrvb3/y2aRccDaUTimGGg8y1tXTRiCtIxIdxnnTrpw rPuYm3PSLP+r0mpfHg/lZnC1sRme/ysc2XjHirUTq9AzfqDuYHHPvxAUK3Kx8QGxhz4O i2KVCCwGE4n747u4j51OyoKXIXQCjVmVjFjEpVROMjMJ6OpGujnAaOLlo1a480g6z20s B7kZESf2ngOyzcGE+qxtciKC+SQio8zctjF2Q9ETQxTBbhWzpwlx4Uf+v+nkNZ3qN0s3 5iRqUc7mYLLiIVr0+ZzQXp2IzJzkMBpf9EbZQlrYxCNwi0rGKk2gt6pNOGp6ACWUdxEj +SKg== X-Gm-Message-State: AOAM532cxwDcFj5fK5LYfbLx8wdgP/qFzeV2ingpT+V+QxVrXnmTbYXE ME7+bBa5uGGCvszuXEGgrI0hynGke8I= X-Google-Smtp-Source: ABdhPJxwB9urorrEJw4EbtD0neypToKHGXNAwUpQnfeuNXdpUmd77TOR1Hzc3cRADvzzBJHg8kqNqA== X-Received: by 2002:a2e:8813:: with SMTP id x19mr2951450ljh.83.1589465646254; Thu, 14 May 2020 07:14:06 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id g11sm1575083ljg.24.2020.05.14.07.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:05 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 02/14] hw/net/xilinx_axienet: Cleanup stream->push assignment Date: Thu, 14 May 2020 16:13:50 +0200 Message-Id: <20200514141402.12498-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::241; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x241.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Split the shared stream_class_init function to assign stream->push with better type-safety. Reviewed-by: Alistair Francis Reviewed-by: Francisco Iglesias Signed-off-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200506082513.18751-3-edgar.iglesias@gmail.com> --- hw/net/xilinx_axienet.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 0f97510d8a..84073753d7 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -1029,11 +1029,19 @@ static void xilinx_enet_class_init(ObjectClass *klass, void *data) dc->reset = xilinx_axienet_reset; } -static void xilinx_enet_stream_class_init(ObjectClass *klass, void *data) +static void xilinx_enet_control_stream_class_init(ObjectClass *klass, + void *data) { StreamSlaveClass *ssc = STREAM_SLAVE_CLASS(klass); - ssc->push = data; + ssc->push = xilinx_axienet_control_stream_push; +} + +static void xilinx_enet_data_stream_class_init(ObjectClass *klass, void *data) +{ + StreamSlaveClass *ssc = STREAM_SLAVE_CLASS(klass); + + ssc->push = xilinx_axienet_data_stream_push; } static const TypeInfo xilinx_enet_info = { @@ -1048,8 +1056,7 @@ static const TypeInfo xilinx_enet_data_stream_info = { .name = TYPE_XILINX_AXI_ENET_DATA_STREAM, .parent = TYPE_OBJECT, .instance_size = sizeof(struct XilinxAXIEnetStreamSlave), - .class_init = xilinx_enet_stream_class_init, - .class_data = xilinx_axienet_data_stream_push, + .class_init = xilinx_enet_data_stream_class_init, .interfaces = (InterfaceInfo[]) { { TYPE_STREAM_SLAVE }, { } @@ -1060,8 +1067,7 @@ static const TypeInfo xilinx_enet_control_stream_info = { .name = TYPE_XILINX_AXI_ENET_CONTROL_STREAM, .parent = TYPE_OBJECT, .instance_size = sizeof(struct XilinxAXIEnetStreamSlave), - .class_init = xilinx_enet_stream_class_init, - .class_data = xilinx_axienet_control_stream_push, + .class_init = xilinx_enet_control_stream_class_init, .interfaces = (InterfaceInfo[]) { { TYPE_STREAM_SLAVE }, { } From patchwork Thu May 14 14:13:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39409697 for ; Thu, 14 May 2020 14:15:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D29820671 for ; Thu, 14 May 2020 14:15:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="t7DviUIT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D29820671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEdi-0000ff-6S for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:15:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEck-0007JD-6e for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:10 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:35400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcj-0003lk-Dl for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:09 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 82so1259816lfh.2 for ; Thu, 14 May 2020 07:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iXdbdMtZycVoB4yx0aXAJuiS2G/DZIxaDbZ/nG1ravs=; b=t7DviUITKWI+B3YUzmUIeXjCEWZiqstLHO8iYnKIPWht4YmBcGiAKiQjQHwqDGpk8J 7QQ5+iBqYr8aPjmVr13NAdRxZSZR4c8No2G/9jVwFKwhuE9GARKHEM2kpqCdbb8r5duj KYddY3ImgkH1VH6TuiCfwCRU8J4edUO+1T0ndhS/JTvQfTs0M8W3n4hezvKTFJ2N745t oRLsBGcMKbWg3CvwJmwt4KwiX257IeTi8RuIGy0gmYYNNx7LRKUbMW5dYAQk0mCcsDK7 zzWhzdwPlTB2N5Hd24GfVwY8j2oPQ6CBnfAPnFVZUNzJsgO6KgG2CwG9M6dCQPEU82+P 2bDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iXdbdMtZycVoB4yx0aXAJuiS2G/DZIxaDbZ/nG1ravs=; b=kY9Zy22iG0agqCdgSSnXDlA/rsdlmmdkLiF3fx/mWaoe/1DJwQ4+vSiAVFvKerbQdO 6mSXXdMkAGLm7XjtCw7xBeouSO6OzUDc+8H/PZyrZlmbh/RbgJkfPkThgx8ZwxEHyjlI ClHy4nyWqVYyatDF+o3Xp1rlu4B6icsDAPOJcLRMEdRO8AaN1vifbNRH/kIlsdaocpbj HTkL3ZyKGuWOGk5g1+xKjr7hqLbeymveePpItb9HUuefWqip2tp9tVP360BC/S1GU0FA vOyBsfdZAMFnPLUfd0H1mmimaHw++sjWhy/qEwmsLTLHfpTloaCb2jjwW8AC5WlL1jsZ TVVQ== X-Gm-Message-State: AOAM531AypGSH9jEf0kYGGRCCQJ+QbCgBx03fdGs+JtwBwFHlR0LdCu0 XUlGsko/3UUtSY3LsIAp6yTI7tyMm5E= X-Google-Smtp-Source: ABdhPJykSKS9NST/AmFqZ+DjdsDCwgSUYl9D+WJavQPT3argkkv95GK/G3NyKFN5gt3rNIEY1ChagA== X-Received: by 2002:a19:ccce:: with SMTP id c197mr3542229lfg.59.1589465647581; Thu, 14 May 2020 07:14:07 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id e16sm2440699lfc.63.2020.05.14.07.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:06 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 03/14] hw/net/xilinx_axienet: Remove unncessary cast Date: Thu, 14 May 2020 16:13:51 +0200 Message-Id: <20200514141402.12498-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x12e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Remove unncessary cast, buf is already uint8_t *. No functional change. Reviewed-by: Alistair Francis Reviewed-by: Francisco Iglesias Signed-off-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200506082513.18751-4-edgar.iglesias@gmail.com> --- hw/net/xilinx_axienet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 84073753d7..c8dfcda3ee 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -918,7 +918,7 @@ xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size) uint16_t csum; tmp_csum = net_checksum_add(size - start_off, - (uint8_t *)buf + start_off); + buf + start_off); /* Accumulate the seed. */ tmp_csum += s->hdr[2] & 0xffff; From patchwork Thu May 14 14:13:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548813 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 573DA739 for ; Thu, 14 May 2020 14:19:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B89120671 for ; Thu, 14 May 2020 14:19:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k+Uk4GTq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B89120671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEiD-0007vn-Bb for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:19:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcp-0007VZ-LT for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:15 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:41682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEco-0003mO-O2 for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:15 -0400 Received: by mail-lj1-x22a.google.com with SMTP id j3so3671238ljg.8 for ; Thu, 14 May 2020 07:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nuSqTkHruAB6ZwGLl1uZPF5Wx8t7d9jxfBh8w6c0fhA=; b=k+Uk4GTqBmbJK8Px+HokUq3zcYwpbC4CZDjECYmrBYeixAIPJ+4xgeEA5Iwq2Ka5kW rKDT0A2OgwgVcXQGSdpsiAYarpHeMQUt5oTQUIGnjU5n+D1naxSZ+TNWzymoSMfEjubu MyuZMJ7vK2M48TkNMKyNHLDKubyHZEoLudAp+NGquhRPgpYA2a4L/GxbSZTnZUjLsVmk 1RiKspZYRySXmtJfp7BkatXT/zJl24g5dTVO+hr6+zi4z62Z5+th87F+ZrMaj0P7fOet vfUYQ/THKMFKVRRkMDKtalZAnKDltcfFUhi2DlZlnBCCpyOrkBDxJ3NTKf9aoGj49c8k bW/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nuSqTkHruAB6ZwGLl1uZPF5Wx8t7d9jxfBh8w6c0fhA=; b=IYI4Le24CKdiDM3w2XVHj7KJxrCiUIBP89vW7Di+pyyWGCuIC1NlU7LVK6qPHblwaj /qLadAFutBxXR0KA4nEFQGBifqarliw8BIhArId+1JKKRP9kg87pC+aFPk5cz8mCyc66 RgFpTKISit9dt28Quhi0Tfyt6Q6M1xc2GoN2z1oAmXetyg7aP7qmsLhcjpnZL+8p7YPp A1BZQzN5HVBuciXVJSGo+fbkIhf68Rq/s9B/GbK6b/2q81cG8Zm9Nj/8n9cScP45v2A0 omQ9AlfYFDURINZDKkuIsjnt3cOGRQmvcUJ4/IrlEFyoZkXIjNc80L9KRS3ckCev2CPg U0Nw== X-Gm-Message-State: AOAM532XMUi82cDDm0DbUGvshBQi5CoRH8ChKKC8A1gLsk1DdsSxwTSG RlxlJwHl4TviJQnxvY8S75I3PiNP1qE= X-Google-Smtp-Source: ABdhPJzvWRYgnbhK4J7x2YwMD4brBMTP3BiFqi3eB1VNZlyoiXsVgoxQ9UycvpILoH8sNkVQM/jHSQ== X-Received: by 2002:a2e:1451:: with SMTP id 17mr178470lju.30.1589465649112; Thu, 14 May 2020 07:14:09 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id r2sm1602843ljm.8.2020.05.14.07.14.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:08 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 04/14] hw/dma/xilinx_axidma: Add DMA memory-region property Date: Thu, 14 May 2020 16:13:52 +0200 Message-Id: <20200514141402.12498-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x22a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Add DMA memory-region property to externally control what address-space this DMA operates on. Reviewed-by: Alistair Francis Reviewed-by: Francisco Iglesias Signed-off-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200506082513.18751-5-edgar.iglesias@gmail.com> --- hw/dma/xilinx_axidma.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 018f36991b..4540051448 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -33,6 +33,7 @@ #include "qemu/log.h" #include "qemu/module.h" +#include "sysemu/dma.h" #include "hw/stream.h" #define D(x) @@ -103,6 +104,7 @@ enum { }; struct Stream { + struct XilinxAXIDMA *dma; ptimer_state *ptimer; qemu_irq irq; @@ -125,6 +127,9 @@ struct XilinxAXIDMAStreamSlave { struct XilinxAXIDMA { SysBusDevice busdev; MemoryRegion iomem; + MemoryRegion *dma_mr; + AddressSpace as; + uint32_t freqhz; StreamSlave *tx_data_dev; StreamSlave *tx_control_dev; @@ -186,7 +191,7 @@ static void stream_desc_load(struct Stream *s, hwaddr addr) { struct SDesc *d = &s->desc; - cpu_physical_memory_read(addr, d, sizeof *d); + address_space_read(&s->dma->as, addr, MEMTXATTRS_UNSPECIFIED, d, sizeof *d); /* Convert from LE into host endianness. */ d->buffer_address = le64_to_cpu(d->buffer_address); @@ -204,7 +209,8 @@ static void stream_desc_store(struct Stream *s, hwaddr addr) d->nxtdesc = cpu_to_le64(d->nxtdesc); d->control = cpu_to_le32(d->control); d->status = cpu_to_le32(d->status); - cpu_physical_memory_write(addr, d, sizeof *d); + address_space_write(&s->dma->as, addr, MEMTXATTRS_UNSPECIFIED, + d, sizeof *d); } static void stream_update_irq(struct Stream *s) @@ -286,8 +292,9 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, txlen + s->pos); } - cpu_physical_memory_read(s->desc.buffer_address, - s->txbuf + s->pos, txlen); + address_space_read(&s->dma->as, s->desc.buffer_address, + MEMTXATTRS_UNSPECIFIED, + s->txbuf + s->pos, txlen); s->pos += txlen; if (stream_desc_eof(&s->desc)) { @@ -336,7 +343,8 @@ static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf, rxlen = len; } - cpu_physical_memory_write(s->desc.buffer_address, buf + pos, rxlen); + address_space_write(&s->dma->as, s->desc.buffer_address, + MEMTXATTRS_UNSPECIFIED, buf + pos, rxlen); len -= rxlen; pos += rxlen; @@ -525,6 +533,7 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp) XilinxAXIDMAStreamSlave *cs = XILINX_AXI_DMA_CONTROL_STREAM( &s->rx_control_dev); Error *local_err = NULL; + int i; object_property_add_link(OBJECT(ds), "dma", TYPE_XILINX_AXI_DMA, (Object **)&ds->dma, @@ -545,17 +554,19 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp) goto xilinx_axidma_realize_fail; } - int i; - for (i = 0; i < 2; i++) { struct Stream *st = &s->streams[i]; + st->dma = s; st->nr = i; st->ptimer = ptimer_init(timer_hit, st, PTIMER_POLICY_DEFAULT); ptimer_transaction_begin(st->ptimer); ptimer_set_freq(st->ptimer, s->freqhz); ptimer_transaction_commit(st->ptimer); } + + address_space_init(&s->as, + s->dma_mr ? s->dma_mr : get_system_memory(), "dma"); return; xilinx_axidma_realize_fail: @@ -575,6 +586,11 @@ static void xilinx_axidma_init(Object *obj) &s->rx_control_dev, sizeof(s->rx_control_dev), TYPE_XILINX_AXI_DMA_CONTROL_STREAM, &error_abort, NULL); + object_property_add_link(obj, "dma", TYPE_MEMORY_REGION, + (Object **)&s->dma_mr, + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_STRONG, + &error_abort); sysbus_init_irq(sbd, &s->streams[0].irq); sysbus_init_irq(sbd, &s->streams[1].irq); From patchwork Thu May 14 14:13:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67037739 for ; Thu, 14 May 2020 14:18:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E48E20671 for ; Thu, 14 May 2020 14:18:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NpEEdpSS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E48E20671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEgX-00055A-98 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:18:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcn-0007RD-NW for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:13 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:46590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcm-0003mE-QD for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:13 -0400 Received: by mail-lf1-x134.google.com with SMTP id v5so2724629lfp.13 for ; Thu, 14 May 2020 07:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U0q5G1KQ0rIOe1dgVo4h2VPPUpfz+JwuhrBEFOHI/4Q=; b=NpEEdpSSSKgynTBrdHPGwb2xRBlmSOL/l6X+YHBLUgFwIg+9xsdIiSYzQpnWMD6tr9 91IQjtpEhsnGFA7KSTyA2yjkkEui7wiY4lljHXQtuJy9IxnYMxAAc1gcGc9Jw8e2aM3l iYolxeua/6Qel1CkdMHwo0zKUu58UaTai/n9zu7Pmqz6JTFweZi2OigoiLe0aoYxj7NJ 3EIeYPZc8OEDIdT0vkH01GlKVUg6qGWasFySrstH6JM1qSosEG69UIdctNfLxraC0WlI Bb3QwVofw7INemFWagTVKP0VL+Of5LtyZfRKc03VXxV6xzu5bU4V5u1jtVgrwHTdFdHP dA6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U0q5G1KQ0rIOe1dgVo4h2VPPUpfz+JwuhrBEFOHI/4Q=; b=TVREtZSsFSq6EeifnovGha35AJWe0/GG1sPR9lAkRIXBLHSH8W58tSmekndYVJZOKK NQHUF3rgmJCmLx1ZHNgDyDdp/OG9qWpQfZpZAxfHNrR6tjybGYTI0AS5UGY/dxMzO5uw +7qz8DiSRxw5lTqbGwDHo81wsMNgf7E/ausMwK+lUs/2RMxmvrSjDQ0wg269ikCiKfCJ VoAF7lBqFaDlc+mi1AqLjy8bDEtBeRy5l9DUe9Xwjw4JrzKSN0Q1KriVBAbu1rVMPIdG YaVDi8B4UdvFN6afanE20WJVlSuPk68RA1mbu4rjJCPvAvAE3KrugGz7Uk6667rf5mk5 Ie8g== X-Gm-Message-State: AOAM531/c78B1K0+B7ClfA0fHLVHKLXe6X5ayXbvs81D6ZnmcCC1hJNa CRPQ7j1smS3pON7OgqRPs3XFQ35OEUs= X-Google-Smtp-Source: ABdhPJyw10YVK9zKcMNfHbYTr2jMP36NX5olImVc9qjBAbWcgoiLb3EvPlrLufP0I69UKf0gFNkpRg== X-Received: by 2002:ac2:5290:: with SMTP id q16mr3481208lfm.108.1589465650679; Thu, 14 May 2020 07:14:10 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id c12sm1892375lfc.92.2020.05.14.07.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:10 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 05/14] hw/core: stream: Add an end-of-packet flag Date: Thu, 14 May 2020 16:13:53 +0200 Message-Id: <20200514141402.12498-6-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x134.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Some stream clients stream an endless stream of data while other clients stream data in packets. Stream interfaces usually have a way to signal the end of a packet or the last beat of a transfer. This adds an end-of-packet flag to the push interface. Reviewed-by: Alistair Francis Reviewed-by: Francisco Iglesias Signed-off-by: Edgar E. Iglesias Message-Id: <20200506082513.18751-6-edgar.iglesias@gmail.com> --- include/hw/stream.h | 5 +++-- hw/core/stream.c | 4 ++-- hw/dma/xilinx_axidma.c | 10 ++++++---- hw/net/xilinx_axienet.c | 14 ++++++++++---- hw/ssi/xilinx_spips.c | 2 +- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/include/hw/stream.h b/include/hw/stream.h index d02f62ca89..ed09e83683 100644 --- a/include/hw/stream.h +++ b/include/hw/stream.h @@ -39,12 +39,13 @@ typedef struct StreamSlaveClass { * @obj: Stream slave to push to * @buf: Data to write * @len: Maximum number of bytes to write + * @eop: End of packet flag */ - size_t (*push)(StreamSlave *obj, unsigned char *buf, size_t len); + size_t (*push)(StreamSlave *obj, unsigned char *buf, size_t len, bool eop); } StreamSlaveClass; size_t -stream_push(StreamSlave *sink, uint8_t *buf, size_t len); +stream_push(StreamSlave *sink, uint8_t *buf, size_t len, bool eop); bool stream_can_push(StreamSlave *sink, StreamCanPushNotifyFn notify, diff --git a/hw/core/stream.c b/hw/core/stream.c index 39b1e595cd..a65ad1208d 100644 --- a/hw/core/stream.c +++ b/hw/core/stream.c @@ -3,11 +3,11 @@ #include "qemu/module.h" size_t -stream_push(StreamSlave *sink, uint8_t *buf, size_t len) +stream_push(StreamSlave *sink, uint8_t *buf, size_t len, bool eop) { StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink); - return k->push(sink, buf, len); + return k->push(sink, buf, len, eop); } bool diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 4540051448..a770e12c96 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -283,7 +283,7 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, if (stream_desc_sof(&s->desc)) { s->pos = 0; - stream_push(tx_control_dev, s->desc.app, sizeof(s->desc.app)); + stream_push(tx_control_dev, s->desc.app, sizeof(s->desc.app), true); } txlen = s->desc.control & SDESC_CTRL_LEN_MASK; @@ -298,7 +298,7 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, s->pos += txlen; if (stream_desc_eof(&s->desc)) { - stream_push(tx_data_dev, s->txbuf, s->pos); + stream_push(tx_data_dev, s->txbuf, s->pos, true); s->pos = 0; stream_complete(s); } @@ -384,7 +384,7 @@ static void xilinx_axidma_reset(DeviceState *dev) static size_t xilinx_axidma_control_stream_push(StreamSlave *obj, unsigned char *buf, - size_t len) + size_t len, bool eop) { XilinxAXIDMAStreamSlave *cs = XILINX_AXI_DMA_CONTROL_STREAM(obj); struct Stream *s = &cs->dma->streams[1]; @@ -416,12 +416,14 @@ xilinx_axidma_data_stream_can_push(StreamSlave *obj, } static size_t -xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len) +xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len, + bool eop) { XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(obj); struct Stream *s = &ds->dma->streams[1]; size_t ret; + assert(eop); ret = stream_process_s2mem(s, buf, len); stream_update_irq(s); return ret; diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index c8dfcda3ee..bd48305577 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -697,14 +697,14 @@ static void axienet_eth_rx_notify(void *opaque) axienet_eth_rx_notify, s)) { size_t ret = stream_push(s->tx_control_dev, (void *)s->rxapp + CONTROL_PAYLOAD_SIZE - - s->rxappsize, s->rxappsize); + - s->rxappsize, s->rxappsize, true); s->rxappsize -= ret; } while (s->rxsize && stream_can_push(s->tx_data_dev, axienet_eth_rx_notify, s)) { size_t ret = stream_push(s->tx_data_dev, (void *)s->rxmem + s->rxpos, - s->rxsize); + s->rxsize, true); s->rxsize -= ret; s->rxpos += ret; if (!s->rxsize) { @@ -874,12 +874,14 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) } static size_t -xilinx_axienet_control_stream_push(StreamSlave *obj, uint8_t *buf, size_t len) +xilinx_axienet_control_stream_push(StreamSlave *obj, uint8_t *buf, size_t len, + bool eop) { int i; XilinxAXIEnetStreamSlave *cs = XILINX_AXI_ENET_CONTROL_STREAM(obj); XilinxAXIEnet *s = cs->enet; + assert(eop); if (len != CONTROL_PAYLOAD_SIZE) { hw_error("AXI Enet requires %d byte control stream payload\n", (int)CONTROL_PAYLOAD_SIZE); @@ -894,11 +896,15 @@ xilinx_axienet_control_stream_push(StreamSlave *obj, uint8_t *buf, size_t len) } static size_t -xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size) +xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size, + bool eop) { XilinxAXIEnetStreamSlave *ds = XILINX_AXI_ENET_DATA_STREAM(obj); XilinxAXIEnet *s = ds->enet; + /* We don't support fragmented packets yet. */ + assert(eop); + /* TX enable ? */ if (!(s->tc & TC_TX)) { return size; diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c index c57850a505..4cfce882ab 100644 --- a/hw/ssi/xilinx_spips.c +++ b/hw/ssi/xilinx_spips.c @@ -868,7 +868,7 @@ static void xlnx_zynqmp_qspips_notify(void *opaque) memcpy(rq->dma_buf, rxd, num); - ret = stream_push(rq->dma, rq->dma_buf, num); + ret = stream_push(rq->dma, rq->dma_buf, num, false); assert(ret == num); xlnx_zynqmp_qspips_check_flush(rq); } From patchwork Thu May 14 14:13:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548803 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60277739 for ; Thu, 14 May 2020 14:17:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36DF020671 for ; Thu, 14 May 2020 14:17:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mQJ5cl99" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36DF020671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEfn-0004ID-9h for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:17:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcp-0007UA-1O for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:15 -0400 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:42354) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEco-0003mK-6m for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:14 -0400 Received: by mail-lf1-x141.google.com with SMTP id r17so2755054lff.9 for ; Thu, 14 May 2020 07:14:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sp83rpbpKuac9eJJl865F4UVUA5uZfXjhS96fufoN2M=; b=mQJ5cl99YfUAZiaWT3ZjLdrxI4KVmFmYTmxD+nkV7u+mhdh5YWV/yhUl7uaHI+NKKK A3mP9RF2KNOThGz4aAqt2zuF7UMNUu976AWQvG+FtJw9Rkw+qfi5UhGOLxhmt/o2EjiF x8yN8BLSRW6wYpuiJLF5pCHimBONCRMpNSbUlkRU5pFwYL26OvidgrcetjFyTDFBA3S2 xbO7yNCUNdtLsqzqd4dHl6F33H+mmfcHNUyCc4pWzuAMxzKuUHF8mqsmheJ2l8sDD8tM qjipDlFZx0NepA2GROUiRr8ueQ4S0np27hvAkkxuyIYB5jq+BMFc9UgBMMsaGaJ+rXGn n1/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sp83rpbpKuac9eJJl865F4UVUA5uZfXjhS96fufoN2M=; b=OcX4ELINj5xDE+LFuXjIn3LCNjs14onm9QQCrmhYJorjkZm71Vf95Ns7m7+VWrQ8XO itcqeX0My3YXrX2c65rfEJWmKVWPimepgomGNcgUp8jcglO8FeYKVSY2RmZfW4SpgpAE eBd4MDdISm6Qfyi2jMjJYO6HdhMTP6Jx3oifLmh0OxSnGHKng+Khp3+cnDg/G+7ikRWk 0FLTWLVOIScVxshJhCx4pfFjr4Q1CCiYqtSiCdlxpH03JpUKikGCqHGh0wNSetFVAZ0B wZYZ1KoqukIOSqFzNQRN7KQq3EmWazoerINu283eLoLIWDYW4Xk3Jhbvafmo57YIaYPO n+NQ== X-Gm-Message-State: AOAM5336OFd6YFrwGOzno6jTMbg+C5yef6du4Qj6yDELT/NXPdpiqUoS ew6MtT5wFakYBsCjAusjl6NvinGcu3M= X-Google-Smtp-Source: ABdhPJz/ZHo+a/9RH9HvuWlH3gXiDcAgxScGqmlxPbzxabjshYHHNIS1ExN2jXB0ftRyw6Wu14pQrA== X-Received: by 2002:a19:490d:: with SMTP id w13mr3456339lfa.96.1589465652110; Thu, 14 May 2020 07:14:12 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id f27sm1896658lfe.93.2020.05.14.07.14.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:11 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 06/14] hw/net/xilinx_axienet: Handle fragmented packets from DMA Date: Thu, 14 May 2020 16:13:54 +0200 Message-Id: <20200514141402.12498-7-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::141; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x141.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Add support for fragmented packets from the DMA. Reviewed-by: Francisco Iglesias Signed-off-by: Edgar E. Iglesias Message-Id: <20200506082513.18751-7-edgar.iglesias@gmail.com> --- hw/net/xilinx_axienet.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index bd48305577..498afe2f54 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -402,6 +402,9 @@ struct XilinxAXIEnet { uint32_t hdr[CONTROL_PAYLOAD_WORDS]; + uint8_t *txmem; + uint32_t txpos; + uint8_t *rxmem; uint32_t rxsize; uint32_t rxpos; @@ -421,6 +424,7 @@ static void axienet_rx_reset(XilinxAXIEnet *s) static void axienet_tx_reset(XilinxAXIEnet *s) { s->tc = TC_JUM | TC_TX | TC_VLAN; + s->txpos = 0; } static inline int axienet_rx_resetting(XilinxAXIEnet *s) @@ -902,17 +906,35 @@ xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size, XilinxAXIEnetStreamSlave *ds = XILINX_AXI_ENET_DATA_STREAM(obj); XilinxAXIEnet *s = ds->enet; - /* We don't support fragmented packets yet. */ - assert(eop); - /* TX enable ? */ if (!(s->tc & TC_TX)) { return size; } + if (s->txpos + size > s->c_txmem) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Packet larger than txmem\n", + TYPE_XILINX_AXI_ENET); + s->txpos = 0; + return size; + } + + if (s->txpos == 0 && eop) { + /* Fast path single fragment. */ + s->txpos = size; + } else { + memcpy(s->txmem + s->txpos, buf, size); + buf = s->txmem; + s->txpos += size; + + if (!eop) { + return size; + } + } + /* Jumbo or vlan sizes ? */ if (!(s->tc & TC_JUM)) { - if (size > 1518 && size <= 1522 && !(s->tc & TC_VLAN)) { + if (s->txpos > 1518 && s->txpos <= 1522 && !(s->tc & TC_VLAN)) { + s->txpos = 0; return size; } } @@ -923,7 +945,7 @@ xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size, uint32_t tmp_csum; uint16_t csum; - tmp_csum = net_checksum_add(size - start_off, + tmp_csum = net_checksum_add(s->txpos - start_off, buf + start_off); /* Accumulate the seed. */ tmp_csum += s->hdr[2] & 0xffff; @@ -936,12 +958,13 @@ xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size, buf[write_off + 1] = csum & 0xff; } - qemu_send_packet(qemu_get_queue(s->nic), buf, size); + qemu_send_packet(qemu_get_queue(s->nic), buf, s->txpos); - s->stats.tx_bytes += size; + s->stats.tx_bytes += s->txpos; s->regs[R_IS] |= IS_TX_COMPLETE; enet_update_irq(s); + s->txpos = 0; return size; } @@ -989,6 +1012,7 @@ static void xilinx_enet_realize(DeviceState *dev, Error **errp) s->TEMAC.parent = s; s->rxmem = g_malloc(s->c_rxmem); + s->txmem = g_malloc(s->c_txmem); return; xilinx_enet_realize_fail: From patchwork Thu May 14 14:13:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBB14739 for ; Thu, 14 May 2020 14:20:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 928B22065D for ; Thu, 14 May 2020 14:20:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ge4N30UK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 928B22065D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEir-0000BV-P6 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:20:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcq-0007XM-9f for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:16 -0400 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:40394) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcp-0003ma-BO for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:15 -0400 Received: by mail-lf1-x141.google.com with SMTP id h188so2022410lfd.7 for ; Thu, 14 May 2020 07:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r7a5kGEyzosESTdmEwVGGd/q63HdJiXWSrEI6m5XxK4=; b=Ge4N30UKYfgXdi3mmq031ONleaEHuug4sPQzs7eiPuPiYmR5U5hlzmuAS1yDYDXaor 77phzA8mSbhZkAhL3B2fzlVfx6zgT+D05SdCIGLAtr+/1y5soRF1VyFf9rxqZ4syOdCM Wl8RaT/GZ8uPpIwqS0/qjU8u7ob+tmAeWJt6lHYaHFUreuig0zjS6yxGrRhP4nT736i0 C6wrK6F51atOAoeE5Tto+VpCne81YsgolvenVq+7XyNL8pE8w4946sHmZBNk2WZCSWSB IGwbMkrDafxDYOHc1lJeXUoeCr/XOkBf3JkxzDPH3sIRdclYIjSD3n6+zTcCAQJYphxy Jkhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r7a5kGEyzosESTdmEwVGGd/q63HdJiXWSrEI6m5XxK4=; b=jB3riGZb0VCyyo9gpQF5DIvVXOrzj1dTAx66vLYC2z7AV9r3SEGY9U1hhItw+sWoRM 4i1q+1gYy2j5Wtr+oHo2U+86zh2Cetuyzh3+z6wW/FjDup9OY9PKM/QUrb6WAKIrD8Tb SrkgAo+gy2M2Y7SausxuGvCPAE9f10BFgByJG2rIzz9Q8gtQ8KUq3ruzwQ5OhCy/fICo sjVXLX53T8M+krOP5es6n6zAzuIHRRDXigrBFj0lfKDwcc2BdiiL+OsLR72hKZEi9TMH EJBrtEFyxPHzDVgNATu0F10q/5DsZM+ftSkjksLzKKxKXhmXaH32bauRRO0kQS1lIxMZ Hb6w== X-Gm-Message-State: AOAM532FMlE2yhVPgcWBppKeAqAadxa6wFrL+ZuhA0iN8FTvkeHzcxX8 +rED4kiqziyOWdeL5yjmREBYLIxw7PQ= X-Google-Smtp-Source: ABdhPJxhcdOP9vo1zJNV7XfYgDKgChzM4BUUzRNmEVggJ9A0pPyPuFuTFW0N63qhAaiPShKcNqBp1g== X-Received: by 2002:a05:6512:691:: with SMTP id t17mr3650080lfe.85.1589465653567; Thu, 14 May 2020 07:14:13 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id r9sm1582242ljg.69.2020.05.14.07.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:12 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 07/14] hw/dma/xilinx_axidma: mm2s: Stream descriptor by descriptor Date: Thu, 14 May 2020 16:13:55 +0200 Message-Id: <20200514141402.12498-8-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::141; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x141.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Stream descriptor by descriptor from memory instead of buffering entire packets before pushing. This enables non-packet streaming clients to work and also lifts the limitation that our internal DMA buffer needs to be able to hold entire packets. Reviewed-by: Alistair Francis Signed-off-by: Edgar E. Iglesias Message-Id: <20200506082513.18751-8-edgar.iglesias@gmail.com> --- hw/dma/xilinx_axidma.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index a770e12c96..101d32a965 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -111,7 +111,6 @@ struct Stream { int nr; struct SDesc desc; - int pos; unsigned int complete_cnt; uint32_t regs[R_MAX]; uint8_t app[20]; @@ -267,7 +266,9 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, StreamSlave *tx_control_dev) { uint32_t prev_d; - unsigned int txlen; + uint32_t txlen; + uint64_t addr; + bool eop; if (!stream_running(s) || stream_idle(s)) { return; @@ -282,24 +283,26 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, } if (stream_desc_sof(&s->desc)) { - s->pos = 0; stream_push(tx_control_dev, s->desc.app, sizeof(s->desc.app), true); } txlen = s->desc.control & SDESC_CTRL_LEN_MASK; - if ((txlen + s->pos) > sizeof s->txbuf) { - hw_error("%s: too small internal txbuf! %d\n", __func__, - txlen + s->pos); - } - address_space_read(&s->dma->as, s->desc.buffer_address, - MEMTXATTRS_UNSPECIFIED, - s->txbuf + s->pos, txlen); - s->pos += txlen; + eop = stream_desc_eof(&s->desc); + addr = s->desc.buffer_address; + while (txlen) { + unsigned int len; + + len = txlen > sizeof s->txbuf ? sizeof s->txbuf : txlen; + address_space_read(&s->dma->as, addr, + MEMTXATTRS_UNSPECIFIED, + s->txbuf, len); + stream_push(tx_data_dev, s->txbuf, len, eop && len == txlen); + txlen -= len; + addr += len; + } - if (stream_desc_eof(&s->desc)) { - stream_push(tx_data_dev, s->txbuf, s->pos, true); - s->pos = 0; + if (eop) { stream_complete(s); } From patchwork Thu May 14 14:13:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84449739 for ; Thu, 14 May 2020 14:17:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B25920671 for ; Thu, 14 May 2020 14:17:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ibe5ZPsO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B25920671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEfh-00046r-Dn for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:17:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcr-0007Zt-CI for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:17 -0400 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]:46862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcq-0003mr-NB for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:17 -0400 Received: by mail-lf1-x144.google.com with SMTP id v5so2724845lfp.13 for ; Thu, 14 May 2020 07:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D7sjpbEKoLtEYjs/TnSi3AkdRZRMvGw4zpygQ0M/4uc=; b=Ibe5ZPsODULQP0cOJOLydJd1oWTboFQ6CUtEokDDzAbTow+co1I3kuwGZwwTp+4HR+ mhPCmzU2NgdNMTnifxF2YkFu+AeqmPLKuznthGr0nXILySb4jLoCG8n1umutjg4nVImk mMhG2C9PyBPpoL6CDapFxF/hOnw6lu/LGLnKAlgE2+sqwKnnxddCe9dFYV8DuwRTUL+8 pbHK4n0ffNTNrUpx/oXl2NlS5SAVWt+UAWlXX1J/KLEbBgyomm78QPj9haKFQ4odzQ/G 8NOp3r2/eNmUmQ/NRDPqBfnO5sjZvFn7Pgjr9kNw3DT/pYx5zCgEtOGdnPk61nGAiuOL 2HnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D7sjpbEKoLtEYjs/TnSi3AkdRZRMvGw4zpygQ0M/4uc=; b=I63PqZULcQYynYm/onzBKnkGdWjMOXDsLXD79D8xexdREyDD2ZW8PLh2gfjcYnvBAx L7BNdpAA6bKU3vPQg8qI6OTLeTXPPYGoJgEQd5tZnjwK9xr44Bn72Nyam7dG5xemHKCK r4AhJazwyKXlYZ+EMJxHu0iXmtIbDKEhxYEOUUiS/LJOnI1cYcNS4jaseygP5UUIEbUg xalbvLHiPysteMvZE6AgJerjjorRbKBLRwNoWdYx93mYRitQx3qFpTFwIqoMTr5hlPFY KO927E/T35frUopJW83ICTGDIp2lHSa5DSHiQ3kuiArqXammnw4IZ6K2wdE65qh17ZaT wXLg== X-Gm-Message-State: AOAM531LMNIwB0eyEwURPrfxSSm7Fpok/xblbkyOKQrfRc2u6AbIyB3R wdk1beunp2UiK/G2vF0pMMU8tiZi/J4= X-Google-Smtp-Source: ABdhPJzm0R9iSevxSuM0/0Yl7LeyFkf7UXkmYgLLee1tR6VlQCkDrI2Pem3eQDaXzKQ03+e/bUgODQ== X-Received: by 2002:ac2:414c:: with SMTP id c12mr3402243lfi.47.1589465654753; Thu, 14 May 2020 07:14:14 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id r23sm1520524lji.32.2020.05.14.07.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:14 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 08/14] hw/dma/xilinx_axidma: s2mm: Support stream fragments Date: Thu, 14 May 2020 16:13:56 +0200 Message-Id: <20200514141402.12498-9-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::144; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x144.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Add support for stream fragments. Reviewed-by: Alistair Francis Signed-off-by: Edgar E. Iglesias Message-Id: <20200506082513.18751-9-edgar.iglesias@gmail.com> --- hw/dma/xilinx_axidma.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 101d32a965..87be9cade7 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -110,6 +110,7 @@ struct Stream { int nr; + bool sof; struct SDesc desc; unsigned int complete_cnt; uint32_t regs[R_MAX]; @@ -174,6 +175,7 @@ static void stream_reset(struct Stream *s) { s->regs[R_DMASR] = DMASR_HALTED; /* starts up halted. */ s->regs[R_DMACR] = 1 << 16; /* Starts with one in compl threshold. */ + s->sof = true; } /* Map an offset addr into a channel index. */ @@ -321,12 +323,11 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, } static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf, - size_t len) + size_t len, bool eop) { uint32_t prev_d; unsigned int rxlen; size_t pos = 0; - int sof = 1; if (!stream_running(s) || stream_idle(s)) { return 0; @@ -352,16 +353,16 @@ static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf, pos += rxlen; /* Update the descriptor. */ - if (!len) { + if (eop) { stream_complete(s); memcpy(s->desc.app, s->app, sizeof(s->desc.app)); s->desc.status |= SDESC_STATUS_EOF; } - s->desc.status |= sof << SDESC_STATUS_SOF_BIT; + s->desc.status |= s->sof << SDESC_STATUS_SOF_BIT; s->desc.status |= SDESC_STATUS_COMPLETE; stream_desc_store(s, s->regs[R_CURDESC]); - sof = 0; + s->sof = eop; /* Advance. */ prev_d = s->regs[R_CURDESC]; @@ -426,8 +427,7 @@ xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len, struct Stream *s = &ds->dma->streams[1]; size_t ret; - assert(eop); - ret = stream_process_s2mem(s, buf, len); + ret = stream_process_s2mem(s, buf, len, eop); stream_update_irq(s); return ret; } From patchwork Thu May 14 14:13:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548831 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A6F0C1391 for ; Thu, 14 May 2020 14:21:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CA6E2065D for ; Thu, 14 May 2020 14:21:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uutq3RVH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CA6E2065D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEk1-0002Xv-KP for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:21:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEct-0007bp-2y for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:19 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:35406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcr-0003nB-VS for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:18 -0400 Received: by mail-lf1-x133.google.com with SMTP id 82so1260364lfh.2 for ; Thu, 14 May 2020 07:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=33o9ClpGyupXXLqwHgoHcaDQTUDIPIIMyTSVPvtJZEc=; b=uutq3RVH7zPbqHB6ai50O8n6vm0E4YiQuOFrZ015Z7ZsW0dRpxB0Qkwx6i6btwOoz/ dohUpNvBgD0IJJVsmW5BS0yefyhRpx3vdASr0ZPPJUBuWLQ9W1KOJ2Uu/ORSZyeQPa8z hDQxeKWDH+Uq61I7Nx+I0PR32zRYQdM8TmWCBvpLvFvaIa8AqFk8616ZH5LmXpi7unkB 0CGp/zXE+TTfud90p9L3Eqh60wi8D0qWBEWP5vedAym+n2Ub1k00JSy1vmKa5REh3Wan gNsZhDSbsJQbte3cPKXgjqtAX1FVWaSu3JXwTGPD7GaDwoqUUC237rvWP4r4VfEGQ/3o 0SQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=33o9ClpGyupXXLqwHgoHcaDQTUDIPIIMyTSVPvtJZEc=; b=ivZMx6h8PHVmx0DaUqj/HEvdtKQ7D/nLdgjBaDaC3QoVUysYVxsGrDlzw3FA+uwItC QVQbhzxUbR+jxZGHDl8uLGLUMWAm1zfxZPruPkgX9cdYnrN/1xOhRkSjT9n1/wgA/T75 pSFYhTMlhfudLNzv+Sze66BusfopEqrntSG+BD8nKTCjwtxg/07ykcojIHqM2sIOyK9h 2J6cKKx7EPAvg6TtnOHgu8XXoUHebW5v2novkXZqkT4gv+LrLlxTcwbCXaM5EZtVSNZp IWv9Yxy6qGZPkgROWG7MRmGeaoknEjqq+j2qf0KF7lNYWRO2g0peT/eyN9Iq+mnSitCR GtAA== X-Gm-Message-State: AOAM531kN4PuCE9fjGKFJcwp6D2lBIEbdCyIWLAT7ski61sx7UnzfLea 3Ow+z89L+JgqXXre+1+poKeAaN49Ni0= X-Google-Smtp-Source: ABdhPJzWf6900RpaZYQX05hB8+caMK794sMDo5X5rbFODM2Road1BHheEK/FtJ7pvRYxrn4YE6GABw== X-Received: by 2002:a05:6512:1051:: with SMTP id c17mr3488951lfb.206.1589465656105; Thu, 14 May 2020 07:14:16 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id f24sm1878522lfc.43.2020.05.14.07.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:15 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 09/14] MAINTAINERS: Add myself as streams maintainer Date: Thu, 14 May 2020 16:13:57 +0200 Message-Id: <20200514141402.12498-10-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x133.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Since we're missing a maintainer, add myself. Reviewed-by: Alistair Francis Signed-off-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200506082513.18751-10-edgar.iglesias@gmail.com> --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 005ee98a59..d11f3cb976 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2315,6 +2315,12 @@ F: net/slirp.c F: include/net/slirp.h T: git https://people.debian.org/~sthibault/qemu.git slirp +Streams +M: Edgar E. Iglesias +S: Maintained +F: hw/core/stream.c +F: include/hw/stream.h + Stubs M: Paolo Bonzini S: Maintained From patchwork Thu May 14 14:13:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548809 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA10D697 for ; Thu, 14 May 2020 14:18:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C110120671 for ; Thu, 14 May 2020 14:18:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Paw4sG1v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C110120671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEgk-0005NE-Ux for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:18:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcu-0007fS-Jt for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:20 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:35397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEct-0003nU-Ri for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:20 -0400 Received: by mail-lf1-x129.google.com with SMTP id 82so1260498lfh.2 for ; Thu, 14 May 2020 07:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/cXvZwwyTvG/wDqV3+ggOWwm7XO+vMd18cZdVrDcu8Q=; b=Paw4sG1vXyNPxXDl0NMkyb0swgYnGuF6Ico54OGJTOGD5rVgtUWfUGBHyRqXKcJWTO MS3ZwjNZA4ISfsIJ9NQHUbu7aI12oNUqSVne98Us+WSlo1hI+5dpktySZv0HkohWaGNQ VqrNLO8+LLpVUVkt9mdoskm+qvLqwFrNTl0znni7l+9+YYMlQmUZdj9L5HuR/fta1D6K UbZf+TGsGiGcHX49ZY2ozJ4nMecW+Mi8tccKrUxKy1tPFlK3/D7mr1DOkAauXDggAI0P 2CvV2Xcro8q2kR1Rz3f1D2M60GV52wcSymdFW31t084XFo7KCUf89XtZr5o8EfEUm+T/ oB/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/cXvZwwyTvG/wDqV3+ggOWwm7XO+vMd18cZdVrDcu8Q=; b=iVDemDKQfKOvRT2oeZHNkM+yUyN/N17mvZhP5u0PS1p2gJqX7JXrc4LyWoJqlw/UoB WieSM6859NzYtOiiIx3i08zdJwzXBtoHrIJtFHDgCFHqdmuVTvnQaJOeuuFq2JaPSL5a UwgWUQ2QlNVCiKKG6Vkx+an6b40f0bOnCf02/nr4oVpvuygw7lx5yXNOA+xgePerFlXz Uk2mr76VrD5tYQbAV/+ihBD93Vi8w/2DvhGQIPb8rtXKBiyINKnURO5g3W0EnZB6Vt1U vZ7rb6tlwLZ91wCJwMv5IgZDs47xLSA4tlUDGN047KsqNO1Lt2fbIMUDN/1opyFUOurB zB4Q== X-Gm-Message-State: AOAM532FDM7bpcMUbfFAZvUleBznGvNlUA2Y+NifHFwuwjnAuVc1TP4j T9NbXUegJ2zx8PutUkv71zIrxMaOWjU= X-Google-Smtp-Source: ABdhPJyWAKlaCuvUpw/hbr6xvkFCG5nrvZ6L88NOAAw1YDzgSoeLJHjimAj96FoVN73ywoc6QV9reg== X-Received: by 2002:a19:ad49:: with SMTP id s9mr3551750lfd.9.1589465657992; Thu, 14 May 2020 07:14:17 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id b25sm1537138ljp.105.2020.05.14.07.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:16 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 10/14] target/microblaze: Add MFS Rd,EDR translation Date: Thu, 14 May 2020 16:13:58 +0200 Message-Id: <20200514141402.12498-11-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x129.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Tong Ho This is to fix cpu-abort with 'qemu: fatal: unknown mfs reg d' (in the default case) when microblaze guest issues 'MFS Rd,EDR' instruction. Since embeddedsw release 2019.2, XPlm_ExceptionHandler() issues the instruction on exception, and microblaze model aborts when PLM firmware guest encounters an exception. Signed-off-by: Tong Ho Reviewed-by: Edgar E. Iglesias Reviewed-by: Luc Michel Message-Id: <20200512143649.21655-2-edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias --- target/microblaze/translate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 20b7427811..92b3630804 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -581,6 +581,7 @@ static void dec_msr(DisasContext *dc) case SR_ESR: case SR_FSR: case SR_BTR: + case SR_EDR: tcg_gen_extrl_i64_i32(cpu_R[dc->rd], cpu_SR[sr]); break; case 0x800: From patchwork Thu May 14 14:13:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548833 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8B90739 for ; Thu, 14 May 2020 14:22:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9ED342065D for ; Thu, 14 May 2020 14:22:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e8rt/9YY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9ED342065D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEkN-0003I5-OZ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:22:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcv-0007il-TF for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:21 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:37004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcu-0003nq-VR for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:21 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 8so2785383lfp.4 for ; Thu, 14 May 2020 07:14:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cdqb6YfEnUEOZ9+1iE9YYK31lx3pNnIUCeb18hsJxJs=; b=e8rt/9YY/PiTZBRxClnOBelZoDeKUflQn/FM+2u7lhwn4vTAJcoqC2gROKM+PvBxLI cszU/9/iErG54X15q//gmh4EvtS5Hw4EeuV7Z5BOZa+NmSRxEOdDstPo7t+Y2l+HJZ1v 3VdwfkjaMh6uHzieUg9qzxx5l7lCe1jn5dfR2ge4Lp9zjwYtqiX4abfY8S8Z0fHJo3TY VXn69BEJRLcUla9gu+aDDICS5hvlLYPPB0O8+whtSP622FSACTT5NiFUS4TyOFtJeT/n PzxxOIm8xIZ/54tmFHg2GI9y9hcIX6b9/8hEzSv0+NytITlwwLSSvdp9rZI/a3hFJsrG kobg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cdqb6YfEnUEOZ9+1iE9YYK31lx3pNnIUCeb18hsJxJs=; b=nDS/dJjUkTbWf8WhkKpBr7boW9e/Y/4vhde0vGIXucVBVUJeYWq5V+v8aas4oJTLs7 5lGku0h+PdY6Czl8QItLL987Oj/R1fNOTzTVsYllRHE1g07KAyXZj1GcyQGyu1yd91lB OJf5FPAkJ5up0sS9O9MCENgYz+4UYfo/MGKcqfsud5HHlxDkyg+WKC+orEqXHtXpbW4f jtkYRoa9ojBEgt5BYQ2PImu/ljMWUbv+7S0cBg9aR/xmY4F2bWsBqIzP3QnRBLc5MvJA FYMVLu3cvZPs7VuI06BdQYyXTelxe+qqIOhs0a6lhP6+mqrSoEUJur7Lg79elKHxEKtH td8g== X-Gm-Message-State: AOAM532jOKz3ebrXSu4TBA08OebKuR1pLLnxnXjGJxoJ1Euax1yvsyba QdmGgUzUpt60uD/iIfkyMYqyhsGuSs0= X-Google-Smtp-Source: ABdhPJwOedG4C5dNUh6HlP0ISJXczYVAmAnAz2CnIiq8H9JKQ8CHZO3ryT9cqSau7iYsBtsk42h6Vw== X-Received: by 2002:ac2:558e:: with SMTP id v14mr3507672lfg.138.1589465659126; Thu, 14 May 2020 07:14:19 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id 26sm1619235ljp.22.2020.05.14.07.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:18 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 11/14] target/microblaze: Fix FPU2 instruction check Date: Thu, 14 May 2020 16:13:59 +0200 Message-Id: <20200514141402.12498-12-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x12b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Joe Komlodi The check to see if we can use FPU2 instructions would return 0 if cfg.use_fpu == 2, rather than returning the PVR2_USE_FPU2_MASK. This would cause all FPU2 instructions (fsqrt, flt, fint) to not be used. Signed-off-by: Joe Komlodi Reviewed-by: Edgar E. Iglesias Message-Id: <1589219346-106769-2-git-send-email-komlodi@xilinx.com> Signed-off-by: Edgar E. Iglesias --- target/microblaze/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 92b3630804..8079724f32 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1392,7 +1392,7 @@ static int dec_check_fpuv2(DisasContext *dc) tcg_gen_movi_i64(cpu_SR[SR_ESR], ESR_EC_FPU); t_gen_raise_exception(dc, EXCP_HW_EXCP); } - return (dc->cpu->cfg.use_fpu == 2) ? 0 : PVR2_USE_FPU2_MASK; + return (dc->cpu->cfg.use_fpu == 2) ? PVR2_USE_FPU2_MASK : 0; } static void dec_fpu(DisasContext *dc) From patchwork Thu May 14 14:14:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F325697 for ; Thu, 14 May 2020 14:19:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 15F7620671 for ; Thu, 14 May 2020 14:19:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WbIPQQg9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15F7620671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEi7-0007hw-2p for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:19:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcx-0007k2-Sf for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:23 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]:44199) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcw-0003oB-77 for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:22 -0400 Received: by mail-lf1-x136.google.com with SMTP id d22so2744332lfm.11 for ; Thu, 14 May 2020 07:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KBuh5XtT3vvpSuwwP/oXkh8fEbk4QnxLl6WMFlm593E=; b=WbIPQQg9BH7E4IXWsisbm0S36p6JyMe15G06iAuUYCYGJ/KYm6GK7CVRDhiEHIWJMa QrzzVF+uzK/7p/hhUr30o7lKmsPi/DeLZMDAl5oiryzsa9jmnFS0tiyRK/AoVbNRlSjP +1uN/7OJGzOaIH5OiVWmpG9f71uMZVEwe45uSxMZ8/vkPd2DthnohGbBClXO+c1xn0Cw XylAocg99frX+xnrpRbT2DZxBCHkA/X4tuR/oXApfAVCvuot8WN9/VBrvAaLT31GU7kd rNjydQ9cFDqjroRTp/6FY6jN1jg7gBxYXFGtCcZUn7MEY9+x7yt9assI0m56TD3t6aAL O4eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KBuh5XtT3vvpSuwwP/oXkh8fEbk4QnxLl6WMFlm593E=; b=sCQUZszu+eY8LxJ4JbZkxxUl6RFz2Q77Tdz+/Q/VlqU1mT+b6ZUow3lKpXxD9/YGJ5 +2FexlrLC7wd0yDSI68KmOlKtTW+8Gn77uf7k7foUKrMW8/EuK7hFTLUtKy2tCCEoV32 fCons0TjUGMG0HGcpxUqAbbOBo02xayuvKLUNETV0wzWtfdwQMAUYLrjQogTreXUua2q TZjO8Llw2B2D0bpHhBFef897ZJgagnxL4XaQcuZmB1uxhYkMnPdNPeinhayUO/+pJjOn UOy7pazQ6MFwBKbtPy1/g9GEeg0MinoEzJrZEVI9bXqn7pkIrIFFEEjiOUhtrC4BjwUC O86g== X-Gm-Message-State: AOAM533C+tnsrZPJh7HsNmTUTNtMD+S3klUEolKnHgH8j0fzeSCv5qMw djTsq3nEUnJBH0QCOlQaqk2VakLoqH0= X-Google-Smtp-Source: ABdhPJx4rNxQSn/ladKfvChx1xMenPQS6RTfV1KFDhwxWqGwM4wavhU2UwOEcz94kLa052gsw+6FIA== X-Received: by 2002:a19:d:: with SMTP id 13mr3491868lfa.167.1589465660321; Thu, 14 May 2020 07:14:20 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id w29sm1963622lfc.4.2020.05.14.07.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:19 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 12/14] target/microblaze: gdb: Extend the number of registers presented to GDB Date: Thu, 14 May 2020 16:14:00 +0200 Message-Id: <20200514141402.12498-13-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x136.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Joe Komlodi Increase the number of Microblaze registers QEMU will report when talking to GDB. Signed-off-by: Joe Komlodi Reviewed-by: Edgar E. Iglesias Message-Id: <1589393329-223076-2-git-send-email-komlodi@xilinx.com> Signed-off-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 2 +- target/microblaze/gdbstub.c | 52 ++++++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index aa9983069a..51e5c85b10 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -329,7 +329,7 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) #endif dc->vmsd = &vmstate_mb_cpu; device_class_set_props(dc, mb_properties); - cc->gdb_num_core_regs = 32 + 5; + cc->gdb_num_core_regs = 32 + 27; cc->disas_set_info = mb_disas_set_info; cc->tcg_initialize = mb_tcg_init; diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index f41ebf1f33..54cc7857d1 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -26,12 +26,37 @@ int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUMBState *env = &cpu->env; + /* + * GDB expects registers to be reported in this order: + * R0-R31 + * PC-BTR + * PVR0-PVR11 + * EDR-TLBHI + * SLR-SHR + */ if (n < 32) { return gdb_get_reg32(mem_buf, env->regs[n]); } else { - return gdb_get_reg32(mem_buf, env->sregs[n - 32]); + n -= 32; + switch (n) { + case 0 ... 5: + return gdb_get_reg32(mem_buf, env->sregs[n]); + /* PVR12 is intentionally skipped */ + case 6 ... 17: + n -= 6; + return gdb_get_reg32(mem_buf, env->pvr.regs[n]); + case 18 ... 24: + /* Add an offset of 6 to resume where we left off with SRegs */ + n = n - 18 + 6; + return gdb_get_reg32(mem_buf, env->sregs[n]); + case 25: + return gdb_get_reg32(mem_buf, env->slr); + case 26: + return gdb_get_reg32(mem_buf, env->shr); + default: + return 0; + } } - return 0; } int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) @@ -50,7 +75,28 @@ int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) if (n < 32) { env->regs[n] = tmp; } else { - env->sregs[n - 32] = tmp; + n -= 32; + switch (n) { + case 0 ... 5: + env->sregs[n] = tmp; + break; + /* PVR12 is intentionally skipped */ + case 6 ... 17: + n -= 6; + env->pvr.regs[n] = tmp; + break; + case 18 ... 24: + /* Add an offset of 6 to resume where we left off with SRegs */ + n = n - 18 + 6; + env->sregs[n] = tmp; + break; + case 25: + env->slr = tmp; + break; + case 26: + env->shr = tmp; + break; + } } return 4; } From patchwork Thu May 14 14:14:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548839 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31BE114B7 for ; Thu, 14 May 2020 14:24:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 079AD2065D for ; Thu, 14 May 2020 14:24:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z1rvc4d+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 079AD2065D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEmT-0006tw-38 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:24:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEcy-0007l0-Jl for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:25 -0400 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]:36632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcx-0003oV-SG for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:24 -0400 Received: by mail-lj1-x241.google.com with SMTP id u15so3717717ljd.3 for ; Thu, 14 May 2020 07:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7FoM1+aW2rkN6WZGeGZa1NdTwyvt1XBX/M5a6guzNPc=; b=Z1rvc4d+iouPEPJFEGxRF7k5GZfcOjA7SOTurgq6CnZ39swZ8ibRCNr09ZmL9pywrz r+ne+HSrzZ1FKmp9ctJzlQoawp27d+fZgaRlOUSKtrxBEVmnnz0JGthzaMwztldS/6dA FFHOVnt4P8OJIZN1AM6EAaww2KR+b5cL1hsNhSdo77Eh1GD9dtm8X2dpSiX5eJk70wLt 6hOlpRS6NGe/9S/yCSjsrsA6a2FAkhO11XTnDjQ0oX3OTJ5uhOWSIIZjtSbWuZd09llU Eq8p3NyoAd62QQ2HbatVirjm4mB/7grbqRUCIYdPgRdKQ/CBIa/6i9IruxtejwGN/LUf 8l9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7FoM1+aW2rkN6WZGeGZa1NdTwyvt1XBX/M5a6guzNPc=; b=m6doRPhgHmW2PR734eKiwwWqR7pnnirVtjDuw6BqSWKxTiFRZD2DLUBhJiEE0+wg3p C0XSIleGCcOiyzg0SltW8iHOHLA7eMU37fXmzXsCcAaGlDcoNxcrUax98rxnwXnYRLP/ PPZLOCbPbHbPk6A3kwiZNT2KRbC+efRLOK2FocH+jbG0gfQ/maszdOwSrDOzy+Qtpw20 sIb+zQehiTBAU041Svm7oTEFHs+TDP/2CPY+1SQDrIs0XxpJpoNPs3RS2174fGkp1tEB LJo20CFAnU7HDEkk430f7vUBHXoRH60mCUxBQ2WcUvg5Vf6gN2H7agMvv8NuYMb4fSO8 xBgA== X-Gm-Message-State: AOAM532J1V12aGP5L6zw6EZg5WdwzhYovW2VJqWlA41PLTl25ERUAzZB 9R3cIZ3ztOgTbLHtAouNhcCXVVrdTGg= X-Google-Smtp-Source: ABdhPJwsVWycX4KYMrtnKmcyEfJjqyfbHirrVzs42xxW0oi48lPv8r7u7QNtREKle+NbFidKbZu1GA== X-Received: by 2002:a2e:9a54:: with SMTP id k20mr3092933ljj.265.1589465661589; Thu, 14 May 2020 07:14:21 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id z17sm1365436ljc.81.2020.05.14.07.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:20 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 13/14] target/microblaze: gdb: Fix incorrect SReg reporting Date: Thu, 14 May 2020 16:14:01 +0200 Message-Id: <20200514141402.12498-14-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::241; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x241.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Joe Komlodi SRegs used to be reported to GDB by iterating over the SRegs array, however we do not store them in an order that allows them to be reported to GDB in that way. To fix this, a simple map is used to map the register GDB wants to its location in the SRegs array. Signed-off-by: Joe Komlodi Reviewed-by: Edgar E. Iglesias Message-Id: <1589393329-223076-3-git-send-email-komlodi@xilinx.com> Signed-off-by: Edgar E. Iglesias --- target/microblaze/gdbstub.c | 59 ++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index 54cc7857d1..73e8973597 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -25,6 +25,21 @@ int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUMBState *env = &cpu->env; + /* + * GDB expects SREGs in the following order: + * PC, MSR, EAR, ESR, FSR, BTR, EDR, PID, ZPR, TLBX, TLBSX, TLBLO, TLBHI. + * They aren't stored in this order, so make a map. + * PID, ZPR, TLBx, TLBsx, TLBLO, and TLBHI aren't modeled, so we don't + * map them to anything and return a value of 0 instead. + */ + static const uint8_t sreg_map[6] = { + SR_PC, + SR_MSR, + SR_EAR, + SR_ESR, + SR_FSR, + SR_BTR + }; /* * GDB expects registers to be reported in this order: @@ -40,15 +55,16 @@ int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) n -= 32; switch (n) { case 0 ... 5: - return gdb_get_reg32(mem_buf, env->sregs[n]); + return gdb_get_reg32(mem_buf, env->sregs[sreg_map[n]]); /* PVR12 is intentionally skipped */ case 6 ... 17: n -= 6; return gdb_get_reg32(mem_buf, env->pvr.regs[n]); - case 18 ... 24: - /* Add an offset of 6 to resume where we left off with SRegs */ - n = n - 18 + 6; - return gdb_get_reg32(mem_buf, env->sregs[n]); + case 18: + return gdb_get_reg32(mem_buf, env->sregs[SR_EDR]); + /* Other SRegs aren't modeled, so report a value of 0 */ + case 19 ... 24: + return gdb_get_reg32(mem_buf, 0); case 25: return gdb_get_reg32(mem_buf, env->slr); case 26: @@ -66,29 +82,52 @@ int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) CPUMBState *env = &cpu->env; uint32_t tmp; + /* + * GDB expects SREGs in the following order: + * PC, MSR, EAR, ESR, FSR, BTR, EDR, PID, ZPR, TLBX, TLBSX, TLBLO, TLBHI. + * They aren't stored in this order, so make a map. + * PID, ZPR, TLBx, TLBsx, TLBLO, and TLBHI aren't modeled, so we don't + * map them to anything. + */ + static const uint8_t sreg_map[6] = { + SR_PC, + SR_MSR, + SR_EAR, + SR_ESR, + SR_FSR, + SR_BTR + }; + if (n > cc->gdb_num_core_regs) { return 0; } tmp = ldl_p(mem_buf); + /* + * GDB expects registers to be reported in this order: + * R0-R31 + * PC-BTR + * PVR0-PVR11 + * EDR-TLBHI + * SLR-SHR + */ if (n < 32) { env->regs[n] = tmp; } else { n -= 32; switch (n) { case 0 ... 5: - env->sregs[n] = tmp; + env->sregs[sreg_map[n]] = tmp; break; /* PVR12 is intentionally skipped */ case 6 ... 17: n -= 6; env->pvr.regs[n] = tmp; break; - case 18 ... 24: - /* Add an offset of 6 to resume where we left off with SRegs */ - n = n - 18 + 6; - env->sregs[n] = tmp; + /* Only EDR is modeled in these indeces, so ignore the rest */ + case 18: + env->sregs[SR_EDR] = tmp; break; case 25: env->slr = tmp; From patchwork Thu May 14 14:14:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11548835 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7587C1391 for ; Thu, 14 May 2020 14:23:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B1FC2065D for ; Thu, 14 May 2020 14:23:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iP3oBFQj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B1FC2065D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZElq-00065S-Ej for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 10:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEd0-0007mL-4G for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:27 -0400 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:43233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEcz-0003oi-DJ for qemu-devel@nongnu.org; Thu, 14 May 2020 10:14:25 -0400 Received: by mail-lj1-x244.google.com with SMTP id l19so3664604lje.10 for ; Thu, 14 May 2020 07:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hHXzvT0ne/aeVCxE+iMY7gU5VPnnGQChVHUMUTuz5KQ=; b=iP3oBFQjQcoENgO8zf2xhHRlly1V2mMzMQM9Qq58k8I0L5lCK01QgJwtxvB5R0DCXH aijXJv70S44d9uw7trn2bdDYWOvSjKlfomBDi7Yj/pU0jGtKzZ7GKaMriqWUoTIRLA0x tuZ7OjNbNlgkcKWDbhmcettoCUfRjaogmBAPyZ9sgy2M35WIa95mmUecDM4wU70pYOeJ ihXpVyS0a+xjcUn30NPtdRhF+C1DUhUFGnH1itPJVZ8X8MtH6L472TvTf21zsh0rDrdP O8hTS48BrBpYnHQpryppFQxKZpTOa+p4cyLqmAZdzaIWvMxlXTCFASQZUXsg0ZSezi7f hqvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hHXzvT0ne/aeVCxE+iMY7gU5VPnnGQChVHUMUTuz5KQ=; b=aZuqZ1Klm+MmsxhOLPhsXbxFmFf2NKK0BoqfQsq0deC6Ad3cYWvgp0GHZcSzXhV1hH jhdHFcqwomJ5n9/UvskUzlGSz90ju4Yenb/ZLDAzGyzgn+O/D122plpaZEO7Zbq3TtAp jKDnZVZp2s0Nd7mGzdrRtKuYjcDB3h5rXhNxSk38RKPA6HWCGGSlc1w9EP7+ljCIdmQK hpvkyMDm9brht2ka6YHk1yuzibv35BBxty3ore/MpOkO45/eKCs1UIPGW+sHbCESX4u2 CEH4Mn+DqbDCFYzNAkGczg5D81CUnfeflDs21utCQ9P09lkqCKPrTPsdc4MJK8ZSz8Mp RioA== X-Gm-Message-State: AOAM530My/Q07SE024+4uwrO+D95wfjLtXz9UFdCiPHzkfRDsiI17biR CdlTvpvPGz1RCGHVdUxtnYcDXujnc2A= X-Google-Smtp-Source: ABdhPJxFcWsTA2HP5+hC1Ms7pxBKavniROcQpahL3GUuMYzzFk4y5zcVelcSX3IBi3ilx72boJs1GQ== X-Received: by 2002:a2e:7508:: with SMTP id q8mr3045648ljc.234.1589465663341; Thu, 14 May 2020 07:14:23 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id m15sm1561799lji.21.2020.05.14.07.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 07:14:22 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PULL v1 14/14] target/microblaze: monitor: Increase the number of registers reported Date: Thu, 14 May 2020 16:14:02 +0200 Message-Id: <20200514141402.12498-15-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514141402.12498-1-edgar.iglesias@gmail.com> References: <20200514141402.12498-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::244; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x244.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 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, FREEMAIL_FROM=0.001, FSL_HELO_FAKE=3.399, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Joe Komlodi Increase the number of registers reported to match GDB. Registers that aren't modeled are reported as 0. Signed-off-by: Joe Komlodi Reviewed-by: Edgar E. Iglesias Message-Id: <1589393329-223076-4-git-send-email-komlodi@xilinx.com> Signed-off-by: Edgar E. Iglesias --- target/microblaze/translate.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 8079724f32..f6ff2591c3 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1789,9 +1789,11 @@ void mb_cpu_dump_state(CPUState *cs, FILE *f, int flags) qemu_fprintf(f, "IN: PC=%" PRIx64 " %s\n", env->sregs[SR_PC], lookup_symbol(env->sregs[SR_PC])); qemu_fprintf(f, "rmsr=%" PRIx64 " resr=%" PRIx64 " rear=%" PRIx64 " " - "debug=%x imm=%x iflags=%x fsr=%" PRIx64 "\n", + "debug=%x imm=%x iflags=%x fsr=%" PRIx64 " " + "rbtr=%" PRIx64 "\n", env->sregs[SR_MSR], env->sregs[SR_ESR], env->sregs[SR_EAR], - env->debug, env->imm, env->iflags, env->sregs[SR_FSR]); + env->debug, env->imm, env->iflags, env->sregs[SR_FSR], + env->sregs[SR_BTR]); qemu_fprintf(f, "btaken=%d btarget=%" PRIx64 " mode=%s(saved=%s) " "eip=%d ie=%d\n", env->btaken, env->btarget, @@ -1799,7 +1801,17 @@ void mb_cpu_dump_state(CPUState *cs, FILE *f, int flags) (env->sregs[SR_MSR] & MSR_UMS) ? "user" : "kernel", (bool)(env->sregs[SR_MSR] & MSR_EIP), (bool)(env->sregs[SR_MSR] & MSR_IE)); + for (i = 0; i < 12; i++) { + qemu_fprintf(f, "rpvr%2.2d=%8.8x ", i, env->pvr.regs[i]); + if ((i + 1) % 4 == 0) { + qemu_fprintf(f, "\n"); + } + } + /* Registers that aren't modeled are reported as 0 */ + qemu_fprintf(f, "redr=%" PRIx64 " rpid=0 rzpr=0 rtlbx=0 rtlbsx=0 " + "rtlblo=0 rtlbhi=0\n", env->sregs[SR_EDR]); + qemu_fprintf(f, "slr=%x shr=%x\n", env->slr, env->shr); for (i = 0; i < 32; i++) { qemu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]); if ((i + 1) % 4 == 0)