From patchwork Thu Feb 15 15:39:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10222013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 259ED601D7 for ; Thu, 15 Feb 2018 15:45:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E7D029421 for ; Thu, 15 Feb 2018 15:45:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02A5629427; Thu, 15 Feb 2018 15:45:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C1ACF29421 for ; Thu, 15 Feb 2018 15:45:10 +0000 (UTC) Received: from localhost ([::1]:60741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emLif-00088E-VQ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 15 Feb 2018 10:45:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emLeE-00045y-L2 for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:40:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emLe8-0003NZ-OK for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:40:34 -0500 Received: from mail-cys01nam02on0072.outbound.protection.outlook.com ([104.47.37.72]:1882 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emLe8-0003NC-FW for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:40:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EULf6Ch5F8qkKlWhTjfSNTN7AuBbpORgQIolSQpxbAE=; b=2kkGR4q2oRi9NRaBwt/LtcaFoA2uKoFOsbczcToeU0zLAaR6Y5Ndlym6dMVkl/sIF/RgEj7maVIL/Vr8wlM+1dmyDwXzE2J9Ln/CuSJnudpUjls2GSObPWmKY3lpi16v2forvnqR+rOGsSSjVqtjV7PKoTPqtvoVSvvTQuXclbE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0157.namprd12.prod.outlook.com (10.162.3.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Thu, 15 Feb 2018 15:40:24 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 09:39:29 -0600 Message-Id: <20180215153955.3253-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180215153955.3253-1-brijesh.singh@amd.com> References: <20180215153955.3253-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CY4PR04CA0044.namprd04.prod.outlook.com (10.172.133.30) To SN1PR12MB0157.namprd12.prod.outlook.com (10.162.3.144) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9caa5b11-f125-442c-b497-08d5748a6edd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SN1PR12MB0157; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0157; 3:imU91qfl233rCZ89qEHmSxqrou2ClJCYVWygfgDaMg4gCqqhq/QtcUzwusOgEdtHQ6C8ehob+ejGsftqMLzVDWIRGUWH/7/DCbEkwQAFSbJ4xonKN+wDzQYqdWC8rv6PFmmd2n7szVfpW8fwoSfCuzpbvkBOULlKMMgGDOCRgmgBFI71oEJK0OJuwJnG4/bJ6B9QDjni3g//lWCk0z2nSuYJZT0zWfV8WRJNoqpTdySkYOsoI7i9W1TS25jJ5Hrq; 25:PQlWgsHlSPaHH2eTAZa1kf/eMeiTg0X9Bp2YZ0BspWPp0eVZU4b3acgkHGeHSj0BmQSIAwttxUurAw4a9VDYaN/Zl2v1FRKcj1/36G7DrUo0Azbe7cfmBitSrmXUYyUEu//GsLPl7eNY3oPjNMrCxWDyCTnOr2OEs8gE5IgfrVul2iV67pToHOANiehbmJcMstuW+o08LKpocevAT0unBEWQyOxbUROe2qu3Iok9KlHXeZWGEMvTig7wz/WMvQPxld/S9r7GDcWO6JK2qYqe7x+zRhWVHYEDbNCvS4hTw1ilHH4c0EbjOeynIev8gLfdv7VzqhTA128CWx8+mdLxfQ==; 31:L8Zi77iXwjQVpHc2FrWrruQMr9qANw7AljcSeSIIk7gLsHIJZImPvREX0bsJtAvfcAQIu9RCb8WcDUMylh+pxE+PZoPJhQZPOwsN/x7Hm7Z1JquBUXgyVp9KyXYVdDqMparIeUSykZ+5/e6LdsIECf2ysngO46hN3G9Iy3hw0ww8CHmF6GLEvHqNvZA/9s6u0VmrgMp0En66Mn4ksnTQGStEjcZUTD9Nz9ILvnqKdQQ= X-MS-TrafficTypeDiagnostic: SN1PR12MB0157: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0157; 20:uX+iILzdOHubmU1v2HK9ciNs+uYCRdUh0h2wI+6lmZbtSntHrGVYusiqTvxGNBSgL3wgttg799QZZaGyl9rXvZ0D/MESXKYxQTE16vh3fTbNLUswcggEy1srICI/WUo1cRzho7Tn3kMCzxdg5cH+k0I2qJXgL19RL13JPb1iUIuvUnSA6AqMJeo4LzhjbnPCllOp0mEWBKMNkjI8LuF0y8M5TxsOkZMv678gbG+3gMjGwyVmlF/6FxJwnoq3Q/RAio2ruyLskVA4rmBaCuiQ4FoCAk667N1fyl5+K1DYarGTCltnW1/lhYWm4sHnWdCxzi4VTNrGajFCIq/K7yXYVXRmYcHjGtuAAmzy+19yKkdxnGfJf0/P3YfF4JCXmpXHHAynJQueGd05e4Rn3LryNvANunGnKdAKpWK2M4dq3KTVVKhWllqBOr4/sASBaOPgndItY4yUViC3INQPf27dxJbSOS8ssRjpDJj2fMk/ejAvJoiqlPCnvhiT3pXdOVoX; 4:DGU+KOZNfDRAsidutSyM/aTR8tAoIGwScx2F8nx8Z3j+TkxU0mbwx8Ccen57TbVNsmYL0FGw4LrS4jwAmygZ6NxCmKcAmF1939j5kEO65v+gbrqL5RujrYlLVDeU9UMfoWdGnRD9ZtvFW56GB5Xddww5DPnKIWonKMk0dnvHIHN+HIMOl3UJqLrbvMWkiwfByRw88izmShxix4LqfjJIsoOZ3q0KgFF46H9sj1B/82Q++Kfki8Ls2Jw2tEO6AolnWVkAWsQsJG7pjfCwpzNWs5ILAo2h/Vuk+qj7Dyom5lLDshDLIe3KGWaKALTA4B3HeENNusGKGhSmtjvcTZWUQA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231101)(944501161)(6055026)(6041288)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:SN1PR12MB0157; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0157; X-Forefront-PRVS: 058441C12A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(346002)(396003)(39860400002)(366004)(189003)(199004)(26005)(3846002)(386003)(8936002)(5660300001)(186003)(16526019)(316002)(8666007)(1076002)(54906003)(6116002)(48376002)(50466002)(7416002)(478600001)(59450400001)(8676002)(68736007)(86362001)(16586007)(2906002)(50226002)(39060400002)(2351001)(6916009)(7736002)(106356001)(51416003)(8656006)(52116002)(25786009)(4326008)(97736004)(2950100002)(6486002)(2361001)(36756003)(76176011)(81166006)(53416004)(66066001)(53936002)(81156014)(47776003)(305945005)(105586002)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0157; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0157; 23:PjBN69dDccIhz378uE2Awyq8B5BW7k4xntB5c0vWw?= =?us-ascii?Q?w6HC5NxIA/Bb0nMwxdKa32f69Ucjo0RxDxNvSrB+xKy4qcniyKsGqMBgJ2CA?= =?us-ascii?Q?5I0jnVDlogw5NxrxptrvIyX5nN/pjrbgADdM6FjfJQa4Pcb8ddiQi2W73ugx?= =?us-ascii?Q?YxH6o6dgnhDTdHwUMpKBTRNjuURA4OSfxWwwATjjCy/zERGxg4CHwiSKNkAf?= =?us-ascii?Q?AtaEWFioKkjrBurHbO1mjihSJgH0E1XzBCPtLCWm8ls2DOzNoH+pxA//crMI?= =?us-ascii?Q?N1mvl7TTgbYJtOHYyl6sMxX4ht7YwlPqWzdGP0lM5z8d8tc/QItyWYSv0uM/?= =?us-ascii?Q?Atn2MUEfe5HiLejON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12MB0157; 20:Ofbgw1/ga/Mm4FoBnrbr/jJIdvBmzdaSICp5ZUiomHylfsM5wARylSo/0Ij5LZAIEivu/4WYnZeNjGBnrDdQkn+aXSlr7ypbUwcRk4OBkeVXryPe9XAyOYtvtMow6mwt+i2WFu3sY7agH2Vj/BiyBsWBR4eqAFpsvbnDHaabawYc45RanwzYl6hjyvA1hpEMIwO7xRNONgHTCLQiH4nhBI8DVkltqhp45IgUF+gEiRDXKZw4uOU449OjhxL0gl5H X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2018 15:40:24.0250 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9caa5b11-f125-442c-b497-08d5748a6edd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0157 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.72 Subject: [Qemu-devel] [PATCH v9 03/29] exec: add debug version of physical memory read and write API 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: Peter Maydell , Brijesh Singh , kvm@vger.kernel.org, "Michael S. Tsirkin" , Stefan Hajnoczi , Alexander Graf , "Edgar E. Iglesias" , Markus Armbruster , Bruce Rogers , Christian Borntraeger , Marcel Apfelbaum , Borislav Petkov , Thomas Lendacky , Eduardo Habkost , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Cornelia Huck , Richard Henderson , Peter Crosthwaite , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Adds the following new APIs - cpu_physical_memory_read_debug - cpu_physical_memory_write_debug - cpu_physical_memory_rw_debug - ldl_phys_debug - ldq_phys_debug Cc: Paolo Bonzini Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Brijesh Singh Reviewed-by: Paolo Bonzini --- exec.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/exec/cpu-common.h | 15 +++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/exec.c b/exec.c index b1366f85b07b..bc7a63fbc2f4 100644 --- a/exec.c +++ b/exec.c @@ -3592,6 +3592,46 @@ void address_space_cache_destroy(MemoryRegionCache *cache) #define RCU_READ_UNLOCK() rcu_read_unlock() #include "memory_ldst.inc.c" +uint32_t ldl_phys_debug(CPUState *cpu, hwaddr addr) +{ + MemTxAttrs attrs; + int asidx = cpu_asidx_from_attrs(cpu, attrs); + uint32_t val; + + /* set debug attrs to indicate memory access is from the debugger */ + attrs.debug = 1; + + address_space_rw(cpu->cpu_ases[asidx].as, addr, attrs, + (void *) &val, 4, 0); + + return tswap32(val); +} + +uint64_t ldq_phys_debug(CPUState *cpu, hwaddr addr) +{ + MemTxAttrs attrs; + int asidx = cpu_asidx_from_attrs(cpu, attrs); + uint64_t val; + + /* set debug attrs to indicate memory access is from the debugger */ + attrs.debug = 1; + + address_space_rw(cpu->cpu_ases[asidx].as, addr, attrs, + (void *) &val, 8, 0); + return val; +} + +void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t *buf, + int len, int is_write) +{ + MemTxAttrs attrs; + + /* set debug attrs to indicate memory access is from the debugger */ + attrs.debug = 1; + + address_space_rw(&address_space_memory, addr, attrs, buf, len, is_write); +} + /* virtual memory access for debug (includes writing to ROM) */ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, uint8_t *buf, int len, int is_write) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 74341b19d26a..fa01385d4f1b 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -77,11 +77,26 @@ size_t qemu_ram_pagesize_largest(void); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf, int len, int is_write); +void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t *buf, + int len, int is_write); static inline void cpu_physical_memory_read(hwaddr addr, void *buf, int len) { cpu_physical_memory_rw(addr, buf, len, 0); } +static inline void cpu_physical_memory_read_debug(hwaddr addr, + void *buf, int len) +{ + cpu_physical_memory_rw_debug(addr, buf, len, 0); +} +static inline void cpu_physical_memory_write_debug(hwaddr addr, + const void *buf, int len) +{ + cpu_physical_memory_rw_debug(addr, (void *)buf, len, 1); +} +uint32_t ldl_phys_debug(CPUState *cpu, hwaddr addr); +uint64_t ldq_phys_debug(CPUState *cpu, hwaddr addr); + static inline void cpu_physical_memory_write(hwaddr addr, const void *buf, int len) {