nvme: expose 'bootindex' property
PATCH 1/1 nvme: expose 'bootindex' property
The check for n->namespace.blkconf.blk always fails because this is in the initialization function.
--- hw/block/nvme.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
hw/block/nvme.c +3 -5
@@ -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,
Signature · 1 line
2.28.0
Quoted 2 lines · Joelle van Dyne
The check for
n->namespace.blkconf.blkalways 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.
Quoted 26 lines
Signed-off-by Joelle van Dyne <[email protected]>--- hw/block/nvme.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)hw/block/nvme.c +3
-5@@ -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,
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Joelle van Dyne
The check for
n->namespace.blkconf.blkalways 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.
If we defer to realization, it won't be available as a parameter on the command line, but as far as I can test, adding it unconditionally doesn't break anything when there is no drive attached to the controller device.
Quoted 28 lines
Quoted 26 lines
Signed-off-by Joelle van Dyne <[email protected]>--- hw/block/nvme.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)hw/block/nvme.c +3
-5@@ -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,
Quoted 12 lines · Klaus Jensen
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Joelle van Dyne
The check for
n->namespace.blkconf.blkalways 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.
Quoted 4 lines
If we defer to realization, it won't be available as a parameter on the command line, but as far as I can test, adding it unconditionally doesn't break anything when there is no drive attached to the controller device.
Patch is good then :)
Klaus Jensen
Reviewed-byQuoted 13 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Klaus Jensen
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Joelle van Dyne
The check for
n->namespace.blkconf.blkalways 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.
Quoted 7 lines
Quoted 4 lines
If we defer to realization, it won't be available as a parameter on the command line, but as far as I can test, adding it unconditionally doesn't break anything when there is no drive attached to the controller device.
Patch is good then :)
Agreed :)
Quoted 30 lines · Joelle van Dyne
The check for
n->namespace.blkconf.blkalways fails because this is in the initialization function.Signed-off-by Joelle van Dyne <[email protected]>--- hw/block/nvme.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)hw/block/nvme.c +3
-5@@ -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,Signature · 1 line
2.28.0
Applied on nvme-fixes, thanks!