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: 11394075 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 BF1DD138D for ; Thu, 20 Feb 2020 13:07:08 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 9BE89206ED for ; Thu, 20 Feb 2020 13:07:08 +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="dB3aYcX+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BE89206ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j4lWs-00011L-Pe; Thu, 20 Feb 2020 13:06:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j4lWs-00010q-6y for xen-devel@lists.xenproject.org; Thu, 20 Feb 2020 13:06:10 +0000 X-Inumbo-ID: c29d4552-53e1-11ea-b0fd-bc764e2007e4 Received: from us-smtp-delivery-1.mimecast.com (unknown [207.211.31.120]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id c29d4552-53e1-11ea-b0fd-bc764e2007e4; Thu, 20 Feb 2020 13:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582203968; 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=dB3aYcX+HHVZYTfEAkajM9JqlWq0mr4IQgD5jiLZWBtr+2u3jdd/ipu/ozaBLsHqzvOrns EXdraVh1Nomg52ebsCs5eKlFpWRoUcwx2w2ZhF2aAq3E16t2HL5WLuvdjLzzdX9ZwD6ww+ o9piFQsqYj9mGMkVGXI02QE5hwSzZyM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-7yXeH7kMOjKik46Yn4-LgA-1; Thu, 20 Feb 2020 08:06:06 -0500 Received: by mail-wm1-f69.google.com with SMTP id t17so797552wmi.7 for ; Thu, 20 Feb 2020 05:06:06 -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=gK2MOeHNX88KsVmgdp0bJwYNVMQs2yzHwdM8vKPgkHvzHkw3lOQS9iXtpNc+po7T8Q 881uNDTJrxKI90MNbu7DlQidvyH7uLZjmeVVhJHdPOoUUqxesryXsXyhhx90XUmpfBy4 cqUFWTAofkLTeLFdibCOhL9kl56UyIYQTo6rLgY4b6GEq69Lq42DTCpUwWBSqinwe7XN qfvme/cUY0RRee9sKQGzDqSMMdpgTaaNZkau7v/P2edZoeTc7A5Fzb82WYnh6RUOT5U8 zmK3bC3Kd/xqlso2c/mdeDXg83dlDgWL2laUVyrg/91NwiSvZM/qgv4Yc/yxIL6DaL6G 52QQ== X-Gm-Message-State: APjAAAVCMg2Kmp8OknzyQCgkrHN+mz2cq2nUguNRY3TzfVsZb7QEOhs8 sQavblx72jNGB6yjhaSXEzpRZjMu4hqBZZDC1vHj2lv8cDGsDYyrJHyoNrI1RXVPRaLN+OhiZ4Q 1ZRh1rxM0OnOKvAZ8Pu3MhDdHFJk= X-Received: by 2002:a5d:4e91:: with SMTP id e17mr40459245wru.233.1582203965279; 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 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-MC-Unique: 7yXeH7kMOjKik46Yn4-LgA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [Xen-devel] [PATCH v3 03/20] exec: Let qemu_ram_*() functions take a const pointer argument X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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?= , Marcel Apfelbaum , 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: xen-devel-bounces@lists.xenproject.org Sender: "Xen-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;