Skip to content

Commit e54b788

Browse files
Shuo Liugregkh
authored andcommitted
virt: acrn: Make remove_cpu sysfs invisible with !CONFIG_HOTPLUG_CPU
Without cpu hotplug support, vCPU cannot be removed from a Service VM. Don't expose remove_cpu sysfs when CONFIG_HOTPLUG_CPU disabled. Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Qais Yousef <qais.yousef@arm.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Signed-off-by: Shuo Liu <shuo.a.liu@intel.com> Link: https://lore.kernel.org/r/20210221134339.57851-2-shuo.a.liu@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 51f2403 commit e54b788

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/virt/acrn/hsm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,22 @@ static ssize_t remove_cpu_store(struct device *dev,
404404
}
405405
static DEVICE_ATTR_WO(remove_cpu);
406406

407+
static umode_t acrn_attr_visible(struct kobject *kobj, struct attribute *a, int n)
408+
{
409+
if (a == &dev_attr_remove_cpu.attr)
410+
return IS_ENABLED(CONFIG_HOTPLUG_CPU) ? a->mode : 0;
411+
412+
return a->mode;
413+
}
414+
407415
static struct attribute *acrn_attrs[] = {
408416
&dev_attr_remove_cpu.attr,
409417
NULL
410418
};
411419

412420
static struct attribute_group acrn_attr_group = {
413421
.attrs = acrn_attrs,
422+
.is_visible = acrn_attr_visible,
414423
};
415424

416425
static const struct attribute_group *acrn_attr_groups[] = {

0 commit comments

Comments
 (0)