]> err.no Git - linux-2.6/log
linux-2.6
16 years agoKVM: export information about NPT to generic x86 code
Joerg Roedel [Thu, 7 Feb 2008 12:47:41 +0000 (13:47 +0100)]
KVM: export information about NPT to generic x86 code

The generic x86 code has to know if the specific implementation uses Nested
Paging. In the generic code Nested Paging is called Two Dimensional Paging
(TDP) to avoid confusion with (future) TDP implementations of other vendors.
This patch exports the availability of TDP to the generic x86 code.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: SVM: add module parameter to disable Nested Paging
Joerg Roedel [Thu, 7 Feb 2008 12:47:40 +0000 (13:47 +0100)]
KVM: SVM: add module parameter to disable Nested Paging

To disable the use of the Nested Paging feature even if it is available in
hardware this patch adds a module parameter. Nested Paging can be disabled by
passing npt=0 to the kvm_amd module.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: SVM: add detection of Nested Paging feature
Joerg Roedel [Thu, 7 Feb 2008 12:47:39 +0000 (13:47 +0100)]
KVM: SVM: add detection of Nested Paging feature

Let SVM detect if the Nested Paging feature is available on the hardware.
Disable it to keep this patch series bisectable.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: SVM: move feature detection to hardware setup code
Joerg Roedel [Thu, 7 Feb 2008 12:47:38 +0000 (13:47 +0100)]
KVM: SVM: move feature detection to hardware setup code

By moving the SVM feature detection from the each_cpu code to the hardware
setup code it runs only once. As an additional advance the feature check is now
available earlier in the module setup process.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: allow access to EFER in 32bit KVM
Joerg Roedel [Thu, 31 Jan 2008 13:57:40 +0000 (14:57 +0100)]
KVM: allow access to EFER in 32bit KVM

This patch makes the EFER register accessible on a 32bit KVM host. This is
necessary to boot 32 bit PAE guests under SVM.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: unifdef the EFER specific code
Joerg Roedel [Thu, 31 Jan 2008 13:57:39 +0000 (14:57 +0100)]
KVM: VMX: unifdef the EFER specific code

To allow access to the EFER register in 32bit KVM the EFER specific code has to
be exported to the x86 generic code. This patch does this in a backwards
compatible manner.

[avi: add check for EFER-less hosts]

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: align valid EFER bits with the features of the host system
Joerg Roedel [Thu, 31 Jan 2008 13:57:38 +0000 (14:57 +0100)]
KVM: align valid EFER bits with the features of the host system

This patch aligns the bits the guest can set in the EFER register with the
features in the host processor. Currently it lets EFER.NX disabled if the
processor does not support it and enables EFER.LME and EFER.LMA only for KVM on
64 bit hosts.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: make EFER_RESERVED_BITS configurable for architecture code
Joerg Roedel [Thu, 31 Jan 2008 13:57:37 +0000 (14:57 +0100)]
KVM: make EFER_RESERVED_BITS configurable for architecture code

This patch give the SVM and VMX implementations the ability to add some bits
the guest can set in its EFER register.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Disable pagefaults during copy_from_user_inatomic()
Andrea Arcangeli [Wed, 30 Jan 2008 18:57:35 +0000 (19:57 +0100)]
KVM: Disable pagefaults during copy_from_user_inatomic()

With CONFIG_PREEMPT=n, this is needed in order to disable the fault-in
code from sleeping.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Use CONFIG_PREEMPT_NOTIFIERS around struct preempt_notifier
Hollis Blanchard [Mon, 28 Jan 2008 23:42:34 +0000 (17:42 -0600)]
KVM: Use CONFIG_PREEMPT_NOTIFIERS around struct preempt_notifier

This allows kvm_host.h to be #included even when struct preempt_notifier is
undefined. This is needed to build ppc asm-offsets.h.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Enable Virtual Processor Identification (VPID)
Sheng Yang [Thu, 17 Jan 2008 07:14:33 +0000 (15:14 +0800)]
KVM: VMX: Enable Virtual Processor Identification (VPID)

To allow TLB entries to be retained across VM entry and VM exit, the VMM
can now identify distinct address spaces through a new virtual-processor ID
(VPID) field of the VMCS.

[avi: drop vpid_sync_all()]
[avi: add "cc" to asm constraints]

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Limit vcpu mmap size to one page on non-x86
Avi Kivity [Thu, 24 Jan 2008 13:13:08 +0000 (15:13 +0200)]
KVM: Limit vcpu mmap size to one page on non-x86

The second page is only needed on archs that support pio.

Noted by Carsten Otte.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Decouple mmio from shadow page tables
Avi Kivity [Thu, 24 Jan 2008 09:44:11 +0000 (11:44 +0200)]
KVM: MMU: Decouple mmio from shadow page tables

Currently an mmio guest pte is encoded in the shadow pagetable as a
not-present trapping pte, with the SHADOW_IO_MARK bit set.  However
nothing is ever done with this information, so maintaining it is a
useless complication.

This patch moves the check for mmio to before shadow ptes are instantiated,
so the shadow code is never invoked for ptes that reference mmio.  The code
is simpler, and with future work, can be made to handle mmio concurrently.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: group decoding for group 1 instructions
Avi Kivity [Wed, 23 Jan 2008 20:26:09 +0000 (22:26 +0200)]
KVM: x86 emulator: group decoding for group 1 instructions

Opcodes 0x80-0x83

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Only x86 has pio
Avi Kivity [Wed, 23 Jan 2008 16:14:23 +0000 (18:14 +0200)]
KVM: Only x86 has pio

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: constify function pointer tables
Jan Engelhardt [Tue, 22 Jan 2008 19:46:14 +0000 (20:46 +0100)]
KVM: constify function pointer tables

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: add group 7 decoding
Avi Kivity [Fri, 18 Jan 2008 11:36:50 +0000 (13:36 +0200)]
KVM: x86 emulator: add group 7 decoding

This adds group decoding for opcode 0x0f 0x01 (group 7).

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Group decoding for groups 4 and 5
Avi Kivity [Fri, 18 Jan 2008 11:12:26 +0000 (13:12 +0200)]
KVM: x86 emulator: Group decoding for groups 4 and 5

Add group decoding support for opcode 0xfe (group 4) and 0xff (group 5).

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Group decoding for group 3
Avi Kivity [Fri, 18 Jan 2008 10:58:04 +0000 (12:58 +0200)]
KVM: x86 emulator: Group decoding for group 3

This adds group decoding support for opcodes 0xf6, 0xf7 (group 3).

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: group decoding for group 1A
Avi Kivity [Fri, 18 Jan 2008 10:46:50 +0000 (12:46 +0200)]
KVM: x86 emulator: group decoding for group 1A

This adds group decode support for opcode 0x8f.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: add support for group decoding
Avi Kivity [Fri, 18 Jan 2008 10:38:59 +0000 (12:38 +0200)]
KVM: x86 emulator: add support for group decoding

Certain x86 instructions use bits 3:5 of the byte following the opcode as an
opcode extension, with the decode sometimes depending on bits 6:7 as well.
Add support for this in the main decoding table rather than an ad-hock
adaptation per opcode.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Simplify hash table indexing
Dong, Eddie [Mon, 7 Jan 2008 11:20:25 +0000 (13:20 +0200)]
KVM: MMU: Simplify hash table indexing

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Update shadow ptes on partial guest pte writes
Dong, Eddie [Mon, 7 Jan 2008 09:14:20 +0000 (11:14 +0200)]
KVM: MMU: Update shadow ptes on partial guest pte writes

A guest partial guest pte write will leave shadow_trap_nonpresent_pte
in spte, which generates a vmexit at the next guest access through that pte.

This patch improves this by reading the full guest pte in advance and thus
being able to update the spte and eliminate the vmexit.

This helps pae guests which use two 32-bit writes to set a single 64-bit pte.

[truncation fix by Eric]

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Feng (Eric) Liu <eric.e.liu@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux...
Linus Torvalds [Sat, 26 Apr 2008 21:04:32 +0000 (14:04 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86-bigbox-bootmem-v3

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86-bigbox-bootmem-v3:
  x86_64/mm: check and print vmemmap allocation continuous
  x86_64: fix setup_node_bootmem to support big mem excluding with memmap
  x86_64: make reserve_bootmem_generic() use new reserve_bootmem()
  mm: allow reserve_bootmem() cross nodes
  mm: offset align in alloc_bootmem()
  mm: fix alloc_bootmem_core to use fast searching for all nodes
  mm: make mem_map allocation continuous

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
Linus Torvalds [Sat, 26 Apr 2008 21:03:54 +0000 (14:03 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
  kbuild: scripts/Makefile.modpost typo fix
  kbuild: soften MODULE_LICENSE check

16 years agox86_64/mm: check and print vmemmap allocation continuous
Yinghai Lu [Sat, 12 Apr 2008 08:19:24 +0000 (01:19 -0700)]
x86_64/mm: check and print vmemmap allocation continuous

On big systems with lots of memory, don't print out too much during
bootup, and make it easy to find if it is continuous.

on 256G 8 sockets system will get
 [ffffe20000000000-ffffe20002bfffff] PMD -> [ffff810001400000-ffff810003ffffff] on node 0
[ffffe2001c700000-ffffe2001c7fffff] potential offnode page_structs
 [ffffe20002c00000-ffffe2001c7fffff] PMD -> [ffff81000c000000-ffff8100255fffff] on node 0
[ffffe20038700000-ffffe200387fffff] potential offnode page_structs
 [ffffe2001c800000-ffffe200387fffff] PMD -> [ffff810820200000-ffff81083c1fffff] on node 1
 [ffffe20040000000-ffffe2007fffffff] PUD ->ffff811027a00000 on node 2
 [ffffe20038800000-ffffe2003fffffff] PMD -> [ffff811020200000-ffff8110279fffff] on node 2
[ffffe20054700000-ffffe200547fffff] potential offnode page_structs
 [ffffe20040000000-ffffe200547fffff] PMD -> [ffff811027c00000-ffff81103c3fffff] on node 2
[ffffe20070700000-ffffe200707fffff] potential offnode page_structs
 [ffffe20054800000-ffffe200707fffff] PMD -> [ffff811820200000-ffff81183c1fffff] on node 3
 [ffffe20080000000-ffffe200bfffffff] PUD ->ffff81202fa00000 on node 4
 [ffffe20070800000-ffffe2007fffffff] PMD -> [ffff812020200000-ffff81202f9fffff] on node 4
[ffffe2008c700000-ffffe2008c7fffff] potential offnode page_structs
 [ffffe20080000000-ffffe2008c7fffff] PMD -> [ffff81202fc00000-ffff81203c3fffff] on node 4
[ffffe200a8700000-ffffe200a87fffff] potential offnode page_structs
 [ffffe2008c800000-ffffe200a87fffff] PMD -> [ffff812820200000-ffff81283c1fffff] on node 5
 [ffffe200c0000000-ffffe200ffffffff] PUD ->ffff813037a00000 on node 6
 [ffffe200a8800000-ffffe200bfffffff] PMD -> [ffff813020200000-ffff8130379fffff] on node 6
[ffffe200c4700000-ffffe200c47fffff] potential offnode page_structs
 [ffffe200c0000000-ffffe200c47fffff] PMD -> [ffff813037c00000-ffff81303c3fffff] on node 6
 [ffffe200c4800000-ffffe200e07fffff] PMD -> [ffff813820200000-ffff81383c1fffff] on node 7

instead of a very long print out...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86_64: fix setup_node_bootmem to support big mem excluding with memmap
Yinghai Lu [Tue, 18 Mar 2008 19:52:37 +0000 (12:52 -0700)]
x86_64: fix setup_node_bootmem to support big mem excluding with memmap

typical case: four sockets system, every node has 4g ram, and we are using:

memmap=10g$4g

to mask out memory on node1 and node2

when numa is enabled, early_node_mem is used to get node_data and node_bootmap.

if it can not get memory from the same node with find_e820_area(), it will
use alloc_bootmem to get buff from previous nodes.

so check it and print out some info about it.

need to move early_res_to_bootmem into every setup_node_bootmem.
and it takes range that node has. otherwise alloc_bootmem could return addr
that reserved early.

depends on "mm: make reserve_bootmem can crossed the nodes".

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86_64: make reserve_bootmem_generic() use new reserve_bootmem()
Yinghai Lu [Tue, 18 Mar 2008 19:50:21 +0000 (12:50 -0700)]
x86_64: make reserve_bootmem_generic() use new reserve_bootmem()

"mm: make reserve_bootmem can crossed the nodes" provides new
reserve_bootmem(), let reserve_bootmem_generic() use that.

reserve_bootmem_generic() is used to reserve initramdisk, so this way
we can make sure even when bootloader or kexec load ranges cross the
node memory boundaries, reserve_bootmem still works.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agomm: allow reserve_bootmem() cross nodes
Yinghai Lu [Tue, 18 Mar 2008 19:49:12 +0000 (12:49 -0700)]
mm: allow reserve_bootmem() cross nodes

split reserve_bootmem_core() into two functions, one which checks
conflicts, and one which sets the bits.

and make reserve_bootmem to loop bdata_list to cross the nodes.

user could be crashkernel and ramdisk..., in case the range provided
by those externalities crosses the nodes.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agomm: offset align in alloc_bootmem()
Yinghai Lu [Tue, 18 Mar 2008 19:44:48 +0000 (12:44 -0700)]
mm: offset align in alloc_bootmem()

need offset alignment when node_boot_start's alignment is less than
the alignment required.

use local node_boot_start to match alignment - so don't add extra operation
in search loop.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agomm: fix alloc_bootmem_core to use fast searching for all nodes
Yinghai Lu [Tue, 11 Mar 2008 06:23:42 +0000 (23:23 -0700)]
mm: fix alloc_bootmem_core to use fast searching for all nodes

Make the nodes other than node 0 use bdata->last_success for fast
search too.

We need to use __alloc_bootmem_core() for vmemmap allocation for other
nodes when numa and sparsemem/vmemmap are enabled.

Also, make fail_block path increase i with incr only after ALIGN
to avoid extra increase when size is larger than align.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agomm: make mem_map allocation continuous
Yinghai Lu [Sun, 13 Apr 2008 18:51:06 +0000 (11:51 -0700)]
mm: make mem_map allocation continuous

vmemmap allocation currently has this layout:

 [ffffe20000000000-ffffe200001fffff] PMD ->ffff810001400000 on node 0
 [ffffe20000200000-ffffe200003fffff] PMD ->ffff810001800000 on node 0
 [ffffe20000400000-ffffe200005fffff] PMD ->ffff810001c00000 on node 0
 [ffffe20000600000-ffffe200007fffff] PMD ->ffff810002000000 on node 0
 [ffffe20000800000-ffffe200009fffff] PMD ->ffff810002400000 on node 0
...

note that there is a 2M hole between them - not optimal.

the root cause is that usemap (24 bytes) will be allocated after every 2M
mem_map, and it will push next vmemmap (2M) to the next (2M) alignment.

solution: try to allocate the mem_map continously.

after the patch, we get:

 [ffffe20000000000-ffffe200001fffff] PMD ->ffff810001400000 on node 0
 [ffffe20000200000-ffffe200003fffff] PMD ->ffff810001600000 on node 0
 [ffffe20000400000-ffffe200005fffff] PMD ->ffff810001800000 on node 0
 [ffffe20000600000-ffffe200007fffff] PMD ->ffff810001a00000 on node 0
 [ffffe20000800000-ffffe200009fffff] PMD ->ffff810001c00000 on node 0
...

which is the ideal layout.

and usemap will share a page because of they are allocated continuously too:

sparse_early_usemap_alloc: usemap = ffff810024e00000 size = 24
sparse_early_usemap_alloc: usemap = ffff810024e00080 size = 24
sparse_early_usemap_alloc: usemap = ffff810024e00100 size = 24
sparse_early_usemap_alloc: usemap = ffff810024e00180 size = 24
...

so we make the bootmem allocation more compact and use less memory
for usemap => mission accomplished ;-)

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux...
Linus Torvalds [Sat, 26 Apr 2008 20:46:11 +0000 (13:46 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-generic-bitops-v3

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-generic-bitops-v3:
  x86, bitops: select the generic bitmap search functions
  x86: include/asm-x86/pgalloc.h/bitops.h: checkpatch cleanups - formatting only
  x86: finalize bitops unification
  x86, UML: remove x86-specific implementations of find_first_bit
  x86: optimize find_first_bit for small bitmaps
  x86: switch 64-bit to generic find_first_bit
  x86: generic versions of find_first_(zero_)bit, convert i386
  bitops: use __fls for fls64 on 64-bit archs
  generic: implement __fls on all 64-bit archs
  generic: introduce a generic __fls implementation
  x86: merge the simple bitops and move them to bitops.h
  x86, generic: optimize find_next_(zero_)bit for small constant-size bitmaps
  x86, uml: fix uml with generic find_next_bit for x86
  x86: change x86 to use generic find_next_bit
  uml: Kconfig cleanup
  uml: fix build error

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Sat, 26 Apr 2008 20:44:19 +0000 (13:44 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (46 commits)
  ide: constify struct ide_dma_ops
  ide: add struct ide_dma_ops (take 3)
  ide: add IDE_HFLAG_SERIALIZE_DMA host flag
  sl82c105: check bridge revision in sl82c105_init_one()
  au1xxx-ide: use ->init_dma method
  palm_bk3710: use ->init_dma method
  sgiioc4: use ->init_dma method
  icside: use ->init_dma method
  ide-pmac: use ->init_dma method
  ide: do complete DMA setup in ->init_dma method (take 2)
  au1xxx-ide: fix MWDMA support
  ide: cleanup ide_setup_dma()
  ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma()
  ide: export ide_allocate_dma_engine()
  ide: move ide_setup_dma() call out from ->init_dma method
  alim15x3: skip DMA initialization completely on revs < 0x20
  pdc202xx_old: remove init_dma_pdc202xx()
  ide: don't display "BIOS" settings in ide_setup_dma()
  ide: remove ->cds field from ide_hwif_t (take 2)
  ide: remove ide_dma_iobase()
  ...

16 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux...
Linus Torvalds [Sat, 26 Apr 2008 20:29:41 +0000 (13:29 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86-bigbox-bootparam

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86-bigbox-bootparam:
  x86, boot: Document for linked list of struct setup_data
  x86, boot: export linked list of struct setup_data via debugfs
  x86, boot: add linked list of struct setup_data
  x86, boot: add free_early to early reservation machanism

16 years agoide: constify struct ide_dma_ops
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:24 +0000 (22:25 +0200)]
ide: constify struct ide_dma_ops

* Export ide_dma_exec_cmd() and __ide_dma_test_irq().

* Constify struct ide_dma_ops.

* Always set hwif->dma_ops to &sff_dma_ops in ide_setup_dma()
  (it is later overriden by ide_init_port() if needed) and drop
  'const struct ide_port_info *d' argument.

While at it:

* Rename __ide_dma_test_irq() to ide_dma_test_irq().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add struct ide_dma_ops (take 3)
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:24 +0000 (22:25 +0200)]
ide: add struct ide_dma_ops (take 3)

Add struct ide_dma_ops and convert core code + drivers to use it.

While at it:

* Drop "ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods.

* Drop "ide_" "infixes" from DMA methods.

* au1xxx-ide.c:
  - use auide_dma_{test_irq,end}() directly in auide_dma_timeout()

* pdc202xx_old.c:
  - drop "old_" "infixes" from DMA methods

* siimage.c:
  - add siimage_dma_test_irq() helper
  - print SATA warning in siimage_init_one()

* Remove no longer needed ->init_hwif implementations.

v2:
* Changes based on review from Sergei:
  - s/siimage_ide_dma_test_irq/siimage_dma_test_irq/
  - s/drive->hwif/hwif/ in idefloppy_pc_intr().
  - fix patch description w.r.t. au1xxx-ide changes
  - fix au1xxx-ide build
  - fix naming for cmd64*_dma_ops
  - drop "ide_" and "old_" infixes
  - s/hpt3xxx_dma_ops/hpt37x_dma_ops/
  - s/hpt370x_dma_ops/hpt370_dma_ops/
  - use correct DMA ops for HPT302/N, HPT371/N and HPT374
  - s/it821x_smart_dma_ops/it821x_pass_through_dma_ops/

v3:
* Two bugs slipped in v2 (noticed by Sergei):
  - use correct DMA ops for HPT374 (for real this time)
  - handle HPT370/HPT370A properly

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add IDE_HFLAG_SERIALIZE_DMA host flag
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:24 +0000 (22:25 +0200)]
ide: add IDE_HFLAG_SERIALIZE_DMA host flag

* Add IDE_HFLAG_SERIALIZE_DMA host flag to serialize ports
  if DMA is available and handle it in ide_init_port().

* Convert sl82c105 host driver to use this new flag.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosl82c105: check bridge revision in sl82c105_init_one()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:23 +0000 (22:25 +0200)]
sl82c105: check bridge revision in sl82c105_init_one()

* Make sl82c105_bridge_revision() return 'u8' instead of 'unsigned long'.

* Check bridge revision in sl82c105_init_one().

While at:

* Use proper KERN_ level for printk().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide: use ->init_dma method
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:23 +0000 (22:25 +0200)]
au1xxx-ide: use ->init_dma method

* Pass 'ide_hwif_t *hwif' instead of '_auide_hwif *auide' to
  auide_ddma_init().

* Add 'const struct ide_port_info *d' argument to auide_ddma_init().

* Convert the driver to use ->init_dma method.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agopalm_bk3710: use ->init_dma method
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:23 +0000 (22:25 +0200)]
palm_bk3710: use ->init_dma method

* Move DMA setup to palm_bk3710_init_dma().

* Convert the driver to use ->init_dma method.

Cc: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosgiioc4: use ->init_dma method
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:23 +0000 (22:25 +0200)]
sgiioc4: use ->init_dma method

* Move dma_base check from sgiioc4_ide_setup_pci_device()
  to ide_dma_sgiioc4().

* Replace ide_dma_sgiioc4() 'unsigned long dma_base' argument
  by 'const struct ide_port_info *d'.

* Move hwif->INB setup from ide_init_sgiioc4() to
  sgiioc4_ide_setup_pci_device().

* Move ide_init_sgiioc4() call from sgiioc4_ide_setup_pci_device()
  to ide_dma_sgiioc4().

* Convert the driver to use ->init_dma method.

Cc: Jeremy Higdon <jeremy@sgi.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoicside: use ->init_dma method
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:23 +0000 (22:25 +0200)]
icside: use ->init_dma method

* Add 'const struct ide_port_info *d' argument to icside_dma_init().

* Make icside_dma_init() return an error value and add icside_dma_off_init()
  (->init_dma implementation for case when DMA cannot be enabled).

* Convert the driver to use ->init_dma method.

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-pmac: use ->init_dma method
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:22 +0000 (22:25 +0200)]
ide-pmac: use ->init_dma method

* Move pmif->dma_regs check from pmac_ide_setup_device() to
  pmac_ide_init_dma().

* Get 'pmif' from 'hwif->hwif_data' in pmac_ide_init_dma() and replace
  'pmac_ide_hwif_t *pmif' argument by 'const struct ide_port_info *d'.

* Add pmac_ide_init_dma() implementation for CONFIG_BLK_DEV_IDEDMA_PMAC=n
  case and convert the driver to use ->init_dma method.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: do complete DMA setup in ->init_dma method (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:22 +0000 (22:25 +0200)]
ide: do complete DMA setup in ->init_dma method (take 2)

* Make ide_hwif_setup_dma() return an error value.

* Pass 'const struct ide_port_info *d' instead of 'unsigned long dmabase'
  to ->init_dma method and make it return an error value.

* Rename ide_get_or_set_dma_base() to ide_pci_dma_base(),
  change ordering of its arguments and then export it.

* Export ide_pci_set_master().

* Do complete DMA setup inside ->init_dma method and update ->init_dma
  users accordingly.

* Sanitize code for DMA setup in ide_init_port().

v2:
* Fix for CONFIG_BLK_DEV_IDEDMA_PCI=n configs
  (from Jiri Slaby <jirislaby@gmail.com>):

  Fix following compiler warning by returning EINVAL:

  In file included from ANYTHING-INCLUDING-IDE.H:45:
  include/linux/ide.h: In function â€˜ide_hwif_setup_dma’:
  include/linux/ide.h:1022: warning: no return statement in function returning non-void

Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide: fix MWDMA support
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:22 +0000 (22:25 +0200)]
au1xxx-ide: fix MWDMA support

Always use "fast" MWDMA support and remove dma_{black,white}_list
(they were based on completely bogus ->ide_dma_check implementation
which didn't set neither the host controller timings nor the device
for the desired transfer mode).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: cleanup ide_setup_dma()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)]
ide: cleanup ide_setup_dma()

* There is no need to call ide_release_dma_engine().

* Move the code up to (and including) ide_allocate_dma_engine()
  call to the callers of ide_setup_dma().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: factor out setting PCI bus-mastering from ide_hwif_setup_dma()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)]
ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma()

Factor out setting PCI bus-mastering from ide_hwif_setup_dma()
to ide_pci_set_master() helper.

While at it:

* don't read PCI Command register if not necessary

* use PCI device name instead of hwif->name

* cleanup ide_hwif_setup_dma() a bit

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: export ide_allocate_dma_engine()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)]
ide: export ide_allocate_dma_engine()

Export ide_allocate_dma_engine() and use it in trm290 host driver.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move ide_setup_dma() call out from ->init_dma method
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)]
ide: move ide_setup_dma() call out from ->init_dma method

There should be no functional changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoalim15x3: skip DMA initialization completely on revs < 0x20
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)]
alim15x3: skip DMA initialization completely on revs < 0x20

Skip DMA initialization completely on revs < 0x20 by setting IDE_HFLAG_NO_DMA
host flag and resetting DMA host masks in alim15x3_init_one() (currently
ide_hwif_setup_dma() will try to obtain DMA base and setup PCI bus-mastering
but init_dma_ali15x3() will fail).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agopdc202xx_old: remove init_dma_pdc202xx()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)]
pdc202xx_old: remove init_dma_pdc202xx()

Do PDC202xx specific DMA initialization in init_chipset_pdc202xx()
and remove no longer needed init_dma_pdc202xx().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: don't display "BIOS" settings in ide_setup_dma()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:20 +0000 (22:25 +0200)]
ide: don't display "BIOS" settings in ide_setup_dma()

Nowadays BIOS info is not very useful and only confuses users since:

- IDE always tries to use DMA

- BIOS info may not be accurate with modular IDE/libata

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ->cds field from ide_hwif_t (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:20 +0000 (22:25 +0200)]
ide: remove ->cds field from ide_hwif_t (take 2)

* Use hwif->name instead of cds->name in ide_allocate_dma_engine().

* Use pci_name(dev) instead of cds->name in init_dma_pdc202xx().

* Remove no longer needed ->cds field from ide_hwif_t.

v2:

* scc_pata.c also needs to be updated now (noticed by Stephen Rothwell).

There should be no functional changes caused by this patch.

Cc: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Cc: Akira Iguchi <akira2.iguchi@toshiba.co.jp>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ide_dma_iobase()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:20 +0000 (22:25 +0200)]
ide: remove ide_dma_iobase()

* ide_mapped_mmio_dma() and ide_iomio_dma() are called only by
  ide_dma_iobase() so inline them there.

* ide_dma_iobase() is called only by ide_setup_dma() so inline
  it there.

* Setup hwif->extra_base also if hwif->mmio flag is set.

There should be no functional changes casued by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ->extra field from struct ide_port_info
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:20 +0000 (22:25 +0200)]
ide: remove ->extra field from struct ide_port_info

Always setup hwif->extra_base in ide_iomio_dma() and remove
no longer needed ->extra field from struct ide_port_info.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: replace remaining __FUNCTION__ occurrences
Harvey Harrison [Sat, 26 Apr 2008 20:25:20 +0000 (22:25 +0200)]
ide: replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

[bart: fix checkpatch.pl errors in ide-lib.c and ppc/mpc8xx.c while at it]

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-tape: remove idetape_pipeline_active()
Borislav Petkov [Sat, 26 Apr 2008 20:25:20 +0000 (22:25 +0200)]
ide-tape: remove idetape_pipeline_active()

This function was simply a wrapper for a test_bit() macro so remove it and
use the macro instead.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: cleanup setting hwif->mmio flag
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:19 +0000 (22:25 +0200)]
ide: cleanup setting hwif->mmio flag

It is no longer needed to set hwif->mmio flag to tell IDE layer to not
manage resources so cleanup host drivers that used hwif->mmio flag only
for this purpose.

Ditto for ide_legacy_init_one().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ide_hwif_request_regions()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:19 +0000 (22:25 +0200)]
ide: remove ide_hwif_request_regions()

Remove no longer used ide_hwif_request_regions() and hwif_request_region().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: manage resources for PCI devices in ide_pci_enable() (take 3)
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:19 +0000 (22:25 +0200)]
ide: manage resources for PCI devices in ide_pci_enable() (take 3)

* Reserve PCI BARs 0-3 (0-1 for single port controllers) in
  ide_pci_enable() and remove ide_hwif_request_regions() call
  from ide_device_add_all() (also cleanup resource management
  in scc_pata host driver).

* Fix handling of PCI BAR 4 in ide_pci_enable(), then cleanup
  ide_iomio_dma() (+ init_hwif_trm290() in trm290 host driver)
  and remove ide_release[_iomio]_dma().

v2:
* Fixup trm290 host driver.

v3:
* Because of scc_pata host driver changes we need to call
  pci_request_selected_regions() also in setup_mmio_scc().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agocmd640: manage I/O resources in driver
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:19 +0000 (22:25 +0200)]
cmd640: manage I/O resources in driver

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Use driver name for resources management.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: manage I/O resources in ide_legacy_init_one()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:18 +0000 (22:25 +0200)]
ide: manage I/O resources in ide_legacy_init_one()

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Set ->name field of 'struct ide_port_info' instances in legacy VLB
  host drivers and use driver name for resources management.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_legacy_init_one() helper
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:18 +0000 (22:25 +0200)]
ide: add ide_legacy_init_one() helper

Move the common code for primary/seconary port setup from
ide_legacy_device_add() to ide_legacy_init_one().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide_arm: manage I/O resources in driver
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:18 +0000 (22:25 +0200)]
ide_arm: manage I/O resources in driver

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Use driver name for resources management.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-4drives: manage I/O resources in driver
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:18 +0000 (22:25 +0200)]
ide-4drives: manage I/O resources in driver

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Use driver name for resources management.

* Remove no longer needed 'hwif->chipset == ide_4drives' handling
  from ide_device_add_all().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-generic: manage I/O resources in driver
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:17 +0000 (22:25 +0200)]
ide-generic: manage I/O resources in driver

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Use driver name for resources management.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ide_hwif_release_regions()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:17 +0000 (22:25 +0200)]
ide: remove ide_hwif_release_regions()

All host drivers using ide_unregister()/module_exit() have been fixed
to manage resources themselves so this function can be removed now.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: register ports with non-present devices (for warm-plug)
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:17 +0000 (22:25 +0200)]
ide: register ports with non-present devices (for warm-plug)

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cs: manage I/O resources in driver
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:17 +0000 (22:25 +0200)]
ide-cs: manage I/O resources in driver

* Make idecs_register() return pointer to hwif structure instead of
  hwif's index.

* Store pointer to hwif structure instead of hwif's index in ide_info_t
  (fixes ide-cs for IDE[6-9]_MAJOR major numbers).

* Remove no longer needed ide_major[].

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Use driver name for resources management.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-pnp: manage I/O resources in driver
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:16 +0000 (22:25 +0200)]
ide-pnp: manage I/O resources in driver

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Use driver name for resources management.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoqd65xx: cleanup qd_probe()
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:16 +0000 (22:25 +0200)]
qd65xx: cleanup qd_probe()

* Replace 'if ()'-s by 'switch ()' block.

* Merge common code for QD6500/QD6580A/QD6580B.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: use ide_legacy_device_add() for qd65xx (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:16 +0000 (22:25 +0200)]
ide: use ide_legacy_device_add() for qd65xx (take 2)

* Add 'unsigned long config' argument to ide_legacy_device_add()
  for setting hwif->config_data.

* Use ide_find_port_slot() instead of ide_find_port() in
  ide_legacy_device_add().

* Handle IDE_HFLAG_QD_2ND_PORT and IDE_HFLAG_SINGLE host flags in
  ide_legacy_device_add().

* Convert qd65xx host driver to use ide_legacy_device_add().

v2:
* Update ali14xx, dtc2278, ht6560b and umc8672 host drivers.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_legacy_device_add() helper
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:16 +0000 (22:25 +0200)]
ide: add ide_legacy_device_add() helper

Add ide_legacy_device_add() helper for use by legacy VLB host drivers
(+ convert them to use it).

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ->noprobe field from ide_hwif_t
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:16 +0000 (22:25 +0200)]
ide: remove ->noprobe field from ide_hwif_t

Update IDE PMAC host driver to use drive->noprobe instead of hwif->noprobe
and remove hwif->noprobe completely (it is always set to zero now).

There should be no functional changes caused by this patch.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: fix remaining checkpatch.pl issues
Borislav Petkov [Sat, 26 Apr 2008 20:25:15 +0000 (22:25 +0200)]
ide-cd: fix remaining checkpatch.pl issues

Some of them are:
WARNING: braces {} are not necessary for single statement blocks
CHECK: multiple assignments should be avoided
WARNING: printk() should include KERN_ facility level
WARNING: no space between function name and open parenthesis '('

[bart: minor fixups]

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: shorten lines longer than 80 columns
Borislav Petkov [Sat, 26 Apr 2008 20:25:15 +0000 (22:25 +0200)]
ide-cd: shorten lines longer than 80 columns

[bart: minor fixups]

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: fixup comments
Borislav Petkov [Sat, 26 Apr 2008 20:25:15 +0000 (22:25 +0200)]
ide-cd: fixup comments

[bart: minor fixups, md5sum checked]

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: put all proc-related code at one place
Borislav Petkov [Sat, 26 Apr 2008 20:25:15 +0000 (22:25 +0200)]
ide-cd: put all proc-related code at one place

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: include proper headers
Borislav Petkov [Sat, 26 Apr 2008 20:25:15 +0000 (22:25 +0200)]
ide-cd: include proper headers

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add struct ide_port_ops (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Apr 2008 20:25:14 +0000 (22:25 +0200)]
ide: add struct ide_port_ops (take 2)

* Move hooks for port/host specific methods from ide_hwif_t to
  'struct ide_port_ops'.

* Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
  and ide_hwif_t.

* Update host drivers and core code accordingly.

While at it:

* Rename ata66_*() cable detect functions to *_cable_detect() to match
  the standard naming. (Suggested by Sergei Shtylyov)

v2:
* Fix build for bast-ide. (Noticed by Andrew Morton)

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agox86, boot: Document for linked list of struct setup_data
Huang, Ying [Fri, 28 Mar 2008 02:49:50 +0000 (10:49 +0800)]
x86, boot: Document for linked list of struct setup_data

Documentation for linked list of struct setup_data.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, boot: export linked list of struct setup_data via debugfs
Huang, Ying [Fri, 28 Mar 2008 02:49:48 +0000 (10:49 +0800)]
x86, boot: export linked list of struct setup_data via debugfs

Export linked list of struct setup_data via debugfs.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, boot: add linked list of struct setup_data
Huang, Ying [Fri, 28 Mar 2008 02:49:44 +0000 (10:49 +0800)]
x86, boot: add linked list of struct setup_data

This patch adds a field of 64-bit physical pointer to NULL terminated
single linked list of struct setup_data to real-mode kernel
header. This is used as a more extensible boot parameters passing
mechanism.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, boot: add free_early to early reservation machanism
Huang, Ying [Fri, 28 Mar 2008 02:49:42 +0000 (10:49 +0800)]
x86, boot: add free_early to early reservation machanism

Add free_early to early reservation mechanism - this way early bootup
failure paths can stop wasting memory.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, PAT: disable /dev/mem mmap RAM with PAT
Venki Pallipadi [Sat, 26 Apr 2008 18:32:12 +0000 (11:32 -0700)]
x86, PAT: disable /dev/mem mmap RAM with PAT

disable /dev/mem mmap of RAM with PAT. It makes things safer and
eliminates aliasing. A future improvement would be to avoid the
range_is_allowed duplication.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agokbuild: scripts/Makefile.modpost typo fix
Adrian Bunk [Fri, 25 Apr 2008 20:40:16 +0000 (23:40 +0300)]
kbuild: scripts/Makefile.modpost typo fix

-EVIUSER  ;-)

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
16 years agokbuild: soften MODULE_LICENSE check
Sam Ravnborg [Sat, 26 Apr 2008 19:07:26 +0000 (21:07 +0200)]
kbuild: soften MODULE_LICENSE check

Only modules that has other MODULE_* content
shall have the MODULE_LICENSE() tag.

This fixes allmodconfig build on my box.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
16 years agox86, bitops: select the generic bitmap search functions
Alexander van Heukelum [Fri, 25 Apr 2008 11:12:53 +0000 (13:12 +0200)]
x86, bitops: select the generic bitmap search functions

Introduce GENERIC_FIND_FIRST_BIT and GENERIC_FIND_NEXT_BIT in
lib/Kconfig, defaulting to off. An arch that wants to use the
generic implementation now only has to use a select statement
to include them.

I added an always-y option (X86_CPU) to arch/x86/Kconfig.cpu
and used that to select the generic search functions. This
way ARCH=um SUBARCH=i386 automatically picks up the change
too, and arch/um/Kconfig.i386 can therefore be simplified a
bit. ARCH=um SUBARCH=x86_64 does things differently, but
still compiles fine. It seems that a "def_bool y" always
wins over a "def_bool n"?

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: include/asm-x86/pgalloc.h/bitops.h: checkpatch cleanups - formatting only
Joe Perches [Sun, 23 Mar 2008 08:03:07 +0000 (01:03 -0700)]
x86: include/asm-x86/pgalloc.h/bitops.h: checkpatch cleanups - formatting only

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: finalize bitops unification
Alexander van Heukelum [Fri, 4 Apr 2008 18:49:30 +0000 (20:49 +0200)]
x86: finalize bitops unification

include/asm-x86/bitops_32.h and include/asm-x86/bitops_64.h are now
almost identical. The 64-bit version sets ARCH_HAS_FAST_MULTIPLIER
and has an extra inline function set_bit_string. The define currently
has no influence on the generated code, but it can be argued that
setting it on i386 is the right thing to do anyhow. The addition
of the extra inline function on i386 does not hurt either.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86, UML: remove x86-specific implementations of find_first_bit
Alexander van Heukelum [Tue, 1 Apr 2008 15:47:57 +0000 (17:47 +0200)]
x86, UML: remove x86-specific implementations of find_first_bit

x86 has been switched to the generic versions of find_first_bit
and find_first_zero_bit, but the original versions were retained.
This patch just removes the now unused x86-specific versions.

also update UML.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: optimize find_first_bit for small bitmaps
Alexander van Heukelum [Tue, 1 Apr 2008 15:42:21 +0000 (17:42 +0200)]
x86: optimize find_first_bit for small bitmaps

Avoid a call to find_first_bit if the bitmap size is know at
compile time and small enough to fit in a single long integer.
Modeled after an optimization in the original x86_64-specific
code.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: switch 64-bit to generic find_first_bit
Alexander van Heukelum [Tue, 1 Apr 2008 15:41:26 +0000 (17:41 +0200)]
x86: switch 64-bit to generic find_first_bit

Switch x86_64 to generic find_first_bit. The x86_64-specific
implementation is not removed.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: generic versions of find_first_(zero_)bit, convert i386
Alexander van Heukelum [Tue, 1 Apr 2008 09:46:19 +0000 (11:46 +0200)]
x86: generic versions of find_first_(zero_)bit, convert i386

Generic versions of __find_first_bit and __find_first_zero_bit
are introduced as simplified versions of __find_next_bit and
__find_next_zero_bit. Their compilation and use are guarded by
a new config variable GENERIC_FIND_FIRST_BIT.

The generic versions of find_first_bit and find_first_zero_bit
are implemented in terms of the newly introduced __find_first_bit
and __find_first_zero_bit.

This patch does not remove the i386-specific implementation,
but it does switch i386 to use the generic functions by setting
GENERIC_FIND_FIRST_BIT=y for X86_32.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agobitops: use __fls for fls64 on 64-bit archs
Alexander van Heukelum [Sat, 15 Mar 2008 17:32:36 +0000 (18:32 +0100)]
bitops: use __fls for fls64 on 64-bit archs

Use __fls for fls64 on 64-bit archs. The implementation for
64-bit archs is moved from x86_64 to asm-generic.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agogeneric: implement __fls on all 64-bit archs
Alexander van Heukelum [Sat, 15 Mar 2008 17:31:49 +0000 (18:31 +0100)]
generic: implement __fls on all 64-bit archs

Implement __fls on all 64-bit archs:

alpha has an implementation of fls64.
Added __fls(x) = fls64(x) - 1.

ia64 has fls, but not __fls.
Added __fls based on code of fls.

mips and powerpc have __ilog2, which is the same as __fls.
Added __fls = __ilog2.

parisc, s390, sh and sparc64:
Include generic __fls.

x86_64 already has __fls.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agogeneric: introduce a generic __fls implementation
Alexander van Heukelum [Sat, 15 Mar 2008 17:30:57 +0000 (18:30 +0100)]
generic: introduce a generic __fls implementation

Add a generic __fls implementation in the same spirit as
the generic __ffs one. It finds the last (most significant)
set bit in the given long value.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: merge the simple bitops and move them to bitops.h
Alexander van Heukelum [Sat, 15 Mar 2008 12:04:42 +0000 (13:04 +0100)]
x86: merge the simple bitops and move them to bitops.h

Some of those can be written in such a way that the same
inline assembly can be used to generate both 32 bit and
64 bit code.

For ffs and fls, x86_64 unconditionally used the cmov
instruction and i386 unconditionally used a conditional
branch over a mov instruction. In the current patch I
chose to select the version based on the availability
of the cmov instruction instead. A small detail here is
that x86_64 did not previously set CONFIG_X86_CMOV=y.

Improved comments for ffs, ffz, fls and variations.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86, generic: optimize find_next_(zero_)bit for small constant-size bitmaps
Alexander van Heukelum [Tue, 11 Mar 2008 15:17:19 +0000 (16:17 +0100)]
x86, generic: optimize find_next_(zero_)bit for small constant-size bitmaps

This moves an optimization for searching constant-sized small
bitmaps form x86_64-specific to generic code.

On an i386 defconfig (the x86#testing one), the size of vmlinux hardly
changes with this applied. I have observed only four places where this
optimization avoids a call into find_next_bit:

In the functions return_unused_surplus_pages, alloc_fresh_huge_page,
and adjust_pool_surplus, this patch avoids a call for a 1-bit bitmap.
In __next_cpu a call is avoided for a 32-bit bitmap. That's it.

On x86_64, 52 locations are optimized with a minimal increase in
code size:

Current #testing defconfig:
146 x bsf, 27 x find_next_*bit
   text    data     bss     dec     hex filename
   5392637  846592  724424 6963653  6a41c5 vmlinux

After removing the x86_64 specific optimization for find_next_*bit:
94 x bsf, 79 x find_next_*bit
   text    data     bss     dec     hex filename
   5392358  846592  724424 6963374  6a40ae vmlinux

After this patch (making the optimization generic):
146 x bsf, 27 x find_next_*bit
   text    data     bss     dec     hex filename
   5392396  846592  724424 6963412  6a40d4 vmlinux

[ tglx@linutronix.de: build fixes ]

Signed-off-by: Ingo Molnar <mingo@elte.hu>