[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 17/25] hw/virtio: Use correct type sizes
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [RFC PATCH 17/25] hw/virtio: Use correct type sizes |
Date: |
Thu, 20 May 2021 21:13:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 5/20/21 6:27 PM, Richard Henderson wrote:
> On 5/18/21 1:36 PM, Philippe Mathieu-Daudé wrote:
>> -static inline int virtio_lduw_p(VirtIODevice *vdev, const void *ptr)
>> +static inline uint16_t virtio_lduw_p(VirtIODevice *vdev, const void
>> *ptr)
>
> While this one looks obviously correct,
>
>> -static inline int virtio_ldl_p(VirtIODevice *vdev, const void *ptr)
>> +static inline uint32_t virtio_ldl_p(VirtIODevice *vdev, const void *ptr)
>> {
>> if (virtio_access_is_big_endian(vdev)) {
>> return ldl_be_p(ptr);
>
> this one isn't so obvious.
>
> Are all of the users unsigned?
All except this one for which I'm not sure:
hw/block/virtio-blk.c:137: int p =
virtio_ldl_p(VIRTIO_DEVICE(s), &req->out.type);
hw/block/virtio-blk.c-138- bool is_read = !(p &
VIRTIO_BLK_T_OUT);
--
hw/block/virtio-blk.c:183: bool is_write_zeroes =
(virtio_ldl_p(VIRTIO_DEVICE(s), &req->out.type) &
hw/block/virtio-blk.c-184-
~VIRTIO_BLK_T_BARRIER) == VIRTIO_BLK_T_WRITE_ZEROES;
hw/block/virtio-blk.c-185-
/* Barrier before this op. */
#define VIRTIO_BLK_T_BARRIER 0x80000000
> If so, should we rename it ldul?
OK.
- [RFC PATCH 12/25] qemu/bswap: Use LDST_CONVERT macro to emit 32-bit load/store functions, (continued)
- [RFC PATCH 16/25] exec/memory: Add methods for aligned pointer access (physical memory), Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 15/25] exec/memory: Add methods for aligned pointer access (address space), Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 17/25] hw/virtio: Use correct type sizes, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 18/25] hw/virtio: Introduce VIRTIO_LD_CONVERT() macro, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 19/25] hw/virtio: Use LD_CONVERT macro to emit 16-bit unsigned load/store code, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 20/25] hw/virtio: Introduce VIRTIO_ST_CONVERT() macro, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 21/25] hw/virtio: Use ST_CONVERT() macro to emit 16-bit load/store functions, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 22/25] hw/virtio: Use LDST_CONVERT macro to emit 32-bit load/store functions, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 24/25] hw/virtio: Add methods for aligned pointer access, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 23/25] hw/virtio: Use LDST_CONVERT macro to emit 64-bit load/store functions, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 25/25] hw/virtio: Optimize accesses on vring aligned pointers, Philippe Mathieu-Daudé, 2021/05/18
- Re: [RFC PATCH 00/25] exec: Add load/store API for aligned pointers, no-reply, 2021/05/18
- Re: [RFC PATCH 00/25] exec: Add load/store API for aligned pointers, Richard Henderson, 2021/05/19