qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] nvme: expose 'bootindex' property


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] nvme: expose 'bootindex' property
Date: Mon, 22 Mar 2021 10:58:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

On 3/22/21 9:24 AM, Joelle van Dyne wrote:
> The check for `n->namespace.blkconf.blk` always fails because
> this is in the initialization function.

This usually mean the code depends to some state only available
during the QOM 'realization' step, so this code should be in
nvme_realize(). Maybe in this case we don't need it there and
can add the property regardless a block drive is provided, I
haven't checked.

> 
> Signed-off-by: Joelle van Dyne <j@getutm.app>
> ---
>  hw/block/nvme.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index 6842b01ab5..42605fc55d 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -6330,11 +6330,9 @@ static void nvme_instance_init(Object *obj)
>  {
>      NvmeCtrl *n = NVME(obj);
>  
> -    if (n->namespace.blkconf.blk) {
> -        device_add_bootindex_property(obj, &n->namespace.blkconf.bootindex,
> -                                      "bootindex", "/namespace@1,0",
> -                                      DEVICE(obj));
> -    }
> +    device_add_bootindex_property(obj, &n->namespace.blkconf.bootindex,
> +                                  "bootindex", "/namespace@1,0",
> +                                  DEVICE(obj));
>  
>      object_property_add(obj, "smart_critical_warning", "uint8",
>                          nvme_get_smart_warning,
> 




reply via email to

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