From patchwork Thu Nov 22 17:26:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 151805 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1018628ljp; Thu, 22 Nov 2018 09:26:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9qZv+HFoEHgo7ed+XHB6ndwHNsHeme8LdnQQCJso1v2Oki7u569O9IiHryel28uOvT0jc X-Received: by 2002:adf:ce86:: with SMTP id r6mr10990149wrn.257.1542907617344; Thu, 22 Nov 2018 09:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542907617; cv=none; d=google.com; s=arc-20160816; b=f0u/rrirf4wBuahiHWhph0vze4gjtt5RgsYWo5tG6dRTIs/hXrrQA7x2/PJkTWyDE8 HAwQ5oYgz0++EjhqNHAiu+LJ6ZYybzbytL4KkvTP0X2ZdRo9LQW0+I2LDIkR5ZzwvQrH nZH6cGWDP8K2B+WzOhVqTXtKJZO21SqQs/zNwlGmjIq4+0fE9xmb3aAccUEIH9AN6KT7 co+qODnt7G5wc3mUoh/ztAhA8Ewscx/xP3CjqzOgTMfPO4zIxgO0dCvPbD3z0K1cu1G0 1DK9Kv/RmT9uXxdBMO5h2o/EYKxN7BLe1qOuwwZ1Da+LADoKsGVnUaakqTWHPIx46/5w jvdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=CM9QkOpn8MWQl+AONWlfU2s6CEP210pM1yZLtvcvKzg=; b=ZT2B193MTarR+MP7bNnk5CKkAkAeL2Lil+UYa9tllqP144gH8BEA9AZMKLl1Oal2H+ AzeyCH5FKQNpdTHFcQx//NKlTwP6fMJ07Xzb2hMHe7glWJ4AjrZG6K/BPM2ZDu1po7hA aYfP0eLA4+AiQMt7uTLX5Crz7DL9z/Cljutldgj4rj2EWvDc/UY+pRma0ntOkA14KUmj P6qArAeMIyi5M/dQbr35dRu8REJTvhpkzBmsANBVzOd84f9dSNIsbqxpTutcMjen2edx 3QlNxrCT65QQqVBx1uZAShmV9uJIXdxZyGAjLuHJpkAV/LxiajrJpXIkQ9Jn2hs0f/kX V2Rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id t15si14419357wrm.351.2018.11.22.09.26.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Nov 2018 09:26:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gPski-0005eP-DZ; Thu, 22 Nov 2018 17:26:56 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, "Dr. David Alan Gilbert" , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 for-4.0 0/3] Avoid cpu_physical_memory_read() in generic code Date: Thu, 22 Nov 2018 17:26:50 +0000 Message-Id: <20181122172653.3413-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 This patchset takes three places in generic code which use cpu_physical_memory_read(), and changes them to use address_space_read() instead. Changes v1->v2: * patches 1, 2 unchanged (and reviewed) * patch 3: handle as being NULL (which for the load_elf APIs means "use address_space_memory") 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 | 4 +++- disas.c | 5 ++++- monitor.c | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) -- 2.19.1