From patchwork Wed Feb 28 21:10:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10249821 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 8600560594 for ; Wed, 28 Feb 2018 21:16:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 735AC28742 for ; Wed, 28 Feb 2018 21:16:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 676A228DB3; Wed, 28 Feb 2018 21:16:27 +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=unavailable 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 DAE7B28B3E for ; Wed, 28 Feb 2018 21:16:26 +0000 (UTC) Received: from localhost ([::1]:46978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er95N-00060X-RO for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 16:16:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er907-000181-Vy for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er904-0005Ry-1e for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:10:59 -0500 Received: from mail-dm3nam03on0050.outbound.protection.outlook.com ([104.47.41.50]:20864 helo=NAM03-DM3-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 1er903-0005Oa-PH for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:10:55 -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=r6GQfGuGm+wLvKUu8RfgirHG417qT/+/YW4V3jFCKtY=; b=PbzUMoiIJT0h+ILRKMbWkp/gUHexptbd9wIuXUicPdSlv65oCpUQ0s5X7hf1qmEzjp752qVs8+/Mfp0RsP9YAvcup6MTkKU9PTxVi3Ct3v4NObHNV9qWL+8wNMI61l1Hcxy87tHYRAh8iQt/HTdcPNeeYdXlelvCx0gnoFMK8LQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 21:10:53 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 15:10:03 -0600 Message-Id: <20180228211028.83970-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR10CA0008.namprd10.prod.outlook.com (2603:10b6:4:2::18) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 77439e46-807f-41ad-6b91-08d57eefc10c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:V5Jfu1rtF5AvNymrrIa3r0lUGWYQcEyFyby1WidNmdmto4BieJu6sZ2tEuWGIUxAavvtPPXaERBXrpGeYWJGmVhnBGYNwpmXGUjNcUEgdWP0yk/kjhn/RtpvqQfOHlllIOlMQU0MKGkqj4s2TzUK3mCZKvXlQDjDJHtVj/8Aatr7cuQtG6qcVsiuEkqiZmTK5UNwxN5ANmtyp/TIty/4D8OZuwixMXz/R8ta77G02Ai4BGiGSmgxispq7uRcJqkb; 25:dhkgR1QNQPzcq3dzR41Cd0/Y1JDU1wYy3Bfr+hCVlIzVSgvo2fuln5fuzMB57chLNDOFX714F2TXsyCD34SmvttJqUakDI+wOH7dQTy3K/5oRRiA3kIH0GDKCBFtPU40+tRrfHFpU/Eu/y4Im1kuZ5ZaN27quo0X+6sYVas7A5v5fJWaHZttbigTQIVZG9kZtFzlAgRJQojO2ryEM8u1lbnRV+Ix/intoYKOsaWdBhi/vX8gXTLgD96PmgVKAxDVT75Oa7O+HiZB5Vv7D9gYzDDcmpM/b1vjJXg4OcoHbPSmQFdJ+/vqq4Z+rhahTJHZ4MxU6P0bAtOOOrFFFHaOXA==; 31:h6sX2EKe2rUYw0pV4y0s2E5icOBXRFplqQEZGDajorr8L5N0ToKPDouvpLFLl3IyY9uUS8fDsHdARoMIGyScga1kE7J8R+IrmF0VEYqytyznkiltqut6ZyI88MMYDqyR2nismEZgVMv1WUAUPucXcs740IJkW/sSXGwl1ClM5ORPdjm6TgTuMV9olQRGMPdJV8XSr4nGxYO4sfxRxn6vGXcaZQVp2S1C/M7rVsCkfSY= X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:iXLhdnZPl5dwDFUk70isuK0H1Ukv0WIbe46ku72OdhBcf7RcKFJ/juBOKcoh+mXrsCWzjFgqyfnt7bf3yB2xHdKyNV2YpTvC/bBudf/6segoyN8TvaZx+wE0tWn2rQAnWUVQYkBfambf2cIFQQC+5PnHKAZ3vjdQAjj+WmzkwksRqMhOJxcsCVOatB9vKJD0GnlSNEt77CQjZ22CT+rcGHRaCoUAIDgAa3NfwtvTMkRLs7z4vlJp1JzESafe/yIQibVPS4Ie7MUOPy2ocSXRrE4DtMDGPvhAz0kpw3yuKYakhTe3uL6J8Zx/RNysCjBavSj/35ie7IUHj0BJIfTcliEmd62dfgCAnuP98bzcI4y6zBVOZq7EyAkKoH/fiU+7M9G0RIdvVbePRp3IIHBz+xwjV/bu3O7OqBJKZ1Da3ew6XUsHg5xuayuayxRXSuCAcru94X+Al5AkVq4/tud6Fiw8Xs8rFEaFtU8QLbCmoMb2TF7EC1azb2JjYOW/fO4d; 4:1md7UJzCVyusr3L6w1kl/+MlHo/eQnS0XFo1jvV7CL/eKRS8h5W8+RdUhp4zV/dbM6EwEZlpCbFs25Ly2UMjv4RM4RrkW8bnXCdKqSUHj8FDAbJdifNbvm8mVyp+OuLk3nRcot9wUJQ53LSAk0z95lgoG8trm0wjVKA0Utdhh6v4Fb5dsxPX5M289O/IJQn1e+JYlWBkM2HquFJeO/Lv+94WPmlbmDMCclUEyjdTrIZQ5S8YFsaIv1msm5/h3he0TRojwj6vnGG9r3c0yLMC1ZNsIx2G7e/Xme43f/knZp1+p+Jrq6hj7QU84FK3GZ1VAGQOcnjFj/DAaRbqNEp4dA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3231220)(944501219)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(346002)(366004)(376002)(189003)(199004)(6486002)(6116002)(1076002)(2351001)(36756003)(16526019)(16586007)(54906003)(53416004)(26005)(53936002)(66066001)(186003)(47776003)(59450400001)(2361001)(478600001)(8666007)(316002)(81166006)(50226002)(8676002)(8936002)(386003)(106356001)(97736004)(5660300001)(2950100002)(6666003)(305945005)(4326008)(76176011)(7736002)(39060400002)(8656006)(105586002)(68736007)(50466002)(7696005)(51416003)(25786009)(48376002)(52116002)(3846002)(2906002)(86362001)(81156014)(7416002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; 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; DM2PR12MB0155; 23:5nn3JwmRUzmZyknTY/GRdaqBIEXbPHs55sxVloG+e?= =?us-ascii?Q?hgYHFnt3oYl2EyHsWPkUXNw47XGSkJQZWrxICKaLVF5Akf5sgGh7w1G4HJe6?= =?us-ascii?Q?pSmiqyGi7WzkGxyS54Bgxs+5UsnRHxQo7AVVt+t1AIiPuqao7vE+0HOg8aVm?= =?us-ascii?Q?Xzv+l6Yf2wCtzNvN+T4ItJdNoN9e1lAY3h9WHN906eLOYASZbBMUs3PI3/xF?= =?us-ascii?Q?dh7/HBiAMuC6P3LFDURwU50hHo1Z1cyZEeSjTVie8TQePgB1ftuvMIFDdBYN?= =?us-ascii?Q?pv1v6Tx8Ehu/eVFxBSTODzJooPNx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K1WcbWc3/PZKA9dENjAChPT9FnU1Bp1Dl6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:QwpM21zt6goizaKVhTMnA1TzvK/WBCMRXwvaqE8j7BVe4fJwoVAl1lRcskoxaA6dRJh+9bkCh3ShGTSmpNZrwHLSCG6zRGnpC3WwQo1CegakC8UUEPfkKLSIdGE3D2L72z9nj3ygkP5AItApd4DiQmRsmT2D1LCG/etpqMQPg0I4NF/56xEZyp12X2hdUIqguwDI2rmcn2OI1jhXTq/OLjI9LQ2SH1Pu9Noz7/vE8DJA6dpqdjFrNu9VlPbrKg3g X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 21:10:53.6705 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77439e46-807f-41ad-6b91-08d57eefc10c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.50 Subject: [Qemu-devel] [PATCH v10 03/28] 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 4408cd26c989..633be92d2b3a 100644 --- a/exec.c +++ b/exec.c @@ -3596,6 +3596,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) {