Re: [PATCH] x86: EuroBraille/Iris power off

Previous thread: [PATCH] MAINTAINERS: add RCU's public git tree by Paul E. McKenney on Wednesday, August 25, 2010 - 8:58 am. (2 messages)

Next thread: [GIT PULL] perf fixes by Ingo Molnar on Wednesday, August 25, 2010 - 10:44 am. (1 message)
From: Andreas Mohr
Date: Wednesday, August 25, 2010 - 9:12 am

Hi,

excellent! Now if as the next step before inclusion you also add the usual DMI check
(as done by many drivers such as acerhdf etc.),
someone inexperienced who is dumb enough to enable it for his unrelated machine
will actually survive an otherwise raw I/O port access and poweroff vector change ;))

Unless these non-APM, non-ACPI machines don't have any DMI support
either and thus won't even have dmidecode work.....
(in which case I'd strongly suggest adding a 0x340+x port value read verification
to bail driver install in case the machine doesn't have this hardware).

Andreas Mohr
--

From: Sebastien Hinderer
Date: Wednesday, August 25, 2010 - 2:12 pm

I did that, but I have noprecise documentation about what the legitimate
values are, so I just compared the read value with 0xff. This prevents
the module from being loaded in qemu for instance.

Shérab.

commit 197e523553a791f97536143001f22abd36f7992c
Author: Shérab <Sebastien.Hinderer@ens-lyon.org>
Date:   Wed Aug 25 23:00:14 2010 +0200

    Eurobraille/Iris power off.
    
    The Iris machines from EuroBraille do not have APM or ACPI support
    to shut themselves down properly.  A special I/O sequence is
    needed to do so.  This modle runs this I/O sequence at
    kernel shutdown.
    
    This is only for Iris machines from EuroBraille.
    Signed-off-by: Shérab <Sebastien.Hinderer@ens-lyon.org>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ac7827f..88bf897 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -493,6 +493,19 @@ config X86_ES7000
 	  Support for Unisys ES7000 systems.  Say 'Y' here if this kernel is
 	  supposed to run on an IA32-based Unisys ES7000 system.
 
+config X86_32_IRIS
+	tristate "Eurobraille/Iris poweroff module"
+	depends on X86_32
+	---help---
+	  The Iris machines from EuroBraille do not have APM or ACPI support
+	  to shut themselves down properly.  A special I/O sequence is
+	  needed to do so, which is what this module does at
+	  kernel shutdown.
+
+	  This is only for Iris machines from EuroBraille.
+
+	  If unused, say N.
+
 config SCHED_OMIT_FRAME_POINTER
 	def_bool y
 	prompt "Single-depth WCHAN output"
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 0925676..98dd1c8 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -115,6 +115,7 @@ obj-$(CONFIG_MICROCODE)			+= microcode.o
 obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
 
 obj-$(CONFIG_SWIOTLB)			+= pci-swiotlb.o
+obj-$(CONFIG_X86_32_IRIS)		+= iris.o
 
 ###
 # 64 bit specific files
diff --git a/arch/x86/kernel/iris.c b/arch/x86/kernel/iris.c
new file mode 100644
index 0000000..8856ef3
--- ...
From: H. Peter Anvin
Date: Wednesday, August 25, 2010 - 2:19 pm

Perhaps a better questions is: what *do* they have?  I really don't feel
comfortable adding something like this which pokes at a random port in
the ISA range, especially with the Interrupt list listing 6 known other
uses of this particular port.

At that point I'd almost prefer doing something like a BIOS signature
check if we can't do anything better.

	-hpa
--

From: Samuel Thibault
Date: Wednesday, August 25, 2010 - 3:50 pm

Well, there will be several versions of the BIOS signature, which the
constructor is not likely to provide.

Just to make sure there's no misunderstanding: it was never planned that
this driver be loaded unless some manual intervention, like explicitly
loadling the module or setting some parameter, so that if bad effects
happen on the machine, the user can only get angry at himself for having
loaded by hand a random module without reading the documentation that
explicitly says (twice) it's only for a particular kind of hardware.

I however now realize that I don't find a way to force a driver to be
compiled only as a module.  If there isn't, I guess we can just add
a module parameter to enable/disable the driver, so that it won't be
active by default even compiled-in?

Samuel
--

From: H. Peter Anvin
Date: Wednesday, August 25, 2010 - 5:06 pm

There is, but that is hardly a reasonable solution.

What other forms of enumerable hardware is on this machine?  PCI?

	-hpa
--

From: Samuel Thibault
Date: Wednesday, August 25, 2010 - 5:19 pm

Who?  This is a very particular kind of device, on which you can install
Linux only through some trick, thus machine coverage will most probably
be very low.  Having to activate a module by hand is really not a

I don't remember and will let Shérab answer.

Samuel
--

From: Sebastien Hinderer
Date: Wednesday, August 25, 2010 - 11:45 pm

Yes, just PCI I think.

Below is the output of lspci -v if that helps.

Best wishes,
Shérab.

00:00.0 Host bridge: Cyrix Corporation PCI Master
	Flags: bus master, medium devsel, latency 0

00:02.0 Ethernet controller: Davicom Semiconductor, Inc. 21x4x DEC-Tulip compatible 10/100 Ethernet (rev 40)
	Subsystem: Davicom Semiconductor, Inc. DM9102A (DM9102AE, SM9102AF) Ethernet 100/10 MBit
	Flags: bus master, medium devsel, latency 165, IRQ 11
	I/O ports at 1000 [size=256]
	Memory at fedfe000 (32-bit, non-prefetchable) [size=256]
	[virtual] Expansion ROM at 08000000 [disabled] [size=256K]
	Capabilities: [50] Power Management version 2
	Kernel driver in use: dmfe

00:12.0 ISA bridge: Cyrix Corporation 5530 Legacy [Kahlua] (rev 30)
	Flags: bus master, medium devsel, latency 64

00:12.1 Bridge: Cyrix Corporation 5530 SMI [Kahlua]
	Flags: medium devsel
	Memory at 40012000 (32-bit, non-prefetchable) [size=256]

00:12.2 IDE interface: Cyrix Corporation 5530 IDE [Kahlua] (prog-if 80 [Master])
	Flags: bus master, medium devsel, latency 0
	[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
	[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
	[virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
	[virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
	I/O ports at 1400 [size=16]
	Kernel driver in use: CS5530 IDE

00:12.3 Multimedia audio controller: Cyrix Corporation 5530 Audio [Kahlua]
	Flags: bus master, medium devsel, latency 0
	Memory at 40011000 (32-bit, non-prefetchable) [size=128]
	Kernel driver in use: CS5530_Audio

00:12.4 VGA compatible controller: Cyrix Corporation 5530 Video [Kahlua] (prog-if 00 [VGA controller])
	Subsystem: Cyrix Corporation Device 0001
	Flags: medium devsel
	Memory at 40800000 (32-bit, non-prefetchable) [size=8M]
	Expansion ROM at <unassigned> [disabled]

00:13.0 USB Controller: Compaq Computer Corporation ZFMicro Chipset USB (rev 06) (prog-if 10 [OHCI])
	Subsystem: Compaq Computer Corporation ...
From: H. Peter Anvin
Date: Wednesday, August 25, 2010 - 11:55 pm

Good grief ... these clowns didn't even program the subsystem ID?  Could
you verify with lspci -vv -n?

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

--

From: Andreas Mohr
Date: Thursday, August 26, 2010 - 12:09 am

Given the very non-standard environment as compared to a modern PC,
perhaps it's a good idea to tend towards establishing a standard
"pseudo-DMI" detection method for old-style "PC standard" hardware?
(which could support functions for checking a BIOS signature
at a defined, well-known BIOS memory location,
or functions for a VGA BIOS signature, or detecting certain standardized
BIOS flag words).
If a PC simply lacks all usual modern methods, then it's us (Linux)
who has to provide an utmost reliable fallback mechanism,
since that would still be much better than having raw, unverified
driver access.

Andreas Mohr
--

From: Sebastien Hinderer
Date: Thursday, August 26, 2010 - 2:29 am

Hi again,


It's included below.

Shérab.

00:00.0 0600: 1078:0001
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0

00:02.0 0200: 1282:9102 (rev 40)
	Subsystem: 0291:8212
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 165 (5000ns min, 10000ns max)
	Interrupt: pin A routed to IRQ 11
	Region 0: I/O ports at 1000 [size=256]
	Region 1: Memory at fedfe000 (32-bit, non-prefetchable) [size=256]
	[virtual] Expansion ROM at 08000000 [disabled] [size=256K]
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=160mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: dmfe

00:12.0 0601: 1078:0100 (rev 30)
	Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 64, Cache Line Size: 16 bytes

00:12.1 0680: 1078:0101
	Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Region 0: Memory at 40012000 (32-bit, non-prefetchable) [size=256]

00:12.2 0101: 1078:0102 (prog-if 80 [Master])
	Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
	Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable) ...
Previous thread: [PATCH] MAINTAINERS: add RCU's public git tree by Paul E. McKenney on Wednesday, August 25, 2010 - 8:58 am. (2 messages)

Next thread: [GIT PULL] perf fixes by Ingo Molnar on Wednesday, August 25, 2010 - 10:44 am. (1 message)