From patchwork Fri Sep 27 03:20:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 1168223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46fcWJ4YQPz9sPS for ; Fri, 27 Sep 2019 13:20:44 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46fcWJ18kYzDqYj for ; Fri, 27 Sep 2019 13:20:44 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46fcWC0b3tzDqSh for ; Fri, 27 Sep 2019 13:20:39 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 46fcWB5BHPz9sP3; Fri, 27 Sep 2019 13:20:38 +1000 (AEST) From: Alistair Popple To: pdbg@lists.ozlabs.org Date: Fri, 27 Sep 2019 13:20:35 +1000 Message-Id: <20190927032035.5040-1-alistair@popple.id.au> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Pdbg] [PATCH] P8 ADU: Fix access sizes X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Commit 302f249d95f0 ("adu: Add arugments for block size") introduced the ability to specify an access size for the POWER8 and POWER9 ADU functions for cache-inhibited access. On POWER8 the ADU control register TSIZE encoding is slightly different than for POWER9. Unfortunately the code for P8 was copied from the P9 version but the encoding was not updated. This resulted in ADU putmem commands writing twice as much memory as they were supposed to on POWER8. Signed-off-by: Alistair Popple Reviewed-by: Amitay Isaacs --- libpdbg/adu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libpdbg/adu.c b/libpdbg/adu.c index 25f08cd..df610a7 100644 --- a/libpdbg/adu.c +++ b/libpdbg/adu.c @@ -344,7 +344,7 @@ static int p8_adu_getmem(struct mem *adu, uint64_t addr, uint64_t *data, if (ci) { /* Do cache inhibited access */ ctrl_reg = SETFIELD(P8_FBC_ALTD_TTYPE, ctrl_reg, P8_TTYPE_CI_PARTIAL_READ); - block_size = (blog2(block_size) + 1) << 1; + block_size = (blog2(block_size) + 1); } else { ctrl_reg = SETFIELD(P8_FBC_ALTD_TTYPE, ctrl_reg, P8_TTYPE_DMA_PARTIAL_READ); block_size = 0; @@ -405,10 +405,9 @@ int p8_adu_putmem(struct mem *adu, uint64_t addr, uint64_t data, int size, if (ci) { /* Do cache inhibited access */ ctrl_reg = SETFIELD(P8_FBC_ALTD_TTYPE, ctrl_reg, P8_TTYPE_CI_PARTIAL_WRITE); - block_size = (blog2(block_size) + 1) << 1; + block_size = (blog2(block_size) + 1); } else { ctrl_reg = SETFIELD(P8_FBC_ALTD_TTYPE, ctrl_reg, P8_TTYPE_DMA_PARTIAL_WRITE); - block_size <<= 1; } ctrl_reg = SETFIELD(P8_FBC_ALTD_TSIZE, ctrl_reg, block_size);