From nobody Fri Dec 19 04:29:46 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1598607268; cv=none; d=zohomail.com; s=zohoarc; b=Q5miPZ5o3kY03hQdqAs4RXmj+owLujhzhBLvhQFiQIGXhAXf13JpanDs8R3YV6Bvlc7WrfYy4crBY83hG4fLciMtYytgFbvl+q/IWH9pI8uX08HPQJ0F87AgW1iLrH194jQqDyiCTISLJBEje/JmYdhSmnqlptmxyALeso0ez6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598607268; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O2u1tsz9QgZ+6NbKIVCGs/beVjIdsELa+9klShgDJPk=; b=Sr+GEHzHAid2lfivzNQatm5RcUYH+wJsIXIJCaJYSua1ilAftKvHH7u1M8o3rubju14a8wC/fcFKd7YI2ygpufRkSwKp3nZN7ZtKvH8vX1Ark6PZABXxah4v6kkaYwJLzmyieX5jykMyB+oAndsglTe0zpE+xy5jmBP1MZWAUoo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598607268283912.3832128786039; Fri, 28 Aug 2020 02:34:28 -0700 (PDT) Received: from localhost ([::1]:43226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBamB-0006hM-0e for importer@patchew.org; Fri, 28 Aug 2020 05:34:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBacg-0004XQ-44 for qemu-devel@nongnu.org; Fri, 28 Aug 2020 05:24:38 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBace-0004Ij-Ai for qemu-devel@nongnu.org; Fri, 28 Aug 2020 05:24:37 -0400 Received: by mail-wm1-x344.google.com with SMTP id w2so299138wmi.1 for ; Fri, 28 Aug 2020 02:24:35 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id t13sm912304wru.65.2020.08.28.02.24.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 02:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=O2u1tsz9QgZ+6NbKIVCGs/beVjIdsELa+9klShgDJPk=; b=OeORbVn3ayh7bMtuBuEKVZqSfrFTKE3ujO7uTBOudAs7fSTPVNvAFEik3ZZQMrzCIK 9rdcaNBNbiIgjf1KQjLUqi2Q6uhV5j6BY/Pr4Nu231WSSCdntwsydyKuhnz4642aaXB6 +F9WuUMSQST27wQOTK/FK417L2IOpUZjanHorreCYwxczCGfzGwqkS6hVHXZyfjGKNkw SlY5Gt0S0qmQPqAX4StywEDtLxfeesnH47TFw8DrKITLslSn3wcCKDkoDpgdcWJU7teF hFdjC68Q9OSrd5p9mnIZ8vNbQ1bgo8lY1EOgKR/WWAmLaXye96muVc+IwMw0uwpU1lzz 5sww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O2u1tsz9QgZ+6NbKIVCGs/beVjIdsELa+9klShgDJPk=; b=UsGqrL9xyWiwc6PLiFsilUNbS8/XZylQKayLE5qAMLZE/GPOfRaMhZcWR/P3gSYrJW tEwZsJ74yAPYBDHnYaBVR3dtMdgUq8e+JW5tob2r+BASlSR9RWTknrDKtCvVtPIGiMSi QYgzOTthjmbN4UC6ZWVDHhaVS4bJXTNJKaMcWxaDirIugt5nnXsP1iJ3jzDN/tl4Sggf SzDA2ax8pSNMCSXPpaGiU8vNWl5CjF+2mTQ2GTPDeZTCdnwjHns+tHvlkHbe2nRFufb6 RhWRwWqHWmPSIXL1sn6BJCVZG3jP/UxLZ+v7nZr8G4bGAoCnYH7U6xZ0Wu4+5Tklbn4j 5fqg== X-Gm-Message-State: AOAM5335Y+aY+hrSuVpmwmLfsCTmWdr8HAgGqKTEcn/U8mfOcaN3WeF6 Xge8CXUytD4OmBDAfd7vMZkuHPbRgI95EXMW X-Google-Smtp-Source: ABdhPJwON4mYzKY0BEp5JhfNcY2KkfmdI91b7bGXXdplqc5NoDa4wk3IJgF6qw60RVtXDuwso0IQuA== X-Received: by 2002:a7b:c342:: with SMTP id l2mr656411wmj.153.1598606674649; Fri, 28 Aug 2020 02:24:34 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/35] hw/misc/unimp: Display the offset with width of the region size Date: Fri, 28 Aug 2020 10:23:55 +0100 Message-Id: <20200828092413.22206-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200828092413.22206-1-peter.maydell@linaro.org> References: <20200828092413.22206-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 To have a better idea of how big is the region where the offset belongs, display the value with the width of the region size (i.e. a region of 0x1000 bytes uses 0x000 format). Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20200812190206.31595-4-f4bug@amsat.org Signed-off-by: Peter Maydell --- include/hw/misc/unimp.h | 1 + hw/misc/unimp.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h index 4c1d13c9bf8..c63968a2cda 100644 --- a/include/hw/misc/unimp.h +++ b/include/hw/misc/unimp.h @@ -20,6 +20,7 @@ typedef struct { SysBusDevice parent_obj; MemoryRegion iomem; + unsigned offset_fmt_width; char *name; uint64_t size; } UnimplementedDeviceState; diff --git a/hw/misc/unimp.c b/hw/misc/unimp.c index b4b318db1c3..6cfc5727f0b 100644 --- a/hw/misc/unimp.c +++ b/hw/misc/unimp.c @@ -23,8 +23,8 @@ static uint64_t unimp_read(void *opaque, hwaddr offset, u= nsigned size) UnimplementedDeviceState *s =3D UNIMPLEMENTED_DEVICE(opaque); =20 qemu_log_mask(LOG_UNIMP, "%s: unimplemented device read " - "(size %d, offset 0x%" HWADDR_PRIx ")\n", - s->name, size, offset); + "(size %d, offset 0x%0*" HWADDR_PRIx ")\n", + s->name, size, s->offset_fmt_width, offset); return 0; } =20 @@ -34,9 +34,9 @@ static void unimp_write(void *opaque, hwaddr offset, UnimplementedDeviceState *s =3D UNIMPLEMENTED_DEVICE(opaque); =20 qemu_log_mask(LOG_UNIMP, "%s: unimplemented device write " - "(size %d, offset 0x%" HWADDR_PRIx + "(size %d, offset 0x%0*" HWADDR_PRIx ", value 0x%0*" PRIx64 ")\n", - s->name, size, offset, size << 1, value); + s->name, size, s->offset_fmt_width, offset, size << 1, v= alue); } =20 static const MemoryRegionOps unimp_ops =3D { @@ -63,6 +63,8 @@ static void unimp_realize(DeviceState *dev, Error **errp) return; } =20 + s->offset_fmt_width =3D DIV_ROUND_UP(64 - clz64(s->size - 1), 4); + memory_region_init_io(&s->iomem, OBJECT(s), &unimp_ops, s, s->name, s->size); sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem); --=20 2.20.1