From nobody Mon May 6 08:10:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=wdc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15537130154331.3876550801791154; Wed, 27 Mar 2019 11:56:55 -0700 (PDT) Received: from localhost ([127.0.0.1]:52161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9DjI-0004ID-CQ for importer@patchew.org; Wed, 27 Mar 2019 14:56:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9Dh5-0002Js-2U for qemu-devel@nongnu.org; Wed, 27 Mar 2019 14:54:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9De4-0004nZ-5k for qemu-devel@nongnu.org; Wed, 27 Mar 2019 14:51:29 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:3132) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9De3-0004kx-P0; Wed, 27 Mar 2019 14:51:28 -0400 Received: from mail-cys01nam02lp2051.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([104.47.37.51]) by ob1.hgst.iphmx.com with ESMTP; 28 Mar 2019 02:51:26 +0800 Received: from BYAPR04MB4901.namprd04.prod.outlook.com (52.135.232.206) by BYAPR04MB4821.namprd04.prod.outlook.com (52.135.240.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Wed, 27 Mar 2019 18:51:24 +0000 Received: from BYAPR04MB4901.namprd04.prod.outlook.com ([fe80::44e8:bd21:17b:348c]) by BYAPR04MB4901.namprd04.prod.outlook.com ([fe80::44e8:bd21:17b:348c%4]) with mapi id 15.20.1750.014; Wed, 27 Mar 2019 18:51:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1553712687; x=1585248687; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=/9U1pzkyGr1lgCA7dMr6CEVrUA4hNLjSgGzFqb3FPGE=; b=iTZnMZobAsBc2MllU+eHwjITJY5U1dgesrZQWES2itT45SDgQr1G2eGf 8EvXaxb0u9gMSgTS6OoGJaNEnM5vpC5FXLPw1vU4rjRTTRhBdxxhGQn5T 3hPSsEEg3rsadFBg/BZOCy7zcw0Yy2jHH42+belIbWAwbH3VcwsUb3sSM uCA8Bib3b4zakcW98zJzpxoTVU7MfhpIDqcWrXhIz2/vwTnhOdMFuJvH8 X7n+uVpr1DIBPXZ+pWpSTUW5mhGDmXuQc5QisS9zc4/UIKbbREE9fVggw FMM+xvl0pzYp6b35q8g+48G+JiAsfyw9PQocTq21IqyoqCkbs62wQkRjZ g==; X-IronPort-AV: E=Sophos;i="5.60,277,1549900800"; d="scan'208";a="105752008" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=USiKU+GrhSVOXojNvxcz48N//UGATfPfQL5Me/ndmXo=; b=ixzW5/F1eupAs5LP11GthVPbMoNu7ikrCesFMt3Mq6XbM23RS5xibxr1577OTYN3p+kU3BlWWG5A6xcT8akpOk29QPJoe8mdKp8DaRA2cMfCxlJCykivFnQvxOoEWNWT/7SUAZEfpGjiae3VDZ1mfbOUOFmvlBlN4Ek+diRa7zA= From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [PATCH for 4.0 v2 1/2] riscv: plic: Fix incorrect irq calculation Thread-Index: AQHU5M4TzNmMPOS+9UOAkUsoTkIkSQ== Date: Wed, 27 Mar 2019 18:51:24 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-clientproxiedby: BYAPR01CA0067.prod.exchangelabs.com (2603:10b6:a03:94::44) To BYAPR04MB4901.namprd04.prod.outlook.com (2603:10b6:a03:4f::14) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e5480b4b-1d74-47e5-583d-08d6b2e53627 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BYAPR04MB4821; x-ms-traffictypediagnostic: BYAPR04MB4821: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(346002)(136003)(366004)(396003)(189003)(199004)(186003)(486006)(4326008)(53936002)(106356001)(7736002)(105586002)(50226002)(446003)(3846002)(68736007)(110136005)(2906002)(44832011)(476003)(2616005)(118296001)(81166006)(8936002)(316002)(11346002)(54906003)(8676002)(6116002)(66066001)(97736004)(25786009)(81156014)(99286004)(5660300002)(26005)(478600001)(14454004)(86362001)(72206003)(14444005)(52116002)(6512007)(386003)(102836004)(36756003)(71200400001)(71190400001)(305945005)(6486002)(6436002)(6506007)(2501003)(256004)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:BYAPR04MB4821; H:BYAPR04MB4901.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: pGUB528bRStK2haNH7naX6MluKzyU4iGaapKEBvDU9i37kRLKyh80Ud5Ueia49zjlD+nYaTUfSAiaq3DfX+bqEDVuyAwgdWlDVCtmxe4t6LXzralbVPh2Ec1lEligEDokzWatU7z53dO1DBBzCXEZ1e87cnXeq61Fm6LhbSFKUNjjApdpu9Tb+0wf8x6agWjT7qfOclwxwPdOh9vCEoyGJJk3oOu3oESzcBt2b+OZmSmdcBHK2BRW2K1EHpKD5uBuHQGYybnIg3VvQ1bax9W7lCRR1vWpeDdvkGg9hRfqBI/C3qhgfCdOIXA9KVTd2jSokeUg+hO6VeDLnUGeAKr7z2rzDxI9PED+bC0mIFCG0ONR+1fFgHlOvwxk+uLwq9F41QOuIwA7Ov7ZIDh7APTtwdtT6dBX2Oju9y6tSRMI90= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5480b4b-1d74-47e5-583d-08d6b2e53627 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 18:51:24.8699 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR04MB4821 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [PATCH for 4.0 v2 1/2] riscv: plic: Fix incorrect irq calculation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , "palmer@sifive.com" , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) Content-Type: text/plain; charset="utf-8" This patch fixes four different things, to maintain bisectability they have been merged into a single patch. The following fixes are below: sifive_plic: Fix incorrect irq calculation The irq is incorrectly calculated to be off by one. It has worked in the past as the priority_base offset has also been set incorrectly. We are about to fix the priority_base offset so first first the irq calculation. sifive_u: Fix PLIC priority base offset and numbering According to the FU540 manual the PLIC source priority address starts at an offset of 0x04 and not 0x00. The same manual also specifies that the PLIC only has 53 source priorities. Fix these two incorrect header files. We also need to over extend the plic_gpios[] array as the PLIC sources count from 1 and not 0. riscv: sifive_e: Fix PLIC priority base offset According to the FE31 manual the PLIC source priority address starts at an offset of 0x04 and not 0x00. riscv: virt: Fix PLIC priority base offset Update the virt offsets based on the newly updated SiFive U and SiFive E offsets. Signed-off-by: Alistair Francis Reviewed-by: Palmer Dabbelt --- hw/riscv/sifive_plic.c | 4 ++-- hw/riscv/sifive_u.c | 2 +- include/hw/riscv/sifive_e.h | 2 +- include/hw/riscv/sifive_u.h | 4 ++-- include/hw/riscv/virt.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/riscv/sifive_plic.c b/hw/riscv/sifive_plic.c index 1c703e1a37..70a85cd075 100644 --- a/hw/riscv/sifive_plic.c +++ b/hw/riscv/sifive_plic.c @@ -206,7 +206,7 @@ static uint64_t sifive_plic_read(void *opaque, hwaddr a= ddr, unsigned size) if (addr >=3D plic->priority_base && /* 4 bytes per source */ addr < plic->priority_base + (plic->num_sources << 2)) { - uint32_t irq =3D (addr - plic->priority_base) >> 2; + uint32_t irq =3D ((addr - plic->priority_base) >> 2) + 1; if (RISCV_DEBUG_PLIC) { qemu_log("plic: read priority: irq=3D%d priority=3D%d\n", irq, plic->source_priority[irq]); @@ -279,7 +279,7 @@ static void sifive_plic_write(void *opaque, hwaddr addr= , uint64_t value, if (addr >=3D plic->priority_base && /* 4 bytes per source */ addr < plic->priority_base + (plic->num_sources << 2)) { - uint32_t irq =3D (addr - plic->priority_base) >> 2; + uint32_t irq =3D ((addr - plic->priority_base) >> 2) + 1; plic->source_priority[irq] =3D value & 7; if (RISCV_DEBUG_PLIC) { qemu_log("plic: write priority: irq=3D%d priority=3D%d\n", diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 5ecc47cea3..88381a7507 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -340,7 +340,7 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev= , Error **errp) const struct MemmapEntry *memmap =3D sifive_u_memmap; MemoryRegion *system_memory =3D get_system_memory(); MemoryRegion *mask_rom =3D g_new(MemoryRegion, 1); - qemu_irq plic_gpios[SIFIVE_U_PLIC_NUM_SOURCES]; + qemu_irq plic_gpios[SIFIVE_U_PLIC_NUM_SOURCES + 1]; int i; Error *err =3D NULL; NICInfo *nd =3D &nd_table[0]; diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h index 7b6d8aed96..f715f8606f 100644 --- a/include/hw/riscv/sifive_e.h +++ b/include/hw/riscv/sifive_e.h @@ -70,7 +70,7 @@ enum { #define SIFIVE_E_PLIC_HART_CONFIG "M" #define SIFIVE_E_PLIC_NUM_SOURCES 127 #define SIFIVE_E_PLIC_NUM_PRIORITIES 7 -#define SIFIVE_E_PLIC_PRIORITY_BASE 0x0 +#define SIFIVE_E_PLIC_PRIORITY_BASE 0x04 #define SIFIVE_E_PLIC_PENDING_BASE 0x1000 #define SIFIVE_E_PLIC_ENABLE_BASE 0x2000 #define SIFIVE_E_PLIC_ENABLE_STRIDE 0x80 diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index be13cc1304..d859ea20f6 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -68,9 +68,9 @@ enum { }; =20 #define SIFIVE_U_PLIC_HART_CONFIG "MS" -#define SIFIVE_U_PLIC_NUM_SOURCES 127 +#define SIFIVE_U_PLIC_NUM_SOURCES 53 #define SIFIVE_U_PLIC_NUM_PRIORITIES 7 -#define SIFIVE_U_PLIC_PRIORITY_BASE 0x0 +#define SIFIVE_U_PLIC_PRIORITY_BASE 0x04 #define SIFIVE_U_PLIC_PENDING_BASE 0x1000 #define SIFIVE_U_PLIC_ENABLE_BASE 0x2000 #define SIFIVE_U_PLIC_ENABLE_STRIDE 0x80 diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index f12deaebd6..568764b570 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -59,7 +59,7 @@ enum { #define VIRT_PLIC_HART_CONFIG "MS" #define VIRT_PLIC_NUM_SOURCES 127 #define VIRT_PLIC_NUM_PRIORITIES 7 -#define VIRT_PLIC_PRIORITY_BASE 0x0 +#define VIRT_PLIC_PRIORITY_BASE 0x04 #define VIRT_PLIC_PENDING_BASE 0x1000 #define VIRT_PLIC_ENABLE_BASE 0x2000 #define VIRT_PLIC_ENABLE_STRIDE 0x80 --=20 2.21.0 From nobody Mon May 6 08:10:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=wdc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553713014267632.086372433338; Wed, 27 Mar 2019 11:56:54 -0700 (PDT) Received: from localhost ([127.0.0.1]:52159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9DjE-0004Ga-1v for importer@patchew.org; Wed, 27 Mar 2019 14:56:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9Dh3-0002Js-Vx for qemu-devel@nongnu.org; Wed, 27 Mar 2019 14:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9DeJ-0004s9-Qa for qemu-devel@nongnu.org; Wed, 27 Mar 2019 14:51:45 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:3157) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9DeG-0004qf-GI; Wed, 27 Mar 2019 14:51:41 -0400 Received: from mail-cys01nam02lp2057.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([104.47.37.57]) by ob1.hgst.iphmx.com with ESMTP; 28 Mar 2019 02:51:37 +0800 Received: from BYAPR04MB4901.namprd04.prod.outlook.com (52.135.232.206) by BYAPR04MB4821.namprd04.prod.outlook.com (52.135.240.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Wed, 27 Mar 2019 18:51:34 +0000 Received: from BYAPR04MB4901.namprd04.prod.outlook.com ([fe80::44e8:bd21:17b:348c]) by BYAPR04MB4901.namprd04.prod.outlook.com ([fe80::44e8:bd21:17b:348c%4]) with mapi id 15.20.1750.014; Wed, 27 Mar 2019 18:51:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1553712700; x=1585248700; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+McbQ3u7pSiVvq1X4UzDG/xhIHOJBUtngx28tuT8kck=; b=Mby3hu4GXY0lzHvUvx9ITmbkVvr1sw5xAGMAAeHVTkXXKD9em8hjAF6e ycH669KRrv35GuoHLH/A4T1bwE5o2RYz164gCxhgAe9j8WQIVdvY8zzDN 0N8+otiFYD15Qz64nZMq7pIzv3ScIL6powUqEf2RWQIKZxCHAQtbaUFlM KLYxGfJaOfmzeGZVq4uJk7uWyhjcgyHEKjj2zLvqwARLUGm14wYaSzViB y5BEU1xpX/ewdvYgBGe9gMqrlrNviQEwguuU0rVm2VHV1bRZM9QAahe8H daeaquueUHq1lyJjPvwK5lT3c4uu+6vhESb/FERJ81hfzlgyyuo182kVz g==; X-IronPort-AV: E=Sophos;i="5.60,277,1549900800"; d="scan'208";a="105752018" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RZyti4Y/QB3Gi/MVqDSxOapl/D5ax08xUY2Lb+FYTT0=; b=fNgcFXfApRhG3p91k2UhNz3XCalI6YLxx20Zgv62bIlg3R31FcHWe8WWfUbD+nqnGdebF7GF+R8KhpMWJinzc0AJZCijS9xdUmupuTM46Il24bi0Hlmn2K8XRm+BHRVFeyYsITEDHjhTAbsXmLCtST/Cca+WwJpXL0B++f4L/8I= From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [PATCH for 4.0 v2 2/2] riscv: plic: Log guest errors Thread-Index: AQHU5M4ZouIELc4vH0GZ/YeQ+LXrNA== Date: Wed, 27 Mar 2019 18:51:34 +0000 Message-ID: <51823496a00b8c8160f10b541275188b61dfd05d.1553712571.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-clientproxiedby: BYAPR06CA0059.namprd06.prod.outlook.com (2603:10b6:a03:14b::36) To BYAPR04MB4901.namprd04.prod.outlook.com (2603:10b6:a03:4f::14) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 65076626-0b96-48b1-1358-08d6b2e53c16 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BYAPR04MB4821; x-ms-traffictypediagnostic: BYAPR04MB4821: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(346002)(136003)(366004)(396003)(189003)(199004)(186003)(486006)(4326008)(53936002)(106356001)(7736002)(105586002)(50226002)(446003)(3846002)(68736007)(110136005)(2906002)(44832011)(476003)(2616005)(118296001)(81166006)(8936002)(316002)(11346002)(54906003)(8676002)(6116002)(66066001)(97736004)(25786009)(81156014)(99286004)(5660300002)(26005)(478600001)(14454004)(86362001)(72206003)(14444005)(52116002)(6512007)(386003)(102836004)(36756003)(71200400001)(71190400001)(305945005)(6486002)(6436002)(6506007)(2501003)(256004)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:BYAPR04MB4821; H:BYAPR04MB4901.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: tr7F18UYm2U44kwulGnauMkFX/4D3lmnpzOkr72pKhCuVQI5SCEBOOlK9X5dvlsfiJv7vc90SfI0IvE+yij0S3RZBWHKhLcVASP7GHfEcjsCBsS7LStr5DXOr2/U2I3oSxAGJge5UzNeWsZ2Cn9VNZY9nTYaqAqCZub03qXPVnWaQMFj5x3gDzD6FaLPtPAoTCWA9HV2PZfRJRtz3TKEzF9Bk1eUFzmlWxEvgQGewtJcesaxbLVbpL8ZAa8/E4ZzWzw+HmOJamHOou3LsnIFDG4STidONTX/MHc9myiXnwfP96Nj/QcFn+BiE4wbVITq/LxzOMAL4+hfHo6vu/GhcLF2B6FLZ8PM2sLeDY8xFKp2QE5sV3EawiL5ZDF1jpCSnLqZa7H5ygHHpb9TBikFps4SSDMB7CC/lVd7mIJwSBw= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65076626-0b96-48b1-1358-08d6b2e53c16 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 18:51:34.7990 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR04MB4821 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [PATCH for 4.0 v2 2/2] riscv: plic: Log guest errors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , "palmer@sifive.com" , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) Content-Type: text/plain; charset="utf-8" Instead of using error_report() to print guest errors let's use qemu_log_mask(LOG_GUEST_ERROR,...) to log the error. Signed-off-by: Alistair Francis Reviewed-by: Palmer Dabbelt Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/riscv/sifive_plic.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/riscv/sifive_plic.c b/hw/riscv/sifive_plic.c index 70a85cd075..7f373d6c9d 100644 --- a/hw/riscv/sifive_plic.c +++ b/hw/riscv/sifive_plic.c @@ -262,7 +262,9 @@ static uint64_t sifive_plic_read(void *opaque, hwaddr a= ddr, unsigned size) } =20 err: - error_report("plic: invalid register read: %08x", (uint32_t)addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Invalid register read 0x%" HWADDR_PRIx "\n", + __func__, addr); return 0; } =20 @@ -289,7 +291,9 @@ static void sifive_plic_write(void *opaque, hwaddr addr= , uint64_t value, } else if (addr >=3D plic->pending_base && /* 1 bit per source */ addr < plic->pending_base + (plic->num_sources >> 3)) { - error_report("plic: invalid pending write: %08x", (uint32_t)addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid pending write: 0x%" HWADDR_PRIx "", + __func__, addr); return; } else if (addr >=3D plic->enable_base && /* 1 bit per source */ addr < plic->enable_base + plic->num_addrs * plic->enable_stride) @@ -339,7 +343,9 @@ static void sifive_plic_write(void *opaque, hwaddr addr= , uint64_t value, } =20 err: - error_report("plic: invalid register write: %08x", (uint32_t)addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Invalid register write 0x%" HWADDR_PRIx "\n", + __func__, addr); } =20 static const MemoryRegionOps sifive_plic_ops =3D { --=20 2.21.0