On Tue, Oct 11, 2022 at 10:03:00AM +0100, Jonathan Cameron wrote:
> On Mon, 10 Oct 2022 15:29:39 -0700
> ira.we...@intel.com wrote:
> 
> > From: Ira Weiny <ira.we...@intel.com>
> > 
> > Gcc requires constant versions of cpu_to_le* calls.
> > 
> > Add a 64 bit version.
> > 
> > Signed-off-by: Ira Weiny <ira.we...@intel.com>
> 
> Seems reasonable to me but I'm not an expert in this stuff.
> FWIW
> 
> Reviewed-by: Jonathan Cameron <jonathan.came...@huawei.com>
> 
> There are probably a lot of places in the CXL emulation where
> our endian handling isn't correct but so far it hasn't mattered
> as all the supported architectures are little endian.
> 
> Good to not introduce more cases however!

Agreed. Thanks!
Ira

> 
> Jonathan
> 
> 
> > ---
> >  include/qemu/bswap.h | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
> > index 346d05f2aab3..08e607821102 100644
> > --- a/include/qemu/bswap.h
> > +++ b/include/qemu/bswap.h
> > @@ -192,10 +192,20 @@ CPU_CONVERT(le, 64, uint64_t)
> >       (((_x) & 0x0000ff00U) <<  8) |              \
> >       (((_x) & 0x00ff0000U) >>  8) |              \
> >       (((_x) & 0xff000000U) >> 24))
> > +# define const_le64(_x)                          \
> > +    ((((_x) & 0x00000000000000ffU) << 56) |      \
> > +     (((_x) & 0x000000000000ff00U) << 40) |      \
> > +     (((_x) & 0x0000000000ff0000U) << 24) |      \
> > +     (((_x) & 0x00000000ff000000U) <<  8) |      \
> > +     (((_x) & 0x000000ff00000000U) >>  8) |      \
> > +     (((_x) & 0x0000ff0000000000U) >> 24) |      \
> > +     (((_x) & 0x00ff000000000000U) >> 40) |      \
> > +     (((_x) & 0xff00000000000000U) >> 56))
> >  # define const_le16(_x)                          \
> >      ((((_x) & 0x00ff) << 8) |                    \
> >       (((_x) & 0xff00) >> 8))
> >  #else
> > +# define const_le64(_x) (_x)
> >  # define const_le32(_x) (_x)
> >  # define const_le16(_x) (_x)
> >  #endif
> 

Reply via email to