[dpdk-dev] [PATCH v5 8/9] virtio: add 1.0 support

Yuanhan Liu yuanhan.liu at linux.intel.com
Wed Jan 27 04:49:29 CET 2016


On Thu, Jan 21, 2016 at 12:37:42PM +0100, Thomas Monjalon wrote:
> 2016-01-19 16:12, Yuanhan Liu:
> > +#define IO_READ_DEF(nr_bits, type)             \
> > +static inline type                             \
> > +io_read##nr_bits(type *addr)                   \
> > +{                                              \
> > +       return *(volatile type *)addr;          \
> > +}
> > +
> > +#define IO_WRITE_DEF(nr_bits, type)            \
> > +static inline void                             \
> > +io_write##nr_bits(type val, type *addr)                \
> > +{                                              \
> > +       *(volatile type *)addr = val;           \
> > +}
> > +
> > +IO_READ_DEF (8, uint8_t)
> > +IO_WRITE_DEF(8, uint8_t)
> > +
> > +IO_READ_DEF (16, uint16_t)
> > +IO_WRITE_DEF(16, uint16_t)
> > +
> > +IO_READ_DEF (32, uint32_t)
> > +IO_WRITE_DEF(32, uint32_t)
> 
> Yes you can do this.
> But not sure you should.
> 
> > +static inline void
> > +io_write64_twopart(uint64_t val, uint32_t *lo, uint32_t *hi)
> > +{
> > +       io_write32(val & ((1ULL << 32) - 1), lo);
> > +       io_write32(val >> 32,                hi);
> > +}
> 
> When debugging this code, how GDB behave?
> How to find the definition of io_write32() with grep or simple editors?

Okay, I will unfold them.

	--yliu


More information about the dev mailing list