From patchwork Wed Dec 6 20:03:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10097097 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 B71BE602BF for ; Wed, 6 Dec 2017 20:17:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D0B328DD2 for ; Wed, 6 Dec 2017 20:17:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9096F29489; Wed, 6 Dec 2017 20:17:22 +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 0331C28DD2 for ; Wed, 6 Dec 2017 20:17:21 +0000 (UTC) Received: from localhost ([::1]:57591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMg88-0003eb-Tk for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Dec 2017 15:17:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMfvb-0005kz-GY for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMfvY-0002NY-91 for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:23 -0500 Received: from mail-sn1nam01on0054.outbound.protection.outlook.com ([104.47.32.54]:7443 helo=NAM01-SN1-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 1eMfvY-0002N2-2Z for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:20 -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=anmrqTX+FUsrpv3BwtL7FoNdTzUw2ejFQUxgVJqIZyE=; b=hrIfsh3qYrHfm909vbjn3fYonesulbfmIq8tX/HtvthZDILXpm+Di3imluGNLXTlzl5Gv8xBR+7k8KhyhTilAGwZYEGCG9BIjtDFO+aZ8/I6kuvE9xKO6mXcjxBbhQGy1z/G5lf1vhRHEkDgXkETYMVoXoHerUySgIOpwIa+QyQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Wed, 6 Dec 2017 20:04:14 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 6 Dec 2017 14:03:26 -0600 Message-Id: <20171206200346.116537-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171206200346.116537-1-brijesh.singh@amd.com> References: <20171206200346.116537-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0035.namprd14.prod.outlook.com (10.171.172.149) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6f462c9f-b2a7-4581-2f79-08d53ce48795 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603286); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:8XIlnP8eT0OQyued1nZx1R4ZTM4UkFJ5QDmOBIjw1c6JyI2hOSRaH8vMJ6UjKwkC64LuWnr5gboTYN78dUT65hq6gOHkzW+eIe05zyTO4htI8qfsyrZ9Wu3pk5iZhhWPollqJRv3eESp8z4OrEBkESJzOnz1Cd0GPBcC1555uDbmLwUKhxOU4FRNkT+glfyMOGTFUGb5+f9Yitak/EWTRqrC07vDQdoyOA4h3h9/LbHb6a103QBoCmw2/apLMF7E; 25:w5vDN+k+/0zDINPQNHOJwkumrWWIDAdVyDbeXjIxSCbx2CNaF4FmuR9WmTQYW/nlD4nHbJVhn3YhDe9CUL/g9/kgDl7vF9gcbAV8e+JWzUdqj6dqrAD482hjtng2vjoQHe/EUQeqJw6Mv6J0nlC0HhnPE69B2rT5xUN6XQhSrvLTbqH5eKAOjpnTodozalkKMP422/gWHlCzWdA1DrZ0nH1q7oaPXlSN6sOx5HuwsJ270E+uNkWlzmQ2ECPioXsg9hBjAx/HJ+SKd/++dau7n19Cey9IqFKA01kzKLz1rgKpi+uJsAlKUbsByoWxbgyDFe+uIpjTBpgmmWajRmjBQQ==; 31:QhJS944OxEkq2i0EYceS3nnE4JJEz1ARjHieQA/WWNECuTaOmUl0FbhUxvcGhDXS6+3LC3thsYWR4fPJ7iawY3mvhlWjJzPxy66XJpPdlyRA0aqbDR1yjj39yhsKoh4fAqn1wDgomrb4woI+h5bi5jNLyMWvshc8jGfg9N3Yi6PC01dVd7pSTet3XBXObzdaAVXSNnCQ0W/Ie/hr3gvpiPOuKK5MPeJ74dSdTurf8dM= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:0TnfLyM4pZh2cx8YFC+kFTGGwdcHqs4dLUH/MnoDGUIdy7wlDPpys12BDHlbWd6KQnISMKXTUQMRfH4tYlY0dHr05oP7yMpvDTQg0sSgha4oNRepbPFghYgIt/BvJFUV64kw63RV5sKP7q1GQJAtHMWUPuf4qPS8h3RpviS0S5NwIfDOmgdEKmzEHUBLUWEEiu7OZehll/qhNNqhLb/bTaWKeaar63EZsESFE4RbFqd6xsXT1wBPWUm1FtvCFepLZMBZICVRgXZBazyekpoDWQ8Up4R5QLlDm6Jnad10DzDZW0KTHvn0ITRZkSV6y+ApIu9/+Kg6qce99avCzPBLujOxFnWJOSElBlSj7ekHb1GuOQbhOhSP54977CdyrOclLpcvKBOuG5iexcET4nTm6EiqsxG5LGzSUBkqKCyjEtp+G42iX37o+qN8xE0cKakLJOf0jooMqWi9dte1blZxKTnJXsDH7BwI0I4V+hf+b/krsaf1fb98DdPUcqtwzNIs; 4:OJEwk/e4lL/cnLoxiSn0yI68CsxkPH7yzm1v6+pmohukgZBM26RCkAWNMHkJvH+J9CBR8WmayJrskZNwF9JnZm9dh7We5P2IzX5gRLDeFrUwVe80o38xO7jLNQl+ZoOPDyvZxprqIaHsRnQagFVFM44uqVLuUlUdNE1l8/V3nM6sgQwH0/hsWgno+stFVdtA+wjZ7vPeYg6h0MWQYbgGYcWP+B35Lyz4ORhFzbqmZKp2ROZvhHfm2sgLStiiTYRSBlJw/e3mbW6KzVZUI/7EfPE4Af4T+v1pDrYDxAjsmdNMz/ANW+jvX7LlE28MOgGp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231022)(6055026)(6041248)(20161123555025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(6072148)(201708071742011); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN1PR12MB0158; X-Forefront-PRVS: 05134F8B4F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(366004)(199004)(189003)(16526018)(16586007)(33646002)(53416004)(105586002)(39060400002)(4326008)(305945005)(2351001)(106356001)(2361001)(7736002)(7696005)(86362001)(52116002)(8936002)(316002)(575784001)(53936002)(97736004)(76176011)(51416003)(36756003)(66066001)(1076002)(3846002)(25786009)(6116002)(47776003)(50226002)(68736007)(54906003)(6916009)(2950100002)(478600001)(6666003)(8666007)(5660300001)(8656006)(8676002)(101416001)(81156014)(81166006)(2906002)(7416002)(48376002)(6486002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; SN1PR12MB0158; 23:uTLf+ZI7SaF/OuLkhto6ICRRGNFWg6l7C9486qwmf?= =?us-ascii?Q?j2F3mRsIGZXyX8L2OttzYvtDxxUl/iza6h01PvwydLO5cO3FYJ7NSLZb036d?= =?us-ascii?Q?ccLvjOqvcKyDCt1q5sRqQd/7avW+jr1S7xyQargDee/+cIKdaL5+3f3H6OGI?= =?us-ascii?Q?VEYHz5n7YR5syDybzLcDzmkuZmfxb2zeVmWZaLd567SUL91grAsYg+lx3RlV?= =?us-ascii?Q?MmJugcpzL/9Q4SJjqAW8fcu6B/TNBHyPJba0Tkq8Y5Ym1BU8paUSmZnfIBDB?= =?us-ascii?Q?WN/bpboFXlPzjn+vkO+tn5SwnLrah6NB0LqZwrVa2TCvBV7EqWNqKDCwT9Pu?= =?us-ascii?Q?D7gxFMY2M6wNhxK98HdZ74xNxtJJZw2W7un5wYnb51dIXnoDO5lu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5auoj7u02/VjYplHATUt7C//IwWvNSGRlT5MmK2RUEn7IG/HnCLwWClIHtLdCSTasksafMx/wD5NfB9LqH2kVUr//Ttgqu7VywhcXQzKqOgJV2Ytr+jd/tq2XLXPN289FMteflRgCu3EXql3vJVMksdWA0tT8Dfx0naN5N4cNnoisK5ADoP1nBzssaLeGiIPihaMD9JM7cq64qtyHPXrQcmpRu58rYeN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 20:04:14.7548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f462c9f-b2a7-4581-2f79-08d53ce48795 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.32.54 Subject: [Qemu-devel] [PATCH v5 03/23] 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: "Edgar E . Iglesias " , Peter Maydell , Peter Crosthwaite , Eduardo Habkost , kvm@vger.kernel.org, Marcel Apfelbaum , Markus Armbruster , "Michael S. Tsirkin" , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Christian Borntraeger , Brijesh Singh , Stefan Hajnoczi , Cornelia Huck , Paolo Bonzini , Thomas Lendacky , Borislav Petkov , Richard Henderson 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 | 31 +++++++++++++++++++++++++++++++ include/exec/cpu-common.h | 15 +++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/exec.c b/exec.c index 9b0ab1648945..e1837cad61f9 100644 --- a/exec.c +++ b/exec.c @@ -3540,6 +3540,37 @@ 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 = MEMTXATTRS_DEBUG; + int asidx = cpu_asidx_from_attrs(cpu, attrs); + uint32_t val; + + cpu_physical_memory_rw_debug_internal(cpu->cpu_ases[asidx].as, + addr, (void *) &val, + 4, attrs, READ_DATA); + return tswap32(val); +} + +uint64_t ldq_phys_debug(CPUState *cpu, hwaddr addr) +{ + MemTxAttrs attrs = MEMTXATTRS_DEBUG; + int asidx = cpu_asidx_from_attrs(cpu, attrs); + uint64_t val; + + cpu_physical_memory_rw_debug_internal(cpu->cpu_ases[asidx].as, + addr, (void *) &val, + 8, attrs, READ_DATA); + return val; +} + +void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t *buf, + int len, int is_write) +{ + address_space_rw(&address_space_memory, addr, MEMTXATTRS_DEBUG, 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) {