From patchwork Thu Feb 20 13:05:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11394123 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B3CE138D for ; Thu, 20 Feb 2020 13:09:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72637206ED for ; Thu, 20 Feb 2020 13:09:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fd+KOQ/J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72637206ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4lZk-0001hP-Ic for patchwork-qemu-devel@patchwork.kernel.org; Thu, 20 Feb 2020 08:09:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56044) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4lXI-0005Mt-Js for qemu-devel@nongnu.org; Thu, 20 Feb 2020 08:06:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j4lXE-0005FK-1u for qemu-devel@nongnu.org; Thu, 20 Feb 2020 08:06:36 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:50998 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j4lXD-0005EM-St for qemu-devel@nongnu.org; Thu, 20 Feb 2020 08:06:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582203991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FX3FXQX3OgJ73Ij27vj7Z7zPMOBdko14sr77VldpMU0=; b=fd+KOQ/JtZluiWrqw7X7t7pCKX1lN0Ek+zv0VS8zFMNmeqHHwktKH2u6d+0SayH6WMWbPR PeWoLDk19HZkMiRtSqWJUv+E4VI/m+1SVEfWO3LJpeVdE255WFe5zNNnbeWo826AaxEzNk VJQh10Q8t5w6zSHl37IP4w6pD5tUWYM= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-14-BGgf0KZ_N6evfS_bAr0TkQ-1; Thu, 20 Feb 2020 08:06:29 -0500 X-MC-Unique: BGgf0KZ_N6evfS_bAr0TkQ-1 Received: by mail-wr1-f70.google.com with SMTP id c6so1696593wrm.18 for ; Thu, 20 Feb 2020 05:06:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8odk76d2z3izhK+yPuh+zYi/Cj4FHaZPMzDDqjJ0XeE=; b=cD5BLjMsgIB4XqaeAIPGbrbuSbpvanMEzIPOefTz0xgs9MUDFe/uK9DgfcRu1im5NP xpSlYhK8oZqZjKo8uG08kjNpIhAxv5oJd29L3+ihSYJjVRQTt+fgRa7tU8yADPq3c9Bh 9MhNHS7cSXzUqGUCLQgTQanTSIfeagn/DEVTqr5czB7do/ssAio8G90tx2tCPaL2Lj2x BmK726a4f4YZSQJzbEYi9HF4/K5hoL83FlH+c157DuwEsXLzC/9pvxXqPrUUeMd6clwA C8+PvNHtb7QYRop8y5Dfqaf5Nmknha5z9DZ42sX8BKBf2YFeFJB5a0LoCFLEfZms/mSK 7GMA== X-Gm-Message-State: APjAAAWkPWiN5KnEWDeci2PskIFgIMbPv1a06GJSFd/6uLTwxdBXwfwH cPkOa6lV2F0HfEx0YXGLojwHqzSyRvJWdPAnOq1L4R+B/VSnG+S9YLnnJQiUknMsCUVN2q1WrNf UuqnJTtca3j8TxWQ= X-Received: by 2002:a5d:4e91:: with SMTP id e17mr40459254wru.233.1582203965282; Thu, 20 Feb 2020 05:06:05 -0800 (PST) X-Google-Smtp-Source: APXvYqxYyC0rm9Zmq8Udvt5K4WfGoUA6AsKImvpwZLE6azxpWra0StVD53WtA0C45GVywJSMzTwuwQ== X-Received: by 2002:a5d:4e91:: with SMTP id e17mr40459189wru.233.1582203964946; Thu, 20 Feb 2020 05:06:04 -0800 (PST) Received: from localhost.localdomain (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id b67sm4594690wmc.38.2020.02.20.05.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 05:06:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , qemu-devel@nongnu.org Subject: [PATCH v3 03/20] exec: Let qemu_ram_*() functions take a const pointer argument Date: Thu, 20 Feb 2020 14:05:31 +0100 Message-Id: <20200220130548.29974-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200220130548.29974-1-philmd@redhat.com> References: <20200220130548.29974-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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: , Cc: Fam Zheng , Dmitry Fleytman , kvm@vger.kernel.org, "Michael S. Tsirkin" , Jason Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Stefano Stabellini , Matthew Rosato , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Aleksandar Rikalo , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Thomas Huth , Eduardo Habkost , Stefan Weil , Alistair Francis , Richard Henderson , Paul Durrant , Eric Auger , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , John Snow , David Gibson , Igor Mitsyanko , Cornelia Huck , Michael Walle , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paul Durrant --- include/exec/cpu-common.h | 6 +++--- include/sysemu/xen-mapcache.h | 4 ++-- exec.c | 8 ++++---- hw/i386/xen/xen-mapcache.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 81753bbb34..05ac1a5d69 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -48,11 +48,11 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr); void qemu_ram_remap(ram_addr_t addr, ram_addr_t length); /* This should not be used by devices. */ -ram_addr_t qemu_ram_addr_from_host(void *ptr); +ram_addr_t qemu_ram_addr_from_host(const void *ptr); RAMBlock *qemu_ram_block_by_name(const char *name); -RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, +RAMBlock *qemu_ram_block_from_host(const void *ptr, bool round_offset, ram_addr_t *offset); -ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host); +ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, const void *host); void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev); void qemu_ram_unset_idstr(RAMBlock *block); const char *qemu_ram_get_idstr(RAMBlock *rb); diff --git a/include/sysemu/xen-mapcache.h b/include/sysemu/xen-mapcache.h index c8e7c2f6cf..81e9aa2fa6 100644 --- a/include/sysemu/xen-mapcache.h +++ b/include/sysemu/xen-mapcache.h @@ -19,7 +19,7 @@ void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque); uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size, uint8_t lock, bool dma); -ram_addr_t xen_ram_addr_from_mapcache(void *ptr); +ram_addr_t xen_ram_addr_from_mapcache(const void *ptr); void xen_invalidate_map_cache_entry(uint8_t *buffer); void xen_invalidate_map_cache(void); uint8_t *xen_replace_cache_entry(hwaddr old_phys_addr, @@ -40,7 +40,7 @@ static inline uint8_t *xen_map_cache(hwaddr phys_addr, abort(); } -static inline ram_addr_t xen_ram_addr_from_mapcache(void *ptr) +static inline ram_addr_t xen_ram_addr_from_mapcache(const void *ptr) { abort(); } diff --git a/exec.c b/exec.c index 8e9cc3b47c..02b4e6ea41 100644 --- a/exec.c +++ b/exec.c @@ -2614,7 +2614,7 @@ static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr, } /* Return the offset of a hostpointer within a ramblock */ -ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host) +ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, const void *host) { ram_addr_t res = (uint8_t *)host - (uint8_t *)rb->host; assert((uintptr_t)host >= (uintptr_t)rb->host); @@ -2640,11 +2640,11 @@ ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host) * pointer, such as a reference to the region that includes the incoming * ram_addr_t. */ -RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, +RAMBlock *qemu_ram_block_from_host(const void *ptr, bool round_offset, ram_addr_t *offset) { RAMBlock *block; - uint8_t *host = ptr; + const uint8_t *host = ptr; if (xen_enabled()) { ram_addr_t ram_addr; @@ -2705,7 +2705,7 @@ RAMBlock *qemu_ram_block_by_name(const char *name) /* Some of the softmmu routines need to translate from a host pointer (typically a TLB entry) back to a ram offset. */ -ram_addr_t qemu_ram_addr_from_host(void *ptr) +ram_addr_t qemu_ram_addr_from_host(const void *ptr) { RAMBlock *block; ram_addr_t offset; diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c index 5b120ed44b..432ad3354d 100644 --- a/hw/i386/xen/xen-mapcache.c +++ b/hw/i386/xen/xen-mapcache.c @@ -363,7 +363,7 @@ uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size, return p; } -ram_addr_t xen_ram_addr_from_mapcache(void *ptr) +ram_addr_t xen_ram_addr_from_mapcache(const void *ptr) { MapCacheEntry *entry = NULL; MapCacheRev *reventry;