Re: [PATCH v4 7/8] virtio: add 1.0 support
From: Yuanhan Liu <hidden>
Date: 2016-01-19 02:43:57
On Tue, Jan 19, 2016 at 01:51:30AM +0000, Xie, Huawei wrote:
On 1/19/2016 9:34 AM, Yuanhan Liu wrote:quoted
On Mon, Jan 18, 2016 at 05:07:51PM +0000, Xie, Huawei wrote:quoted
.On 1/15/2016 12:34 PM, Yuanhan Liu wrote:quoted
Modern (v1.0) virtio pci device defines several pci capabilities. Each cap has a configure structure corresponding to it, and the cap.bar and cap.offset fields tell us where to find it.[snip]quoted
+ +static inline void +io_write64_twopart(uint64_t val, uint32_t *lo, uint32_t *hi) +{ + io_write32((uint32_t)val, lo); + io_write32(val >> 32, hi);Firstly your second iowrite32 doesn't do the conversion.Because it's not necessary. The first one is for retrieving the low 32 bits.I don't mean the shift operation, but the conversion from 64bit to 32bit. Same applied to below.
It's more than a casting here: it's same as "val & (1<<32 - 1)", as stated above, to retrieve the low 32 bits. I know it still could work without it, but, hey, what's wrong to make it explicit? --yliu