• K. Y. Srinivasan's avatar
    x86, irq, pic: Probe for legacy PIC and set legacy_pic appropriately · e179f691
    K. Y. Srinivasan authored
    The legacy PIC may or may not be available and we need a mechanism to
    detect the existence of the legacy PIC that is applicable for all
    hardware (both physical as well as virtual) currently supported by
    Linux.
    
    On Hyper-V, when our legacy firmware presented to the guests, emulates
    the legacy PIC while when our EFI based firmware is presented we do
    not emulate the PIC. To support Hyper-V EFI firmware, we had to set
    the legacy_pic to the null_legacy_pic since we had to bypass PIC based
    calibration in the early boot code. While, on the EFI firmware, we
    know we don't emulate the legacy PIC, we need a generic mechanism to
    detect the presence of the legacy PIC that is not based on boot time
    state - this became apparent when we tried to get kexec to work on
    Hyper-V EFI firmware.
    
    This patch implements the proposal put forth by H. Peter Anvin
    <hpa@linux.intel.com>: Write a known value to the PIC data port and
    read it back. If the value read is the value written, we do have the
    PIC, if not there is no PIC and we can safely set the legacy_pic to
    null_legacy_pic. Since the read from an unconnected I/O port returns
    0xff, we will use ~(1 << PIC_CASCADE_IR) (0xfb: mask all lines except
    the cascade line) to probe for the existence of the PIC.
    
    In version V1 of the patch, I had cleaned up the code based on comments from Peter.
    In version V2 of the patch, I have addressed additional comments from Peter.
    In version V3 of the patch, I have addressed Jan's comments (JBeulich@suse.com).
    In version V4 of the patch, I have addressed additional comments from Peter.
    Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
    Link: http://lkml.kernel.org/r/1397501029-29286-1-git-send-email-kys@microsoft.com
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    e179f691
mshyperv.c 3.67 KB