From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNMQb-00048R-MR for qemu-devel@nongnu.org; Mon, 16 Feb 2015 09:13:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNMQX-00069w-Fb for qemu-devel@nongnu.org; Mon, 16 Feb 2015 09:13:37 -0500 Received: from e37.co.us.ibm.com ([32.97.110.158]:60804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNMQW-00069m-W2 for qemu-devel@nongnu.org; Mon, 16 Feb 2015 09:13:33 -0500 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Feb 2015 07:13:32 -0700 From: Michael Roth Date: Mon, 16 Feb 2015 08:10:48 -0600 Message-Id: <1424095858-15501-7-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1424095858-15501-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1424095858-15501-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v5 06/16] spapr: add rtas_st_buffer_direct() helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aik@ozlabs.ru, qemu-pcc@nongnu.org, agraf@suse.de, ncmike@ncultra.org, tyreld@linux.vnet.ibm.com, bharata.rao@gmail.com, nfont@linux.vnet.ibm.com, david@gibson.dropbear.id.au This is similar to the existing rtas_st_buffer(), but for cases where the guest is not expecting a length-encoded byte array. Namely, for calls where a "work area" buffer is used to pass around arbitrary fields/data. Reviewed-by: David Gibson Signed-off-by: Michael Roth --- include/hw/ppc/spapr.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 96eb21e..3cc4490 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -425,6 +425,13 @@ static inline void rtas_st(target_ulong phys, int n, uint32_t val) stl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4*n), val); } +static inline void rtas_st_buffer_direct(target_ulong phys, + target_ulong phys_len, + uint8_t *buffer, uint16_t buffer_len) +{ + cpu_physical_memory_write(ppc64_phys_to_real(phys), buffer, + MIN(buffer_len, phys_len)); +} static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len, uint8_t *buffer, uint16_t buffer_len) @@ -434,8 +441,7 @@ static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len, } stw_be_phys(&address_space_memory, ppc64_phys_to_real(phys), buffer_len); - cpu_physical_memory_write(ppc64_phys_to_real(phys + 2), - buffer, MIN(buffer_len, phys_len - 2)); + rtas_st_buffer_direct(phys + 2, phys_len - 2, buffer, buffer_len); } typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr, -- 1.9.1