On Mon, Jun 26 2023, Shaoqin Huang <shahuang@xxxxxxxxxx> wrote: > The SMCCC call filtering provide the ability to forward the SMCCC call > to userspace, so we provide a new option `user-smccc` to enable handling > SMCCC call in userspace, the default value is off. > > And add the skeleton implementation for userspace SMCCC call > initialization and handling. > > Signed-off-by: Shaoqin Huang <shahuang@xxxxxxxxxx> > --- > docs/system/arm/virt.rst | 4 +++ > hw/arm/virt.c | 21 ++++++++++++++++ > include/hw/arm/virt.h | 1 + > target/arm/kvm.c | 54 ++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 80 insertions(+) > > diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst > index 1cab33f02e..ff43d52f04 100644 > --- a/docs/system/arm/virt.rst > +++ b/docs/system/arm/virt.rst > @@ -155,6 +155,10 @@ dtb-randomness > DTB to be non-deterministic. It would be the responsibility of > the firmware to come up with a seed and pass it on if it wants to. > > +user-smccc > + Set ``on``/``off`` to enable/disable handling smccc call in userspace > + instead of kernel. > + > dtb-kaslr-seed > A deprecated synonym for dtb-randomness. > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index 9b9f7d9c68..767720321c 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -42,6 +42,7 @@ > #include "hw/vfio/vfio-amd-xgbe.h" > #include "hw/display/ramfb.h" > #include "net/net.h" > +#include "qom/object.h" > #include "sysemu/device_tree.h" > #include "sysemu/numa.h" > #include "sysemu/runstate.h" > @@ -2511,6 +2512,19 @@ static void virt_set_oem_table_id(Object *obj, const char *value, > strncpy(vms->oem_table_id, value, 8); > } > > +static bool virt_get_user_smccc(Object *obj, Error **errp) > +{ > + VirtMachineState *vms = VIRT_MACHINE(obj); > + > + return vms->user_smccc; > +} > + > +static void virt_set_user_smccc(Object *obj, bool value, Error **errp) > +{ > + VirtMachineState *vms = VIRT_MACHINE(obj); > + > + vms->user_smccc = value; > +} > > bool virt_is_acpi_enabled(VirtMachineState *vms) > { > @@ -3155,6 +3169,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) > "in ACPI table header." > "The string may be up to 8 bytes in size"); > > + object_class_property_add_bool(oc, "user-smccc", > + virt_get_user_smccc, > + virt_set_user_smccc); > + object_class_property_set_description(oc, "user-smccc", > + "Set on/off to enable/disable " > + "handling smccc call in userspace"); > + > } > > static void virt_instance_init(Object *obj) This knob pretty much only makes sense for KVM guests, and we'll ignore it with tcg -- would it make sense to check that we are actually using KVM before we proceed (like we do for the tcg-only props?)