From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWaEF-0006hy-Gh for qemu-devel@nongnu.org; Mon, 31 Aug 2015 21:19:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWaEC-00049Q-Jh for qemu-devel@nongnu.org; Mon, 31 Aug 2015 21:19:15 -0400 Date: Tue, 1 Sep 2015 11:05:38 +1000 From: David Gibson Message-ID: <20150901010538.GO11475@voom.redhat.com> References: <1440746120-21577-1-git-send-email-gwshan@linux.vnet.ibm.com> <1440746120-21577-7-git-send-email-gwshan@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="w6U88vdWm8UqIXvc" Content-Disposition: inline In-Reply-To: <1440746120-21577-7-git-send-email-gwshan@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v7 6/8] sPAPR: Introduce rtas_ldq() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gavin Shan Cc: aik@ozlabs.ru, peter.maydell@linaro.org, thuth@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org --w6U88vdWm8UqIXvc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 28, 2015 at 05:15:18PM +1000, Gavin Shan wrote: > This introduces rtas_ldq() to load 64-bits parameter from continuous > two 4-bytes memory chunk of RTAS parameter buffer, to simplify the > code. >=20 > Signed-off-by: Gavin Shan > Reviewed-by: Thomas Huth Looks good. Since this doesn't depend on the other patches, I've merged it into spapr-next already. > --- > hw/ppc/spapr_pci.c | 20 ++++++++++---------- > include/hw/ppc/spapr.h | 5 +++++ > 2 files changed, 15 insertions(+), 10 deletions(-) >=20 > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index 9d41060..bc30631 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -140,7 +140,7 @@ static void rtas_ibm_read_pci_config(PowerPCCPU *cpu,= sPAPRMachineState *spapr, > return; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > size =3D rtas_ld(args, 3); > addr =3D rtas_ld(args, 0); > =20 > @@ -206,7 +206,7 @@ static void rtas_ibm_write_pci_config(PowerPCCPU *cpu= , sPAPRMachineState *spapr, > return; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > val =3D rtas_ld(args, 4); > size =3D rtas_ld(args, 3); > addr =3D rtas_ld(args, 0); > @@ -269,7 +269,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAP= RMachineState *spapr, > target_ulong rets) > { > uint32_t config_addr =3D rtas_ld(args, 0); > - uint64_t buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args,= 2); > + uint64_t buid =3D rtas_ldq(args, 1); > unsigned int func =3D rtas_ld(args, 3); > unsigned int req_num =3D rtas_ld(args, 4); /* 0 =3D=3D remove all */ > unsigned int seq_num =3D rtas_ld(args, 5); > @@ -391,7 +391,7 @@ static void rtas_ibm_query_interrupt_source_number(Po= werPCCPU *cpu, > target_ulong rets) > { > uint32_t config_addr =3D rtas_ld(args, 0); > - uint64_t buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args,= 2); > + uint64_t buid =3D rtas_ldq(args, 1); > unsigned int intr_src_num =3D -1, ioa_intr_num =3D rtas_ld(args, 3); > sPAPRPHBState *phb =3D NULL; > PCIDevice *pdev =3D NULL; > @@ -440,7 +440,7 @@ static void rtas_ibm_set_eeh_option(PowerPCCPU *cpu, > goto param_error_exit; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > addr =3D rtas_ld(args, 0); > option =3D rtas_ld(args, 3); > =20 > @@ -484,7 +484,7 @@ static void rtas_ibm_get_config_addr_info2(PowerPCCPU= *cpu, > goto param_error_exit; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > sphb =3D spapr_pci_find_phb(spapr, buid); > if (!sphb) { > goto param_error_exit; > @@ -539,7 +539,7 @@ static void rtas_ibm_read_slot_reset_state2(PowerPCCP= U *cpu, > goto param_error_exit; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > sphb =3D spapr_pci_find_phb(spapr, buid); > if (!sphb) { > goto param_error_exit; > @@ -584,7 +584,7 @@ static void rtas_ibm_set_slot_reset(PowerPCCPU *cpu, > goto param_error_exit; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > option =3D rtas_ld(args, 3); > sphb =3D spapr_pci_find_phb(spapr, buid); > if (!sphb) { > @@ -619,7 +619,7 @@ static void rtas_ibm_configure_pe(PowerPCCPU *cpu, > goto param_error_exit; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > sphb =3D spapr_pci_find_phb(spapr, buid); > if (!sphb) { > goto param_error_exit; > @@ -654,7 +654,7 @@ static void rtas_ibm_slot_error_detail(PowerPCCPU *cp= u, > goto param_error_exit; > } > =20 > - buid =3D ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); > + buid =3D rtas_ldq(args, 1); > sphb =3D spapr_pci_find_phb(spapr, buid); > if (!sphb) { > goto param_error_exit; > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index d87c6d4..c75cc5e 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -492,6 +492,11 @@ static inline uint32_t rtas_ld(target_ulong phys, in= t n) > return ldl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + = 4*n)); > } > =20 > +static inline uint64_t rtas_ldq(target_ulong phys, int n) > +{ > + return (uint64_t)rtas_ld(phys, n) << 32 | rtas_ld(phys, n + 1); > +} > + > 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), v= al); --=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 --w6U88vdWm8UqIXvc Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJV5PniAAoJEGw4ysog2bOSeJQQAJsvSnDyCFmcj5q4acyA0VII +BHKBHlT4qEhJmxF3I/eMzbQpC14E59TpP1Qwsu1D9fzDklKz7aUJn8aR/Q5fSZk enlfQlJlWASi3o5LrjCQFUHF44t79ltLOGrcPKg6N/9KoN2Dijmw3coBTovO2Att Sx50eOQVok6milk0I/XjjOi0qSAZ/QHN5I6WpHdqfWI9HzosrsOCtvJl7hMlXKQy 7cK9GeZHNNemtMlVp0xf9Vx/btqrf3HsLnS8YSG5MVUe+VODLfA+jR2o1LutJiSt 2xX3rT/HZW4ccn+f/D5B2tm5HR0AGOT05MwK+l8YcbLuRxcH6aK4SzGfZ/jVob7O Luk38uCrcNGcwJTf4WziDPwfuC49Hwqi6z6Ego/8bPKJmLwqyEs42N9hpxrqq7S4 JuWHbhzd4HYfxjPn5W/vWSjoe6wqT/D8hlj4AcpDo1A/gfLU9zzBPkCeItCJg+uz Pu43vN+PAkQcZH3ubKyrjnqVrKFWhJhqb3HkgufYQcacm99hzAMgbD4rNKjqnk+b F9Qo2o5larzzCFmdyQKKaCliuoLuvTR6Zi2R5BWsxLTuq10yYuZ8WasY1F9Bt4gF Cto8wGH6qcVx4VCfRDlcQXRQ/xCMXCKQfVqoKPTDDEvF6QoSI51S721WZta/RqKt Y05Ced+o+2nJx/tCSh3P =7bqG -----END PGP SIGNATURE----- --w6U88vdWm8UqIXvc--