Skip to contentSkip to conversation

genirq core for 2.6.37

GIT PULL Thomas Gleixner 2 participants 3 messages Oct 21, 2010 – Oct 26, 2010

Subsystems (10)
Network drivers x86 Block layer PCI +6 more subsystems
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest irq-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-core-for-linus

Please pull this after x86/x2apic and x86/cleanups.

Both branches have been merged into irq/core to avoid massive conflicts. The changelog below is against 2.6.36 + x86/x2apic and x86/cleanups.

Thanks,

tglx
---
Anand Gadiyar (1):
genirq, ARM: Fix boot on ARM platforms

Ingo Molnar (1):
Merge branch 'linus' into irq/core

Robert Richter (2):
apic, x86: Check if EILVT APIC registers are available (AMD only) apic, x86: Use BIOS settings for IBS and MCE threshold interrupt LVT offsets

Thomas Gleixner (94):
MAINTAINERS: Add IRQ subsystem
genirq: Cleanup irq_chip->typename leftovers
mfd: Rename struct irq_data to struct sih_irq_data
isdn: Free irq_data namespace
genirq: Provide Kconfig
x86: Use genirq Kconfig
genirq: Create irq_data
genirq: Convert core code to irq_data
genirq: Provide advanced irq chip functions
genirq: Add new functions to dummy chips
genirq: Provide compat handling for bus_lock/bus_sync_unlock
genirq: Provide compat handling for chip->mask()
genirq: Provide compat handling for chip->unmask()
genirq: Provide compat handling for chip->ack()
genirq: Provide compat handling for chip->mask_ack()
genirq: Provide compat handling for chip->eoi()
genirq: Provide compat handling for chip->enable()
genirq: Provide compat handling for chip->disable()/shutdown()
genirq: Provide compat handling for chip->startup()
genirq: Provide compat handling for chip->set_affinity()
genirq: Provide compat handling for chip->set_type()
genirq: Provide compat handling for chip->set_wake()
genirq: Provide compat handling for chip->retrigger()
genirq: Provide config option to disable deprecated code
mfd: twl4030: Fix dummy irq chip usage
genirq: Distangle irq.h
genirq: Remove unsused inline
genirq: Provide status modifier
genirq: Sanitize irq_data accessors
genirq: Distangle kernel/irq/handle.c
genirq: Remove early_init_irq_lock_class()
isdn: hisax: Replace the bogus access to irq stats
genirq: Remove export of kstat_irqs_cpu
genirq: Provide default irq init flags
genirq: Implement a sane sparse_irq allocator
genirq: Prepare proc for real sparse irq support
genirq: Implement sane enumeration
genirq: Implement irq reservation genirq-update-kerneldoc.patch
genirq: Use sane sparse allocator
genirq: Query arch for number of early descriptors
Merge branch 'x86/x2apic' into irq/sparseirq
Merge branch 'x86/cleanups' into irq/sparseirq
Merge branch 'x86/urgent' of into irq/sparseirq
pci: Convert msi to new irq_chip functions
pci: Cleanup the irq_desc mess in msi
x86: Remove useless reinitialization of irq descriptors
x86: Convert irq_chip access to new functions
x86: Sanitize apb timer interrupt handling
x86: lguest: Convert to new irq chip functions
x86: Cleanup visws interrupt handling
x86: i8259: Convert to new irq_chip functions
x86: Cleanup access to irq_data
x86: Cleanup io_apic
x86: io_apic: Convert startup to new irq_chip function
x86: ioapic: Convert mask to new irq_chip function
x86: ioapic/hpet: Convert to new chip functions
dmar: Convert to new irq chip functions
ht: Convert to new irq_chip functions
x86: ioapic: Clean up the direct access to irq_desc
x86: Prepare the affinity common functions for taking struct irq_data *
x86: Convert msi affinity setting to new chip functions
x86: Convert remapped ioapic affinity setting to new irq chip function
x86: Convert remapped msi to new chip.irq_set_affinity function
x86: Convert dmar affinity setting to new chip function
x86: Cleanup hpet affinity setting
x86: Convert ht set_affinity to new chip function
x86: ioapic: Cleanup some more
x86: ioapic: Cleanup get_one_free_irq_cfg()
x86: Implement new allocator functions
x86: io_apic: Prepare alloc/free_irq_cfg()
x86: ioapic: Cleanup sparse irq code
x86: io_apic: Remove the now unused sparse_irq arch_* functions
pci: intr-remap: Free irte memory if SPARSE_IRQ=y
pci: intr_remap: Use irq_data
pci: intr_remap: Remove unused functions
x86: Embedd irq_2_iommu into irq_cfg
intr_remap: Use irq_2_iommu in struct irq_cfg
intr_remap: Simplify the code further
x86: Speed up the irq_remapped check in hot pathes
genirq: Remove irq_2_iommu
x86: Make io_apic.c local functions static
x86: uv: Clean up the direct access to irq_desc
x86: Use sane enumeration
x86: xen: Sanitise sparse_irq handling
genirq: Remove arch_init_chip_data()
genirq: Sanitize dynamic irq handling
genirq: Remove the now unused sparse irq leftovers
x86: lguest: Use new irq allocator
genirq: Make sparse_lock a mutex
genirq: Switch sparse_irq allocator to GFP_KERNEL
x86: Switch sparse_irq allocations to GFP_KERNEL
genirq: Fix CONFIG_GENIRQ_NO_DEPRECATED=y build
arm: Use ARCH_IRQ_INIT_FLAGS

Yinghai Lu (2):
x86: Don't setup ioapic irq for sci twice
x86: ioapic: Call free_irte only if interrupt remapping enabled

 Documentation/DocBook/genericirq.tmpl  |   84 ++--
 MAINTAINERS                            |    6 +
 arch/arm/include/asm/hw_irq.h          |    2 +
 arch/arm/kernel/irq.c                  |   10 +-
 arch/arm/mach-bcmring/irq.c            |    6 +-
 arch/arm/mach-iop13xx/msi.c            |    8 +-
 arch/ia64/kernel/msi_ia64.c            |    8 +-
 arch/ia64/sn/kernel/msi_sn.c           |    4 +-
 arch/m32r/kernel/irq.c                 |    2 +-
 arch/m32r/platforms/m32104ut/setup.c   |    2 +-
 arch/m32r/platforms/m32700ut/setup.c   |    8 +-
 arch/m32r/platforms/mappi/setup.c      |    2 +-
 arch/m32r/platforms/mappi2/setup.c     |    2 +-
 arch/m32r/platforms/mappi3/setup.c     |    2 +-
 arch/m32r/platforms/oaks32r/setup.c    |    2 +-
 arch/m32r/platforms/opsput/setup.c     |    6 +-
 arch/m32r/platforms/usrv/setup.c       |    4 +-
 arch/powerpc/platforms/cell/axon_msi.c |    6 +-
 arch/powerpc/platforms/pseries/xics.c  |    2 +-
 arch/powerpc/sysdev/fsl_msi.c          |    4 +-
 arch/powerpc/sysdev/mpic_pasemi_msi.c  |   22 +-
 arch/powerpc/sysdev/mpic_u3msi.c       |   18 +-
 arch/sh/kernel/irq.c                   |    2 +-
 arch/sparc/kernel/pci_msi.c            |    8 +-
 arch/tile/kernel/irq.c                 |    4 +-
 arch/um/kernel/irq.c                   |    6 +-
 arch/x86/Kconfig                       |   35 +--
 arch/x86/include/asm/apic.h            |    4 +-
 arch/x86/include/asm/apicdef.h         |    1 +
 arch/x86/include/asm/hpet.h            |   10 +-
 arch/x86/include/asm/hw_irq.h          |   17 +-
 arch/x86/include/asm/i8259.h           |    2 +
 arch/x86/include/asm/io_apic.h         |    6 -
 arch/x86/include/asm/irq_remapping.h   |    8 +
 arch/x86/kernel/apb_timer.c            |   54 +--
 arch/x86/kernel/apic/apic.c            |   88 +++-
 arch/x86/kernel/apic/io_apic.c         |  849 ++++++++++++--------------------
 arch/x86/kernel/apic/nmi.c             |    2 +-
 arch/x86/kernel/cpu/mcheck/mce_amd.c   |   27 +-
 arch/x86/kernel/hpet.c                 |   16 +-
 arch/x86/kernel/i8259.c                |   63 ++--
 arch/x86/kernel/irq.c                  |   24 +-
 arch/x86/kernel/irqinit.c              |   17 +-
 arch/x86/kernel/smpboot.c              |    4 +-
 arch/x86/kernel/uv_irq.c               |   55 +--
 arch/x86/kernel/visws_quirks.c         |  140 ++----
 arch/x86/lguest/boot.c                 |   18 +-
 arch/x86/oprofile/op_model_amd.c       |  145 +++++-
 arch/xtensa/kernel/irq.c               |    2 +-
 drivers/isdn/act2000/act2000.h         |    6 +-
 drivers/isdn/hisax/config.c            |   18 +-
 drivers/isdn/hisax/hisax.h             |    1 +
 drivers/mfd/twl4030-irq.c              |    4 +-
 drivers/pci/dmar.c                     |    8 +-
 drivers/pci/htirq.c                    |   22 +-
 drivers/pci/intr_remapping.c           |  212 +-------
 drivers/pci/msi.c                      |   38 +-
 drivers/xen/events.c                   |   23 +-
 include/linux/dmar.h                   |   10 +-
 include/linux/htirq.h                  |    5 +-
 include/linux/interrupt.h              |    3 -
 include/linux/irq.h                    |  447 +++++++-----------
 include/linux/irqdesc.h                |  159 ++++++
 include/linux/irqnr.h                  |    5 +
 include/linux/lockdep.h                |    8 -
 include/linux/msi.h                    |   13 +-
 init/Kconfig                           |    2 +
 init/main.c                            |    1 -
 kernel/irq/Kconfig                     |   53 ++
 kernel/irq/Makefile                    |    3 +-
 kernel/irq/autoprobe.c                 |   15 +-
 kernel/irq/chip.c                      |  378 ++++++++-------
 kernel/irq/dummychip.c                 |   68 +++
 kernel/irq/handle.c                    |  341 +-------------
 kernel/irq/internals.h                 |   39 +-
 kernel/irq/irqdesc.c                   |  395 +++++++++++++++
 kernel/irq/manage.c                    |   87 ++--
 kernel/irq/migration.c                 |   12 +-
 kernel/irq/numa_migrate.c              |  120 -----
 kernel/irq/proc.c                      |   26 +-
 kernel/irq/resend.c                    |    5 +-
 kernel/irq/spurious.c                  |    8 +-
 kernel/softirq.c                       |    9 +-
 83 files changed, 2135 insertions(+), 2226 deletions(-)
 create mode 100644 include/linux/irqdesc.h
 create mode 100644 kernel/irq/Kconfig
 create mode 100644 kernel/irq/dummychip.c
 create mode 100644 kernel/irq/irqdesc.c
 delete mode 100644 kernel/irq/numa_migrate.c
#1 lore raw

[GIT PULL] stable/xen-pcifront-0.8.2 for 2.6.37

[Hey Thomas: replaying to your e-mail thread as my patchset depends on your sparse-irq work]

Hello Linus,

Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git stable/xen-pcifront-0.8.2

for patches since git commit 032fa36091a925f555158f4e80f8a09d951cdb10 Thomas Gleixner (1):
arm: Use ARCH_IRQ_INIT_FLAGS

[also known as "irq-core-for-linus"]. My patchset has been rebased on top of Thomas's sparse_irq work, but if you prefer to have it based off your tree (v2.6.36-rc7), there is stable/xen-pcifront-0.8.1 branch which has no sparse_irq work. If you choose that route, the patch "x86: xen: Sanitse irq handling (part two)" would have to be applied after tip/irq/core had been merged in after my patchset. I can follow up with that patch if you would like.

(Thomas merged the latest v2.6.36-rc8 in his "irq-core-for-linus", and to my pleasant surprise a rebase on top of his "irq-core-for-linus" shows no conflict feast, and merge of his tree and mine is clean-free - I can do this if you would like, but thought it best to keep it as is so there would not be churn).

Back to this patch set:

This patch set contains the supporting patches and the driver itself for Xen Paravirtualized (PV) domains to use PCI pass-through devices. This patch-set is also utilized in Stefano's PV on HVM MSI/MSI-X patchset, and his initial domain support [1]. The impact of this patchset is that domU guests can utilize PCI devices.

The Xen PCI frontend driver can be used by PV guests on IOMMU hardware (or IOMMU-less). Without the hardware IOMMU you have a potential security hole wherein a guest domain can use the hardware to map pages outside its memory range and slurp pages up. As such, this is more restricted to a Privileged PV domain, aka - device driver domain (similar to Qubes but a poor-man mechanism [2]).

The first set of patches are specific to the Xen subsystem, where we introduce an IRQ chip for Physical IRQs, along with the supporting harness code:
xen: Don't disable the I/O space
xen: define BIOVEC_PHYS_MERGEABLE()
xen: implement pirq type event channels
xen: identity map gsi->irqs
xen: dynamically allocate irq & event structures
xen: set pirq name to something useful.
xen: statically initialize cpu_evtchn_mask_p
xen: Find an unbound irq number in reverse order (high to low).
xen: Provide a variant of xen_poll_irq with timeout.
xen: fix shared irq device passthrough

The next set of patches expose functionality for module drivers to be able to enumerate and iomap (using the _PAGE_IOMAP flag) PCI devices.

x86/io_apic: add get_nr_irqs_gsi()
x86/PCI: Clean up pci_cache_line_size x86/PCI: make sure _PAGE_IOMAP it set on pci mappings x86/PCI: Export pci_walk_bus function.

The next two patches abstract the MSI/MSI-X architecture calls so that the default native one (used on bare-metal) can be overwritten when running in virtualized mode (right now on Xen). The implementation is a simple function pointer structure.

msi: Introduce default_[teardown|setup]_msi_irqs with fallback.
x86: Introduce x86_msi_ops

Next, the Xen PCI stub driver. I've put it in the same location where other sub-platform PCI drivers are. It hooks up to the
PCI legacy IRQ setup ('pcibios_enable_irq'), and MSI/MSI-X allocation/de-allocation (via the x86_msi_ops introduced in earlier patches).

xen/x86/PCI: Add support for the Xen PCI subsystem

Lastly, the Xen PCI front-end driver which is responsible for hooking up to the PCI configuration read/write methods via the 'pci_scan_bus_parented' call. In essence all pci_conf_read/write in the guest will be tunneled via pcifront_bus_[read|write] methods. The MSI/MSI-X calls will be handled by the Xen-PCI front-end driver as well. We also need to add a new state so updating the XenBus:

xenbus: Xen paravirtualised PCI hotplug support.
xenbus: prevent warnings on unhandled enumeration values
xen-pcifront: Xen PCI frontend driver.

Then various fixes and updating the MAINTAINERs file with my name:

xen/pci: Request ACS when Xen-SWIOTLB is activated.
MAINTAINERS: Add myself for Xen PCI and Xen SWIOTLB maintainer.
swiotlb-xen: On x86-32 builts, select SWIOTLB instead of depending on it.

And rebasing on top of sparse_irq required to use the new framework:
x86: xen: Sanitse irq handling (part two)

The rest of the patches are due to compile/merge fallout in linux-next/mmotm:
xen: Update Makefile with CONFIG_BLOCK dependency for biomerge.c
MAINTAINERS: Add myself to the Xen Hypervisor Interface and remove Chris Wright. X86/PCI: Remove the dependency on isapnp_disable.

The change log:
Changelog since v8.0.1 [inclusion of this patches in linux-next/mmotm]
- Rebase on top tip/irq/core to use sparse_irq
- Fix fallout issues from linux-next/mmotm
Changelog since v8 [http://lkml.org/lkml/2010/10/12/207] posting:
- Added Acked-by on Xen PCI frontend driver
Changelog since v7 [http://lwn.net/Articles/408418/] posting:
- Added Reviewed-by/Acked-by on some of the patches.
- Fleshed out comments.
- Ditched the io_apic.c idea and used Thomas Gleixner idea.

The shortlog and the diffstat:

Alex Nixon (3):
xen: Don't disable the I/O space
x86/PCI: Clean up pci_cache_line_size xen/x86/PCI: Add support for the Xen PCI subsystem

Gerd Hoffmann (1):
xen: set pirq name to something useful.

Jeremy Fitzhardinge (6):
xen: define BIOVEC_PHYS_MERGEABLE()
xen: implement pirq type event channels x86/io_apic: add get_nr_irqs_gsi()
xen: dynamically allocate irq & event structures
xen: statically initialize cpu_evtchn_mask_p x86/PCI: make sure _PAGE_IOMAP it set on pci mappings

Konrad Rzeszutek Wilk (12):
xen: identity map gsi->irqs
xen: Find an unbound irq number in reverse order (high to low).
xen: Provide a variant of xen_poll_irq with timeout.
xen: fix shared irq device passthrough
x86/PCI: Export pci_walk_bus function.
xen/pci: Request ACS when Xen-SWIOTLB is activated.
MAINTAINERS: Add myself for Xen PCI and Xen SWIOTLB maintainer.
swiotlb-xen: On x86-32 builts, select SWIOTLB instead of depending on it.
x86: xen: Sanitse irq handling (part two)
MAINTAINERS: Add myself to the Xen Hypervisor Interface and remove Chris Wright.
xen: Update Makefile with CONFIG_BLOCK dependency for biomerge.c X86/PCI: Remove the dependency on isapnp_disable.

Noboru Iwamatsu (1):
xenbus: prevent warnings on unhandled enumeration values

Ryan Wilson (1):
xen-pcifront: Xen PCI frontend driver.

Stefano Stabellini (1):

      x86: Introduce x86_msi_ops

Thomas Gleixner (1):
msi: Introduce default_[teardown|setup]_msi_irqs with fallback.

Yosuke Iwamatsu (1):
xenbus: Xen paravirtualised PCI hotplug support.

 MAINTAINERS                        |   20 +-
 arch/x86/Kconfig                   |    5 +
 arch/x86/include/asm/io.h          |   13 +
 arch/x86/include/asm/io_apic.h     |    1 +
 arch/x86/include/asm/pci.h         |   33 +-
 arch/x86/include/asm/pci_x86.h     |    1 +
 arch/x86/include/asm/x86_init.h    |    9 +
 arch/x86/include/asm/xen/pci.h     |   53 ++
 arch/x86/kernel/apic/io_apic.c     |    9 +-
 arch/x86/kernel/x86_init.c         |    7 +
 arch/x86/pci/Makefile              |    1 +
 arch/x86/pci/common.c              |   17 +-
 arch/x86/pci/i386.c                |    2 +
 arch/x86/pci/xen.c                 |  142 +++++
 arch/x86/xen/enlighten.c           |    3 +
 arch/x86/xen/pci-swiotlb-xen.c     |    4 +
 arch/x86/xen/setup.c               |    2 -
 drivers/block/xen-blkfront.c       |    2 +
 drivers/input/xen-kbdfront.c       |    2 +
 drivers/net/xen-netfront.c         |    2 +
 drivers/pci/Kconfig                |   21 +
 drivers/pci/Makefile               |    2 +
 drivers/pci/bus.c                  |    1 +
 drivers/pci/msi.c                  |   14 +-
 drivers/pci/xen-pcifront.c         | 1148 ++++++++++++++++++++++++++++++++++++
 drivers/video/xen-fbfront.c        |    2 +
 drivers/xen/Kconfig                |    3 +-
 drivers/xen/Makefile               |    1 +
 drivers/xen/biomerge.c             |   13 +
 drivers/xen/events.c               |  344 ++++++++++-
 drivers/xen/xenbus/xenbus_client.c |    2 +
 include/xen/events.h               |   18 +
 include/xen/interface/io/pciif.h   |  112 ++++
 include/xen/interface/io/xenbus.h  |    8 +-
 34 files changed, 1981 insertions(+), 36 deletions(-)

P.S.
[1]. git://xenbits.xen.org/people/sstabellini/linux-pvhvm.git 2.6.36-rc8-initial-domain-v5

[2]: http://qubes-os.org/ which utilizes hardware IOMMU to run seperate domains wherein each has specific access to hardware.

[3] Some of the authors of the patches have moved on, so their e-mails are bouncing. The git tree contains their proper old email addresses.

MAINTAINERS +17 -3
index 62c0ace..59e9999 100644
@@ -6492,11 +6492,25 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.
 S:	Maintained
 F:	drivers/platform/x86
 
+XEN PCI SUBSYSTEM
+M:	Konrad Rzeszutek Wilk <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	arch/x86/pci/*xen*
+F:	drivers/pci/*xen*
+
+XEN SWIOTLB SUBSYSTEM
+M:	Konrad Rzeszutek Wilk <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	arch/x86/xen/*swiotlb*
+F:	drivers/xen/*swiotlb*
+
 XEN HYPERVISOR INTERFACE
-M:	Jeremy Fitzhardinge <[email protected]>
-M:	Chris Wright <[email protected]>
+M:	Jeremy Fitzhardinge <[email protected]>
+M:	Konrad Rzeszutek Wilk <[email protected]>
+L:	[email protected]
 L:	[email protected]
-L:	[email protected]
 S:	Supported
 F:	arch/x86/xen/
 F:	drivers/*/xen-*front.c
arch/x86/Kconfig +5 -0
index 8cc5108..74ea59d 100644
@@ -1898,6 +1898,11 @@ config PCI_OLPC
 	def_bool y
 	depends on PCI && OLPC && (PCI_GOOLPC || PCI_GOANY)
 
+config PCI_XEN
+	def_bool y
+	depends on PCI && XEN
+	select SWIOTLB_XEN
+
 config PCI_DOMAINS
 	def_bool y
 	depends on PCI
arch/x86/include/asm/io.h +13 -0
index 30a3e97..0ad29d4 100644
@@ -41,6 +41,8 @@
 #include <asm-generic/int-ll64.h>
 #include <asm/page.h>
 
+#include <xen/xen.h>
+
 #define build_mmio_read(name, size, type, reg, barrier) \
 static inline type name(const volatile void __iomem *addr) \
 { type ret; asm volatile("mov" size " %1,%0":reg (ret) \
@@ -349,6 +351,17 @@ extern void __iomem *early_memremap(resource_size_t phys_addr,
 extern void early_iounmap(void __iomem *addr, unsigned long size);
 extern void fixup_early_ioremap(void);
 
+#ifdef CONFIG_XEN
+struct bio_vec;
+
+extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
+				      const struct bio_vec *vec2);
+
+#define BIOVEC_PHYS_MERGEABLE(vec1, vec2)				\
+	(__BIOVEC_PHYS_MERGEABLE(vec1, vec2) &&				\
+	 (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)))
+#endif	/* CONFIG_XEN */
+
 #define IO_SPACE_LIMIT 0xffff
 
 #endif /* _ASM_X86_IO_H */
arch/x86/include/asm/io_apic.h +1 -0
index c8be456..a6b28d0 100644
@@ -169,6 +169,7 @@ extern void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
 extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
 
 extern void probe_nr_irqs_gsi(void);
+extern int get_nr_irqs_gsi(void);
 
 extern void setup_ioapic_ids_from_mpc(void);
 
arch/x86/include/asm/pci.h +31 -2
index d395540..ca0437c 100644
@@ -7,6 +7,7 @@
 #include <linux/string.h>
 #include <asm/scatterlist.h>
 #include <asm/io.h>
+#include <asm/x86_init.h>
 
 #ifdef __KERNEL__
 
@@ -94,8 +95,36 @@ static inline void early_quirks(void) { }
 
 extern void pci_iommu_alloc(void);
 
-/* MSI arch hook */
-#define arch_setup_msi_irqs arch_setup_msi_irqs
+#ifdef CONFIG_PCI_MSI
+/* MSI arch specific hooks */
+static inline int x86_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
+{
+	return x86_msi.setup_msi_irqs(dev, nvec, type);
+}
+
+static inline void x86_teardown_msi_irqs(struct pci_dev *dev)
+{
+	x86_msi.teardown_msi_irqs(dev);
+}
+
+static inline void x86_teardown_msi_irq(unsigned int irq)
+{
+	x86_msi.teardown_msi_irq(irq);
+}
+#define arch_setup_msi_irqs x86_setup_msi_irqs
+#define arch_teardown_msi_irqs x86_teardown_msi_irqs
+#define arch_teardown_msi_irq x86_teardown_msi_irq
+/* implemented in arch/x86/kernel/apic/io_apic. */
+int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
+void native_teardown_msi_irq(unsigned int irq);
+/* default to the implementation in drivers/lib/msi.c */
+#define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
+void default_teardown_msi_irqs(struct pci_dev *dev);
+#else
+#define native_setup_msi_irqs		NULL
+#define native_teardown_msi_irq		NULL
+#define default_teardown_msi_irqs	NULL
+#endif
 
 #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
 
arch/x86/include/asm/pci_x86.h +1 -0
index 49c7219..7045267 100644
@@ -47,6 +47,7 @@ enum pci_bf_sort_state {
 extern unsigned int pcibios_max_latency;
 
 void pcibios_resource_survey(void);
+void pcibios_set_cache_line_size(void);
 
 /* pci-pc.c */
 
arch/x86/include/asm/x86_init.h +9 -0
index baa579c..64642ad 100644
@@ -154,9 +154,18 @@ struct x86_platform_ops {
 	int (*i8042_detect)(void);
 };
 
+struct pci_dev;
+
+struct x86_msi_ops {
+	int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
+	void (*teardown_msi_irq)(unsigned int irq);
+	void (*teardown_msi_irqs)(struct pci_dev *dev);
+};
+
 extern struct x86_init_ops x86_init;
 extern struct x86_cpuinit_ops x86_cpuinit;
 extern struct x86_platform_ops x86_platform;
+extern struct x86_msi_ops x86_msi;
 
 extern void x86_init_noop(void);
 extern void x86_init_uint_noop(unsigned int unused);
arch/x86/include/asm/xen/pci.h new file +53 -0

53 lines not on this page · raw message

arch/x86/kernel/apic/io_apic.c +7 -2
index 20e47e0..0885a41 100644
@@ -3330,7 +3330,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
 	return 0;
 }
 
-int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
+int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
 	int node, ret, sub_handle, index = 0;
 	unsigned int irq, irq_want;
@@ -3388,7 +3388,7 @@ error:
 	return ret;
 }
 
-void arch_teardown_msi_irq(unsigned int irq)
+void native_teardown_msi_irq(unsigned int irq)
 {
 	destroy_irq(irq);
 }
@@ -3649,6 +3649,11 @@ void __init probe_nr_irqs_gsi(void)
 	printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi);
 }
 
+int get_nr_irqs_gsi(void)
+{
+	return nr_irqs_gsi;
+}
+
 #ifdef CONFIG_SPARSE_IRQ
 int __init arch_probe_nr_irqs(void)
 {
arch/x86/kernel/x86_init.c +7 -0
index cd6da6b..ceb2911 100644
@@ -6,10 +6,12 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
+#include <linux/pci.h>
 
 #include <asm/bios_ebda.h>
 #include <asm/paravirt.h>
 #include <asm/pci_x86.h>
+#include <asm/pci.h>
 #include <asm/mpspec.h>
 #include <asm/setup.h>
 #include <asm/apic.h>
@@ -99,3 +101,8 @@ struct x86_platform_ops x86_platform = {
 };
 
 EXPORT_SYMBOL_GPL(x86_platform);
+struct x86_msi_ops x86_msi = {
+	.setup_msi_irqs = native_setup_msi_irqs,
+	.teardown_msi_irq = native_teardown_msi_irq,
+	.teardown_msi_irqs = default_teardown_msi_irqs,
+};
arch/x86/pci/Makefile +1 -0
index a0207a7..effd96e 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_PCI_BIOS)		+= pcbios.o
 obj-$(CONFIG_PCI_MMCONFIG)	+= mmconfig_$(BITS).o direct.o mmconfig-shared.o
 obj-$(CONFIG_PCI_DIRECT)	+= direct.o
 obj-$(CONFIG_PCI_OLPC)		+= olpc.o
+obj-$(CONFIG_PCI_XEN)		+= xen.o
 
 obj-y				+= fixup.o
 obj-$(CONFIG_ACPI)		+= acpi.o
arch/x86/pci/common.c +10 -7
index a0772af..f7c8a39 100644
@@ -421,16 +421,10 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
 
 	return bus;
 }
-
-int __init pcibios_init(void)
+void __init pcibios_set_cache_line_size(void)
 {
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
-	if (!raw_pci_ops) {
-		printk(KERN_WARNING "PCI: System does not support PCI\n");
-		return 0;
-	}
-
 	/*
 	 * Set PCI cacheline size to that of the CPU if the CPU has reported it.
 	 * (For older CPUs that don't support cpuid, we se it to 32 bytes
@@ -445,7 +439,16 @@ int __init pcibios_init(void)
  		pci_dfl_cache_line_size = 32 >> 2;
 		printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n");
 	}
+}
+
+int __init pcibios_init(void)
+{
+	if (!raw_pci_ops) {
+		printk(KERN_WARNING "PCI: System does not support PCI\n");
+		return 0;
+	}
 
+	pcibios_set_cache_line_size();
 	pcibios_resource_survey();
 
 	if (pci_bf_sort >= pci_force_bf)
arch/x86/pci/i386.c +2 -0
index 5525309..8379c2c 100644
@@ -311,6 +311,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 		 */
 		prot |= _PAGE_CACHE_UC_MINUS;
 
+	prot |= _PAGE_IOMAP;	/* creating a mapping for IO */
+
 	vma->vm_page_prot = __pgprot(prot);
 
 	if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
arch/x86/pci/xen.c new file +142 -0

142 lines not on this page · raw message

arch/x86/xen/enlighten.c +3 -0
index 7d46c84..1ccfa1b 100644
@@ -45,6 +45,7 @@
 #include <asm/paravirt.h>
 #include <asm/apic.h>
 #include <asm/page.h>
+#include <asm/xen/pci.h>
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/fixmap.h>
@@ -1220,6 +1221,8 @@ asmlinkage void __init xen_start_kernel(void)
 		add_preferred_console("xenboot", 0, NULL);
 		add_preferred_console("tty", 0, NULL);
 		add_preferred_console("hvc", 0, NULL);
+		if (pci_xen)
+			x86_init.pci.arch_init = pci_xen_init;
 	} else {
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
arch/x86/xen/pci-swiotlb-xen.c +4 -0
index a013ec9..be4d80a 100644
@@ -1,6 +1,7 @@
 /* Glue code to lib/swiotlb-xen.c */
 
 #include <linux/dma-mapping.h>
+#include <linux/pci.h>
 #include <xen/swiotlb-xen.h>
 
 #include <asm/xen/hypervisor.h>
@@ -54,5 +55,8 @@ void __init pci_xen_swiotlb_init(void)
 	if (xen_swiotlb) {
 		xen_swiotlb_init(1);
 		dma_ops = &xen_swiotlb_dma_ops;
+
+		/* Make sure ACS will be enabled */
+		pci_request_acs();
 	}
 }
arch/x86/xen/setup.c +0 -2
index 328b003..c413132 100644
@@ -260,7 +260,5 @@ void __init xen_arch_setup(void)
 
 	pm_idle = xen_idle;
 
-	paravirt_disable_iospace();
-
 	fiddle_vdso();
 }
drivers/block/xen-blkfront.c +2 -0
index ab735a6..c4e9d81 100644
@@ -1125,6 +1125,8 @@ static void blkback_changed(struct xenbus_device *dev,
 	case XenbusStateInitialising:
 	case XenbusStateInitWait:
 	case XenbusStateInitialised:
+	case XenbusStateReconfiguring:
+	case XenbusStateReconfigured:
 	case XenbusStateUnknown:
 	case XenbusStateClosed:
 		break;
drivers/input/xen-kbdfront.c +2 -0
index ebb1190..e0c024d 100644
@@ -276,6 +276,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 	switch (backend_state) {
 	case XenbusStateInitialising:
 	case XenbusStateInitialised:
+	case XenbusStateReconfiguring:
+	case XenbusStateReconfigured:
 	case XenbusStateUnknown:
 	case XenbusStateClosed:
 		break;
drivers/net/xen-netfront.c +2 -0
index b50fedc..cb6e112 100644
@@ -1610,6 +1610,8 @@ static void backend_changed(struct xenbus_device *dev,
 	switch (backend_state) {
 	case XenbusStateInitialising:
 	case XenbusStateInitialised:
+	case XenbusStateReconfiguring:
+	case XenbusStateReconfigured:
 	case XenbusStateConnected:
 	case XenbusStateUnknown:
 	case XenbusStateClosed:
drivers/pci/Kconfig +21 -0
index 34ef70d..5b1630e 100644
@@ -40,6 +40,27 @@ config PCI_STUB
 
 	  When in doubt, say N.
 
+config XEN_PCIDEV_FRONTEND
+        tristate "Xen PCI Frontend"
+        depends on PCI && X86 && XEN
+        select HOTPLUG
+        select PCI_XEN
+        default y
+        help
+          The PCI device frontend driver allows the kernel to import arbitrary
+          PCI devices from a PCI backend to support PCI driver domains.
+
+config XEN_PCIDEV_FE_DEBUG
+        bool "Xen PCI Frontend debugging"
+        depends on XEN_PCIDEV_FRONTEND && PCI_DEBUG
+	help
+	  Say Y here if you want the Xen PCI frontend to produce a bunch of debug
+	  messages to the system log.  Select this if you are having a
+	  problem with Xen PCI frontend support and want to see more of what is
+	  going on.
+
+	  When in doubt, say N.
+
 config HT_IRQ
 	bool "Interrupts on hypertransport devices"
 	default y
drivers/pci/Makefile +2 -0
index dc1aa09..d5e2705 100644
@@ -65,6 +65,8 @@ obj-$(CONFIG_PCI_SYSCALL) += syscall.o
 
 obj-$(CONFIG_PCI_STUB) += pci-stub.o
 
+obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o
+
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
drivers/pci/bus.c +1 -0
index 7f0af0e..69546e9 100644
@@ -299,6 +299,7 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 	}
 	up_read(&pci_bus_sem);
 }
+EXPORT_SYMBOL_GPL(pci_walk_bus);
 
 EXPORT_SYMBOL(pci_bus_alloc_resource);
 EXPORT_SYMBOL_GPL(pci_bus_add_device);
drivers/pci/msi.c +12 -2
index 5fcf5ae..7c24dce 100644
@@ -35,7 +35,12 @@ int arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
 #endif
 
 #ifndef arch_setup_msi_irqs
-int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
+# define arch_setup_msi_irqs default_setup_msi_irqs
+# define HAVE_DEFAULT_MSI_SETUP_IRQS
+#endif
+
+#ifdef HAVE_DEFAULT_MSI_SETUP_IRQS
+int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
 	struct msi_desc *entry;
 	int ret;
@@ -60,7 +65,12 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 #endif
 
 #ifndef arch_teardown_msi_irqs
-void arch_teardown_msi_irqs(struct pci_dev *dev)
+# define arch_teardown_msi_irqs default_teardown_msi_irqs
+# define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
+#endif
+
+#ifdef HAVE_DEFAULT_MSI_TEARDOWN_IRQS
+void default_teardown_msi_irqs(struct pci_dev *dev)
 {
 	struct msi_desc *entry;
 
drivers/pci/xen-pcifront.c new file +1148 -0

1,148 lines not on this page · raw message

drivers/video/xen-fbfront.c +2 -0
index 7c7f42a..428d273 100644
@@ -631,6 +631,8 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
 	switch (backend_state) {
 	case XenbusStateInitialising:
 	case XenbusStateInitialised:
+	case XenbusStateReconfiguring:
+	case XenbusStateReconfigured:
 	case XenbusStateUnknown:
 	case XenbusStateClosed:
 		break;
drivers/xen/Kconfig +2 -1
index 60d71e9..6e6180c 100644
@@ -74,6 +74,7 @@ config XEN_PLATFORM_PCI
 
 config SWIOTLB_XEN
 	def_bool y
-	depends on SWIOTLB
+	depends on PCI
+	select SWIOTLB
 
 endmenu
drivers/xen/Makefile +1 -0
index fcaf838..b978645 100644
@@ -4,6 +4,7 @@ obj-y	+= xenbus/
 nostackp := $(call cc-option, -fno-stack-protector)
 CFLAGS_features.o			:= $(nostackp)
 
+obj-$(CONFIG_BLOCK)		+= biomerge.o
 obj-$(CONFIG_HOTPLUG_CPU)	+= cpu_hotplug.o
 obj-$(CONFIG_XEN_XENCOMM)	+= xencomm.o
 obj-$(CONFIG_XEN_BALLOON)	+= balloon.o
drivers/xen/biomerge.c new file +13 -0
new file mode 100644
index 0000000..ba6eda4
@@ -0,0 +1,13 @@
+#include <linux/bio.h>
+#include <linux/io.h>
+#include <xen/page.h>
+
+bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
+			       const struct bio_vec *vec2)
+{
+	unsigned long mfn1 = pfn_to_mfn(page_to_pfn(vec1->bv_page));
+	unsigned long mfn2 = pfn_to_mfn(page_to_pfn(vec2->bv_page));
+
+	return __BIOVEC_PHYS_MERGEABLE(vec1, vec2) &&
+		((mfn1 == mfn2) || ((mfn1+1) == mfn2));
+}
drivers/xen/events.c +328 -16

446 lines not on this page · raw message

drivers/xen/xenbus/xenbus_client.c +2 -0
index 7e49527..cdacf92 100644
@@ -50,6 +50,8 @@ const char *xenbus_strstate(enum xenbus_state state)
 		[ XenbusStateConnected    ] = "Connected",
 		[ XenbusStateClosing      ] = "Closing",
 		[ XenbusStateClosed	  ] = "Closed",
+		[XenbusStateReconfiguring] = "Reconfiguring",
+		[XenbusStateReconfigured] = "Reconfigured",
 	};
 	return (state < ARRAY_SIZE(name)) ? name[state] : "INVALID";
 }
include/xen/events.h +18 -0
index a15d932..c1717ca 100644
@@ -53,6 +53,10 @@ bool xen_test_irq_pending(int irq);
    irq will be disabled so it won't deliver an interrupt. */
 void xen_poll_irq(int irq);
 
+/* Poll waiting for an irq to become pending with a timeout.  In the usual case,
+ * the irq will be disabled so it won't deliver an interrupt. */
+void xen_poll_irq_timeout(int irq, u64 timeout);
+
 /* Determine the IRQ which is bound to an event channel */
 unsigned irq_from_evtchn(unsigned int evtchn);
 
@@ -63,4 +67,18 @@ int xen_set_callback_via(uint64_t via);
 void xen_evtchn_do_upcall(struct pt_regs *regs);
 void xen_hvm_evtchn_do_upcall(void);
 
+/* Allocate an irq for a physical interrupt, given a gsi.  "Legacy"
+ * GSIs are identity mapped; others are dynamically allocated as
+ * usual. */
+int xen_allocate_pirq(unsigned gsi, int shareable, char *name);
+
+/* De-allocates the above mentioned physical interrupt. */
+int xen_destroy_irq(int irq);
+
+/* Return vector allocated to pirq */
+int xen_vector_from_irq(unsigned pirq);
+
+/* Return gsi allocated to pirq */
+int xen_gsi_from_irq(unsigned pirq);
+
 #endif	/* _XEN_EVENTS_H */
include/xen/interface/io/pciif.h new file +112 -0

112 lines not on this page · raw message

include/xen/interface/io/xenbus.h +7 -1
index 46508c7..9fda532 100644
@@ -27,8 +27,14 @@ enum xenbus_state
 	XenbusStateClosing      = 5,  /* The device is being closed
 					 due to an error or an unplug
 					 event. */
-	XenbusStateClosed       = 6
+	XenbusStateClosed       = 6,
 
+	/*
+	* Reconfiguring: The device is being reconfigured.
+	*/
+	XenbusStateReconfiguring = 7,
+
+	XenbusStateReconfigured  = 8
 };
 
 #endif /* _XEN_PUBLIC_IO_XENBUS_H */
#2 lore raw

Re: [GIT PULL] stable/xen-pcifront-0.8.2 for 2.6.37

Quoted 9 lines · Konrad Rzeszutek Wilk

Hello Linus,

Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git stable/xen-pcifront-0.8.2

for patches since git commit 032fa36091a925f555158f4e80f8a09d951cdb10 Thomas Gleixner (1):
arm: Use ARCH_IRQ_INIT_FLAGS

Quoted 6 lines

[also known as "irq-core-for-linus"]. My patchset has been rebased on top of Thomas's sparse_irq work, but if you prefer to have it based off your tree (v2.6.36-rc7), there is stable/xen-pcifront-0.8.1 branch which has no sparse_irq work. If you choose that route, the patch "x86: xen: Sanitse irq handling (part two)" would have to be applied after tip/irq/core had been merged in after my patchset. I can follow up with that patch if you would like.

Linus,
Since the sparse_irq rework has been merged, please do git pull

    stable/xen-pcifront-0.8.2 

branch and ignore the stable/xen-pcifront-0.8.1.

Stephen found a contextual git merge error with the tree and the patch below fixes the issue. I can rebase the tree of your latest but I am pretty sure that is not the right way to do it, so I am leaving it as is. If however you would like me to rebase on top of your tree I can definitly do it.

<begin copy-n-paste>
Hi Konrad,

Today's linux-next merge of the swiotlb-xen tree got a conflict in arch/x86/include/asm/io_apic.h between commit 23f9b267159b4c7ff59d2e6c8ed31693eff841e3 ("x86: apic: Move probe_nr_irqs_gsi() into ioapic_init_mappings()") from the tip tree and commit 7b586d71858091f0958e5808b7e3d5390c2ae47d ("x86/io_apic: add get_nr_irqs_gsi()") from the swiotlb-xen tree.

Just context changes. I fixed it up (see below) and can carry the fix as necessary.

Signature · 19 lines
Cheers,
Stephen Rothwell                    [email protected]

diff --cc arch/x86/include/asm/io_apic.h
index 240a0a5,a6b28d0..0000000
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@@ -168,6 -168,9 +168,8 @@@ extern int save_IO_APIC_setup(struct IO
  extern void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
  extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
  
 -extern void probe_nr_irqs_gsi(void);
+ extern int get_nr_irqs_gsi(void);
+ 
  extern void setup_ioapic_ids_from_mpc(void);
  
  struct mp_ioapic_gsi{

<end copy-n-paste>