From patchwork Thu Nov 22 11:29:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 1001700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 430y1B0vqtz9s29 for ; Thu, 22 Nov 2018 22:30:38 +1100 (AEDT) Received: from localhost ([::1]:45275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPnBr-0002JE-KM for incoming@patchwork.ozlabs.org; Thu, 22 Nov 2018 06:30:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPnBK-0002It-5b for qemu-devel@nongnu.org; Thu, 22 Nov 2018 06:30:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPnBJ-0005ax-9Q for qemu-devel@nongnu.org; Thu, 22 Nov 2018 06:30:02 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:52716) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPnBJ-0004lO-2L for qemu-devel@nongnu.org; Thu, 22 Nov 2018 06:30:01 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gPnB9-0004uZ-Gu; Thu, 22 Nov 2018 11:29:51 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 22 Nov 2018 11:29:44 +0000 Message-Id: <20181122112947.7586-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH for-4.0 0/3] Avoid cpu_physical_memory_read() in generic code 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: Markus Armbruster , "Dr. David Alan Gilbert" , patches@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This patchset takes three places in generic code which use cpu_physical_memory_read(), and changes them to use address_space_read() instead. cpu_physical_memory_{read,rw,write} all implicitly assume that there is exactly one view of physical memory. This is sort-of true today, but we'd like to be able to move to having heterogenous systems where not all CPUs share the same view of physical memory. In disas.c we are disassembling for a particular CPU, so use that CPU's primary address space (cs->as). In monitor.c we are reading physical memory for a particular CPU, so again use that CPU's primary address space; we fall back to address_space_memory for the case where there are no CPUs in the system (-machine none). In elf_ops.h the function was passed an address space to use, so just use it. Other places in generic code that use these functions are: * dump.c -- the whole UI here seems to assume that there is only one view of memory and that is what is being dumped * cpu.c:qmp_pmemsave() -- again, the UI assumption is that there's only one view of memory So I've left those alone. NB: git grep command line for finding callsites: git grep '\' thanks -- PMM Peter Maydell (3): disas.c: Use address_space_read() to read memory monitor: Use address_space_read() to read memory elf_ops.h: Use address_space_write() to write memory include/hw/elf_ops.h | 3 ++- disas.c | 5 ++++- monitor.c | 8 +++++++- 3 files changed, 13 insertions(+), 3 deletions(-)