From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLNvD-0006qb-Ik for qemu-devel@nongnu.org; Mon, 18 Jan 2016 23:29:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLNvA-0002Jo-PJ for qemu-devel@nongnu.org; Mon, 18 Jan 2016 23:29:35 -0500 Date: Tue, 19 Jan 2016 15:08:51 +1100 From: David Gibson Message-ID: <20160119040851.GZ9301@voom.fritz.box> References: <1452906886-806-1-git-send-email-david@gibson.dropbear.id.au> <1452906886-806-3-git-send-email-david@gibson.dropbear.id.au> <569D9A5B.3050501@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bWJzwVwZrZVVyQvz" Content-Disposition: inline In-Reply-To: <569D9A5B.3050501@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH 2/3] spapr: Remove rtas_st_buffer_direct() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de --bWJzwVwZrZVVyQvz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 19, 2016 at 01:07:23PM +1100, Alexey Kardashevskiy wrote: > On 01/16/2016 12:14 PM, David Gibson wrote: > >rtas_st_buffer_direct() is a not particularly useful wrapper around > >cpu_physical_memory_write(). All the callers are in > >rtas_ibm_configure_connector, where it's better handled by local helper. > > > >Signed-off-by: David Gibson > >--- > > hw/ppc/spapr_rtas.c | 19 ++++++++++++------- > > include/hw/ppc/spapr.h | 8 -------- > > 2 files changed, 12 insertions(+), 15 deletions(-) > > > >diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c > >index f4fb9ba..940509e 100644 > >--- a/hw/ppc/spapr_rtas.c > >+++ b/hw/ppc/spapr_rtas.c > >@@ -504,6 +504,13 @@ out: > > #define CC_VAL_DATA_OFFSET ((CC_IDX_PROP_DATA_OFFSET + 1) * 4) > > #define CC_WA_LEN 4096 > > > >+static void st_cc_buf(target_ulong addr, target_ulong offset, > >+ void *buf, size_t len) >=20 >=20 > Can we please call it cc_st_buf() to make it clear that "cc" is a prefix = and > not about functionality? Yeah, st_cc_buf() is not a good name. I've gone with "configure_connector_st()" which I hope will be better. >=20 >=20 >=20 > >+{ > >+ cpu_physical_memory_write(ppc64_phys_to_real(addr + offset), > >+ buf, MIN(len, CC_WA_LEN - offset)); > >+} > >+ > > static void rtas_ibm_configure_connector(PowerPCCPU *cpu, > > sPAPRMachineState *spapr, > > uint32_t token, uint32_t narg= s, > >@@ -526,6 +533,7 @@ static void rtas_ibm_configure_connector(PowerPCCPU = *cpu, > > } > > > > wa_addr =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 0); > >+ wa_addr =3D ppc64_phys_to_real(wa_addr); >=20 >=20 > Not needed here, st_cc_buf() also does ppc64_phys_to_real(). Good point, corrected. > > > > drc_index =3D rtas_ld(wa_addr, 0); > > drc =3D spapr_dr_connector_by_index(drc_index); > >@@ -569,8 +577,7 @@ static void rtas_ibm_configure_connector(PowerPCCPU = *cpu, > > /* provide the name of the next OF node */ > > wa_offset =3D CC_VAL_DATA_OFFSET; > > rtas_st(wa_addr, CC_IDX_NODE_NAME_OFFSET, wa_offset); > >- rtas_st_buffer_direct(wa_addr + wa_offset, CC_WA_LEN - wa_o= ffset, > >- (uint8_t *)name, strlen(name) + 1); > >+ st_cc_buf(wa_addr, wa_offset, (uint8_t *)name, strlen(name)= + 1); >=20 >=20 > Since you made @buf a void* in st_cc_buf(), you do not need (uint8_t*) he= re > and below. Ah, yes good point also. >=20 >=20 >=20 > > resp =3D SPAPR_DR_CC_RESPONSE_NEXT_CHILD; > > break; > > case FDT_END_NODE: > >@@ -595,8 +602,7 @@ static void rtas_ibm_configure_connector(PowerPCCPU = *cpu, > > /* provide the name of the next OF property */ > > wa_offset =3D CC_VAL_DATA_OFFSET; > > rtas_st(wa_addr, CC_IDX_PROP_NAME_OFFSET, wa_offset); > >- rtas_st_buffer_direct(wa_addr + wa_offset, CC_WA_LEN - wa_o= ffset, > >- (uint8_t *)name, strlen(name) + 1); > >+ st_cc_buf(wa_addr, wa_offset, (uint8_t *)name, strlen(name)= + 1); > > > > /* provide the length and value of the OF property. data g= ets > > * placed immediately after NULL terminator of the OF prop= erty's > >@@ -605,9 +611,8 @@ static void rtas_ibm_configure_connector(PowerPCCPU = *cpu, > > wa_offset +=3D strlen(name) + 1, > > rtas_st(wa_addr, CC_IDX_PROP_LEN, prop_len); > > rtas_st(wa_addr, CC_IDX_PROP_DATA_OFFSET, wa_offset); > >- rtas_st_buffer_direct(wa_addr + wa_offset, CC_WA_LEN - wa_o= ffset, > >- (uint8_t *)((struct fdt_property *)pr= op)->data, > >- prop_len); > >+ st_cc_buf(wa_addr, wa_offset, > >+ (uint8_t *)((struct fdt_property *)prop)->data, p= rop_len); > > resp =3D SPAPR_DR_CC_RESPONSE_NEXT_PROPERTY; > > break; > > case FDT_END: > >diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > >index ec9e7ea..d6f4eb4 100644 > >--- a/include/hw/ppc/spapr.h > >+++ b/include/hw/ppc/spapr.h > >@@ -505,14 +505,6 @@ 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 buff= er_len) > >-{ > >- cpu_physical_memory_write(ppc64_phys_to_real(phys), buffer, > >- MIN(buffer_len, phys_len)); > >-} > >- > > typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPRMachineState *sm, > > uint32_t token, > > uint32_t nargs, target_ulong args, > > >=20 >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --bWJzwVwZrZVVyQvz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWnbbTAAoJEGw4ysog2bOSxBUQAL8Ux/KPx1nEoooTQInIaSNi NrnCqn1x5QQotGI14jkc2iIxcGpDaJfjmSay5Tk/4TlSFosx4MEPu/HowSMMAiC0 Oc8MGkKR0OaO4yQUrk9otVH8+DHhULw6zpW6txJQYu/TKHJTdazZyi7FC5uIEu9X 5ZxBjhEOvOcgmiZdmAR7/hORoxhS7wbhXN6miWqUbd//7gfq0OU9BHtibGp1YgnH mSMoD/htD1wWPZJIGY+9NYTifKKb62Wo3Q8dNT24RurkiuwIY/Z1QciydU3VNHNk g7WS2bE/f6p7dxGiCoLm2HLTyk5erh0qsLYFKpUc1nwUJOxQDTF60CmXZxbBqqsQ vZr3d+N5t7d0W2UDXDh5Xg6CFJWuPNErep9ycLoHry+diA+LvqyTYVokwKVFejZN QCRzNvXSFeWjHQP39+buAY3ifAHd5TLtLp13VKKpCxWqB8EjpMC1G9ubHwWkHUtQ 004ZGB5/cejadMRDxZEqLZt9kiUuE6C36QqklZbRANCTo6iZu5ShJdMtcT9F/Fy8 T+9/4Mx0GQnEaxDumx1ZU8A6y/oHcAXtCSA6N1AxcMpT7VtNGGW4SUnO7WWh9TgZ gL/a6s4TOWl06WE+WVCVtQE1DQ6JdzPPiY6F/8S3s5IIvlZyLAbR7lvVXm8KciNb 5Uexwr4vDddW4g367Pp3 =ngds -----END PGP SIGNATURE----- --bWJzwVwZrZVVyQvz--