/* * Thunderbolt Cactus Ridge driver - NHI driver * * Copyright (c) 2014 Andreas Noever */ #ifndef DSL3510_H_ #define DSL3510_H_ #include #include /** * struct tb_nhi - thunderbolt native host interface */ struct tb_nhi { struct mutex lock; /* * Must be held during ring creation/destruction. * Is acquired by interrupt_work when dispatching * interrupts to individual rings. **/ struct pci_dev *pdev; void __iomem *iobase; struct tb_ring **tx_rings; struct tb_ring **rx_rings; struct work_struct interrupt_work; u32 hop_count; /* Number of rings (end point hops) supported by NHI. */ }; /** * struct tb_ring - thunderbolt TX or RX ring associated with a NHI */ struct tb_ring { struct mutex lock; /* must be acquired after nhi->lock */ struct tb_nhi *nhi; int size; int hop; int head; /* write next descriptor here */ int tail; /* complete next descriptor here */ struct ring_desc *descriptors; dma_addr_t descriptors_dma; struct list_head queue; struct list_head in_flight; struct work_struct work; bool is_tx:1; /* rx otherwise */ bool running:1; }; struct ring_frame; typedef void (*ring_cb)(struct tb_ring*, struct ring_frame*, bool canceled); /** * struct ring_frame - for use with ring_rx/ring_tx */ struct ring_frame { dma_addr_t buffer_phy; ring_cb callback; struct list_head list; u32 size:12; /* TX: in, RX: out*/ u32 flags:12; /* RX: out */ u32 eof:4; /* TX:in, RX: out */ u32 sof:4; /* TX:in, RX: out */ }; #define TB_FRAME_SIZE 0x100 /* minimum size for ring_rx */ struct tb_ring *ring_alloc_tx(struct tb_nhi *nhi, int hop, int size); struct tb_ring *ring_alloc_rx(struct tb_nhi *nhi, int hop, int size); void ring_start(struct tb_ring *ring); void ring_stop(struct tb_ring *ring); void ring_free(struct tb_ring *ring); int __ring_enqueue(struct tb_ring *ring, struct ring_frame *frame); /** * ring_rx() - enqueue a frame on an RX ring * * frame->buffer, frame->buffer_phy and frame->callback have to be set. The * buffer must contain at least TB_FRAME_SIZE bytes. * * frame->callback will be invoked with frame->size, frame->flags, frame->eof, * frame->sof set once the frame has been received. * * If ring_stop is called after the packet has been enqueued frame->callback * will be called with canceled set to true. * * Return: Returns ESHUTDOWN if ring_stop has been called. Zero otherwise. */ static inline int ring_rx(struct tb_ring *ring, struct ring_frame *frame) { WARN_ON(ring->is_tx); return __ring_enqueue(ring, frame); } /** * ring_tx() - enqueue a frame on an TX ring * * frame->buffer, frame->buffer_phy, frame->callback, frame->size, frame->eof * and frame->sof have to be set. * * frame->callback will be invoked with once the frame has been transmitted. * * If ring_stop is called after the packet has been enqueued frame->callback * will be called with canceled set to true. * * Return: Returns ESHUTDOWN if ring_stop has been called. Zero otherwise. */ static inline int ring_tx(struct tb_ring *ring, struct ring_frame *frame) { WARN_ON(!ring->is_tx); return __ring_enqueue(ring, frame); } #endif e017ac649326f'>tools/testing/selftests/mqueue
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2017-01-27 22:25:52 +0000
committerIngo Molnar <mingo@kernel.org>2017-01-28 09:18:56 +0100
commitbf29bddf0417a4783da3b24e8c9e017ac649326f (patch)
tree54a05a4883b73f80e4e1d8c4b15750aa01c39932 /tools/testing/selftests/mqueue
parent883af14e67e8b8702b5560aa64c888c0cd0bd66c (diff)
x86/efi: Always map the first physical page into the EFI pagetables
Commit: 129766708 ("x86/efi: Only map RAM into EFI page tables if in mixed-mode") stopped creating 1:1 mappings for all RAM, when running in native 64-bit mode. It turns out though that there are 64-bit EFI implementations in the wild (this particular problem has been reported on a Lenovo Yoga 710-11IKB), which still make use of the first physical page for their own private use, even though they explicitly mark it EFI_CONVENTIONAL_MEMORY in the memory map. In case there is no mapping for this particular frame in the EFI pagetables, as soon as firmware tries to make use of it, a triple fault occurs and the system reboots (in case of the Yoga 710-11IKB this is very early during bootup). Fix that by always mapping the first page of physical memory into the EFI pagetables. We're free to hand this page to the BIOS, as trim_bios_range() will reserve the first page and isolate it away from memory allocators anyway. Note that just reverting 129766708 alone is not enough on v4.9-rc1+ to fix the regression on affected hardware, as this commit: ab72a27da ("x86/efi: Consolidate region mapping logic") later made the first physical frame not to be mapped anyway. Reported-by: Hanka Pavlikova <hanka@ucw.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Borislav Petkov <bp@suse.de> Cc: Laura Abbott <labbott@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vojtech Pavlik <vojtech@ucw.cz> Cc: Waiman Long <waiman.long@hpe.com> Cc: linux-efi@vger.kernel.org Cc: stable@kernel.org # v4.8+ Fixes: 129766708 ("x86/efi: Only map RAM into EFI page tables if in mixed-mode") Link: http://lkml.kernel.org/r/20170127222552.22336-1-matt@codeblueprint.co.uk [ Tidied up the changelog and the comment. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/testing/selftests/mqueue')