• Lorenzo Pieralisi's avatar
    ARM: kvm: psci: fix handling of unimplemented functions · 3cadf681
    Lorenzo Pieralisi authored
    [ Upstream commit e2d99736 ]
    
    According to the PSCI specification and the SMC/HVC calling
    convention, PSCI function_ids that are not implemented must
    return NOT_SUPPORTED as return value.
    
    Current KVM implementation takes an unhandled PSCI function_id
    as an error and injects an undefined instruction into the guest
    if PSCI implementation is called with a function_id that is not
    handled by the resident PSCI version (ie it is not implemented),
    which is not the behaviour expected by a guest when calling a
    PSCI function_id that is not implemented.
    
    This patch fixes this issue by returning NOT_SUPPORTED whenever
    the kvm PSCI call is executed for a function_id that is not
    implemented by the PSCI kvm layer.
    
    Cc: <stable@vger.kernel.org> # 3.18+
    Cc: Christoffer Dall <christoffer.dall@linaro.org>
    Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
    3cadf681
psci.c 8.25 KB