qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 08/25] block/nvme: Simplify device reset


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 08/25] block/nvme: Simplify device reset
Date: Tue, 27 Oct 2020 16:53:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 10/27/20 3:58 PM, Keith Busch wrote:
> On Tue, Oct 27, 2020 at 02:55:30PM +0100, Philippe Mathieu-Daudé wrote:
>> Avoid multiple endianess conversion by using device endianess.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  block/nvme.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/block/nvme.c b/block/nvme.c
>> index e95d59d3126..be14350f959 100644
>> --- a/block/nvme.c
>> +++ b/block/nvme.c
>> @@ -755,7 +755,7 @@ static int nvme_init(BlockDriverState *bs, const char 
>> *device, int namespace,
>>      timeout_ms = MIN(500 * NVME_CAP_TO(cap), 30000);
>>  
>>      /* Reset device to get a clean state. */
>> -    regs->cc = cpu_to_le32(le32_to_cpu(regs->cc) & 0xFE);
>> +    regs->cc &= const_le32(0xFE);
> 
> This doesn't look right. The 'regs' is an MMIO address, correct? Memory
> mappings use the CPU native access.

cc is little-endian uint32_t.

on big-endian: const_le32(0xFE) = 0xfe000000;
so: regs->cc &= 0xfe000000.

Anyway this is an example of unproductive patch, as it makes
things more confuse to you. Let's ignore it.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]