• Benjamin Herrenschmidt's avatar
    powerpc: Don't Oops when accessing /proc/powerpc/lparcfg without hypervisor · f5f6cbb6
    Benjamin Herrenschmidt authored
    /proc/powerpc/lparcfg is an ancient facility (though still actively used)
    which allows access to some informations relative to the partition when
    running underneath a PAPR compliant hypervisor.
    
    It makes no sense on non-pseries machines. However, currently, not only
    can it be created on these if the kernel has pseries support, but accessing
    it on such a machine will crash due to trying to do hypervisor calls.
    
    In fact, it should also not do HV calls on older pseries that didn't have
    an hypervisor either.
    
    Finally, it has the plumbing to be a module but is a "bool" Kconfig option.
    
    This fixes the whole lot by turning it into a machine_device_initcall
    that is only created on pseries, and adding the necessary hypervisor
    check before calling the H_GET_EM_PARMS hypercall
    
    CC: <stable@vger.kernel.org>
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    f5f6cbb6
lparcfg.c 19 KB