Commit f6365201 authored by Len Brown's avatar Len Brown Committed by Ingo Molnar

x86: Remove the ancient and deprecated disable_hlt() and enable_hlt() facility

The X86_32-only disable_hlt/enable_hlt mechanism was used by the
32-bit floppy driver. Its effect was to replace the use of the
HLT instruction inside default_idle() with cpu_relax() - essentially
it turned off the use of HLT.

This workaround was commented in the code as:

 "disable hlt during certain critical i/o operations"

 "This halt magic was a workaround for ancient floppy DMA
  wreckage. It should be safe to remove."

H. Peter Anvin additionally adds:

 "To the best of my knowledge, no-hlt only existed because of
  flaky power distributions on 386/486 systems which were sold to
  run DOS.  Since DOS did no power management of any kind,
  including HLT, the power draw was fairly uniform; when exposed
  to the much hhigher noise levels you got when Linux used HLT
  caused some of these systems to fail.

  They were by far in the minority even back then."

Alan Cox further says:

 "Also for the Cyrix 5510 which tended to go castors up if a HLT
  occurred during a DMA cycle and on a few other boxes HLT during
  DMA tended to go astray.

  Do we care ? I doubt it. The 5510 was pretty obscure, the 5520
  fixed it, the 5530 is probably the oldest still in any kind of
  use."

So, let's finally drop this.
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
Signed-off-by: default avatarJosh Boyer <jwboyer@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Acked-by: default avatar"H. Peter Anvin" <hpa@zytor.com>
Acked-by: default avatarAlan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Stephen Hemminger <shemminger@vyatta.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/n/tip-3rhk9bzf0x9rljkv488tloib@git.kernel.org
[ If anyone cares then alternative instruction patching could be
  used to replace HLT with a one-byte NOP instruction. Much simpler. ]
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 186e54cb
...@@ -6,14 +6,6 @@ be removed from this file. ...@@ -6,14 +6,6 @@ be removed from this file.
--------------------------- ---------------------------
What: x86 floppy disable_hlt
When: 2012
Why: ancient workaround of dubious utility clutters the
code used by everybody else.
Who: Len Brown <len.brown@intel.com>
---------------------------
What: CONFIG_APM_CPU_IDLE, and its ability to call APM BIOS in idle What: CONFIG_APM_CPU_IDLE, and its ability to call APM BIOS in idle
When: 2012 When: 2012
Why: This optional sub-feature of APM is of dubious reliability, Why: This optional sub-feature of APM is of dubious reliability,
......
...@@ -974,16 +974,6 @@ extern bool cpu_has_amd_erratum(const int *); ...@@ -974,16 +974,6 @@ extern bool cpu_has_amd_erratum(const int *);
#define cpu_has_amd_erratum(x) (false) #define cpu_has_amd_erratum(x) (false)
#endif /* CONFIG_CPU_SUP_AMD */ #endif /* CONFIG_CPU_SUP_AMD */
#ifdef CONFIG_X86_32
/*
* disable hlt during certain critical i/o operations
*/
#define HAVE_DISABLE_HLT
#endif
void disable_hlt(void);
void enable_hlt(void);
void cpu_idle_wait(void); void cpu_idle_wait(void);
extern unsigned long arch_align_stack(unsigned long sp); extern unsigned long arch_align_stack(unsigned long sp);
......
...@@ -362,34 +362,10 @@ void (*pm_idle)(void); ...@@ -362,34 +362,10 @@ void (*pm_idle)(void);
EXPORT_SYMBOL(pm_idle); EXPORT_SYMBOL(pm_idle);
#endif #endif
#ifdef CONFIG_X86_32
/*
* This halt magic was a workaround for ancient floppy DMA
* wreckage. It should be safe to remove.
*/
static int hlt_counter;
void disable_hlt(void)
{
hlt_counter++;
}
EXPORT_SYMBOL(disable_hlt);
void enable_hlt(void)
{
hlt_counter--;
}
EXPORT_SYMBOL(enable_hlt);
static inline int hlt_use_halt(void)
{
return (!hlt_counter && boot_cpu_data.hlt_works_ok);
}
#else
static inline int hlt_use_halt(void) static inline int hlt_use_halt(void)
{ {
return 1; return 1;
} }
#endif
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
static inline void play_dead(void) static inline void play_dead(void)
......
...@@ -1030,37 +1030,6 @@ static int fd_wait_for_completion(unsigned long delay, timeout_fn function) ...@@ -1030,37 +1030,6 @@ static int fd_wait_for_completion(unsigned long delay, timeout_fn function)
return 0; return 0;
} }
static DEFINE_SPINLOCK(floppy_hlt_lock);
static int hlt_disabled;
static void floppy_disable_hlt(void)
{
unsigned long flags;
WARN_ONCE(1, "floppy_disable_hlt() scheduled for removal in 2012");
spin_lock_irqsave(&floppy_hlt_lock, flags);
if (!hlt_disabled) {
hlt_disabled = 1;
#ifdef HAVE_DISABLE_HLT
disable_hlt();
#endif
}
spin_unlock_irqrestore(&floppy_hlt_lock, flags);
}
static void floppy_enable_hlt(void)
{
unsigned long flags;
spin_lock_irqsave(&floppy_hlt_lock, flags);
if (hlt_disabled) {
hlt_disabled = 0;
#ifdef HAVE_DISABLE_HLT
enable_hlt();
#endif
}
spin_unlock_irqrestore(&floppy_hlt_lock, flags);
}
static void setup_DMA(void) static void setup_DMA(void)
{ {
unsigned long f; unsigned long f;
...@@ -1105,7 +1074,6 @@ static void setup_DMA(void) ...@@ -1105,7 +1074,6 @@ static void setup_DMA(void)
fd_enable_dma(); fd_enable_dma();
release_dma_lock(f); release_dma_lock(f);
#endif #endif
floppy_disable_hlt();
} }
static void show_floppy(void); static void show_floppy(void);
...@@ -1707,7 +1675,6 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id) ...@@ -1707,7 +1675,6 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id)
fd_disable_dma(); fd_disable_dma();
release_dma_lock(f); release_dma_lock(f);
floppy_enable_hlt();
do_floppy = NULL; do_floppy = NULL;
if (fdc >= N_FDC || FDCS->address == -1) { if (fdc >= N_FDC || FDCS->address == -1) {
/* we don't even know which FDC is the culprit */ /* we don't even know which FDC is the culprit */
...@@ -1856,8 +1823,6 @@ static void floppy_shutdown(unsigned long data) ...@@ -1856,8 +1823,6 @@ static void floppy_shutdown(unsigned long data)
show_floppy(); show_floppy();
cancel_activity(); cancel_activity();
floppy_enable_hlt();
flags = claim_dma_lock(); flags = claim_dma_lock();
fd_disable_dma(); fd_disable_dma();
release_dma_lock(flags); release_dma_lock(flags);
...@@ -4508,7 +4473,6 @@ static void floppy_release_irq_and_dma(void) ...@@ -4508,7 +4473,6 @@ static void floppy_release_irq_and_dma(void)
#if N_FDC > 1 #if N_FDC > 1
set_dor(1, ~8, 0); set_dor(1, ~8, 0);
#endif #endif
floppy_enable_hlt();
if (floppy_track_buffer && max_buffer_sectors) { if (floppy_track_buffer && max_buffer_sectors) {
tmpsize = max_buffer_sectors * 1024; tmpsize = max_buffer_sectors * 1024;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment