[tip: x86/apic] x86/ioapic: Use I/O-APIC ID for finding irqdomain, not index

2020-11-04 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: f36a74b9345aebaf5d325380df87a54720229d18 Gitweb: https://git.kernel.org/tip/f36a74b9345aebaf5d325380df87a54720229d18 Author:David Woodhouse AuthorDate:Tue, 03 Nov 2020 16:36:22 Committer

Re: [PATCH v2 1/2] sched/wait: Add add_wait_queue_priority()

2020-11-04 Thread David Woodhouse
On Wed, 2020-10-28 at 15:35 +0100, Peter Zijlstra wrote: > On Tue, Oct 27, 2020 at 02:39:43PM +0000, David Woodhouse wrote: > > From: David Woodhouse > > > > This allows an exclusive wait_queue_entry to be added at the head of the > > queue, instead of the ta

[PATCH] x86/ioapic: Use I/OAPIC ID for finding irqdomain, not index

2020-11-03 Thread David Woodhouse
From: David Woodhouse In commit b643128b917 ("x86/ioapic: Use irq_find_matching_fwspec() to find remapping irqdomain") the I/OAPIC code was changed to find its parent irqdomain using irq_find_matching_fwspec(), but the key used for the lookup was wrong. It shouldn't use 'ioa

Re: [PATCH] x86/hyperv: Enable 15-bit APIC ID if the hypervisor supports it

2020-11-03 Thread David Woodhouse
255 APIC ID. > > The kdump issue can be fixed by the Extended Dest ID, which is introduced > recently by David Woodhouse (for IOAPIC, see the field virt_destid_8_14 in > struct IO_APIC_route_entry). Of course, the Extended Dest ID needs the > support of the underlying hypervisor. The

[tip: x86/apic] x86/kvm: Enable 15-bit extension when KVM_FEATURE_MSI_EXT_DEST_ID detected

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 2e008ffe426f927b1697adb4ed10c1e419927ae4 Gitweb: https://git.kernel.org/tip/2e008ffe426f927b1697adb4ed10c1e419927ae4 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:35 +01:00

[tip: x86/apic] iommu/vt-d: Implement select() method on remapping irqdomain

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: a87fb465ffe8eacd0d69032da33455e4f6fd8b41 Gitweb: https://git.kernel.org/tip/a87fb465ffe8eacd0d69032da33455e4f6fd8b41 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:25 +01:00

[tip: x86/apic] iommu/hyper-v: Disable IRQ pseudo-remapping if 15 bit APIC IDs are available

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: bf27ef8a77d8da38c9f35f8f6aab013a2dcf175f Gitweb: https://git.kernel.org/tip/bf27ef8a77d8da38c9f35f8f6aab013a2dcf175f Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:33 +01:00

[tip: x86/apic] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 5d5a97133887b2dfd8e2ad0347c3a02cc7aaa0cb Gitweb: https://git.kernel.org/tip/5d5a97133887b2dfd8e2ad0347c3a02cc7aaa0cb Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:21 +01:00

[tip: x86/apic] iommu/amd: Implement select() method on remapping irqdomain

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: a1a785b572425ab3ca5494a4be02ab59a796df51 Gitweb: https://git.kernel.org/tip/a1a785b572425ab3ca5494a4be02ab59a796df51 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:24 +01:00

[tip: x86/apic] x86/ioapic: Handle Extended Destination ID field in RTE

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 51130d21881d435fad5fa7f25bea77aa0ffc9a4e Gitweb: https://git.kernel.org/tip/51130d21881d435fad5fa7f25bea77aa0ffc9a4e Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:31 +01:00

[tip: x86/apic] x86/ioapic: Use irq_find_matching_fwspec() to find remapping irqdomain

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: b643128b917ca8f1c8b1e14af64ebdc81147b2d1 Gitweb: https://git.kernel.org/tip/b643128b917ca8f1c8b1e14af64ebdc81147b2d1 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:28 +01:00

[tip: x86/apic] x86/apic: Add select() method on vector irqdomain

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 6452ea2a323b80868ce5e6d3030e4ccbeab9dc30 Gitweb: https://git.kernel.org/tip/6452ea2a323b80868ce5e6d3030e4ccbeab9dc30 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:23 +01:00

[tip: x86/apic] genirq/irqdomain: Implement get_name() method on irqchip fwnodes

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 2cbd5a45e5296b28d64224ffbbd33d427704ba1b Gitweb: https://git.kernel.org/tip/2cbd5a45e5296b28d64224ffbbd33d427704ba1b Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:22 +01:00

[tip: x86/apic] x86/kvm: Reserve KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 5a169bf04cd2bfdbac967d12eb5b70915b29d7ee Gitweb: https://git.kernel.org/tip/5a169bf04cd2bfdbac967d12eb5b70915b29d7ee Author:David Woodhouse AuthorDate:Mon, 19 Oct 2020 15:55:56 +01:00

[tip: x86/apic] x86/hpet: Move MSI support into hpet.c

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 3d7295eb3003aea9f89de35304b3a88ae4d5036b Gitweb: https://git.kernel.org/tip/3d7295eb3003aea9f89de35304b3a88ae4d5036b Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:10 +01:00

[tip: x86/apic] x86/apic: Always provide irq_compose_msi_msg() method for vector domain

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: f598181acfb36f67e1de138cbe80a7db497f7d8c Gitweb: https://git.kernel.org/tip/f598181acfb36f67e1de138cbe80a7db497f7d8c Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:09 +01:00

[tip: x86/apic] x86/msi: Only use high bits of MSI address for DMAR unit

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 47bea873cf809f490cfac0c4e88533fd7fed6064 Gitweb: https://git.kernel.org/tip/47bea873cf809f490cfac0c4e88533fd7fed6064 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:02 +01:00

[tip: x86/apic] x86/apic: Fix x2apic enablement without interrupt remapping

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 26573a97746c7a99f394f9d398ce91a8853b3b89 Gitweb: https://git.kernel.org/tip/26573a97746c7a99f394f9d398ce91a8853b3b89 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:01 +01:00

[tip: x86/apic] x86/hpet: Use irq_find_matching_fwspec() to find remapping irqdomain

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: c2a5881c28e5bb4cb901029423a1c7068c0afa2d Gitweb: https://git.kernel.org/tip/c2a5881c28e5bb4cb901029423a1c7068c0afa2d Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:27 +01:00

[tip: x86/apic] x86/apic: Support 15 bits of APIC ID in MSI where available

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: ab0f59c6f135289c7ea90b0e2471674bf289d884 Gitweb: https://git.kernel.org/tip/ab0f59c6f135289c7ea90b0e2471674bf289d884 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:32 +01:00

[tip: x86/apic] iommu/hyper-v: Implement select() method on remapping irqdomain

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: a491bb19f728cdb8cc1f4734ecc57c0afa099fac Gitweb: https://git.kernel.org/tip/a491bb19f728cdb8cc1f4734ecc57c0afa099fac Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:26 +01:00

[tip: x86/apic] iommu/vt-d: Simplify intel_irq_remapping_select()

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: 79eb3581bcaae9b5677629d945e14da212aa76e2 Gitweb: https://git.kernel.org/tip/79eb3581bcaae9b5677629d945e14da212aa76e2 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:30 +01:00

[tip: x86/apic] x86: Kill all traces of irq_remapping_get_irq_domain()

2020-10-29 Thread tip-bot2 for David Woodhouse
The following commit has been merged into the x86/apic branch of tip: Commit-ID: ed381fca47122f0787ee53b97e5f9d562eec7237 Gitweb: https://git.kernel.org/tip/ed381fca47122f0787ee53b97e5f9d562eec7237 Author:David Woodhouse AuthorDate:Sat, 24 Oct 2020 22:35:29 +01:00

Re: [PATCH v2 1/2] sched/wait: Add add_wait_queue_priority()

2020-10-27 Thread David Woodhouse
On Tue, 2020-10-27 at 21:30 +0100, Peter Zijlstra wrote: > On Tue, Oct 27, 2020 at 07:27:59PM +0000, David Woodhouse wrote: > > > > While looking at this I found that weird __add_wait_queue_exclusive() > > > which is used by fs/eventpoll.c and does something similar, exce

Re: [PATCH v2 1/2] sched/wait: Add add_wait_queue_priority()

2020-10-27 Thread David Woodhouse
On Tue, 2020-10-27 at 21:30 +0100, Peter Zijlstra wrote: > On Tue, Oct 27, 2020 at 07:27:59PM +0000, David Woodhouse wrote: > > > > While looking at this I found that weird __add_wait_queue_exclusive() > > > which is used by fs/eventpoll.c and does something similar, exce

Re: [PATCH v2 1/2] sched/wait: Add add_wait_queue_priority()

2020-10-27 Thread David Woodhouse
On Tue, 2020-10-27 at 20:09 +0100, Peter Zijlstra wrote: > On Tue, Oct 27, 2020 at 02:39:43PM +0000, David Woodhouse wrote: > > From: David Woodhouse > > > > This allows an exclusive wait_queue_entry to be added at the head of the > > queue, instead of the ta

[PATCH v2 1/2] sched/wait: Add add_wait_queue_priority()

2020-10-27 Thread David Woodhouse
From: David Woodhouse This allows an exclusive wait_queue_entry to be added at the head of the queue, instead of the tail as normal. Thus, it gets to consume events first without allowing non-exclusive waiters to be woken at all. The (first) intended use is for KVM IRQFD, which currently has

[PATCH v2 2/2] kvm/eventfd: Use priority waitqueue to catch events before userspace

2020-10-27 Thread David Woodhouse
From: David Woodhouse When posted interrupts are available, the IRTE is modified to deliver interrupts direclty to the vCPU and nothing ever reaches userspace, if it's listening on the same eventfd that feeds the irqfd. I like that behaviour. Let's do it all the time, even without posted

[PATCH v2 0/2] Allow KVM IRQFD to consistently intercept events

2020-10-27 Thread David Woodhouse
consume the eventfd counter too. David Woodhouse (2): sched/wait: Add add_wait_queue_priority() kvm/eventfd: Use priority waitqueue to catch events before userspace include/linux/wait.h | 12 +++- kernel/sched/wait.c | 17 - virt/kvm/eventfd.c | 6 --

[PATCH 0/3] Allow in-kernel consumers to drain events from eventfd

2020-10-27 Thread David Woodhouse
it as they handle their respective events. David Woodhouse (3): eventfd: Export eventfd_ctx_do_read() vfio/virqfd: Drain events from eventfd in virqfd_wakeup() kvm/eventfd: Drain events from eventfd in irqfd_wakeup() drivers/vfio/virqfd.c | 3 +++ fs/eventfd.c| 5 - include

[PATCH 2/3] vfio/virqfd: Drain events from eventfd in virqfd_wakeup()

2020-10-27 Thread David Woodhouse
From: David Woodhouse Don't allow the events to accumulate in the eventfd counter, drain them as they are handled. Signed-off-by: David Woodhouse --- drivers/vfio/virqfd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vfio/virqfd.c b/drivers/vfio/virqfd.c index 997cb5d0a657

[PATCH 1/3] eventfd: Export eventfd_ctx_do_read()

2020-10-27 Thread David Woodhouse
From: David Woodhouse Where events are consumed in the kernel, for example by KVM's irqfd_wakeup() and VFIO's virqfd_wakeup(), they currently lack a mechanism to drain the eventfd's counter. Since the wait queue is already locked while the wakeup functions are invoked, all they really need

[PATCH 3/3] kvm/eventfd: Drain events from eventfd in irqfd_wakeup()

2020-10-27 Thread David Woodhouse
From: David Woodhouse Don't allow the events to accumulate in the eventfd counter, drain them as they are handled. Signed-off-by: David Woodhouse --- virt/kvm/eventfd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index d6408bb497dc

Re: [RFC PATCH 2/2] kvm/eventfd: Use priority waitqueue to catch events before userspace

2020-10-27 Thread David Woodhouse
On Tue, 2020-10-27 at 09:01 +0100, Paolo Bonzini wrote: > On 26/10/20 18:53, David Woodhouse wrote: > > From: David Woodhouse > > > > As far as I can tell, when we use posted interrupts we silently cut off > > the events from userspace, if it's listening on the

[RFC PATCH 2/2] kvm/eventfd: Use priority waitqueue to catch events before userspace

2020-10-26 Thread David Woodhouse
From: David Woodhouse As far as I can tell, when we use posted interrupts we silently cut off the events from userspace, if it's listening on the same eventfd that feeds the irqfd. I like that behaviour. Let's do it all the time, even without posted interrupts. It makes it much easier to handle

[RFC PATCH 1/2] sched/wait: Add add_wait_queue_priority()

2020-10-26 Thread David Woodhouse
From: David Woodhouse This allows an exclusive wait_queue_entry to be added at the head of the queue, instead of the tail as normal. Thus, it gets to consume events first. The problem I'm trying to solve here is interrupt remapping invalidation vs. MSI interrupts from VFIO. I'd really like KVM

Re: [PATCH v3 17/35] x86/pci/xen: Use msi_msg shadow structs

2020-10-25 Thread David Woodhouse
On Sun, 2020-10-25 at 09:49 +, David Laight wrote: > Just looking at a random one of these patches... > > Does the compiler manage to optimise that reasonably? > Or does it generate a lot of shifts and masks as each > bitfield is set? > > The code generation for bitfields is often a lot

Re: [PATCH v3 00/35] Fix x2apic enablement and allow more CPUs, clean up I/OAPIC and MSI bitfields

2020-10-25 Thread David Woodhouse
On Sat, 2020-10-24 at 22:35 +0100, David Woodhouse wrote: > Fix the conditions for enabling x2apic on guests without interrupt > remapping, and support 15-bit Extended Destination ID to allow 32768 > CPUs without IR on hypervisors that support it. > > Make the I/OAPIC code g

[PATCH v3 04/35] x86/devicetree: Fix the ioapic interrupt type table

2020-10-24 Thread David Woodhouse
the type information for consistency sake. No functional change. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/kernel/devicetree.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/x86/kernel/devicetree.c b

[PATCH v3 00/35] Fix x2apic enablement and allow more CPUs, clean up I/OAPIC and MSI bitfields

2020-10-24 Thread David Woodhouse
parent irqchip's MSI messages. • Clean up HPET MSI support into hpet.c now that we can. David Woodhouse (19): x86/apic: Fix x2apic enablement without interrupt remapping x86/msi: Only use high bits of MSI address for DMAR unit x86/apic: Always provide irq_compose_msi_msg

[PATCH v3 03/35] x86/apic/uv: Fix inconsistent destination mode

2020-10-24 Thread David Woodhouse
-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/kernel/apic/x2apic_uv_x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 714233cee0b5..9ade9e6a95ff 100644 --- a/arch/x86/kernel/apic

[PATCH v3 02/35] x86/msi: Only use high bits of MSI address for DMAR unit

2020-10-24 Thread David Woodhouse
From: David Woodhouse The Intel IOMMU has an MSI-like configuration for its interrupt, but it isn't really MSI. So it gets to abuse the high 32 bits of the address, and puts the high 24 bits of the extended APIC ID there. This isn't something that can be used in the general case for real MSIs

[PATCH v3 11/35] genirq/msi: Allow shadow declarations of msi_msg::$member

2020-10-24 Thread David Woodhouse
representation for each member of msi_msg. Provide empty defaults for each and stick them into an union. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- include/asm-generic/msi.h | 4 include/linux/msi.h | 46 +++ 2 files changed, 46

[PATCH v3 06/35] x86/apic: Replace pointless apic::dest_logical usage

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner All these functions are only used for logical destination mode. So reading the destination mode mask from the apic structure is a pointless exercise. Just hand in the proper constant: APIC_DEST_LOGICAL. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse

[PATCH v3 09/35] x86/apic: Always provide irq_compose_msi_msg() method for vector domain

2020-10-24 Thread David Woodhouse
From: David Woodhouse This shouldn't be dependent on PCI_MSI. HPET and I/O-APIC can deliver interrupts through MSI without having any PCI in the system at all. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/apic.h | 8 +++- arch/x86/kernel/apic

[PATCH v3 01/35] x86/apic: Fix x2apic enablement without interrupt remapping

2020-10-24 Thread David Woodhouse
From: David Woodhouse Currently, Linux as a hypervisor guest will enable x2apic only if there are no CPUs present at boot time with an APIC ID above 255. Hotplugging a CPU later with a higher APIC ID would result in a CPU which cannot be targeted by external interrupts. Add a filter

[PATCH v3 16/35] x86/kvm: Use msi_msg shadow structs

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner Use the bitfields in the x86 shadow structs instead of decomposing the 32bit value with macros. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/kvm/irq_comm.c | 31 +-- 1 file changed, 13 insertions(+), 18 deletions

[PATCH v3 08/35] x86/apic: Cleanup destination mode

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner apic::irq_dest_mode is actually a boolean, but defined as u32 and named in a way which does not explain what it means. Make it a boolean and rename it to 'dest_mode_logical' Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/include/asm/apic.h

[PATCH v3 12/35] x86/msi: Provide msi message shadow structs

2020-10-24 Thread David Woodhouse
not all to be a union] Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/include/asm/msi.h | 49 + arch/x86/kernel/apic/apic.c | 35 ++ 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/arch/x86

[PATCH v3 28/35] x86/ioapic: Use irq_find_matching_fwspec() to find remapping irqdomain

2020-10-24 Thread David Woodhouse
From: David Woodhouse All possible parent domains have a select method now. Make use of it. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- arch/x86/kernel/apic/io_apic.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch

[PATCH v3 05/35] x86/apic: Cleanup delivery mode defines

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner The enum ioapic_irq_destination_types and the enumerated constants starting with 'dest_' are gross misnomers because they describe the delivery mode. Rename then enum and the constants so they actually make sense. Signed-off-by: Thomas Gleixner Signed-off-by: David

[PATCH v3 10/35] x86/hpet: Move MSI support into hpet.c

2020-10-24 Thread David Woodhouse
From: David Woodhouse This isn't really dependent on PCI MSI; it's just generic MSI which is now supported by the generic x86_vector_domain. Move the HPET MSI support back into hpet.c with the rest of the HPET support. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- arch

[PATCH v3 22/35] genirq/irqdomain: Implement get_name() method on irqchip fwnodes

2020-10-24 Thread David Woodhouse
From: David Woodhouse Prerequesite to make x86 more irqdomain compliant. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- kernel/irq/irqdomain.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c

[PATCH v3 15/35] PCI: vmd: Use msi_msg shadow structs

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner Use the x86 shadow structs in msi_msg instead of the macros. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- drivers/pci/controller/vmd.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/vmd.c b

[PATCH v3 13/35] iommu/intel: Use msi_msg shadow structs

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner Use the bitfields in the x86 shadow struct to compose the MSI message. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- drivers/iommu/intel/irq_remapping.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git

[PATCH v3 24/35] iommu/amd: Implement select() method on remapping irqdomain

2020-10-24 Thread David Woodhouse
From: David Woodhouse Preparatory change to remove irq_remapping_get_irq_domain(). Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- drivers/iommu/amd/iommu.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu

[PATCH v3 17/35] x86/pci/xen: Use msi_msg shadow structs

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner Use the msi_msg shadow structs and compose the message with named bitfields instead of the unreadable macro maze. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/pci/xen.c | 26 +++--- 1 file changed, 11 insertions(+), 15

[PATCH v3 21/35] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-24 Thread David Woodhouse
From: David Woodhouse The I/O-APIC generates an MSI cycle with address/data bits taken from its Redirection Table Entry in some combination which used to make sense, but now is just a bunch of bits which get passed through in some seemingly arbitrary order. Instead of making IRQ remapping

[PATCH v3 30/35] iommu/vt-d: Simplify intel_irq_remapping_select()

2020-10-24 Thread David Woodhouse
From: David Woodhouse Now that the old get_irq_domain() method has gone, consolidate on just the map_XXX_to_iommu() functions. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- drivers/iommu/intel/irq_remapping.c | 19 +++ 1 file changed, 7 insertions(+), 12

[PATCH v3 31/35] x86/ioapic: Handle Extended Destination ID field in RTE

2020-10-24 Thread David Woodhouse
From: David Woodhouse Bits 63-48 of the I/OAPIC Redirection Table Entry map directly to bits 19-4 of the address used in the resulting MSI cycle. Historically, the x86 MSI format only used the top 8 of those 16 bits as the destination APIC ID, and the "Extended Destination ID" in t

[PATCH v3 20/35] x86/ioapic: Cleanup IO/APIC route entry structs

2020-10-24 Thread David Woodhouse
Signed-off-by: David Woodhouse --- arch/x86/include/asm/io_apic.h | 78 ++- arch/x86/kernel/apic/io_apic.c | 144 +--- drivers/iommu/amd/iommu.c | 8 +- drivers/iommu/hyperv-iommu.c| 4 +- drivers/iommu/intel/irq_remapping.c

[PATCH v3 18/35] x86/msi: Remove msidef.h

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner Nothing uses the macro maze anymore. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/include/asm/msidef.h | 57 --- 1 file changed, 57 deletions(-) delete mode 100644 arch/x86/include/asm/msidef.h diff --git

[PATCH v3 26/35] iommu/hyper-v: Implement select() method on remapping irqdomain

2020-10-24 Thread David Woodhouse
From: David Woodhouse Preparatory for removing irq_remapping_get_irq_domain() Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- drivers/iommu/hyperv-iommu.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/hyperv-iommu.c b/drivers/iommu/hyperv

[PATCH v3 29/35] x86: Kill all traces of irq_remapping_get_irq_domain()

2020-10-24 Thread David Woodhouse
From: David Woodhouse All users are converted to use the fwspec based parent domain lookup. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/hw_irq.h| 2 -- arch/x86/include/asm/irq_remapping.h | 9 drivers/iommu/amd/iommu.c

[PATCH v3 25/35] iommu/vt-d: Implement select() method on remapping irqdomain

2020-10-24 Thread David Woodhouse
From: David Woodhouse Preparatory for removing irq_remapping_get_irq_domain() Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- drivers/iommu/intel/irq_remapping.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/intel/irq_remapping.c b

[PATCH v3 07/35] x86/apic: Get rid of apic::dest_logical

2020-10-24 Thread David Woodhouse
. This will be cleaned up in a subsequent change. Remove apic::dest_logical and fixup the remaining users. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/include/asm/apic.h | 2 -- arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/apic/apic_flat_64.c

[PATCH v3 23/35] x86/apic: Add select() method on vector irqdomain

2020-10-24 Thread David Woodhouse
From: David Woodhouse This will be used to select the irqdomain for I/O-APIC and HPET. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/irqdomain.h | 3 +++ arch/x86/kernel/apic/vector.c| 43 2 files changed, 46

[PATCH v3 14/35] iommu/amd: Use msi_msg shadow structs

2020-10-24 Thread David Woodhouse
From: Thomas Gleixner Get rid of the macro mess and use the shadow structs for the x86 specific MSI message format. Convert the intcapxt setup to use named bitfields as well while touching it anyway. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- drivers/iommu/amd/init.c

[PATCH v3 19/35] x86/io_apic: Cleanup trigger/polarity helpers

2020-10-24 Thread David Woodhouse
of 'trigger' and 'polarity' is opaque and confusing at best. Rename them to 'is_level' and 'active_low' and make them boolean in various structs so it's entirely clear what the meaning is. Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse --- arch/x86/include/asm/hw_irq.h | 6

[PATCH v3 35/35] x86/kvm: Enable 15-bit extension when KVM_FEATURE_MSI_EXT_DEST_ID detected

2020-10-24 Thread David Woodhouse
From: David Woodhouse This allows the host to indicate that MSI emulation supports 15-bit destination IDs, allowing up to 32768 CPUs without interrupt remapping. cf. https://patchwork.kernel.org/patch/11816693/ for qemu Signed-off-by: David Woodhouse Acked-by: Paolo Bonzini --- arch/x86

[PATCH v3 27/35] x86/hpet: Use irq_find_matching_fwspec() to find remapping irqdomain

2020-10-24 Thread David Woodhouse
From: David Woodhouse All possible parent domains have a select method now. Make use of it. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner --- arch/x86/kernel/hpet.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel

[PATCH v3 34/35] x86/kvm: Reserve KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-24 Thread David Woodhouse
From: David Woodhouse No functional change; just reserve the feature bit for now so that VMMs can start to implement it. This will allow the host to indicate that MSI emulation supports 15-bit destination IDs, allowing up to 32768 CPUs without interrupt remapping. cf. https

[PATCH v3 32/35] x86/apic: Support 15 bits of APIC ID in MSI where available

2020-10-24 Thread David Woodhouse
From: David Woodhouse Some hypervisors can allow the guest to use the Extended Destination ID field in the MSI address to address up to 32768 CPUs. This applies to all downstream devices which generate MSI cycles, including HPET, I/OAPIC and PCI MSI. HPET and PCI MSI use the same

[PATCH v3 33/35] iommu/hyper-v: Disable IRQ pseudo-remapping if 15 bit APIC IDs are available

2020-10-24 Thread David Woodhouse
From: David Woodhouse If the 15-bit APIC ID support is present in emulated MSI then there's no need for the pseudo-remapping support. Signed-off-by: David Woodhouse --- drivers/iommu/hyperv-iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/hyperv-iommu.c b/drivers

Re: [PATCH v2 8/8] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-24 Thread David Woodhouse
On Sat, 2020-10-24 at 11:13 +0100, David Woodhouse wrote: > OK, thanks. I'll rework Thomas's tree with that first and the other > changes I'd mentioned in my parts, as well as fixing up that unholy > chimæra of struct/union in which we set some bitfields from each side > of the

Re: [PATCH v2 8/8] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-24 Thread David Woodhouse
On 24 October 2020 10:13:36 BST, Paolo Bonzini wrote: >On 24/10/20 10:26, David Woodhouse wrote: >> I was also hoping Paolo was going to take the patch which just >defines >> the KVM_FEATURE_MSI_EXT_DEST_ID bit² ASAP, so that we end up with a >> second patch³

Re: [PATCH v2 8/8] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-24 Thread David Woodhouse
On Sat, 2020-10-24 at 09:26 +0100, David Woodhouse wrote: > > And now I wish it was just a simple shift instead of an unholy maze of > overlapping unions of bitfields. But I'll make more coffee and stare at > it harder... Hah, it really *was* unions of the bitfields. This boots...

Re: [PATCH v2 8/8] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-24 Thread David Woodhouse
On Fri, 2020-10-23 at 23:28 +0200, Thomas Gleixner wrote: > On Fri, Oct 23 2020 at 11:10, David Woodhouse wrote: > > On 22 October 2020 22:43:52 BST, Thomas Gleixner wrote: > > It makes the callers slightly more readable, not having to cast to > > uint32_t* from the struct.

Re: [PATCH v2 8/8] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-23 Thread David Woodhouse
rdware. Even doing it with bitfields is just going to be masking the issue by having structure definitions that don't actually match the I/OAPIC documentation. Better to be up front about it. I've added more words though; more words always help... https://git.infradead.org/users/dwmw2/linux.git/short

Re: [PATCH v2 8/8] x86/ioapic: Generate RTE directly from parent irqchip's MSI message

2020-10-23 Thread David Woodhouse
On 22 October 2020 22:43:52 BST, Thomas Gleixner wrote: >On Fri, Oct 09 2020 at 11:46, David Woodhouse wrote: > >@@ -45,12 +45,11 @@ enum irq_alloc_type { > }; > >> +static void mp_swizzle_msi_dest_bits(struct irq_data *irq_data, void >*_entry) >> +{ >>

Re: [PATCH next] iommu: intel: don't dereference iommu_device if IOMMU_API is not built

2020-10-17 Thread David Woodhouse
On Wed, 2020-10-14 at 14:57 +0200, Joerg Roedel wrote: > On Wed, Oct 14, 2020 at 03:25:08PM +0800, Lu Baolu wrote: > > I suppose Joerg will pick this up. I guess you don't need to resend it > > unless Joerg asks you to do. > > Yes, will pick this up soon, no need to re-send. Please could it, and

Re: dmar compile failure in -git

2020-10-17 Thread David Woodhouse
On 16 October 2020 22:23:46 BST, Jens Axboe wrote: >Hi, > >Ran into this one yesterday: > >drivers/iommu/intel/dmar.c: In function ‘free_iommu’: >drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no >member named ‘ops’ > 1139 | if (intel_iommu_enabled && iommu->iommu.ops) {

Re: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-13 Thread David Woodhouse
On Tue, 2020-10-13 at 11:53 +0100, David Woodhouse wrote: > On Tue, 2020-10-13 at 12:46 +0200, Thomas Gleixner wrote: > > And after becoming more awake, that wont work anyway because there is > > more than one IR domain, so there is no way to return an error "You > > for

Re: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-13 Thread David Woodhouse
On Tue, 2020-10-13 at 12:46 +0200, Thomas Gleixner wrote: > And after becoming more awake, that wont work anyway because there is > more than one IR domain, so there is no way to return an error "You > forgot to register" obviously. > > But the APIC id (32768) valid check is also broken because

Re: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-13 Thread David Woodhouse
On Tue, 2020-10-13 at 11:28 +0200, Thomas Gleixner wrote: > On Tue, Oct 13 2020 at 08:52, David Woodhouse wrote: > > On Tue, 2020-10-13 at 00:13 +0200, Thomas Gleixner wrote: > > + dom = irq_find_matching_fwspec(fwspec, DOMAIN_BUS_IR); > > + if (dom) > > +

Re: [PATCH next] iommu: intel: don't dereference iommu_device if IOMMU_API is not built

2020-10-13 Thread David Woodhouse
ly handle DMAR units with no > supported address widths") > Signed-off-by: Bartosz Golaszewski Oops, apologies for that. Thanks for fixing it. Acked-by: David Woodhouse smime.p7s Description: S/MIME cryptographic signature

[PATCH 3/9] iommu/amd: Implement select() method on remapping irqdomain

2020-10-13 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- drivers/iommu/amd/iommu.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 13d0a8f42d56..7ecebc5d255f 100644 --- a/drivers/iommu/amd/iommu.c +++ b

[PATCH 9/9] iommu/vt-d: Simplify intel_irq_remapping_select()

2020-10-13 Thread David Woodhouse
From: David Woodhouse Now that the old get_irq_domain() method has gone, we can consolidate on just the map_XXX_to_iommu() functions. Signed-off-by: David Woodhouse --- drivers/iommu/intel/irq_remapping.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git

[PATCH 5/9] iommu/hyper-v: Implement select() method on remapping irqdomain

2020-10-13 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- drivers/iommu/hyperv-iommu.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/hyperv-iommu.c b/drivers/iommu/hyperv-iommu.c index 37dd485a5640..6a8966fbc3bd 100644 --- a/drivers/iommu/hyperv-iommu.c +++ b

[PATCH 0/9] Remove irq_remapping_get_irq_domain()

2020-10-13 Thread David Woodhouse
s at https://patchwork.kernel.org/project/kvm/list/?series=362037 https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/ext_dest_id David Woodhouse (9): genirq/irqdomain: Implement get_name() method on irqchip fwnodes x86/apic: Add select() method on vector irqdomain iommu/amd: Implem

[PATCH 7/9] x86/ioapic: Use irq_find_matching_fwspec() to find remapping irqdomain

2020-10-13 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- arch/x86/kernel/apic/io_apic.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index ca2da19d5c55..73cacc92c3bb 100644

[PATCH 1/9] genirq/irqdomain: Implement get_name() method on irqchip fwnodes

2020-10-13 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- kernel/irq/irqdomain.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 76cd7ebd1178..6440f97c412e 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq

[PATCH 6/9] x86/hpet: Use irq_find_matching_fwspec() to find remapping irqdomain

2020-10-13 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- arch/x86/kernel/hpet.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 3b8b12769f3b..fb7736ca7b5b 100644 --- a/arch/x86/kernel/hpet.c

[PATCH 4/9] iommu/vt-d: Implement select() method on remapping irqdomain

2020-10-13 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- drivers/iommu/intel/irq_remapping.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c index 511dfb4884bc..40c2fec122b8 100644 --- a/drivers/iommu

[PATCH 8/9] x86: Kill all traces of irq_remapping_get_irq_domain()

2020-10-13 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- arch/x86/include/asm/hw_irq.h| 2 -- arch/x86/include/asm/irq_remapping.h | 9 drivers/iommu/amd/iommu.c| 34 drivers/iommu/hyperv-iommu.c | 9 drivers/iommu

[PATCH 2/9] x86/apic: Add select() method on vector irqdomain

2020-10-13 Thread David Woodhouse
From: David Woodhouse This will be used to select the irqdomain for I/OAPIC and HPET. Signed-off-by: David Woodhouse --- arch/x86/include/asm/irqdomain.h | 3 +++ arch/x86/kernel/apic/vector.c| 43 2 files changed, 46 insertions(+) diff --git a/arch/x86

Re: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-13 Thread David Woodhouse
On Tue, 2020-10-13 at 00:13 +0200, Thomas Gleixner wrote: > On Mon, Oct 12 2020 at 21:20, David Woodhouse wrote: > > On Mon, 2020-10-12 at 20:38 +0200, Thomas Gleixner wrote: > > > Nasty, but way better than what we have now. > > > > Want me to send that out in e

Re: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-12 Thread David Woodhouse
On Mon, 2020-10-12 at 20:38 +0200, Thomas Gleixner wrote: > On Mon, Oct 12 2020 at 17:06, David Woodhouse wrote: > > On Mon, 2020-10-12 at 11:33 +0200, Thomas Gleixner wrote: > > > You might want to look into using irq_find_matching_fwspec() > > > instead for > > &

Re: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-12 Thread David Woodhouse
On Mon, 2020-10-12 at 11:33 +0200, Thomas Gleixner wrote: > On Sun, Oct 11 2020 at 22:15, David Woodhouse wrote: > > On 11 October 2020 18:12:08 BST, Thomas Gleixner wrote: > > > On Sat, Oct 10 2020 at 12:58, David Woodhouse wrote: > > > > On 10 October 2020

Re: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID

2020-10-11 Thread David Woodhouse
On 11 October 2020 18:12:08 BST, Thomas Gleixner wrote: >On Sat, Oct 10 2020 at 12:58, David Woodhouse wrote: >> On 10 October 2020 12:44:10 BST, Thomas Gleixner >wrote: >>>On Sat, Oct 10 2020 at 11:06, David Woodhouse wrote: > >>>> The IRQ remapping driv

<    1   2   3   4   5   6   7   8   9   10   >