[Qemu-devel] [PATCH 0/4] Define and use PRI*PLX format specifier macros for target_phys_addr_t

2012-06-25 Thread Peter Maydell
This patchset defines a set of macros for use in printf format strings
for handling target_phys_addr_t values, as suggested by Andreas Färber
(http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg01547.html)

We can then use them in some places which were previously either
making assumptions about the width of target_phys_addr_t or had
an ifdef to handle the 32 and 64 bit cases separately. Patches 2-4
cover the format-string related parts of Anthony's original make
target_phys_addr_t 64 bits in all cases patch:
http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg01523.html

Peter Maydell (4):
  targphys.h: Define PRI*PLX format specifier macros
  hw/omap.h: Use PRIxPLX to define OMAP_FMT_plx
  hw/sh_serial: Use PRIxPLX rather than %x for physaddr
  monitor: Use PRI*PLX to avoid TARGET_PHYS_ADDR_BITS ifdef

 hw/omap.h  |8 +---
 hw/sh_serial.c |5 +++--
 monitor.c  |   29 -
 targphys.h |   16 
 4 files changed, 24 insertions(+), 34 deletions(-)




Re: [Qemu-devel] [PATCH 0/4] Define and use PRI*PLX format specifier macros for target_phys_addr_t

2012-06-25 Thread Andreas Färber
Am 25.06.2012 14:45, schrieb Peter Maydell:
 This patchset defines a set of macros for use in printf format strings
 for handling target_phys_addr_t values, as suggested by Andreas Färber
 (http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg01547.html)

What is the X for again? I assume PL = Physical Long, X as in
hexadecimal would then contradict the d/u and duplicate x/X.

Thus I would suggest TARGET_PRIdPHYSADDR, also addressing Eric's
comment. Judging from patches 2-4 it's not used to frequently unlike its
user TARGET_FMT_plx, so we don't have to badly shorten it for usability.

Andreas

 We can then use them in some places which were previously either
 making assumptions about the width of target_phys_addr_t or had
 an ifdef to handle the 32 and 64 bit cases separately. Patches 2-4
 cover the format-string related parts of Anthony's original make
 target_phys_addr_t 64 bits in all cases patch:
 http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg01523.html
 
 Peter Maydell (4):
   targphys.h: Define PRI*PLX format specifier macros
   hw/omap.h: Use PRIxPLX to define OMAP_FMT_plx
   hw/sh_serial: Use PRIxPLX rather than %x for physaddr
   monitor: Use PRI*PLX to avoid TARGET_PHYS_ADDR_BITS ifdef
 
  hw/omap.h  |8 +---
  hw/sh_serial.c |5 +++--
  monitor.c  |   29 -
  targphys.h |   16 
  4 files changed, 24 insertions(+), 34 deletions(-)

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH 0/4] Define and use PRI*PLX format specifier macros for target_phys_addr_t

2012-06-25 Thread Peter Maydell
On 25 June 2012 14:48, Andreas Färber afaer...@suse.de wrote:
 Am 25.06.2012 14:45, schrieb Peter Maydell:
 This patchset defines a set of macros for use in printf format strings
 for handling target_phys_addr_t values, as suggested by Andreas Färber
 (http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg01547.html)

 What is the X for again? I assume PL = Physical Long, X as in
 hexadecimal would then contradict the d/u and duplicate x/X.

I'm just following the existing use of 'plx' in TARGET_FMT_plx,
but I'm not very attached to the abbreviation.

 Thus I would suggest TARGET_PRIdPHYSADDR, also addressing Eric's
 comment. Judging from patches 2-4 it's not used to frequently unlike its
 user TARGET_FMT_plx, so we don't have to badly shorten it for usability.

The hope is that it is used more extensively in the future (ie
any device that would have used TARGET_FMT_plx should use these
instead); I think TARGET_PRIdPHYSADDR is too long.

-- PMM



Re: [Qemu-devel] [PATCH 0/4] Define and use PRI*PLX format specifier macros for target_phys_addr_t

2012-06-25 Thread Andreas Färber
Am 25.06.2012 16:10, schrieb Peter Maydell:
 On 25 June 2012 14:48, Andreas Färber afaer...@suse.de wrote:
 Am 25.06.2012 14:45, schrieb Peter Maydell:
 This patchset defines a set of macros for use in printf format strings
 for handling target_phys_addr_t values, as suggested by Andreas Färber
 (http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg01547.html)

 What is the X for again? I assume PL = Physical Long, X as in
 hexadecimal would then contradict the d/u and duplicate x/X.
 
 I'm just following the existing use of 'plx' in TARGET_FMT_plx,
 but I'm not very attached to the abbreviation.

That one is hexadecimal. So it becomes (TARGET_)PRIxPL.

 Thus I would suggest TARGET_PRIdPHYSADDR, also addressing Eric's
 comment. Judging from patches 2-4 it's not used to frequently unlike its
 user TARGET_FMT_plx, so we don't have to badly shorten it for usability.
 
 The hope is that it is used more extensively in the future (ie
 any device that would have used TARGET_FMT_plx should use these
 instead); I think TARGET_PRIdPHYSADDR is too long.

Well, PRI*PHYSADDR would be another option, reasoning:
target_ | phys_addr | _t --- int_ | least64 | _t (PRI*LEAST64)
Or maybe PRI*PHYS since int is dropped, too?

Point is, POSIX keeps the part after PRIx readable or at least
corresponding to the type name:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH 0/4] Define and use PRI*PLX format specifier macros for target_phys_addr_t

2012-06-25 Thread Peter Maydell
On 25 June 2012 15:43, Andreas Färber afaer...@suse.de wrote:
 Am 25.06.2012 16:10, schrieb Peter Maydell:
 On 25 June 2012 14:48, Andreas Färber afaer...@suse.de wrote:
 Thus I would suggest TARGET_PRIdPHYSADDR, also addressing Eric's
 comment. Judging from patches 2-4 it's not used to frequently unlike its
 user TARGET_FMT_plx, so we don't have to badly shorten it for usability.

 The hope is that it is used more extensively in the future (ie
 any device that would have used TARGET_FMT_plx should use these
 instead); I think TARGET_PRIdPHYSADDR is too long.

 Well, PRI*PHYSADDR would be another option, reasoning:
 target_ | phys_addr | _t --- int_ | least64 | _t (PRI*LEAST64)
 Or maybe PRI*PHYS since int is dropped, too?

 Point is, POSIX keeps the part after PRIx readable or at least
 corresponding to the type name

Right. How about TARGET_PRI*PHYS, then?

-- PMM



Re: [Qemu-devel] [PATCH 0/4] Define and use PRI*PLX format specifier macros for target_phys_addr_t

2012-06-25 Thread Andreas Färber
Am 25.06.2012 16:54, schrieb Peter Maydell:
 On 25 June 2012 15:43, Andreas Färber afaer...@suse.de wrote:
 Am 25.06.2012 16:10, schrieb Peter Maydell:
 On 25 June 2012 14:48, Andreas Färber afaer...@suse.de wrote:
 Thus I would suggest TARGET_PRIdPHYSADDR, also addressing Eric's
 comment. Judging from patches 2-4 it's not used to frequently unlike its
 user TARGET_FMT_plx, so we don't have to badly shorten it for usability.

 The hope is that it is used more extensively in the future (ie
 any device that would have used TARGET_FMT_plx should use these
 instead); I think TARGET_PRIdPHYSADDR is too long.

 Well, PRI*PHYSADDR would be another option, reasoning:
 target_ | phys_addr | _t --- int_ | least64 | _t (PRI*LEAST64)
 Or maybe PRI*PHYS since int is dropped, too?

 Point is, POSIX keeps the part after PRIx readable or at least
 corresponding to the type name
 
 Right. How about TARGET_PRI*PHYS, then?

Fine with me.

/-F

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg