GitHub/LineageOS/android_kernel_motorola_exynos9610.git
15 years agoMerge branches 'iommu/api' and 'iommu/amd' into for-linus
Joerg Roedel [Sat, 3 Jan 2009 15:43:44 +0000 (16:43 +0100)]
Merge branches 'iommu/api' and 'iommu/amd' into for-linus

15 years agoAMD IOMMU: prealloc_protection_domains should be static
Jaswinder Singh Rajput [Mon, 29 Dec 2008 16:15:22 +0000 (21:45 +0530)]
AMD IOMMU: prealloc_protection_domains should be static

Impact: cleanup, reduce kernel size a bit, avoid sparse warning

Fixes sparse warning:
arch/x86/kernel/amd_iommu.c:1299:6: warning: symbol 'prealloc_protection_domains' was not declared. Should it be static?

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agokvm/iommu: fix compile warning
Joerg Roedel [Sat, 3 Jan 2009 15:37:53 +0000 (16:37 +0100)]
kvm/iommu: fix compile warning

This fixes a compile warning about a variable thats maybe used
uninitialized in the function.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add statistics about total number of map requests
Joerg Roedel [Fri, 12 Dec 2008 15:13:04 +0000 (16:13 +0100)]
AMD IOMMU: add statistics about total number of map requests

Impact: see total number of map requests in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add statistics about allocated io memory
Joerg Roedel [Fri, 12 Dec 2008 14:57:30 +0000 (15:57 +0100)]
AMD IOMMU: add statistics about allocated io memory

Impact: see amount of allocated io memory in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for domain tlb flushes
Joerg Roedel [Fri, 12 Dec 2008 14:48:28 +0000 (15:48 +0100)]
AMD IOMMU: add stats counter for domain tlb flushes

Impact: see number of domain tlb flushes in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for single iommu domain tlb flushes
Joerg Roedel [Fri, 12 Dec 2008 14:46:29 +0000 (15:46 +0100)]
AMD IOMMU: add stats counter for single iommu domain tlb flushes

Impact: see number of single iommu domain tlb flushes in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for cross-page request
Joerg Roedel [Fri, 12 Dec 2008 14:42:39 +0000 (15:42 +0100)]
AMD IOMMU: add stats counter for cross-page request

Impact: see number of requests for more than one page in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for free_coherent requests
Joerg Roedel [Fri, 12 Dec 2008 14:16:38 +0000 (15:16 +0100)]
AMD IOMMU: add stats counter for free_coherent requests

Impact: see number of free_coherent requests in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for alloc_coherent requests
Joerg Roedel [Fri, 12 Dec 2008 14:14:21 +0000 (15:14 +0100)]
AMD IOMMU: add stats counter for alloc_coherent requests

Impact: see number of alloc_coherent requests in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for unmap_sg requests
Joerg Roedel [Fri, 12 Dec 2008 14:12:14 +0000 (15:12 +0100)]
AMD IOMMU: add stats counter for unmap_sg requests

Impact: see number of unmap_sg requests in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for map_sg requests
Joerg Roedel [Fri, 12 Dec 2008 14:09:48 +0000 (15:09 +0100)]
AMD IOMMU: add stats counter for map_sg requests

Impact: see number of map_sg requests in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for unmap_single requests
Joerg Roedel [Fri, 12 Dec 2008 14:07:12 +0000 (15:07 +0100)]
AMD IOMMU: add stats counter for unmap_single requests

Impact: see number of unmap_single requests in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for map_single requests
Joerg Roedel [Fri, 12 Dec 2008 14:05:16 +0000 (15:05 +0100)]
AMD IOMMU: add stats counter for map_single requests

Impact: see number of map_single requests in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add stats counter for completion wait events
Joerg Roedel [Fri, 12 Dec 2008 13:59:58 +0000 (14:59 +0100)]
AMD IOMMU: add stats counter for completion wait events

Impact: see number of completion wait events in debugfs

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add init code for statistic collection
Joerg Roedel [Fri, 12 Dec 2008 12:50:21 +0000 (13:50 +0100)]
AMD IOMMU: add init code for statistic collection

Impact: create a new debugfs directory

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add necessary header defines for stats counting
Joerg Roedel [Fri, 12 Dec 2008 11:33:06 +0000 (12:33 +0100)]
AMD IOMMU: add necessary header defines for stats counting

Impact: add defines to make iommu stats collection configurable

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add Kconfig entry for statistic collection code
Joerg Roedel [Thu, 11 Dec 2008 18:00:12 +0000 (19:00 +0100)]
AMD IOMMU: add Kconfig entry for statistic collection code

Impact: adds new Kconfig entry

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: use dev_name in iommu_enable function
Joerg Roedel [Wed, 10 Dec 2008 19:04:18 +0000 (20:04 +0100)]
AMD IOMMU: use dev_name in iommu_enable function

Impact: cleanup

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: use calc_devid in prealloc_protection_domains
Joerg Roedel [Wed, 10 Dec 2008 19:01:45 +0000 (20:01 +0100)]
AMD IOMMU: use calc_devid in prealloc_protection_domains

Impact: cleanup

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: convert amd_iommu_isolate to bool
Joerg Roedel [Fri, 12 Dec 2008 12:53:54 +0000 (13:53 +0100)]
AMD IOMMU: convert amd_iommu_isolate to bool

Impact: cleanup

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: convert iommu->need_sync to bool
Joerg Roedel [Wed, 10 Dec 2008 18:58:00 +0000 (19:58 +0100)]
AMD IOMMU: convert iommu->need_sync to bool

Impact: use bool instead of int for iommu->need_sync

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: use dev_name instead of self-build print_devid
Joerg Roedel [Wed, 10 Dec 2008 18:43:07 +0000 (19:43 +0100)]
AMD IOMMU: use dev_name instead of self-build print_devid

Impact: use generic dev_name instead of own function

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: allocate a new protection for hotplugged devices
Joerg Roedel [Wed, 10 Dec 2008 18:33:26 +0000 (19:33 +0100)]
AMD IOMMU: allocate a new protection for hotplugged devices

Impact: also hotplug devices benefit from device isolation

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add a domain flag for default domains
Joerg Roedel [Wed, 10 Dec 2008 17:48:59 +0000 (18:48 +0100)]
AMD IOMMU: add a domain flag for default domains

Impact: adds a new protection domain flag

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: register functions for the IOMMU API
Joerg Roedel [Wed, 3 Dec 2008 16:00:17 +0000 (17:00 +0100)]
AMD IOMMU: register functions for the IOMMU API

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add domain address lookup function for IOMMU API
Joerg Roedel [Tue, 2 Dec 2008 19:05:50 +0000 (20:05 +0100)]
AMD IOMMU: add domain address lookup function for IOMMU API

Impact: add a generic function to lockup addresses in protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add domain unmap function for IOMMU API
Joerg Roedel [Tue, 2 Dec 2008 18:59:10 +0000 (19:59 +0100)]
AMD IOMMU: add domain unmap function for IOMMU API

Impact: add a generic function to unmap pages into protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add domain map function for IOMMU API
Joerg Roedel [Tue, 2 Dec 2008 18:48:43 +0000 (19:48 +0100)]
AMD IOMMU: add domain map function for IOMMU API

Impact: add a generic function to map pages into protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add device attach function for IOMMU API
Joerg Roedel [Tue, 2 Dec 2008 18:34:11 +0000 (19:34 +0100)]
AMD IOMMU: add device attach function for IOMMU API

Impact: add a generic function to attach devices to protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add device detach function for IOMMU API
Joerg Roedel [Mon, 8 Dec 2008 11:07:44 +0000 (12:07 +0100)]
AMD IOMMU: add device detach function for IOMMU API

Impact: add a generic function to detach devices from protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add domain destroy function for IOMMU API
Joerg Roedel [Tue, 2 Dec 2008 17:34:12 +0000 (18:34 +0100)]
AMD IOMMU: add domain destroy function for IOMMU API

Impact: add a generic function for releasing protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add domain init function for IOMMU API
Joerg Roedel [Tue, 2 Dec 2008 17:13:27 +0000 (18:13 +0100)]
AMD IOMMU: add domain init function for IOMMU API

Impact: add a generic function for allocation protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add domain cleanup helper function
Joerg Roedel [Mon, 8 Dec 2008 11:05:55 +0000 (12:05 +0100)]
AMD IOMMU: add domain cleanup helper function

Impact: add a function to remove all devices from a domain

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add device notifier callback
Joerg Roedel [Wed, 10 Dec 2008 17:27:25 +0000 (18:27 +0100)]
AMD IOMMU: add device notifier callback

Impact: inform IOMMU about state change of a device in the driver core

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add device detach helper functions
Joerg Roedel [Mon, 8 Dec 2008 11:02:41 +0000 (12:02 +0100)]
AMD IOMMU: add device detach helper functions

Impact: add helper functions to detach a device from a domain

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: rename set_device_domain function
Joerg Roedel [Wed, 10 Dec 2008 13:39:51 +0000 (14:39 +0100)]
AMD IOMMU: rename set_device_domain function

Impact: rename set_device_domain() to attach_device()

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add device reference counting for protection domains
Joerg Roedel [Tue, 2 Dec 2008 16:56:36 +0000 (17:56 +0100)]
AMD IOMMU: add device reference counting for protection domains

Impact: know how many devices are assigned to a domain

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add checks for dma_ops domain to dma_ops functions
Joerg Roedel [Tue, 2 Dec 2008 16:49:42 +0000 (17:49 +0100)]
AMD IOMMU: add checks for dma_ops domain to dma_ops functions

Impact: detect when a driver uses a device assigned otherwise

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add protection domain flags
Joerg Roedel [Tue, 2 Dec 2008 16:46:25 +0000 (17:46 +0100)]
AMD IOMMU: add protection domain flags

Imapct: add a new struct member to 'struct protection_domain'

When using protection domains for dma_ops and KVM its better to know for
which subsystem it was allocated. Add a flags member to struct
protection domain for that purpose.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add iommu_flush_domain function
Joerg Roedel [Tue, 2 Dec 2008 20:01:12 +0000 (21:01 +0100)]
AMD IOMMU: add iommu_flush_domain function

Impact: add a function to flush a domain id on every IOMMU

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: don't remove protection domain from iommu_pd_list
Joerg Roedel [Wed, 10 Dec 2008 19:05:52 +0000 (20:05 +0100)]
AMD IOMMU: don't remove protection domain from iommu_pd_list

Impact: save unneeded logic to add and remove domains to the list

The removal of a protection domain from the iommu_pd_list is not
necessary. Another benefit is that we save complexity because we don't
have to readd it later when the device no longer uses the domain.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: move invalidation command building to a separate function
Joerg Roedel [Tue, 2 Dec 2008 19:54:37 +0000 (20:54 +0100)]
AMD IOMMU: move invalidation command building to a separate function

Impact: refactoring of iommu_queue_inv_iommu_pages

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: refactor completion wait handling into separate functions
Joerg Roedel [Tue, 2 Dec 2008 19:34:41 +0000 (20:34 +0100)]
AMD IOMMU: refactor completion wait handling into separate functions

Impact: split one function into three

The separate functions are required synchronize commands across all
hardware IOMMUs in the system.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: add domain id free function
Joerg Roedel [Tue, 2 Dec 2008 17:28:53 +0000 (18:28 +0100)]
AMD IOMMU: add domain id free function

Impact: add code to release a domain id

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: make dma_ops_free_pagetable generic
Joerg Roedel [Tue, 2 Dec 2008 17:20:21 +0000 (18:20 +0100)]
AMD IOMMU: make dma_ops_free_pagetable generic

Impact: change code to free pagetables from protection domains

The dma_ops_free_pagetable function can only free pagetables from
dma_ops domains. Change that to free pagetables of pure protection
domains.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAMD IOMMU: rename iommu_map to iommu_map_page
Joerg Roedel [Tue, 2 Dec 2008 16:27:52 +0000 (17:27 +0100)]
AMD IOMMU: rename iommu_map to iommu_map_page

Impact: function rename

The iommu_map function maps only one page. Make this clear in the
function name.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agointel-iommu: fix bit shift at DOMAIN_FLAG_P2P_MULTIPLE_DEVICES
Mike Day [Fri, 12 Dec 2008 16:16:30 +0000 (17:16 +0100)]
intel-iommu: fix bit shift at DOMAIN_FLAG_P2P_MULTIPLE_DEVICES

Signed-off-by: Mike Day <ncmike@ncultra.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoVT-d: remove now unused intel_iommu_found function
Joerg Roedel [Wed, 3 Dec 2008 14:26:42 +0000 (15:26 +0100)]
VT-d: remove now unused intel_iommu_found function

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoVT-d: register functions for the IOMMU API
Joerg Roedel [Wed, 3 Dec 2008 14:14:02 +0000 (15:14 +0100)]
VT-d: register functions for the IOMMU API

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoVT-d: adapt domain iova_to_phys function for IOMMU API
Joerg Roedel [Wed, 3 Dec 2008 14:06:57 +0000 (15:06 +0100)]
VT-d: adapt domain iova_to_phys function for IOMMU API

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoVT-d: adapt domain map and unmap functions for IOMMU API
Joerg Roedel [Wed, 3 Dec 2008 14:04:09 +0000 (15:04 +0100)]
VT-d: adapt domain map and unmap functions for IOMMU API

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoVT-d: adapt device attach and detach functions for IOMMU API
Joerg Roedel [Wed, 3 Dec 2008 13:58:24 +0000 (14:58 +0100)]
VT-d: adapt device attach and detach functions for IOMMU API

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoVT-d: adapt domain init and destroy functions for IOMMU API
Joerg Roedel [Wed, 3 Dec 2008 13:52:32 +0000 (14:52 +0100)]
VT-d: adapt domain init and destroy functions for IOMMU API

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoKVM: change KVM to use IOMMU API
Joerg Roedel [Wed, 3 Dec 2008 13:43:34 +0000 (14:43 +0100)]
KVM: change KVM to use IOMMU API

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoselect IOMMU_API when DMAR and/or AMD_IOMMU is selected
Joerg Roedel [Wed, 26 Nov 2008 16:25:13 +0000 (17:25 +0100)]
select IOMMU_API when DMAR and/or AMD_IOMMU is selected

These two IOMMUs can implement the current version of this API. So
select the API if one or both of these IOMMU drivers is selected.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoadd frontend implementation for the IOMMU API
Joerg Roedel [Wed, 26 Nov 2008 16:21:24 +0000 (17:21 +0100)]
add frontend implementation for the IOMMU API

This API can be used by KVM for accessing different types of IOMMUs to
do device passthrough to guests. Beside that this API can also be used
by device drivers to map non-linear host memory into dma-linear
addresses to prevent sgather-gather DMA. UIO may be another user for
this API.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agointrocude linux/iommu.h for an iommu api
Joerg Roedel [Wed, 26 Nov 2008 16:02:33 +0000 (17:02 +0100)]
introcude linux/iommu.h for an iommu api

This patch introduces the API to abstract the exported VT-d functions
for KVM into a generic API. This way the AMD IOMMU implementation can
plug into this API later.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoKVM: rename vtd.c to iommu.c
Joerg Roedel [Wed, 26 Nov 2008 14:51:19 +0000 (15:51 +0100)]
KVM: rename vtd.c to iommu.c

Impact: file renamed

The code in the vtd.c file can be reused for other IOMMUs as well. So
rename it to make it clear that it handle more than VT-d.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoDeassign device in kvm_free_assgined_device
Weidong Han [Mon, 8 Dec 2008 15:29:53 +0000 (23:29 +0800)]
Deassign device in kvm_free_assgined_device

In kvm_iommu_unmap_memslots(), assigned_dev_head is already empty.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoKVM: support device deassignment
Weidong Han [Tue, 2 Dec 2008 13:24:23 +0000 (21:24 +0800)]
KVM: support device deassignment

Support device deassignment, it can be used in device hotplug.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoKVM: use the new intel iommu APIs
Weidong Han [Tue, 2 Dec 2008 13:03:39 +0000 (21:03 +0800)]
KVM: use the new intel iommu APIs

intel iommu APIs are updated, use the new APIs.

In addition, change kvm_iommu_map_guest() to just create the domain, let kvm_iommu_assign_device() assign device.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoCheck agaw is sufficient for mapped memory
Weidong Han [Mon, 8 Dec 2008 15:10:23 +0000 (23:10 +0800)]
Check agaw is sufficient for mapped memory

When domain is related to multiple iommus, need to check if the minimum agaw is sufficient for the mapped memory

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoChange intel iommu APIs of virtual machine domain
Weidong Han [Mon, 8 Dec 2008 15:09:29 +0000 (23:09 +0800)]
Change intel iommu APIs of virtual machine domain

These APIs are used by KVM to use VT-d

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoChange domain_context_mapping_one for virtual machine domain
Weidong Han [Mon, 8 Dec 2008 15:08:15 +0000 (23:08 +0800)]
Change domain_context_mapping_one for virtual machine domain

vm_domid won't be set in context, find available domain id for a device from its iommu.

For a virtual machine domain, a default agaw will be set, and skip top levels of page tables for iommu which has less agaw than default.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAllocation and free functions of virtual machine domain
Weidong Han [Mon, 8 Dec 2008 15:03:27 +0000 (23:03 +0800)]
Allocation and free functions of virtual machine domain

virtual machine domain is different from native DMA-API domain, implement separate allocation and free functions for virtual machine domain.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAdd domain_flush_cache
Weidong Han [Mon, 8 Dec 2008 15:00:00 +0000 (23:00 +0800)]
Add domain_flush_cache

Because virtual machine domain may have multiple devices from different iommus, it cannot use __iommu_flush_cache.

In some common low level functions, use domain_flush_cache instead of __iommu_flush_cache. On the other hand, in some functions, iommu can is specified or domain cannot be got, still use __iommu_flush_cache

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAdd/remove domain device info for virtual machine domain
Weidong Han [Mon, 8 Dec 2008 14:51:37 +0000 (22:51 +0800)]
Add/remove domain device info for virtual machine domain

Add iommu reference count in domain, and add a lock to protect iommu setting including iommu_bmp, iommu_count and iommu_coherency.

virtual machine domain may have multiple devices from different iommus, so it needs to do more things when add/remove domain device info. Thus implement separate these functions for virtual machine domain.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAdd domain flag DOMAIN_FLAG_VIRTUAL_MACHINE
Weidong Han [Mon, 8 Dec 2008 08:35:39 +0000 (16:35 +0800)]
Add domain flag DOMAIN_FLAG_VIRTUAL_MACHINE

Add this flag for VT-d used in virtual machine, like KVM.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoiommu coherency
Weidong Han [Mon, 8 Dec 2008 07:49:06 +0000 (15:49 +0800)]
iommu coherency

In dmar_domain, more than one iommus may be included in iommu_bmp. Due to "Coherency" capability may be different across iommus, set this variable to indicate iommu access is coherent or not. Only when all related iommus in a dmar_domain are all coherent, iommu access of this domain is coherent.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agocalculate agaw for each iommu
Weidong Han [Mon, 8 Dec 2008 07:34:06 +0000 (15:34 +0800)]
calculate agaw for each iommu

"SAGAW" capability may be different across iommus. Use a default agaw, but if default agaw is not supported in some iommus, choose a less supported agaw.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoiommu bitmap instead of iommu pointer in dmar_domain
Weidong Han [Mon, 8 Dec 2008 07:29:22 +0000 (15:29 +0800)]
iommu bitmap instead of iommu pointer in dmar_domain

In order to support assigning multiple devices from different iommus to a domain, iommu bitmap is used to keep all iommus the domain are related to.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoGet iommu from g_iommus for deferred flush
Weidong Han [Mon, 8 Dec 2008 03:24:12 +0000 (11:24 +0800)]
Get iommu from g_iommus for deferred flush

deferred_flush[] uses the iommu seq_id to index, so its iommu is fixed and can get it from g_iommus.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoAdd global iommu list
Weidong Han [Mon, 8 Dec 2008 03:06:32 +0000 (11:06 +0800)]
Add global iommu list

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agochange P2P domain flags
Weidong Han [Mon, 8 Dec 2008 01:17:15 +0000 (09:17 +0800)]
change P2P domain flags

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoInitialize domain flags to 0
Weidong Han [Sun, 7 Dec 2008 13:13:41 +0000 (21:13 +0800)]
Initialize domain flags to 0

It's random number after the domain is allocated by kmem_cache_alloc

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agoVT-d: fix segment number being ignored when searching DRHD
Yu Zhao [Mon, 22 Dec 2008 08:54:58 +0000 (16:54 +0800)]
VT-d: fix segment number being ignored when searching DRHD

On platforms with multiple PCI segments, any of the segments can have a DRHD
with INCLUDE_PCI_ALL flag. So need to check the DRHD's segment number against
the PCI device's when searching its DRHD.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
15 years agointel-iommu: trivially inline DMA PTE macros
Mark McLoughlin [Fri, 21 Nov 2008 16:56:53 +0000 (16:56 +0000)]
intel-iommu: trivially inline DMA PTE macros

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: trivially inline context entry macros
Mark McLoughlin [Fri, 21 Nov 2008 16:54:46 +0000 (16:54 +0000)]
intel-iommu: trivially inline context entry macros

Some macros were unused, so I just dropped them:

  context_fault_disable
  context_translation_type
  context_address_root
  context_address_width
  context_domain_id

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: move iommu_prepare_gfx_mapping() out of dma_remapping.h
Mark McLoughlin [Thu, 20 Nov 2008 15:49:50 +0000 (15:49 +0000)]
intel-iommu: move iommu_prepare_gfx_mapping() out of dma_remapping.h

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: kill off duplicate def of dmar_disabled
Mark McLoughlin [Thu, 20 Nov 2008 15:49:49 +0000 (15:49 +0000)]
intel-iommu: kill off duplicate def of dmar_disabled

This is only used in dmar.c and intel-iommu.h, so dma_remapping.h
seems like the appropriate place for it.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: move struct device_domain_info out of dma_remapping.h
Mark McLoughlin [Thu, 20 Nov 2008 15:49:48 +0000 (15:49 +0000)]
intel-iommu: move struct device_domain_info out of dma_remapping.h

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: move struct dmar_domain def out dma_remapping.h
Mark McLoughlin [Thu, 20 Nov 2008 15:49:47 +0000 (15:49 +0000)]
intel-iommu: move struct dmar_domain def out dma_remapping.h

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: move DMA PTE defs out of dma_remapping.h
Mark McLoughlin [Thu, 20 Nov 2008 15:49:46 +0000 (15:49 +0000)]
intel-iommu: move DMA PTE defs out of dma_remapping.h

DMA_PTE_READ/WRITE are needed by kvm.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: move context entry defs out from dma_remapping.h
Mark McLoughlin [Thu, 20 Nov 2008 15:49:45 +0000 (15:49 +0000)]
intel-iommu: move context entry defs out from dma_remapping.h

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: move root entry defs from dma_remapping.h
Mark McLoughlin [Thu, 20 Nov 2008 15:49:44 +0000 (15:49 +0000)]
intel-iommu: move root entry defs from dma_remapping.h

We keep the struct root_entry forward declaration for the
pointer in struct intel_iommu.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: move DMA_32/64BIT_PFN into intel-iommu.c
Mark McLoughlin [Thu, 20 Nov 2008 15:49:43 +0000 (15:49 +0000)]
intel-iommu: move DMA_32/64BIT_PFN into intel-iommu.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: make init_dmars() static
Mark McLoughlin [Thu, 20 Nov 2008 14:21:13 +0000 (14:21 +0000)]
intel-iommu: make init_dmars() static

init_dmars() is not used outside of drivers/pci/intel-iommu.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agointel-iommu: remove some unused struct intel_iommu fields
Mark McLoughlin [Thu, 20 Nov 2008 14:04:20 +0000 (14:04 +0000)]
intel-iommu: remove some unused struct intel_iommu fields

The seg, saved_msg and sysdev fields appear to be unused since
before the code was first merged.

linux/msi.h is not needed in linux/intel-iommu.h anymore since
there is no longer a reference to struct msi_msg. The MSI code
in drivers/pci/intel-iommu.c still has linux/msi.h included
via linux/dmar.h.

linux/sysdev.h isn't needed because there is no reference to
struct sys_device.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agoDisallow gcc versions 3.{0,1}
Ingo Molnar [Fri, 2 Jan 2009 17:53:14 +0000 (18:53 +0100)]
Disallow gcc versions 3.{0,1}

GCC 3.0 and 3.1 are too old to build a working kernel.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
[ This check got dropped as obsolete when I simplified the gcc header
  inclusion mess in f153b82121b0366fe0e5f9553545cce237335175, but Willy
  Tarreau reports actually having those old versions still..  -Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'cpus4096-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 2 Jan 2009 19:44:09 +0000 (11:44 -0800)]
Merge branch 'cpus4096-for-linus-2' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'cpus4096-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (66 commits)
  x86: export vector_used_by_percpu_irq
  x86: use logical apicid in x2apic_cluster's x2apic_cpu_mask_to_apicid_and()
  sched: nominate preferred wakeup cpu, fix
  x86: fix lguest used_vectors breakage, -v2
  x86: fix warning in arch/x86/kernel/io_apic.c
  sched: fix warning in kernel/sched.c
  sched: move test_sd_parent() to an SMP section of sched.h
  sched: add SD_BALANCE_NEWIDLE at MC and CPU level for sched_mc>0
  sched: activate active load balancing in new idle cpus
  sched: bias task wakeups to preferred semi-idle packages
  sched: nominate preferred wakeup cpu
  sched: favour lower logical cpu number for sched_mc balance
  sched: framework for sched_mc/smt_power_savings=N
  sched: convert BALANCE_FOR_xx_POWER to inline functions
  x86: use possible_cpus=NUM to extend the possible cpus allowed
  x86: fix cpu_mask_to_apicid_and to include cpu_online_mask
  x86: update io_apic.c to the new cpumask code
  x86: Introduce topology_core_cpumask()/topology_thread_cpumask()
  x86: xen: use smp_call_function_many()
  x86: use work_on_cpu in x86/kernel/cpu/mcheck/mce_amd_64.c
  ...

Fixed up trivial conflict in kernel/time/tick-sched.c manually

15 years agoMerge branch 'kvm-updates/2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 2 Jan 2009 19:41:11 +0000 (11:41 -0800)]
Merge branch 'kvm-updates/2.6.29' of git://git./linux/kernel/git/avi/kvm

* 'kvm-updates/2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm: (140 commits)
  KVM: MMU: handle large host sptes on invlpg/resync
  KVM: Add locking to virtual i8259 interrupt controller
  KVM: MMU: Don't treat a global pte as such if cr4.pge is cleared
  MAINTAINERS: Maintainership changes for kvm/ia64
  KVM: ia64: Fix kvm_arch_vcpu_ioctl_[gs]et_regs()
  KVM: x86: Rework user space NMI injection as KVM_CAP_USER_NMI
  KVM: VMX: Fix pending NMI-vs.-IRQ race for user space irqchip
  KVM: fix handling of ACK from shared guest IRQ
  KVM: MMU: check for present pdptr shadow page in walk_shadow
  KVM: Consolidate userspace memory capability reporting into common code
  KVM: Advertise the bug in memory region destruction as fixed
  KVM: use cpumask_var_t for cpus_hardware_enabled
  KVM: use modern cpumask primitives, no cpumask_t on stack
  KVM: Extract core of kvm_flush_remote_tlbs/kvm_reload_remote_mmus
  KVM: set owner of cpu and vm file operations
  anon_inodes: use fops->owner for module refcount
  x86: KVM guest: kvm_get_tsc_khz: return khz, not lpj
  KVM: MMU: prepopulate the shadow on invlpg
  KVM: MMU: skip global pgtables on sync due to cr3 switch
  KVM: MMU: collapse remote TLB flushes on root sync
  ...

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Fri, 2 Jan 2009 18:32:18 +0000 (10:32 -0800)]
Merge git://git./linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (32 commits)
  ide-atapi: start dma in a drive-specific way
  ide-atapi: put the rest of non-ide-cd code into the else-clause of ide_transfer_pc
  ide-atapi: remove timeout arg to ide_issue_pc
  ide-cd: remove handler wrappers
  ide-cd: remove xferlen arg to cdrom_start_packet_command
  ide-atapi: split drive-specific functionality in ide_issue_pc
  ide-atapi: assign expiry and timeout based on device type
  ide-atapi: compute cmd_len based on device type in ide_transfer_pc
  ide: remove the last ide-scsi remnants
  ide-atapi: remove ide-scsi remnants from ide_pc_intr()
  ide-atapi: remove ide-scsi remnants from ide_transfer_pc()
  ide-atapi: remove ide-scsi remnants from ide_issue_pc
  ide-cd: move cdrom_timer_expiry to ide-atapi.c
  ide-atapi: teach ide atapi about drive->waiting_for_dma
  ide-atapi: accomodate transfer length calculation for ide-cd
  ide-atapi: setup dma for ide-cd
  ide-atapi: combine drive-specific assignments
  ide-atapi: add a dev_is_idecd-inline
  remove ide-scsi
  ide-floppy: allocate only toplevel packet commands
  ...

15 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb
Linus Torvalds [Fri, 2 Jan 2009 18:31:04 +0000 (10:31 -0800)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/dvrabel/uwb

* 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb: (31 commits)
  uwb: remove beacon cache entry after calling uwb_notify()
  uwb: remove unused include/linux/uwb/debug.h
  uwb: use print_hex_dump()
  uwb: use dev_dbg() for debug messages
  uwb: fix memory leak in uwb_rc_notif()
  wusb: fix oops when terminating a non-existant reservation
  uwb: fix oops when terminating an already terminated reservation
  uwb: improved MAS allocator and reservation conflict handling
  wusb: add debug files for ASL, PZL and DI to the whci-hcd driver
  uwb: fix oops in debug PAL's reservation callback
  uwb: clean up whci_wait_for() timeout error message
  wusb: whci-hcd shouldn't do ASL/PZL updates while channel is inactive
  uwb: remove unused beacon group join/leave events
  wlp: start/stop radio on network interface up/down
  uwb: add basic radio manager
  uwb: add pal parameter to new reservation callback
  uwb: fix races between events and neh timers
  uwb: don't unbind the radio controller driver when resetting
  uwb: per-radio controller event thread and beacon cache
  uwb: add commands to add/remove IEs to the debug interface
  ...

15 years agoUpdate powerpc maintainers
Paul Mackerras [Fri, 2 Jan 2009 04:40:55 +0000 (15:40 +1100)]
Update powerpc maintainers

Ben Herrenschmidt is taking over as the primary powerpc architecture
maintainer.  I'll still be around as his backup/deputy.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'i8k-updates' from Alan
Linus Torvalds [Fri, 2 Jan 2009 18:28:41 +0000 (10:28 -0800)]
Merge branch 'i8k-updates' from Alan

* i8k-updates:
  i8k: Add Dell Vostro systems
  i8k: Enable i8k on Dell Precision Systems

15 years agoi8k: Add Dell Vostro systems
Federico Heinz [Fri, 2 Jan 2009 16:19:23 +0000 (16:19 +0000)]
i8k: Add Dell Vostro systems

This trivial patch adds support for i8k on the new Dell Vostro models.
I tested it on my Vostro 1400, and it works. It does print a warning
when loading the module:

i8k: unable to get SMM BIOS version

But I couldn't figure out how to fix that. The module seems to work fine,
anyway...

Signed-off-by: Federico Heinz <fheinz@vialibre.org.ar>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoi8k: Enable i8k on Dell Precision Systems
Andy Spencer [Fri, 2 Jan 2009 16:19:13 +0000 (16:19 +0000)]
i8k: Enable i8k on Dell Precision Systems

Patch to enable i8k on Dell Precisions.

Signed-off-by: Andy Spencer <spenceal@rose-hulman.edu>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoFix compiler warning in arch/x86/mm/init_32.c
Ingo Brueckl [Fri, 2 Jan 2009 13:42:00 +0000 (14:42 +0100)]
Fix compiler warning in arch/x86/mm/init_32.c

Signed-off-by: Ingo Brueckl <ib@wupperonline.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'tty-updates' from Alan
Linus Torvalds [Fri, 2 Jan 2009 18:25:51 +0000 (10:25 -0800)]
Merge branch 'tty-updates' from Alan

* tty-updates: (75 commits)
  serial_8250: support for Sealevel Systems Model 7803 COMM+8
  hso maintainers update patch
  hso modem detect fix patch against Alan Cox'es tty tree
  tty: Fix an ircomm warning and note another bug
  drivers/char/cyclades.c: cy_pci_probe: fix error path
  Serial: UART driver changes for Cavium OCTEON.
  Serial: Allow port type to be specified when calling serial8250_register_port.
  8250: Serial driver changes to support future Cavium OCTEON serial patches.
  8250: Don't clobber spinlocks.
  fix for tty-serial-move-port
  tty: We want the port object to be persistent
  __FUNCTION__ is gcc-specific, use __func__
  serial: RS485 ioctl structure uses __u32 include linux/types.h
  tty: Drop the lock_kernel in the private ioctl hook
  synclink_cs: Convert to tty_port
  tty: use port methods for the rocket driver
  tty: kref the rocket driver
  tty: make rocketport use standard port->flags
  tty: Redo the rocket driver locking
  tty: Make epca use the port helpers
  ...