This is the 4.9.142 stable release
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlwCSesACgkQONu9yGCS aT6l4xAA1dKYI5S/l/K6VswVDAR48BZY4hAVPrCOCuhWt6RXMa6rv9Jhqvlj8DTH njfntSSpQCkEUHdmG1uceTVtuitXKFWyIwQXVql73cdg9u7Jxd1uJ71B7dSzyqFw s712+HkKyp2O64KH/LpLjwEbImtVXTAzIXhIAxLjLdOEkBV7kNZMcVTFzKqPO/vX OKwZw65ro2+3VZiU5cfSVx6Oerbdjusan56dQTGAxH96JCo3+5mXjBiK83fmQf0e 52zmesn4bSfC4083bwJpAx5wy6tBBZocDRMTCXJ6vvHMFL58QvZEnIdWpe2ECT3v rUIxOs5nNq6yFHwfn3VM+PzYhqz7WT08RBkr2KNTpaDOIQqFqMi7H4qVo2BfUVnv RKEUnyXe9hO5SNcVroNmM8qwda5tubA/EGPgLt+BFw2sUEZIcQ0VWduxSJtgxerH aSEvyEvT9551oXLg4LHARIJwNiKDk2Iq8UkANwL6+F0ZLD0sNzDNM+gysvNII7aW lkY6Z/sE0oGYWylq17i+wFxJ2PeLo84KJeZ3tqrnTbTuok4cjIWSmxPszDnq+E3f b9dMoDnECEO1DmM+OCKBeOkxzwbl92rkn3HaQxWQNFRhGzoGK1h4ECHSHyMCkZJw 7n17JeT4QGrxhmkmO7qS2u1yjPiJWURDd0FDd1ns6Tm4soaljvs= =zLVF -----END PGP SIGNATURE----- Merge 4.9.142 into android-4.9 Changes in 4.9.142 usb: core: Fix hub port connection events lost usb: dwc3: core: Clean up ULPI device usb: xhci: fix timeout for transition from RExit to U0 MAINTAINERS: Add Sasha as a stable branch maintainer gpio: don't free unallocated ida on gpiochip_add_data_with_key() error path iwlwifi: mvm: support sta_statistics() even on older firmware iwlwifi: mvm: fix regulatory domain update when the firmware starts brcmfmac: fix reporting support for 160 MHz channels tools/power/cpupower: fix compilation with STATIC=true v9fs_dir_readdir: fix double-free on p9stat_read error selinux: Add __GFP_NOWARN to allocation at str_read() bfs: add sanity check at bfs_fill_super() sctp: clear the transport of some out_chunk_list chunks in sctp_assoc_rm_peer gfs2: Don't leave s_fs_info pointing to freed memory in init_sbd llc: do not use sk_eat_skb() mm: don't warn about large allocations for slab drm/ast: change resolution may cause screen blurred drm/ast: fixed cursor may disappear sometimes drm/ast: Remove existing framebuffers before loading driver can: dev: can_get_echo_skb(): factor out non sending code to __can_get_echo_skb() can: dev: __can_get_echo_skb(): replace struct can_frame by canfd_frame to access frame length can: dev: __can_get_echo_skb(): Don't crash the kernel if can_priv::echo_skb is accessed out of bounds can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb IB/core: Fix for core panic IB/hfi1: Eliminate races in the SDMA send error path usb: xhci: Prevent bus suspend if a port connect change or polling state is detected pinctrl: meson: fix pinconf bias disable KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE cpufreq: imx6q: add return value check for voltage scale rtc: pcf2127: fix a kmemleak caused in pcf2127_i2c_gather_write floppy: fix race condition in __floppy_read_block_0() powerpc/io: Fix the IO workarounds code to work with Radix perf/x86/intel/uncore: Add more IMC PCI IDs for KabyLake and CoffeeLake CPUs SUNRPC: Fix a bogus get/put in generic_key_to_expire() kdb: Use strscpy with destination buffer size powerpc/numa: Suppress "VPHN is not supported" messages efi/arm: Revert deferred unmap of early memmap mapping tmpfs: make lseek(SEEK_DATA/SEK_HOLE) return ENXIO with a negative offset of: add helper to lookup compatible child node NFC: nfcmrvl_uart: fix OF child-node lookup net: bcmgenet: fix OF child-node lookup arm64: remove no-op -p linker flag ath10k: fix kernel panic due to race in accessing arvif list Input: xpad - add product ID for Xbox One S pad Input: xpad - fix Xbox One rumble stopping after 2.5 secs Input: xpad - correctly sort vendor id's Input: xpad - move reporting xbox one home button to common function Input: xpad - simplify error condition in init_output Input: xpad - don't depend on endpoint order Input: xpad - fix stuck mode button on Xbox One S pad Input: xpad - restore LED state after device resume Input: xpad - support some quirky Xbox One pads Input: xpad - sort supported devices by USB ID Input: xpad - sync supported devices with xboxdrv Input: xpad - add USB IDs for Mad Catz Brawlstick and Razer Sabertooth Input: xpad - sync supported devices with 360Controller Input: xpad - sync supported devices with XBCD Input: xpad - constify usb_device_id Input: xpad - fix PowerA init quirk for some gamepad models Input: xpad - validate USB endpoint type during probe Input: xpad - add support for PDP Xbox One controllers Input: xpad - add PDP device id 0x02a4 Input: xpad - fix some coding style issues Input: xpad - avoid using __set_bit() for capabilities Input: xpad - add GPD Win 2 Controller USB IDs Input: xpad - fix GPD Win 2 controller name Input: xpad - add support for Xbox1 PDP Camo series gamepad cw1200: Don't leak memory if krealloc failes mwifiex: prevent register accesses after host is sleeping mwifiex: report error to PCIe for suspend failure mwifiex: Fix NULL pointer dereference in skb_dequeue() mwifiex: fix p2p device doesn't find in scan problem scsi: ufs: fix bugs related to null pointer access and array size scsi: ufshcd: Fix race between clk scaling and ungate work scsi: ufs: fix race between clock gating and devfreq scaling work scsi: ufshcd: release resources if probe fails include/linux/pfn_t.h: force '~' to be parsed as an unary operator tty: wipe buffer. tty: wipe buffer if not echoing data usb: xhci: fix uninitialized completion when USB3 port got wrong status sched/core: Allow __sched_setscheduler() in interrupts when PI is not used namei: allow restricted O_CREAT of FIFOs and regular files lan78xx: Read MAC address from DT if present s390/mm: Check for valid vma before zapping in gmap_discard net: ieee802154: 6lowpan: fix frag reassembly Revert "evm: Translate user/group ids relative to s_user_ns when computing HMAC" ima: always measure and audit files in policy EVM: Add support for portable signature format ima: re-introduce own integrity cache lock ima: re-initialize iint->atomic_flags Linux 4.9.142 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
commit
db71418d4a
86 changed files with 1316 additions and 461 deletions
|
@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
|
||||||
- overflowgid
|
- overflowgid
|
||||||
- pipe-user-pages-hard
|
- pipe-user-pages-hard
|
||||||
- pipe-user-pages-soft
|
- pipe-user-pages-soft
|
||||||
|
- protected_fifos
|
||||||
- protected_hardlinks
|
- protected_hardlinks
|
||||||
|
- protected_regular
|
||||||
- protected_symlinks
|
- protected_symlinks
|
||||||
- suid_dumpable
|
- suid_dumpable
|
||||||
- super-max
|
- super-max
|
||||||
|
@ -182,6 +184,24 @@ applied.
|
||||||
|
|
||||||
==============================================================
|
==============================================================
|
||||||
|
|
||||||
|
protected_fifos:
|
||||||
|
|
||||||
|
The intent of this protection is to avoid unintentional writes to
|
||||||
|
an attacker-controlled FIFO, where a program expected to create a regular
|
||||||
|
file.
|
||||||
|
|
||||||
|
When set to "0", writing to FIFOs is unrestricted.
|
||||||
|
|
||||||
|
When set to "1" don't allow O_CREAT open on FIFOs that we don't own
|
||||||
|
in world writable sticky directories, unless they are owned by the
|
||||||
|
owner of the directory.
|
||||||
|
|
||||||
|
When set to "2" it also applies to group writable sticky directories.
|
||||||
|
|
||||||
|
This protection is based on the restrictions in Openwall.
|
||||||
|
|
||||||
|
==============================================================
|
||||||
|
|
||||||
protected_hardlinks:
|
protected_hardlinks:
|
||||||
|
|
||||||
A long-standing class of security issues is the hardlink-based
|
A long-standing class of security issues is the hardlink-based
|
||||||
|
@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall and grsecurity.
|
||||||
|
|
||||||
==============================================================
|
==============================================================
|
||||||
|
|
||||||
|
protected_regular:
|
||||||
|
|
||||||
|
This protection is similar to protected_fifos, but it
|
||||||
|
avoids writes to an attacker-controlled regular file, where a program
|
||||||
|
expected to create one.
|
||||||
|
|
||||||
|
When set to "0", writing to regular files is unrestricted.
|
||||||
|
|
||||||
|
When set to "1" don't allow O_CREAT open on regular files that we
|
||||||
|
don't own in world writable sticky directories, unless they are
|
||||||
|
owned by the owner of the directory.
|
||||||
|
|
||||||
|
When set to "2" it also applies to group writable sticky directories.
|
||||||
|
|
||||||
|
==============================================================
|
||||||
|
|
||||||
protected_symlinks:
|
protected_symlinks:
|
||||||
|
|
||||||
A long-standing class of security issues is the symlink-based
|
A long-standing class of security issues is the symlink-based
|
||||||
|
|
|
@ -11482,6 +11482,7 @@ F: arch/alpha/kernel/srm_env.c
|
||||||
|
|
||||||
STABLE BRANCH
|
STABLE BRANCH
|
||||||
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
M: Sasha Levin <sashal@kernel.org>
|
||||||
L: stable@vger.kernel.org
|
L: stable@vger.kernel.org
|
||||||
S: Supported
|
S: Supported
|
||||||
F: Documentation/stable_kernel_rules.txt
|
F: Documentation/stable_kernel_rules.txt
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
||||||
VERSION = 4
|
VERSION = 4
|
||||||
PATCHLEVEL = 9
|
PATCHLEVEL = 9
|
||||||
SUBLEVEL = 141
|
SUBLEVEL = 142
|
||||||
EXTRAVERSION =
|
EXTRAVERSION =
|
||||||
NAME = Roaring Lionus
|
NAME = Roaring Lionus
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 1995-2001 by Russell King
|
# Copyright (C) 1995-2001 by Russell King
|
||||||
|
|
||||||
LDFLAGS_vmlinux :=-p --no-undefined -X
|
LDFLAGS_vmlinux :=--no-undefined -X
|
||||||
CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
|
CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
|
||||||
GZFLAGS :=-9
|
GZFLAGS :=-9
|
||||||
|
|
||||||
|
|
|
@ -333,19 +333,13 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
|
||||||
* their hooks, a bitfield is reserved for use by the platform near the
|
* their hooks, a bitfield is reserved for use by the platform near the
|
||||||
* top of MMIO addresses (not PIO, those have to cope the hard way).
|
* top of MMIO addresses (not PIO, those have to cope the hard way).
|
||||||
*
|
*
|
||||||
* This bit field is 12 bits and is at the top of the IO virtual
|
* The highest address in the kernel virtual space are:
|
||||||
* addresses PCI_IO_INDIRECT_TOKEN_MASK.
|
|
||||||
*
|
*
|
||||||
* The kernel virtual space is thus:
|
* d0003fffffffffff # with Hash MMU
|
||||||
|
* c00fffffffffffff # with Radix MMU
|
||||||
*
|
*
|
||||||
* 0xD000000000000000 : vmalloc
|
* The top 4 bits are reserved as the region ID on hash, leaving us 8 bits
|
||||||
* 0xD000080000000000 : PCI PHB IO space
|
* that can be used for the field.
|
||||||
* 0xD000080080000000 : ioremap
|
|
||||||
* 0xD0000fffffffffff : end of ioremap region
|
|
||||||
*
|
|
||||||
* Since the top 4 bits are reserved as the region ID, we use thus
|
|
||||||
* the next 12 bits and keep 4 bits available for the future if the
|
|
||||||
* virtual address space is ever to be extended.
|
|
||||||
*
|
*
|
||||||
* The direct IO mapping operations will then mask off those bits
|
* The direct IO mapping operations will then mask off those bits
|
||||||
* before doing the actual access, though that only happen when
|
* before doing the actual access, though that only happen when
|
||||||
|
@ -357,8 +351,8 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_INDIRECT_MMIO
|
#ifdef CONFIG_PPC_INDIRECT_MMIO
|
||||||
#define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul
|
#define PCI_IO_IND_TOKEN_SHIFT 52
|
||||||
#define PCI_IO_IND_TOKEN_SHIFT 48
|
#define PCI_IO_IND_TOKEN_MASK (0xfful << PCI_IO_IND_TOKEN_SHIFT)
|
||||||
#define PCI_FIX_ADDR(addr) \
|
#define PCI_FIX_ADDR(addr) \
|
||||||
((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK))
|
((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK))
|
||||||
#define PCI_GET_ADDR_TOKEN(addr) \
|
#define PCI_GET_ADDR_TOKEN(addr) \
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#undef TRACE_SYSTEM
|
#undef TRACE_SYSTEM
|
||||||
#define TRACE_SYSTEM kvm
|
#define TRACE_SYSTEM kvm
|
||||||
#define TRACE_INCLUDE_PATH .
|
|
||||||
#define TRACE_INCLUDE_FILE trace
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tracepoint for guest mode entry.
|
* Tracepoint for guest mode entry.
|
||||||
|
@ -119,4 +117,10 @@ TRACE_EVENT(kvm_check_requests,
|
||||||
#endif /* _TRACE_KVM_H */
|
#endif /* _TRACE_KVM_H */
|
||||||
|
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
|
#undef TRACE_INCLUDE_PATH
|
||||||
|
#undef TRACE_INCLUDE_FILE
|
||||||
|
|
||||||
|
#define TRACE_INCLUDE_PATH .
|
||||||
|
#define TRACE_INCLUDE_FILE trace
|
||||||
|
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#undef TRACE_SYSTEM
|
#undef TRACE_SYSTEM
|
||||||
#define TRACE_SYSTEM kvm_booke
|
#define TRACE_SYSTEM kvm_booke
|
||||||
#define TRACE_INCLUDE_PATH .
|
|
||||||
#define TRACE_INCLUDE_FILE trace_booke
|
|
||||||
|
|
||||||
#define kvm_trace_symbol_exit \
|
#define kvm_trace_symbol_exit \
|
||||||
{0, "CRITICAL"}, \
|
{0, "CRITICAL"}, \
|
||||||
|
@ -217,4 +215,11 @@ TRACE_EVENT(kvm_booke_queue_irqprio,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
|
|
||||||
|
#undef TRACE_INCLUDE_PATH
|
||||||
|
#undef TRACE_INCLUDE_FILE
|
||||||
|
|
||||||
|
#define TRACE_INCLUDE_PATH .
|
||||||
|
#define TRACE_INCLUDE_FILE trace_booke
|
||||||
|
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#undef TRACE_SYSTEM
|
#undef TRACE_SYSTEM
|
||||||
#define TRACE_SYSTEM kvm_hv
|
#define TRACE_SYSTEM kvm_hv
|
||||||
#define TRACE_INCLUDE_PATH .
|
|
||||||
#define TRACE_INCLUDE_FILE trace_hv
|
|
||||||
|
|
||||||
#define kvm_trace_symbol_hcall \
|
#define kvm_trace_symbol_hcall \
|
||||||
{H_REMOVE, "H_REMOVE"}, \
|
{H_REMOVE, "H_REMOVE"}, \
|
||||||
|
@ -496,4 +494,11 @@ TRACE_EVENT(kvmppc_run_vcpu_exit,
|
||||||
#endif /* _TRACE_KVM_HV_H */
|
#endif /* _TRACE_KVM_HV_H */
|
||||||
|
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
|
|
||||||
|
#undef TRACE_INCLUDE_PATH
|
||||||
|
#undef TRACE_INCLUDE_FILE
|
||||||
|
|
||||||
|
#define TRACE_INCLUDE_PATH .
|
||||||
|
#define TRACE_INCLUDE_FILE trace_hv
|
||||||
|
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
#undef TRACE_SYSTEM
|
#undef TRACE_SYSTEM
|
||||||
#define TRACE_SYSTEM kvm_pr
|
#define TRACE_SYSTEM kvm_pr
|
||||||
#define TRACE_INCLUDE_PATH .
|
|
||||||
#define TRACE_INCLUDE_FILE trace_pr
|
|
||||||
|
|
||||||
TRACE_EVENT(kvm_book3s_reenter,
|
TRACE_EVENT(kvm_book3s_reenter,
|
||||||
TP_PROTO(int r, struct kvm_vcpu *vcpu),
|
TP_PROTO(int r, struct kvm_vcpu *vcpu),
|
||||||
|
@ -271,4 +269,11 @@ TRACE_EVENT(kvm_unmap_hva,
|
||||||
#endif /* _TRACE_KVM_H */
|
#endif /* _TRACE_KVM_H */
|
||||||
|
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
|
|
||||||
|
#undef TRACE_INCLUDE_PATH
|
||||||
|
#undef TRACE_INCLUDE_FILE
|
||||||
|
|
||||||
|
#define TRACE_INCLUDE_PATH .
|
||||||
|
#define TRACE_INCLUDE_FILE trace_pr
|
||||||
|
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
|
@ -1289,7 +1289,7 @@ static long vphn_get_associativity(unsigned long cpu,
|
||||||
|
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case H_FUNCTION:
|
case H_FUNCTION:
|
||||||
printk(KERN_INFO
|
printk_once(KERN_INFO
|
||||||
"VPHN is not supported. Disabling polling...\n");
|
"VPHN is not supported. Disabling polling...\n");
|
||||||
stop_topology_update();
|
stop_topology_update();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -686,6 +686,8 @@ void gmap_discard(struct gmap *gmap, unsigned long from, unsigned long to)
|
||||||
vmaddr |= gaddr & ~PMD_MASK;
|
vmaddr |= gaddr & ~PMD_MASK;
|
||||||
/* Find vma in the parent mm */
|
/* Find vma in the parent mm */
|
||||||
vma = find_vma(gmap->mm, vmaddr);
|
vma = find_vma(gmap->mm, vmaddr);
|
||||||
|
if (!vma)
|
||||||
|
continue;
|
||||||
size = min(to - gaddr, PMD_SIZE - (gaddr & ~PMD_MASK));
|
size = min(to - gaddr, PMD_SIZE - (gaddr & ~PMD_MASK));
|
||||||
zap_page_range(vma, vmaddr, size, NULL);
|
zap_page_range(vma, vmaddr, size, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,25 @@
|
||||||
#define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910
|
#define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910
|
||||||
#define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f
|
#define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f
|
||||||
#define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f
|
#define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f
|
||||||
|
#define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c
|
||||||
|
#define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904
|
||||||
|
#define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914
|
||||||
|
#define PCI_DEVICE_ID_INTEL_KBL_SD_IMC 0x590f
|
||||||
|
#define PCI_DEVICE_ID_INTEL_KBL_SQ_IMC 0x591f
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_2U_IMC 0x3ecc
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_4U_IMC 0x3ed0
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_4H_IMC 0x3e10
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_6H_IMC 0x3ec4
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC 0x3e0f
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC 0x3e1f
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC 0x3ec2
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC 0x3e30
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC 0x3e18
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC 0x3ec6
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC 0x3e31
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC 0x3e33
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC 0x3eca
|
||||||
|
#define PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC 0x3e32
|
||||||
|
|
||||||
/* SNB event control */
|
/* SNB event control */
|
||||||
#define SNB_UNC_CTL_EV_SEL_MASK 0x000000ff
|
#define SNB_UNC_CTL_EV_SEL_MASK 0x000000ff
|
||||||
|
@ -631,7 +650,82 @@ static const struct pci_device_id skl_uncore_pci_ids[] = {
|
||||||
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC),
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC),
|
||||||
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
},
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_Y_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_U_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_UQ_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SD_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SQ_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2U_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4U_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4H_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6H_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
|
{ /* IMC */
|
||||||
|
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC),
|
||||||
|
.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
|
||||||
|
},
|
||||||
{ /* end: all zeroes */ },
|
{ /* end: all zeroes */ },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -680,6 +774,25 @@ static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = {
|
||||||
IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */
|
IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */
|
||||||
IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */
|
IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */
|
||||||
IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */
|
IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */
|
||||||
|
IMC_DEV(KBL_Y_IMC, &skl_uncore_pci_driver), /* 7th Gen Core Y */
|
||||||
|
IMC_DEV(KBL_U_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U */
|
||||||
|
IMC_DEV(KBL_UQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U Quad Core */
|
||||||
|
IMC_DEV(KBL_SD_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Dual Core */
|
||||||
|
IMC_DEV(KBL_SQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Quad Core */
|
||||||
|
IMC_DEV(CFL_2U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 2 Cores */
|
||||||
|
IMC_DEV(CFL_4U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 4 Cores */
|
||||||
|
IMC_DEV(CFL_4H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 4 Cores */
|
||||||
|
IMC_DEV(CFL_6H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 6 Cores */
|
||||||
|
IMC_DEV(CFL_2S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 2 Cores Desktop */
|
||||||
|
IMC_DEV(CFL_4S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Desktop */
|
||||||
|
IMC_DEV(CFL_6S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Desktop */
|
||||||
|
IMC_DEV(CFL_8S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Desktop */
|
||||||
|
IMC_DEV(CFL_4S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Work Station */
|
||||||
|
IMC_DEV(CFL_6S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Work Station */
|
||||||
|
IMC_DEV(CFL_8S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Work Station */
|
||||||
|
IMC_DEV(CFL_4S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Server */
|
||||||
|
IMC_DEV(CFL_6S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Server */
|
||||||
|
IMC_DEV(CFL_8S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Server */
|
||||||
{ /* end marker */ }
|
{ /* end marker */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3823,10 +3823,11 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive)
|
||||||
bio.bi_end_io = floppy_rb0_cb;
|
bio.bi_end_io = floppy_rb0_cb;
|
||||||
bio_set_op_attrs(&bio, REQ_OP_READ, 0);
|
bio_set_op_attrs(&bio, REQ_OP_READ, 0);
|
||||||
|
|
||||||
|
init_completion(&cbdata.complete);
|
||||||
|
|
||||||
submit_bio(&bio);
|
submit_bio(&bio);
|
||||||
process_fd_request();
|
process_fd_request();
|
||||||
|
|
||||||
init_completion(&cbdata.complete);
|
|
||||||
wait_for_completion(&cbdata.complete);
|
wait_for_completion(&cbdata.complete);
|
||||||
|
|
||||||
__free_page(page);
|
__free_page(page);
|
||||||
|
|
|
@ -130,8 +130,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
|
||||||
/* Ensure the arm clock divider is what we expect */
|
/* Ensure the arm clock divider is what we expect */
|
||||||
ret = clk_set_rate(arm_clk, new_freq * 1000);
|
ret = clk_set_rate(arm_clk, new_freq * 1000);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
int ret1;
|
||||||
|
|
||||||
dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
|
dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
|
||||||
regulator_set_voltage_tol(arm_reg, volt_old, 0);
|
ret1 = regulator_set_voltage_tol(arm_reg, volt_old, 0);
|
||||||
|
if (ret1)
|
||||||
|
dev_warn(cpu_dev,
|
||||||
|
"failed to restore vddarm voltage: %d\n", ret1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,10 @@ void __init efi_init(void)
|
||||||
(params.mmap & ~PAGE_MASK)));
|
(params.mmap & ~PAGE_MASK)));
|
||||||
|
|
||||||
init_screen_info();
|
init_screen_info();
|
||||||
|
|
||||||
|
/* ARM does not permit early mappings to persist across paging_init() */
|
||||||
|
if (IS_ENABLED(CONFIG_ARM))
|
||||||
|
efi_memmap_unmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init register_gop_device(void)
|
static int __init register_gop_device(void)
|
||||||
|
|
|
@ -118,7 +118,7 @@ static int __init arm_enable_runtime_services(void)
|
||||||
{
|
{
|
||||||
u64 mapsize;
|
u64 mapsize;
|
||||||
|
|
||||||
if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) {
|
if (!efi_enabled(EFI_BOOT)) {
|
||||||
pr_info("EFI services will not be available.\n");
|
pr_info("EFI services will not be available.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,9 @@ int __init efi_memmap_init_early(struct efi_memory_map_data *data)
|
||||||
|
|
||||||
void __init efi_memmap_unmap(void)
|
void __init efi_memmap_unmap(void)
|
||||||
{
|
{
|
||||||
|
if (!efi_enabled(EFI_MEMMAP))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!efi.memmap.late) {
|
if (!efi.memmap.late) {
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
||||||
|
|
|
@ -1153,7 +1153,7 @@ int gpiochip_add_data(struct gpio_chip *chip, void *data)
|
||||||
gdev->descs = kcalloc(chip->ngpio, sizeof(gdev->descs[0]), GFP_KERNEL);
|
gdev->descs = kcalloc(chip->ngpio, sizeof(gdev->descs[0]), GFP_KERNEL);
|
||||||
if (!gdev->descs) {
|
if (!gdev->descs) {
|
||||||
status = -ENOMEM;
|
status = -ENOMEM;
|
||||||
goto err_free_gdev;
|
goto err_free_ida;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chip->ngpio == 0) {
|
if (chip->ngpio == 0) {
|
||||||
|
@ -1285,8 +1285,9 @@ err_free_label:
|
||||||
kfree(gdev->label);
|
kfree(gdev->label);
|
||||||
err_free_descs:
|
err_free_descs:
|
||||||
kfree(gdev->descs);
|
kfree(gdev->descs);
|
||||||
err_free_gdev:
|
err_free_ida:
|
||||||
ida_simple_remove(&gpio_ida, gdev->id);
|
ida_simple_remove(&gpio_ida, gdev->id);
|
||||||
|
err_free_gdev:
|
||||||
/* failures here can mean systems won't boot... */
|
/* failures here can mean systems won't boot... */
|
||||||
pr_err("%s: GPIOs %d..%d (%s) failed to register\n", __func__,
|
pr_err("%s: GPIOs %d..%d (%s) failed to register\n", __func__,
|
||||||
gdev->base, gdev->base + gdev->ngpio - 1,
|
gdev->base, gdev->base + gdev->ngpio - 1,
|
||||||
|
|
|
@ -60,8 +60,29 @@ static const struct pci_device_id pciidlist[] = {
|
||||||
|
|
||||||
MODULE_DEVICE_TABLE(pci, pciidlist);
|
MODULE_DEVICE_TABLE(pci, pciidlist);
|
||||||
|
|
||||||
|
static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
|
||||||
|
{
|
||||||
|
struct apertures_struct *ap;
|
||||||
|
bool primary = false;
|
||||||
|
|
||||||
|
ap = alloc_apertures(1);
|
||||||
|
if (!ap)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ap->ranges[0].base = pci_resource_start(pdev, 0);
|
||||||
|
ap->ranges[0].size = pci_resource_len(pdev, 0);
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86
|
||||||
|
primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
|
||||||
|
#endif
|
||||||
|
drm_fb_helper_remove_conflicting_framebuffers(ap, "astdrmfb", primary);
|
||||||
|
kfree(ap);
|
||||||
|
}
|
||||||
|
|
||||||
static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
{
|
{
|
||||||
|
ast_kick_out_firmware_fb(pdev);
|
||||||
|
|
||||||
return drm_get_pci_dev(pdev, ent, &driver);
|
return drm_get_pci_dev(pdev, ent, &driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -545,6 +545,7 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
|
||||||
}
|
}
|
||||||
ast_bo_unreserve(bo);
|
ast_bo_unreserve(bo);
|
||||||
|
|
||||||
|
ast_set_offset_reg(crtc);
|
||||||
ast_set_start_address_crt1(crtc, (u32)gpu_addr);
|
ast_set_start_address_crt1(crtc, (u32)gpu_addr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1235,7 +1236,7 @@ static int ast_cursor_move(struct drm_crtc *crtc,
|
||||||
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07));
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07));
|
||||||
|
|
||||||
/* dummy write to fire HWC */
|
/* dummy write to fire HWC */
|
||||||
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00);
|
ast_show_cursor(crtc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1522,7 +1522,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
|
||||||
*/
|
*/
|
||||||
if (!ib_query_qp(qp, &attr, IB_QP_STATE | IB_QP_PORT, &init_attr)) {
|
if (!ib_query_qp(qp, &attr, IB_QP_STATE | IB_QP_PORT, &init_attr)) {
|
||||||
if (attr.qp_state >= IB_QPS_INIT) {
|
if (attr.qp_state >= IB_QPS_INIT) {
|
||||||
if (qp->device->get_link_layer(qp->device, attr.port_num) !=
|
if (rdma_port_get_link_layer(qp->device, attr.port_num) !=
|
||||||
IB_LINK_LAYER_INFINIBAND)
|
IB_LINK_LAYER_INFINIBAND)
|
||||||
return true;
|
return true;
|
||||||
goto lid_check;
|
goto lid_check;
|
||||||
|
@ -1531,7 +1531,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
|
||||||
|
|
||||||
/* Can't get a quick answer, iterate over all ports */
|
/* Can't get a quick answer, iterate over all ports */
|
||||||
for (port = 0; port < qp->device->phys_port_cnt; port++)
|
for (port = 0; port < qp->device->phys_port_cnt; port++)
|
||||||
if (qp->device->get_link_layer(qp->device, port) !=
|
if (rdma_port_get_link_layer(qp->device, port) !=
|
||||||
IB_LINK_LAYER_INFINIBAND)
|
IB_LINK_LAYER_INFINIBAND)
|
||||||
num_eth_ports++;
|
num_eth_ports++;
|
||||||
|
|
||||||
|
|
|
@ -148,11 +148,8 @@ MODULE_PARM_DESC(sdma_comp_size, "Size of User SDMA completion ring. Default: 12
|
||||||
#define TXREQ_FLAGS_REQ_LAST_PKT BIT(0)
|
#define TXREQ_FLAGS_REQ_LAST_PKT BIT(0)
|
||||||
|
|
||||||
/* SDMA request flag bits */
|
/* SDMA request flag bits */
|
||||||
#define SDMA_REQ_FOR_THREAD 1
|
#define SDMA_REQ_HAVE_AHG 1
|
||||||
#define SDMA_REQ_SEND_DONE 2
|
#define SDMA_REQ_HAS_ERROR 2
|
||||||
#define SDMA_REQ_HAVE_AHG 3
|
|
||||||
#define SDMA_REQ_HAS_ERROR 4
|
|
||||||
#define SDMA_REQ_DONE_ERROR 5
|
|
||||||
|
|
||||||
#define SDMA_PKT_Q_INACTIVE BIT(0)
|
#define SDMA_PKT_Q_INACTIVE BIT(0)
|
||||||
#define SDMA_PKT_Q_ACTIVE BIT(1)
|
#define SDMA_PKT_Q_ACTIVE BIT(1)
|
||||||
|
@ -252,8 +249,6 @@ struct user_sdma_request {
|
||||||
u64 seqsubmitted;
|
u64 seqsubmitted;
|
||||||
struct list_head txps;
|
struct list_head txps;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
/* status of the last txreq completed */
|
|
||||||
int status;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -546,7 +541,6 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
|
||||||
struct sdma_req_info info;
|
struct sdma_req_info info;
|
||||||
struct user_sdma_request *req;
|
struct user_sdma_request *req;
|
||||||
u8 opcode, sc, vl;
|
u8 opcode, sc, vl;
|
||||||
int req_queued = 0;
|
|
||||||
u16 dlid;
|
u16 dlid;
|
||||||
u32 selector;
|
u32 selector;
|
||||||
|
|
||||||
|
@ -611,11 +605,13 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
|
||||||
req->data_iovs = req_iovcnt(info.ctrl) - 1; /* subtract header vector */
|
req->data_iovs = req_iovcnt(info.ctrl) - 1; /* subtract header vector */
|
||||||
req->pq = pq;
|
req->pq = pq;
|
||||||
req->cq = cq;
|
req->cq = cq;
|
||||||
req->status = -1;
|
|
||||||
INIT_LIST_HEAD(&req->txps);
|
INIT_LIST_HEAD(&req->txps);
|
||||||
|
|
||||||
memcpy(&req->info, &info, sizeof(info));
|
memcpy(&req->info, &info, sizeof(info));
|
||||||
|
|
||||||
|
/* The request is initialized, count it */
|
||||||
|
atomic_inc(&pq->n_reqs);
|
||||||
|
|
||||||
if (req_opcode(info.ctrl) == EXPECTED) {
|
if (req_opcode(info.ctrl) == EXPECTED) {
|
||||||
/* expected must have a TID info and at least one data vector */
|
/* expected must have a TID info and at least one data vector */
|
||||||
if (req->data_iovs < 2) {
|
if (req->data_iovs < 2) {
|
||||||
|
@ -704,7 +700,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
|
||||||
memcpy(&req->iovs[i].iov, iovec + idx++, sizeof(struct iovec));
|
memcpy(&req->iovs[i].iov, iovec + idx++, sizeof(struct iovec));
|
||||||
ret = pin_vector_pages(req, &req->iovs[i]);
|
ret = pin_vector_pages(req, &req->iovs[i]);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
req->status = ret;
|
req->data_iovs = i;
|
||||||
goto free_req;
|
goto free_req;
|
||||||
}
|
}
|
||||||
req->data_len += req->iovs[i].iov.iov_len;
|
req->data_len += req->iovs[i].iov.iov_len;
|
||||||
|
@ -772,14 +768,10 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
|
||||||
}
|
}
|
||||||
|
|
||||||
set_comp_state(pq, cq, info.comp_idx, QUEUED, 0);
|
set_comp_state(pq, cq, info.comp_idx, QUEUED, 0);
|
||||||
atomic_inc(&pq->n_reqs);
|
|
||||||
req_queued = 1;
|
|
||||||
/* Send the first N packets in the request to buy us some time */
|
/* Send the first N packets in the request to buy us some time */
|
||||||
ret = user_sdma_send_pkts(req, pcount);
|
ret = user_sdma_send_pkts(req, pcount);
|
||||||
if (unlikely(ret < 0 && ret != -EBUSY)) {
|
if (unlikely(ret < 0 && ret != -EBUSY))
|
||||||
req->status = ret;
|
|
||||||
goto free_req;
|
goto free_req;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is possible that the SDMA engine would have processed all the
|
* It is possible that the SDMA engine would have processed all the
|
||||||
|
@ -796,17 +788,11 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
|
||||||
* request have been submitted to the SDMA engine. However, it
|
* request have been submitted to the SDMA engine. However, it
|
||||||
* will not wait for send completions.
|
* will not wait for send completions.
|
||||||
*/
|
*/
|
||||||
while (!test_bit(SDMA_REQ_SEND_DONE, &req->flags)) {
|
while (req->seqsubmitted != req->info.npkts) {
|
||||||
ret = user_sdma_send_pkts(req, pcount);
|
ret = user_sdma_send_pkts(req, pcount);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (ret != -EBUSY) {
|
if (ret != -EBUSY)
|
||||||
req->status = ret;
|
goto free_req;
|
||||||
set_bit(SDMA_REQ_DONE_ERROR, &req->flags);
|
|
||||||
if (ACCESS_ONCE(req->seqcomp) ==
|
|
||||||
req->seqsubmitted - 1)
|
|
||||||
goto free_req;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
wait_event_interruptible_timeout(
|
wait_event_interruptible_timeout(
|
||||||
pq->busy.wait_dma,
|
pq->busy.wait_dma,
|
||||||
(pq->state == SDMA_PKT_Q_ACTIVE),
|
(pq->state == SDMA_PKT_Q_ACTIVE),
|
||||||
|
@ -817,10 +803,19 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
|
||||||
*count += idx;
|
*count += idx;
|
||||||
return 0;
|
return 0;
|
||||||
free_req:
|
free_req:
|
||||||
user_sdma_free_request(req, true);
|
/*
|
||||||
if (req_queued)
|
* If the submitted seqsubmitted == npkts, the completion routine
|
||||||
|
* controls the final state. If sequbmitted < npkts, wait for any
|
||||||
|
* outstanding packets to finish before cleaning up.
|
||||||
|
*/
|
||||||
|
if (req->seqsubmitted < req->info.npkts) {
|
||||||
|
if (req->seqsubmitted)
|
||||||
|
wait_event(pq->busy.wait_dma,
|
||||||
|
(req->seqcomp == req->seqsubmitted - 1));
|
||||||
|
user_sdma_free_request(req, true);
|
||||||
pq_update(pq);
|
pq_update(pq);
|
||||||
set_comp_state(pq, cq, info.comp_idx, ERROR, req->status);
|
set_comp_state(pq, cq, info.comp_idx, ERROR, ret);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,10 +898,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
|
||||||
pq = req->pq;
|
pq = req->pq;
|
||||||
|
|
||||||
/* If tx completion has reported an error, we are done. */
|
/* If tx completion has reported an error, we are done. */
|
||||||
if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags)) {
|
if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags))
|
||||||
set_bit(SDMA_REQ_DONE_ERROR, &req->flags);
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if we might have sent the entire request already
|
* Check if we might have sent the entire request already
|
||||||
|
@ -929,10 +922,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
|
||||||
* with errors. If so, we are not going to process any
|
* with errors. If so, we are not going to process any
|
||||||
* more packets from this request.
|
* more packets from this request.
|
||||||
*/
|
*/
|
||||||
if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags)) {
|
if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags))
|
||||||
set_bit(SDMA_REQ_DONE_ERROR, &req->flags);
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
|
||||||
|
|
||||||
tx = kmem_cache_alloc(pq->txreq_cache, GFP_KERNEL);
|
tx = kmem_cache_alloc(pq->txreq_cache, GFP_KERNEL);
|
||||||
if (!tx)
|
if (!tx)
|
||||||
|
@ -1090,7 +1081,6 @@ dosend:
|
||||||
ret = sdma_send_txlist(req->sde, &pq->busy, &req->txps, &count);
|
ret = sdma_send_txlist(req->sde, &pq->busy, &req->txps, &count);
|
||||||
req->seqsubmitted += count;
|
req->seqsubmitted += count;
|
||||||
if (req->seqsubmitted == req->info.npkts) {
|
if (req->seqsubmitted == req->info.npkts) {
|
||||||
set_bit(SDMA_REQ_SEND_DONE, &req->flags);
|
|
||||||
/*
|
/*
|
||||||
* The txreq has already been submitted to the HW queue
|
* The txreq has already been submitted to the HW queue
|
||||||
* so we can free the AHG entry now. Corruption will not
|
* so we can free the AHG entry now. Corruption will not
|
||||||
|
@ -1489,11 +1479,15 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* SDMA tx request completion callback. Called when the SDMA progress
|
* user_sdma_txreq_cb() - SDMA tx request completion callback.
|
||||||
* state machine gets notification that the SDMA descriptors for this
|
* @txreq: valid sdma tx request
|
||||||
* tx request have been processed by the DMA engine. Called in
|
* @status: success/failure of request
|
||||||
* interrupt context.
|
*
|
||||||
|
* Called when the SDMA progress state machine gets notification that
|
||||||
|
* the SDMA descriptors for this tx request have been processed by the
|
||||||
|
* DMA engine. Called in interrupt context.
|
||||||
|
* Only do work on completed sequences.
|
||||||
*/
|
*/
|
||||||
static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status)
|
static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status)
|
||||||
{
|
{
|
||||||
|
@ -1502,7 +1496,7 @@ static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status)
|
||||||
struct user_sdma_request *req;
|
struct user_sdma_request *req;
|
||||||
struct hfi1_user_sdma_pkt_q *pq;
|
struct hfi1_user_sdma_pkt_q *pq;
|
||||||
struct hfi1_user_sdma_comp_q *cq;
|
struct hfi1_user_sdma_comp_q *cq;
|
||||||
u16 idx;
|
enum hfi1_sdma_comp_state state = COMPLETE;
|
||||||
|
|
||||||
if (!tx->req)
|
if (!tx->req)
|
||||||
return;
|
return;
|
||||||
|
@ -1515,31 +1509,19 @@ static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status)
|
||||||
SDMA_DBG(req, "SDMA completion with error %d",
|
SDMA_DBG(req, "SDMA completion with error %d",
|
||||||
status);
|
status);
|
||||||
set_bit(SDMA_REQ_HAS_ERROR, &req->flags);
|
set_bit(SDMA_REQ_HAS_ERROR, &req->flags);
|
||||||
|
state = ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
req->seqcomp = tx->seqnum;
|
req->seqcomp = tx->seqnum;
|
||||||
kmem_cache_free(pq->txreq_cache, tx);
|
kmem_cache_free(pq->txreq_cache, tx);
|
||||||
tx = NULL;
|
|
||||||
|
|
||||||
idx = req->info.comp_idx;
|
/* sequence isn't complete? We are done */
|
||||||
if (req->status == -1 && status == SDMA_TXREQ_S_OK) {
|
if (req->seqcomp != req->info.npkts - 1)
|
||||||
if (req->seqcomp == req->info.npkts - 1) {
|
return;
|
||||||
req->status = 0;
|
|
||||||
user_sdma_free_request(req, false);
|
user_sdma_free_request(req, false);
|
||||||
pq_update(pq);
|
set_comp_state(pq, cq, req->info.comp_idx, state, status);
|
||||||
set_comp_state(pq, cq, idx, COMPLETE, 0);
|
pq_update(pq);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (status != SDMA_TXREQ_S_OK)
|
|
||||||
req->status = status;
|
|
||||||
if (req->seqcomp == (ACCESS_ONCE(req->seqsubmitted) - 1) &&
|
|
||||||
(test_bit(SDMA_REQ_SEND_DONE, &req->flags) ||
|
|
||||||
test_bit(SDMA_REQ_DONE_ERROR, &req->flags))) {
|
|
||||||
user_sdma_free_request(req, false);
|
|
||||||
pq_update(pq);
|
|
||||||
set_comp_state(pq, cq, idx, ERROR, req->status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void pq_update(struct hfi1_user_sdma_pkt_q *pq)
|
static inline void pq_update(struct hfi1_user_sdma_pkt_q *pq)
|
||||||
|
@ -1572,6 +1554,8 @@ static void user_sdma_free_request(struct user_sdma_request *req, bool unpin)
|
||||||
if (!node)
|
if (!node)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
req->iovs[i].node = NULL;
|
||||||
|
|
||||||
if (unpin)
|
if (unpin)
|
||||||
hfi1_mmu_rb_remove(req->pq->handler,
|
hfi1_mmu_rb_remove(req->pq->handler,
|
||||||
&node->rb);
|
&node->rb);
|
||||||
|
|
|
@ -89,8 +89,10 @@
|
||||||
|
|
||||||
#define XPAD_PKT_LEN 64
|
#define XPAD_PKT_LEN 64
|
||||||
|
|
||||||
/* xbox d-pads should map to buttons, as is required for DDR pads
|
/*
|
||||||
but we map them to axes when possible to simplify things */
|
* xbox d-pads should map to buttons, as is required for DDR pads
|
||||||
|
* but we map them to axes when possible to simplify things
|
||||||
|
*/
|
||||||
#define MAP_DPAD_TO_BUTTONS (1 << 0)
|
#define MAP_DPAD_TO_BUTTONS (1 << 0)
|
||||||
#define MAP_TRIGGERS_TO_BUTTONS (1 << 1)
|
#define MAP_TRIGGERS_TO_BUTTONS (1 << 1)
|
||||||
#define MAP_STICKS_TO_NULL (1 << 2)
|
#define MAP_STICKS_TO_NULL (1 << 2)
|
||||||
|
@ -126,45 +128,77 @@ static const struct xpad_device {
|
||||||
u8 mapping;
|
u8 mapping;
|
||||||
u8 xtype;
|
u8 xtype;
|
||||||
} xpad_device[] = {
|
} xpad_device[] = {
|
||||||
|
{ 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX },
|
||||||
|
{ 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX },
|
||||||
|
{ 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x044f, 0x0f10, "Thrustmaster Modena GT Wheel", 0, XTYPE_XBOX },
|
||||||
|
{ 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 },
|
||||||
{ 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX },
|
{ 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX },
|
||||||
{ 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX },
|
{ 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX },
|
||||||
{ 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX },
|
{ 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX },
|
||||||
|
{ 0x045e, 0x0288, "Microsoft Xbox Controller S v2", 0, XTYPE_XBOX },
|
||||||
{ 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX },
|
{ 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX },
|
||||||
{ 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 },
|
{ 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x045e, 0x028f, "Microsoft X-Box 360 pad v2", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
|
||||||
{ 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE },
|
{ 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE },
|
||||||
{ 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE },
|
{ 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE },
|
||||||
{ 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE },
|
{ 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE },
|
||||||
{ 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
|
{ 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE },
|
||||||
{ 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
|
{ 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
|
||||||
{ 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
|
|
||||||
{ 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 },
|
|
||||||
{ 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 },
|
{ 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 },
|
||||||
{ 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 },
|
{ 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 },
|
||||||
{ 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 },
|
{ 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 },
|
||||||
{ 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
|
{ 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
|
{ 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
|
{ 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
|
||||||
|
{ 0x046d, 0xca8a, "Logitech Precision Vibration Feedback Wheel", 0, XTYPE_XBOX },
|
||||||
|
{ 0x046d, 0xcaa3, "Logitech DriveFx Racing Wheel", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x056e, 0x2004, "Elecom JC-U3613M", 0, XTYPE_XBOX360 },
|
||||||
{ 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX },
|
{ 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX },
|
||||||
{ 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX },
|
{ 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX },
|
||||||
|
{ 0x05fe, 0x3030, "Chic Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x05fe, 0x3031, "Chic Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x062a, 0x0020, "Logic3 Xbox GamePad", 0, XTYPE_XBOX },
|
||||||
|
{ 0x062a, 0x0033, "Competition Pro Steering Wheel", 0, XTYPE_XBOX },
|
||||||
|
{ 0x06a3, 0x0200, "Saitek Racing Wheel", 0, XTYPE_XBOX },
|
||||||
|
{ 0x06a3, 0x0201, "Saitek Adrenalin", 0, XTYPE_XBOX },
|
||||||
|
{ 0x06a3, 0xf51a, "Saitek P3600", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0738, 0x4506, "Mad Catz 4506 Wireless Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX },
|
{ 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0738, 0x4520, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX },
|
||||||
{ 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX },
|
{ 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX },
|
||||||
{ 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX },
|
{ 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0738, 0x4530, "Mad Catz Universal MC2 Racing Wheel and Pedals", 0, XTYPE_XBOX },
|
||||||
{ 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX },
|
{ 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX },
|
||||||
{ 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
{ 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
||||||
{ 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX },
|
{ 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0738, 0x4586, "Mad Catz MicroCon Wireless Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0738, 0x4588, "Mad Catz Blaster", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0738, 0x45ff, "Mad Catz Beat Pad (w/ Handle)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
||||||
{ 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0x4718, "Mad Catz Street Fighter IV FightStick SE", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0x4718, "Mad Catz Street Fighter IV FightStick SE", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0x4726, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0x4726, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x0738, 0x4736, "Mad Catz MicroCon Gamepad", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0738, 0x4743, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
||||||
|
{ 0x0738, 0x4758, "Mad Catz Arcade Game Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
|
{ 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
|
||||||
{ 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
{ 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
||||||
|
{ 0x0738, 0x9871, "Mad Catz Portable Drum", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0738, 0xb738, "Mad Catz MVC2TE Stick 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 },
|
{ 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0xcb02, "Saitek Cyborg Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0xcb02, "Saitek Cyborg Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0xcb03, "Saitek P3200 Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0xcb03, "Saitek P3200 Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0738, 0xcb29, "Saitek Aviator Stick AV8R02", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 },
|
{ 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x07ff, 0xffff, "Mad Catz GamePad", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0c12, 0x0005, "Intec wireless", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0c12, 0x8801, "Nyko Xbox Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
|
{ 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", DANCEPAD_MAP_CONFIG, XTYPE_XBOX },
|
{ 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", DANCEPAD_MAP_CONFIG, XTYPE_XBOX },
|
||||||
{ 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX },
|
{ 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX },
|
||||||
|
@ -172,35 +206,66 @@ static const struct xpad_device {
|
||||||
{ 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX },
|
{ 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX },
|
||||||
{ 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
{ 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
||||||
{ 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX },
|
{ 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0e4c, 0x1103, "Radica Gamester Reflex", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX },
|
||||||
{ 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX },
|
{ 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0e4c, 0x3510, "Radica Gamester", 0, XTYPE_XBOX },
|
||||||
{ 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX },
|
{ 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX },
|
{ 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX },
|
{ 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x0e6f, 0x0008, "After Glow Pro Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
{ 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0e6f, 0x011f, "Rock Candy Gamepad Wired Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0e6f, 0x0131, "PDP EA Sports Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0e6f, 0x0133, "Xbox 360 Wired Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE },
|
{ 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x013a, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x0147, "PDP Marvel Xbox One Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x015c, "PDP Xbox One Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x0161, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x0162, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x0163, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x0164, "PDP Battlefield One", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x0165, "PDP Titanfall 2", 0, XTYPE_XBOXONE },
|
||||||
{ 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
{ 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
{ 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
{ 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE },
|
{ 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0e6f, 0x02a6, "PDP Wired Controller for Xbox One - Camo Series", 0, XTYPE_XBOXONE },
|
||||||
{ 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 },
|
{ 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE },
|
||||||
{ 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 },
|
{ 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0e6f, 0x0413, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0e6f, 0x0501, "PDP Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0e6f, 0xf900, "PDP Afterglow AX.1", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
|
{ 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
|
||||||
{ 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX },
|
{ 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX },
|
||||||
{ 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 },
|
{ 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x0f0d, 0x000c, "Hori PadEX Turbo", 0, XTYPE_XBOX360 },
|
||||||
{ 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x0f0d, 0x001b, "Hori Real Arcade Pro VX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
|
||||||
{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
|
{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
|
||||||
|
{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
|
||||||
{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
|
{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
|
{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX },
|
{ 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX },
|
||||||
|
{ 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 },
|
||||||
{ 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 },
|
{ 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x12ab, 0x0303, "Mortal Kombat Klassic FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
{ 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
||||||
{ 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
|
{ 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
{ 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
|
||||||
|
{ 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
|
{ 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 },
|
{ 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
|
||||||
{ 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE },
|
{ 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE },
|
||||||
{ 0x15e4, 0x3f00, "Power A Mini Pro Elite", 0, XTYPE_XBOX360 },
|
{ 0x15e4, 0x3f00, "Power A Mini Pro Elite", 0, XTYPE_XBOX360 },
|
||||||
{ 0x15e4, 0x3f0a, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
|
{ 0x15e4, 0x3f0a, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
|
||||||
|
@ -208,27 +273,67 @@ static const struct xpad_device {
|
||||||
{ 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 },
|
{ 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 },
|
{ 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 },
|
{ 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE },
|
{ 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 },
|
|
||||||
{ 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0x0130, "Ion Drum Rocker", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf018, "Mad Catz Street Fighter IV SE Fighting Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf019, "Mad Catz Brawlstick for Xbox 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf021, "Mad Cats Ghost Recon FS GamePad", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf025, "Mad Catz Call Of Duty", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf027, "Mad Catz FPS Pro", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf02e, "Mad Catz Fightpad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf030, "Mad Catz Xbox 360 MC2 MicroCon Racing Wheel", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf036, "Mad Catz MicroCon GamePad Pro", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf039, "Mad Catz MvC2 TE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf03a, "Mad Catz SFxT Fightstick Pro", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf03d, "Street Fighter IV Arcade Stick TE - Chun Li", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf03e, "Mad Catz MLG FightStick TE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf03f, "Mad Catz FightStick SoulCaliber", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf042, "Mad Catz FightStick TES+", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf080, "Mad Catz FightStick TE2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf501, "HoriPad EX2 Turbo", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf502, "Hori Real Arcade Pro.VX SA", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf503, "Hori Fighting Stick VX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf504, "Hori Real Arcade Pro. EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf505, "Hori Fighting Stick EX2B", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf506, "Hori Real Arcade Pro.EX Premium VLX", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 },
|
{ 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf904, "PDP Versus Fighting Pad", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xf906, "MortalKombat FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xfa01, "MadCatz GamePad", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x530a, "Xbox 360 Pro EX Controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x531a, "PowerA Pro Ex", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x5397, "FUS1ON Tournament Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE },
|
{ 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE },
|
||||||
{ 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE },
|
{ 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE },
|
||||||
{ 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x5502, "Hori Fighting Stick VX Alt", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x550e, "Hori Real Arcade Pro V Kai 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x551a, "PowerA FUSION Pro Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x24c6, 0x561a, "PowerA FUSION Controller", 0, XTYPE_XBOXONE },
|
||||||
|
{ 0x24c6, 0x5b00, "ThrustMaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 },
|
||||||
{ 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
|
{ 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
|
||||||
|
{ 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX },
|
||||||
{ 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
|
{ 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
|
||||||
{ 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
|
{ 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
|
||||||
};
|
};
|
||||||
|
@ -289,15 +394,15 @@ static const signed short xpad_abs_triggers[] = {
|
||||||
* match against vendor id as well. Wired Xbox 360 devices have protocol 1,
|
* match against vendor id as well. Wired Xbox 360 devices have protocol 1,
|
||||||
* wireless controllers have protocol 129.
|
* wireless controllers have protocol 129.
|
||||||
*/
|
*/
|
||||||
#define XPAD_XBOX360_VENDOR_PROTOCOL(vend,pr) \
|
#define XPAD_XBOX360_VENDOR_PROTOCOL(vend, pr) \
|
||||||
.match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, \
|
.match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, \
|
||||||
.idVendor = (vend), \
|
.idVendor = (vend), \
|
||||||
.bInterfaceClass = USB_CLASS_VENDOR_SPEC, \
|
.bInterfaceClass = USB_CLASS_VENDOR_SPEC, \
|
||||||
.bInterfaceSubClass = 93, \
|
.bInterfaceSubClass = 93, \
|
||||||
.bInterfaceProtocol = (pr)
|
.bInterfaceProtocol = (pr)
|
||||||
#define XPAD_XBOX360_VENDOR(vend) \
|
#define XPAD_XBOX360_VENDOR(vend) \
|
||||||
{ XPAD_XBOX360_VENDOR_PROTOCOL(vend,1) }, \
|
{ XPAD_XBOX360_VENDOR_PROTOCOL((vend), 1) }, \
|
||||||
{ XPAD_XBOX360_VENDOR_PROTOCOL(vend,129) }
|
{ XPAD_XBOX360_VENDOR_PROTOCOL((vend), 129) }
|
||||||
|
|
||||||
/* The Xbox One controller uses subclass 71 and protocol 208. */
|
/* The Xbox One controller uses subclass 71 and protocol 208. */
|
||||||
#define XPAD_XBOXONE_VENDOR_PROTOCOL(vend, pr) \
|
#define XPAD_XBOXONE_VENDOR_PROTOCOL(vend, pr) \
|
||||||
|
@ -307,37 +412,138 @@ static const signed short xpad_abs_triggers[] = {
|
||||||
.bInterfaceSubClass = 71, \
|
.bInterfaceSubClass = 71, \
|
||||||
.bInterfaceProtocol = (pr)
|
.bInterfaceProtocol = (pr)
|
||||||
#define XPAD_XBOXONE_VENDOR(vend) \
|
#define XPAD_XBOXONE_VENDOR(vend) \
|
||||||
{ XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) }
|
{ XPAD_XBOXONE_VENDOR_PROTOCOL((vend), 208) }
|
||||||
|
|
||||||
static struct usb_device_id xpad_table[] = {
|
static const struct usb_device_id xpad_table[] = {
|
||||||
{ USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */
|
{ USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */
|
||||||
|
XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 Controller */
|
||||||
XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */
|
XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */
|
||||||
XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */
|
XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */
|
||||||
XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */
|
XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */
|
||||||
XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */
|
XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */
|
||||||
|
XPAD_XBOX360_VENDOR(0x056e), /* Elecom JC-U3613M */
|
||||||
|
XPAD_XBOX360_VENDOR(0x06a3), /* Saitek P3600 */
|
||||||
XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */
|
XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */
|
||||||
{ USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */
|
{ USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */
|
||||||
XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */
|
XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */
|
||||||
|
XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz GamePad */
|
||||||
XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */
|
XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */
|
||||||
XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */
|
XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */
|
||||||
|
XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */
|
||||||
|
XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */
|
||||||
|
XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */
|
||||||
XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */
|
XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */
|
||||||
XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */
|
XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */
|
||||||
XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */
|
XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */
|
||||||
XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */
|
|
||||||
XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */
|
|
||||||
XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */
|
|
||||||
XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */
|
|
||||||
XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */
|
|
||||||
XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */
|
|
||||||
XPAD_XBOX360_VENDOR(0x1532), /* Razer Sabertooth */
|
XPAD_XBOX360_VENDOR(0x1532), /* Razer Sabertooth */
|
||||||
XPAD_XBOXONE_VENDOR(0x1532), /* Razer Wildcat */
|
XPAD_XBOXONE_VENDOR(0x1532), /* Razer Wildcat */
|
||||||
XPAD_XBOX360_VENDOR(0x15e4), /* Numark X-Box 360 controllers */
|
XPAD_XBOX360_VENDOR(0x15e4), /* Numark X-Box 360 controllers */
|
||||||
XPAD_XBOX360_VENDOR(0x162e), /* Joytech X-Box 360 controllers */
|
XPAD_XBOX360_VENDOR(0x162e), /* Joytech X-Box 360 controllers */
|
||||||
|
XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */
|
||||||
|
XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */
|
||||||
|
XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */
|
||||||
|
XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_DEVICE_TABLE(usb, xpad_table);
|
MODULE_DEVICE_TABLE(usb, xpad_table);
|
||||||
|
|
||||||
|
struct xboxone_init_packet {
|
||||||
|
u16 idVendor;
|
||||||
|
u16 idProduct;
|
||||||
|
const u8 *data;
|
||||||
|
u8 len;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define XBOXONE_INIT_PKT(_vid, _pid, _data) \
|
||||||
|
{ \
|
||||||
|
.idVendor = (_vid), \
|
||||||
|
.idProduct = (_pid), \
|
||||||
|
.data = (_data), \
|
||||||
|
.len = ARRAY_SIZE(_data), \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This packet is required for all Xbox One pads with 2015
|
||||||
|
* or later firmware installed (or present from the factory).
|
||||||
|
*/
|
||||||
|
static const u8 xboxone_fw2015_init[] = {
|
||||||
|
0x05, 0x20, 0x00, 0x01, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This packet is required for the Titanfall 2 Xbox One pads
|
||||||
|
* (0x0e6f:0x0165) to finish initialization and for Hori pads
|
||||||
|
* (0x0f0d:0x0067) to make the analog sticks work.
|
||||||
|
*/
|
||||||
|
static const u8 xboxone_hori_init[] = {
|
||||||
|
0x01, 0x20, 0x00, 0x09, 0x00, 0x04, 0x20, 0x3a,
|
||||||
|
0x00, 0x00, 0x00, 0x80, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This packet is required for some of the PDP pads to start
|
||||||
|
* sending input reports. These pads include: (0x0e6f:0x02ab),
|
||||||
|
* (0x0e6f:0x02a4).
|
||||||
|
*/
|
||||||
|
static const u8 xboxone_pdp_init1[] = {
|
||||||
|
0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This packet is required for some of the PDP pads to start
|
||||||
|
* sending input reports. These pads include: (0x0e6f:0x02ab),
|
||||||
|
* (0x0e6f:0x02a4).
|
||||||
|
*/
|
||||||
|
static const u8 xboxone_pdp_init2[] = {
|
||||||
|
0x06, 0x20, 0x00, 0x02, 0x01, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A specific rumble packet is required for some PowerA pads to start
|
||||||
|
* sending input reports. One of those pads is (0x24c6:0x543a).
|
||||||
|
*/
|
||||||
|
static const u8 xboxone_rumblebegin_init[] = {
|
||||||
|
0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
|
||||||
|
0x1D, 0x1D, 0xFF, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A rumble packet with zero FF intensity will immediately
|
||||||
|
* terminate the rumbling required to init PowerA pads.
|
||||||
|
* This should happen fast enough that the motors don't
|
||||||
|
* spin up to enough speed to actually vibrate the gamepad.
|
||||||
|
*/
|
||||||
|
static const u8 xboxone_rumbleend_init[] = {
|
||||||
|
0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This specifies the selection of init packets that a gamepad
|
||||||
|
* will be sent on init *and* the order in which they will be
|
||||||
|
* sent. The correct sequence number will be added when the
|
||||||
|
* packet is going to be sent.
|
||||||
|
*/
|
||||||
|
static const struct xboxone_init_packet xboxone_init_packets[] = {
|
||||||
|
XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
|
||||||
|
XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
|
||||||
|
XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
|
||||||
|
XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1),
|
||||||
|
XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2),
|
||||||
|
XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1),
|
||||||
|
XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2),
|
||||||
|
XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1),
|
||||||
|
XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2),
|
||||||
|
XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
|
||||||
|
XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
|
||||||
|
XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
|
||||||
|
XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumbleend_init),
|
||||||
|
XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumbleend_init),
|
||||||
|
XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumbleend_init),
|
||||||
|
};
|
||||||
|
|
||||||
struct xpad_output_packet {
|
struct xpad_output_packet {
|
||||||
u8 data[XPAD_PKT_LEN];
|
u8 data[XPAD_PKT_LEN];
|
||||||
u8 len;
|
u8 len;
|
||||||
|
@ -374,6 +580,7 @@ struct usb_xpad {
|
||||||
|
|
||||||
struct xpad_output_packet out_packets[XPAD_NUM_OUT_PACKETS];
|
struct xpad_output_packet out_packets[XPAD_NUM_OUT_PACKETS];
|
||||||
int last_out_packet;
|
int last_out_packet;
|
||||||
|
int init_seq;
|
||||||
|
|
||||||
#if defined(CONFIG_JOYSTICK_XPAD_LEDS)
|
#if defined(CONFIG_JOYSTICK_XPAD_LEDS)
|
||||||
struct xpad_led *led;
|
struct xpad_led *led;
|
||||||
|
@ -390,6 +597,7 @@ struct usb_xpad {
|
||||||
|
|
||||||
static int xpad_init_input(struct usb_xpad *xpad);
|
static int xpad_init_input(struct usb_xpad *xpad);
|
||||||
static void xpad_deinit_input(struct usb_xpad *xpad);
|
static void xpad_deinit_input(struct usb_xpad *xpad);
|
||||||
|
static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xpad_process_packet
|
* xpad_process_packet
|
||||||
|
@ -609,14 +817,36 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xpadone_process_buttons
|
* xpadone_process_packet
|
||||||
*
|
*
|
||||||
* Process a button update packet from an Xbox one controller.
|
* Completes a request by converting the data into events for the
|
||||||
|
* input subsystem. This version is for the Xbox One controller.
|
||||||
|
*
|
||||||
|
* The report format was gleaned from
|
||||||
|
* https://github.com/kylelemons/xbox/blob/master/xbox.go
|
||||||
*/
|
*/
|
||||||
static void xpadone_process_buttons(struct usb_xpad *xpad,
|
static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data)
|
||||||
struct input_dev *dev,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
{
|
||||||
|
struct input_dev *dev = xpad->dev;
|
||||||
|
|
||||||
|
/* the xbox button has its own special report */
|
||||||
|
if (data[0] == 0X07) {
|
||||||
|
/*
|
||||||
|
* The Xbox One S controller requires these reports to be
|
||||||
|
* acked otherwise it continues sending them forever and
|
||||||
|
* won't report further mode button events.
|
||||||
|
*/
|
||||||
|
if (data[1] == 0x30)
|
||||||
|
xpadone_ack_mode_report(xpad, data[2]);
|
||||||
|
|
||||||
|
input_report_key(dev, BTN_MODE, data[4] & 0x01);
|
||||||
|
input_sync(dev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* check invalid packet */
|
||||||
|
else if (data[0] != 0X20)
|
||||||
|
return;
|
||||||
|
|
||||||
/* menu/view buttons */
|
/* menu/view buttons */
|
||||||
input_report_key(dev, BTN_START, data[4] & 0x04);
|
input_report_key(dev, BTN_START, data[4] & 0x04);
|
||||||
input_report_key(dev, BTN_SELECT, data[4] & 0x08);
|
input_report_key(dev, BTN_SELECT, data[4] & 0x08);
|
||||||
|
@ -679,34 +909,6 @@ static void xpadone_process_buttons(struct usb_xpad *xpad,
|
||||||
input_sync(dev);
|
input_sync(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* xpadone_process_packet
|
|
||||||
*
|
|
||||||
* Completes a request by converting the data into events for the
|
|
||||||
* input subsystem. This version is for the Xbox One controller.
|
|
||||||
*
|
|
||||||
* The report format was gleaned from
|
|
||||||
* https://github.com/kylelemons/xbox/blob/master/xbox.go
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void xpadone_process_packet(struct usb_xpad *xpad,
|
|
||||||
u16 cmd, unsigned char *data)
|
|
||||||
{
|
|
||||||
struct input_dev *dev = xpad->dev;
|
|
||||||
|
|
||||||
switch (data[0]) {
|
|
||||||
case 0x20:
|
|
||||||
xpadone_process_buttons(xpad, dev, data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x07:
|
|
||||||
/* the xbox button has its own special report */
|
|
||||||
input_report_key(dev, BTN_MODE, data[4] & 0x01);
|
|
||||||
input_sync(dev);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xpad_irq_in(struct urb *urb)
|
static void xpad_irq_in(struct urb *urb)
|
||||||
{
|
{
|
||||||
struct usb_xpad *xpad = urb->context;
|
struct usb_xpad *xpad = urb->context;
|
||||||
|
@ -753,12 +955,48 @@ exit:
|
||||||
__func__, retval);
|
__func__, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Callers must hold xpad->odata_lock spinlock */
|
||||||
|
static bool xpad_prepare_next_init_packet(struct usb_xpad *xpad)
|
||||||
|
{
|
||||||
|
const struct xboxone_init_packet *init_packet;
|
||||||
|
|
||||||
|
if (xpad->xtype != XTYPE_XBOXONE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* Perform initialization sequence for Xbox One pads that require it */
|
||||||
|
while (xpad->init_seq < ARRAY_SIZE(xboxone_init_packets)) {
|
||||||
|
init_packet = &xboxone_init_packets[xpad->init_seq++];
|
||||||
|
|
||||||
|
if (init_packet->idVendor != 0 &&
|
||||||
|
init_packet->idVendor != xpad->dev->id.vendor)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (init_packet->idProduct != 0 &&
|
||||||
|
init_packet->idProduct != xpad->dev->id.product)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* This packet applies to our device, so prepare to send it */
|
||||||
|
memcpy(xpad->odata, init_packet->data, init_packet->len);
|
||||||
|
xpad->irq_out->transfer_buffer_length = init_packet->len;
|
||||||
|
|
||||||
|
/* Update packet with current sequence number */
|
||||||
|
xpad->odata[2] = xpad->odata_serial++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Callers must hold xpad->odata_lock spinlock */
|
/* Callers must hold xpad->odata_lock spinlock */
|
||||||
static bool xpad_prepare_next_out_packet(struct usb_xpad *xpad)
|
static bool xpad_prepare_next_out_packet(struct usb_xpad *xpad)
|
||||||
{
|
{
|
||||||
struct xpad_output_packet *pkt, *packet = NULL;
|
struct xpad_output_packet *pkt, *packet = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* We may have init packets to send before we can send user commands */
|
||||||
|
if (xpad_prepare_next_init_packet(xpad))
|
||||||
|
return true;
|
||||||
|
|
||||||
for (i = 0; i < XPAD_NUM_OUT_PACKETS; i++) {
|
for (i = 0; i < XPAD_NUM_OUT_PACKETS; i++) {
|
||||||
if (++xpad->last_out_packet >= XPAD_NUM_OUT_PACKETS)
|
if (++xpad->last_out_packet >= XPAD_NUM_OUT_PACKETS)
|
||||||
xpad->last_out_packet = 0;
|
xpad->last_out_packet = 0;
|
||||||
|
@ -851,10 +1089,9 @@ static void xpad_irq_out(struct urb *urb)
|
||||||
spin_unlock_irqrestore(&xpad->odata_lock, flags);
|
spin_unlock_irqrestore(&xpad->odata_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
|
static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad,
|
||||||
|
struct usb_endpoint_descriptor *ep_irq_out)
|
||||||
{
|
{
|
||||||
struct usb_endpoint_descriptor *ep_irq_out;
|
|
||||||
int ep_irq_out_idx;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (xpad->xtype == XTYPE_UNKNOWN)
|
if (xpad->xtype == XTYPE_UNKNOWN)
|
||||||
|
@ -864,23 +1101,17 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
|
||||||
|
|
||||||
xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN,
|
xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN,
|
||||||
GFP_KERNEL, &xpad->odata_dma);
|
GFP_KERNEL, &xpad->odata_dma);
|
||||||
if (!xpad->odata) {
|
if (!xpad->odata)
|
||||||
error = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto fail1;
|
|
||||||
}
|
|
||||||
|
|
||||||
spin_lock_init(&xpad->odata_lock);
|
spin_lock_init(&xpad->odata_lock);
|
||||||
|
|
||||||
xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL);
|
xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
if (!xpad->irq_out) {
|
if (!xpad->irq_out) {
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
goto fail2;
|
goto err_free_coherent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Xbox One controller has in/out endpoints swapped. */
|
|
||||||
ep_irq_out_idx = xpad->xtype == XTYPE_XBOXONE ? 0 : 1;
|
|
||||||
ep_irq_out = &intf->cur_altsetting->endpoint[ep_irq_out_idx].desc;
|
|
||||||
|
|
||||||
usb_fill_int_urb(xpad->irq_out, xpad->udev,
|
usb_fill_int_urb(xpad->irq_out, xpad->udev,
|
||||||
usb_sndintpipe(xpad->udev, ep_irq_out->bEndpointAddress),
|
usb_sndintpipe(xpad->udev, ep_irq_out->bEndpointAddress),
|
||||||
xpad->odata, XPAD_PKT_LEN,
|
xpad->odata, XPAD_PKT_LEN,
|
||||||
|
@ -890,8 +1121,9 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma);
|
err_free_coherent:
|
||||||
fail1: return error;
|
usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma);
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xpad_stop_output(struct usb_xpad *xpad)
|
static void xpad_stop_output(struct usb_xpad *xpad)
|
||||||
|
@ -950,24 +1182,17 @@ static int xpad_inquiry_pad_presence(struct usb_xpad *xpad)
|
||||||
|
|
||||||
static int xpad_start_xbox_one(struct usb_xpad *xpad)
|
static int xpad_start_xbox_one(struct usb_xpad *xpad)
|
||||||
{
|
{
|
||||||
struct xpad_output_packet *packet =
|
|
||||||
&xpad->out_packets[XPAD_OUT_CMD_IDX];
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
spin_lock_irqsave(&xpad->odata_lock, flags);
|
spin_lock_irqsave(&xpad->odata_lock, flags);
|
||||||
|
|
||||||
/* Xbox one controller needs to be initialized. */
|
/*
|
||||||
packet->data[0] = 0x05;
|
* Begin the init sequence by attempting to send a packet.
|
||||||
packet->data[1] = 0x20;
|
* We will cycle through the init packet sequence before
|
||||||
packet->data[2] = xpad->odata_serial++; /* packet serial */
|
* sending any packets from the output ring.
|
||||||
packet->data[3] = 0x01; /* rumble bit enable? */
|
*/
|
||||||
packet->data[4] = 0x00;
|
xpad->init_seq = 0;
|
||||||
packet->len = 5;
|
|
||||||
packet->pending = true;
|
|
||||||
|
|
||||||
/* Reset the sequence so we send out start packet first */
|
|
||||||
xpad->last_out_packet = -1;
|
|
||||||
retval = xpad_try_sending_next_out_packet(xpad);
|
retval = xpad_try_sending_next_out_packet(xpad);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&xpad->odata_lock, flags);
|
spin_unlock_irqrestore(&xpad->odata_lock, flags);
|
||||||
|
@ -975,6 +1200,30 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
struct xpad_output_packet *packet =
|
||||||
|
&xpad->out_packets[XPAD_OUT_CMD_IDX];
|
||||||
|
static const u8 mode_report_ack[] = {
|
||||||
|
0x01, 0x20, 0x00, 0x09, 0x00, 0x07, 0x20, 0x02,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
spin_lock_irqsave(&xpad->odata_lock, flags);
|
||||||
|
|
||||||
|
packet->len = sizeof(mode_report_ack);
|
||||||
|
memcpy(packet->data, mode_report_ack, packet->len);
|
||||||
|
packet->data[2] = seq_num;
|
||||||
|
packet->pending = true;
|
||||||
|
|
||||||
|
/* Reset the sequence so we send out the ack now */
|
||||||
|
xpad->last_out_packet = -1;
|
||||||
|
xpad_try_sending_next_out_packet(xpad);
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&xpad->odata_lock, flags);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_JOYSTICK_XPAD_FF
|
#ifdef CONFIG_JOYSTICK_XPAD_FF
|
||||||
static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect)
|
static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect)
|
||||||
{
|
{
|
||||||
|
@ -1046,9 +1295,9 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
|
||||||
packet->data[7] = 0x00;
|
packet->data[7] = 0x00;
|
||||||
packet->data[8] = strong / 512; /* left actuator */
|
packet->data[8] = strong / 512; /* left actuator */
|
||||||
packet->data[9] = weak / 512; /* right actuator */
|
packet->data[9] = weak / 512; /* right actuator */
|
||||||
packet->data[10] = 0xFF;
|
packet->data[10] = 0xFF; /* on period */
|
||||||
packet->data[11] = 0x00;
|
packet->data[11] = 0x00; /* off period */
|
||||||
packet->data[12] = 0x00;
|
packet->data[12] = 0xFF; /* repeat count */
|
||||||
packet->len = 13;
|
packet->len = 13;
|
||||||
packet->pending = true;
|
packet->pending = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1199,6 +1448,7 @@ static int xpad_led_probe(struct usb_xpad *xpad)
|
||||||
led_cdev = &led->led_cdev;
|
led_cdev = &led->led_cdev;
|
||||||
led_cdev->name = led->name;
|
led_cdev->name = led->name;
|
||||||
led_cdev->brightness_set = xpad_led_set;
|
led_cdev->brightness_set = xpad_led_set;
|
||||||
|
led_cdev->flags = LED_CORE_SUSPENDRESUME;
|
||||||
|
|
||||||
error = led_classdev_register(&xpad->udev->dev, led_cdev);
|
error = led_classdev_register(&xpad->udev->dev, led_cdev);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -1333,7 +1583,6 @@ static void xpad_close(struct input_dev *dev)
|
||||||
static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
|
static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
|
||||||
{
|
{
|
||||||
struct usb_xpad *xpad = input_get_drvdata(input_dev);
|
struct usb_xpad *xpad = input_get_drvdata(input_dev);
|
||||||
set_bit(abs, input_dev->absbit);
|
|
||||||
|
|
||||||
switch (abs) {
|
switch (abs) {
|
||||||
case ABS_X:
|
case ABS_X:
|
||||||
|
@ -1353,6 +1602,9 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
|
||||||
case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */
|
case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */
|
||||||
input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
|
input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
input_set_abs_params(input_dev, abs, 0, 0, 0, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1393,10 +1645,7 @@ static int xpad_init_input(struct usb_xpad *xpad)
|
||||||
input_dev->close = xpad_close;
|
input_dev->close = xpad_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
__set_bit(EV_KEY, input_dev->evbit);
|
|
||||||
|
|
||||||
if (!(xpad->mapping & MAP_STICKS_TO_NULL)) {
|
if (!(xpad->mapping & MAP_STICKS_TO_NULL)) {
|
||||||
__set_bit(EV_ABS, input_dev->evbit);
|
|
||||||
/* set up axes */
|
/* set up axes */
|
||||||
for (i = 0; xpad_abs[i] >= 0; i++)
|
for (i = 0; xpad_abs[i] >= 0; i++)
|
||||||
xpad_set_up_abs(input_dev, xpad_abs[i]);
|
xpad_set_up_abs(input_dev, xpad_abs[i]);
|
||||||
|
@ -1404,21 +1653,22 @@ static int xpad_init_input(struct usb_xpad *xpad)
|
||||||
|
|
||||||
/* set up standard buttons */
|
/* set up standard buttons */
|
||||||
for (i = 0; xpad_common_btn[i] >= 0; i++)
|
for (i = 0; xpad_common_btn[i] >= 0; i++)
|
||||||
__set_bit(xpad_common_btn[i], input_dev->keybit);
|
input_set_capability(input_dev, EV_KEY, xpad_common_btn[i]);
|
||||||
|
|
||||||
/* set up model-specific ones */
|
/* set up model-specific ones */
|
||||||
if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W ||
|
if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W ||
|
||||||
xpad->xtype == XTYPE_XBOXONE) {
|
xpad->xtype == XTYPE_XBOXONE) {
|
||||||
for (i = 0; xpad360_btn[i] >= 0; i++)
|
for (i = 0; xpad360_btn[i] >= 0; i++)
|
||||||
__set_bit(xpad360_btn[i], input_dev->keybit);
|
input_set_capability(input_dev, EV_KEY, xpad360_btn[i]);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; xpad_btn[i] >= 0; i++)
|
for (i = 0; xpad_btn[i] >= 0; i++)
|
||||||
__set_bit(xpad_btn[i], input_dev->keybit);
|
input_set_capability(input_dev, EV_KEY, xpad_btn[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
|
if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
|
||||||
for (i = 0; xpad_btn_pad[i] >= 0; i++)
|
for (i = 0; xpad_btn_pad[i] >= 0; i++)
|
||||||
__set_bit(xpad_btn_pad[i], input_dev->keybit);
|
input_set_capability(input_dev, EV_KEY,
|
||||||
|
xpad_btn_pad[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1435,7 +1685,8 @@ static int xpad_init_input(struct usb_xpad *xpad)
|
||||||
|
|
||||||
if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
|
if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
|
||||||
for (i = 0; xpad_btn_triggers[i] >= 0; i++)
|
for (i = 0; xpad_btn_triggers[i] >= 0; i++)
|
||||||
__set_bit(xpad_btn_triggers[i], input_dev->keybit);
|
input_set_capability(input_dev, EV_KEY,
|
||||||
|
xpad_btn_triggers[i]);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; xpad_abs_triggers[i] >= 0; i++)
|
for (i = 0; xpad_abs_triggers[i] >= 0; i++)
|
||||||
xpad_set_up_abs(input_dev, xpad_abs_triggers[i]);
|
xpad_set_up_abs(input_dev, xpad_abs_triggers[i]);
|
||||||
|
@ -1469,8 +1720,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
|
||||||
{
|
{
|
||||||
struct usb_device *udev = interface_to_usbdev(intf);
|
struct usb_device *udev = interface_to_usbdev(intf);
|
||||||
struct usb_xpad *xpad;
|
struct usb_xpad *xpad;
|
||||||
struct usb_endpoint_descriptor *ep_irq_in;
|
struct usb_endpoint_descriptor *ep_irq_in, *ep_irq_out;
|
||||||
int ep_irq_in_idx;
|
|
||||||
int i, error;
|
int i, error;
|
||||||
|
|
||||||
if (intf->cur_altsetting->desc.bNumEndpoints != 2)
|
if (intf->cur_altsetting->desc.bNumEndpoints != 2)
|
||||||
|
@ -1540,14 +1790,29 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
|
||||||
goto err_free_in_urb;
|
goto err_free_in_urb;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = xpad_init_output(intf, xpad);
|
ep_irq_in = ep_irq_out = NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < 2; i++) {
|
||||||
|
struct usb_endpoint_descriptor *ep =
|
||||||
|
&intf->cur_altsetting->endpoint[i].desc;
|
||||||
|
|
||||||
|
if (usb_endpoint_xfer_int(ep)) {
|
||||||
|
if (usb_endpoint_dir_in(ep))
|
||||||
|
ep_irq_in = ep;
|
||||||
|
else
|
||||||
|
ep_irq_out = ep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ep_irq_in || !ep_irq_out) {
|
||||||
|
error = -ENODEV;
|
||||||
|
goto err_free_in_urb;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = xpad_init_output(intf, xpad, ep_irq_out);
|
||||||
if (error)
|
if (error)
|
||||||
goto err_free_in_urb;
|
goto err_free_in_urb;
|
||||||
|
|
||||||
/* Xbox One controller has in/out endpoints swapped. */
|
|
||||||
ep_irq_in_idx = xpad->xtype == XTYPE_XBOXONE ? 1 : 0;
|
|
||||||
ep_irq_in = &intf->cur_altsetting->endpoint[ep_irq_in_idx].desc;
|
|
||||||
|
|
||||||
usb_fill_int_urb(xpad->irq_in, udev,
|
usb_fill_int_urb(xpad->irq_in, udev,
|
||||||
usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress),
|
usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress),
|
||||||
xpad->idata, XPAD_PKT_LEN, xpad_irq_in,
|
xpad->idata, XPAD_PKT_LEN, xpad_irq_in,
|
||||||
|
@ -1663,8 +1928,16 @@ static int xpad_resume(struct usb_interface *intf)
|
||||||
retval = xpad360w_start_input(xpad);
|
retval = xpad360w_start_input(xpad);
|
||||||
} else {
|
} else {
|
||||||
mutex_lock(&input->mutex);
|
mutex_lock(&input->mutex);
|
||||||
if (input->users)
|
if (input->users) {
|
||||||
retval = xpad_start_input(xpad);
|
retval = xpad_start_input(xpad);
|
||||||
|
} else if (xpad->xtype == XTYPE_XBOXONE) {
|
||||||
|
/*
|
||||||
|
* Even if there are no users, we'll send Xbox One pads
|
||||||
|
* the startup sequence so they don't sit there and
|
||||||
|
* blink until somebody opens the input device again.
|
||||||
|
*/
|
||||||
|
retval = xpad_start_xbox_one(xpad);
|
||||||
|
}
|
||||||
mutex_unlock(&input->mutex);
|
mutex_unlock(&input->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -453,6 +453,34 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(can_put_echo_skb);
|
EXPORT_SYMBOL_GPL(can_put_echo_skb);
|
||||||
|
|
||||||
|
struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr)
|
||||||
|
{
|
||||||
|
struct can_priv *priv = netdev_priv(dev);
|
||||||
|
struct sk_buff *skb = priv->echo_skb[idx];
|
||||||
|
struct canfd_frame *cf;
|
||||||
|
|
||||||
|
if (idx >= priv->echo_skb_max) {
|
||||||
|
netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n",
|
||||||
|
__func__, idx, priv->echo_skb_max);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skb) {
|
||||||
|
netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n",
|
||||||
|
__func__, idx);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Using "struct canfd_frame::len" for the frame
|
||||||
|
* length is supported on both CAN and CANFD frames.
|
||||||
|
*/
|
||||||
|
cf = (struct canfd_frame *)skb->data;
|
||||||
|
*len_ptr = cf->len;
|
||||||
|
priv->echo_skb[idx] = NULL;
|
||||||
|
|
||||||
|
return skb;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the skb from the stack and loop it back locally
|
* Get the skb from the stack and loop it back locally
|
||||||
*
|
*
|
||||||
|
@ -462,22 +490,16 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb);
|
||||||
*/
|
*/
|
||||||
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
|
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
|
||||||
{
|
{
|
||||||
struct can_priv *priv = netdev_priv(dev);
|
struct sk_buff *skb;
|
||||||
|
u8 len;
|
||||||
|
|
||||||
BUG_ON(idx >= priv->echo_skb_max);
|
skb = __can_get_echo_skb(dev, idx, &len);
|
||||||
|
if (!skb)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (priv->echo_skb[idx]) {
|
netif_rx(skb);
|
||||||
struct sk_buff *skb = priv->echo_skb[idx];
|
|
||||||
struct can_frame *cf = (struct can_frame *)skb->data;
|
|
||||||
u8 dlc = cf->can_dlc;
|
|
||||||
|
|
||||||
netif_rx(priv->echo_skb[idx]);
|
return len;
|
||||||
priv->echo_skb[idx] = NULL;
|
|
||||||
|
|
||||||
return dlc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(can_get_echo_skb);
|
EXPORT_SYMBOL_GPL(can_get_echo_skb);
|
||||||
|
|
||||||
|
|
|
@ -483,7 +483,7 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
|
||||||
if (!compat)
|
if (!compat)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->mdio_dn = of_find_compatible_node(dn, NULL, compat);
|
priv->mdio_dn = of_get_compatible_child(dn, compat);
|
||||||
kfree(compat);
|
kfree(compat);
|
||||||
if (!priv->mdio_dn) {
|
if (!priv->mdio_dn) {
|
||||||
dev_err(kdev, "unable to find MDIO bus node\n");
|
dev_err(kdev, "unable to find MDIO bus node\n");
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <linux/mdio.h>
|
#include <linux/mdio.h>
|
||||||
#include <net/ip6_checksum.h>
|
#include <net/ip6_checksum.h>
|
||||||
#include <linux/microchipphy.h>
|
#include <linux/microchipphy.h>
|
||||||
|
#include <linux/of_net.h>
|
||||||
#include "lan78xx.h"
|
#include "lan78xx.h"
|
||||||
|
|
||||||
#define DRIVER_AUTHOR "WOOJUNG HUH <woojung.huh@microchip.com>"
|
#define DRIVER_AUTHOR "WOOJUNG HUH <woojung.huh@microchip.com>"
|
||||||
|
@ -1644,34 +1645,31 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
|
||||||
addr[5] = (addr_hi >> 8) & 0xFF;
|
addr[5] = (addr_hi >> 8) & 0xFF;
|
||||||
|
|
||||||
if (!is_valid_ether_addr(addr)) {
|
if (!is_valid_ether_addr(addr)) {
|
||||||
/* reading mac address from EEPROM or OTP */
|
if (!eth_platform_get_mac_address(&dev->udev->dev, addr)) {
|
||||||
if ((lan78xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
|
/* valid address present in Device Tree */
|
||||||
addr) == 0) ||
|
netif_dbg(dev, ifup, dev->net,
|
||||||
(lan78xx_read_otp(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
|
"MAC address read from Device Tree");
|
||||||
addr) == 0)) {
|
} else if (((lan78xx_read_eeprom(dev, EEPROM_MAC_OFFSET,
|
||||||
if (is_valid_ether_addr(addr)) {
|
ETH_ALEN, addr) == 0) ||
|
||||||
/* eeprom values are valid so use them */
|
(lan78xx_read_otp(dev, EEPROM_MAC_OFFSET,
|
||||||
netif_dbg(dev, ifup, dev->net,
|
ETH_ALEN, addr) == 0)) &&
|
||||||
"MAC address read from EEPROM");
|
is_valid_ether_addr(addr)) {
|
||||||
} else {
|
/* eeprom values are valid so use them */
|
||||||
/* generate random MAC */
|
netif_dbg(dev, ifup, dev->net,
|
||||||
random_ether_addr(addr);
|
"MAC address read from EEPROM");
|
||||||
netif_dbg(dev, ifup, dev->net,
|
|
||||||
"MAC address set to random addr");
|
|
||||||
}
|
|
||||||
|
|
||||||
addr_lo = addr[0] | (addr[1] << 8) |
|
|
||||||
(addr[2] << 16) | (addr[3] << 24);
|
|
||||||
addr_hi = addr[4] | (addr[5] << 8);
|
|
||||||
|
|
||||||
ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
|
|
||||||
ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
|
|
||||||
} else {
|
} else {
|
||||||
/* generate random MAC */
|
/* generate random MAC */
|
||||||
random_ether_addr(addr);
|
random_ether_addr(addr);
|
||||||
netif_dbg(dev, ifup, dev->net,
|
netif_dbg(dev, ifup, dev->net,
|
||||||
"MAC address set to random addr");
|
"MAC address set to random addr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addr_lo = addr[0] | (addr[1] << 8) |
|
||||||
|
(addr[2] << 16) | (addr[3] << 24);
|
||||||
|
addr_hi = addr[4] | (addr[5] << 8);
|
||||||
|
|
||||||
|
ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
|
||||||
|
ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
|
ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
|
||||||
|
|
|
@ -4967,7 +4967,9 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
|
||||||
}
|
}
|
||||||
|
|
||||||
ar->free_vdev_map &= ~(1LL << arvif->vdev_id);
|
ar->free_vdev_map &= ~(1LL << arvif->vdev_id);
|
||||||
|
spin_lock_bh(&ar->data_lock);
|
||||||
list_add(&arvif->list, &ar->arvifs);
|
list_add(&arvif->list, &ar->arvifs);
|
||||||
|
spin_unlock_bh(&ar->data_lock);
|
||||||
|
|
||||||
/* It makes no sense to have firmware do keepalives. mac80211 already
|
/* It makes no sense to have firmware do keepalives. mac80211 already
|
||||||
* takes care of this with idle connection polling.
|
* takes care of this with idle connection polling.
|
||||||
|
@ -5118,7 +5120,9 @@ err_peer_delete:
|
||||||
err_vdev_delete:
|
err_vdev_delete:
|
||||||
ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
|
ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
|
||||||
ar->free_vdev_map |= 1LL << arvif->vdev_id;
|
ar->free_vdev_map |= 1LL << arvif->vdev_id;
|
||||||
|
spin_lock_bh(&ar->data_lock);
|
||||||
list_del(&arvif->list);
|
list_del(&arvif->list);
|
||||||
|
spin_unlock_bh(&ar->data_lock);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (arvif->beacon_buf) {
|
if (arvif->beacon_buf) {
|
||||||
|
@ -5164,7 +5168,9 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
|
||||||
arvif->vdev_id, ret);
|
arvif->vdev_id, ret);
|
||||||
|
|
||||||
ar->free_vdev_map |= 1LL << arvif->vdev_id;
|
ar->free_vdev_map |= 1LL << arvif->vdev_id;
|
||||||
|
spin_lock_bh(&ar->data_lock);
|
||||||
list_del(&arvif->list);
|
list_del(&arvif->list);
|
||||||
|
spin_unlock_bh(&ar->data_lock);
|
||||||
|
|
||||||
if (arvif->vdev_type == WMI_VDEV_TYPE_AP ||
|
if (arvif->vdev_type == WMI_VDEV_TYPE_AP ||
|
||||||
arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
|
arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
|
||||||
|
|
|
@ -5990,7 +5990,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
|
||||||
* for subsequent chanspecs.
|
* for subsequent chanspecs.
|
||||||
*/
|
*/
|
||||||
channel->flags = IEEE80211_CHAN_NO_HT40 |
|
channel->flags = IEEE80211_CHAN_NO_HT40 |
|
||||||
IEEE80211_CHAN_NO_80MHZ;
|
IEEE80211_CHAN_NO_80MHZ |
|
||||||
|
IEEE80211_CHAN_NO_160MHZ;
|
||||||
ch.bw = BRCMU_CHAN_BW_20;
|
ch.bw = BRCMU_CHAN_BW_20;
|
||||||
cfg->d11inf.encchspec(&ch);
|
cfg->d11inf.encchspec(&ch);
|
||||||
chaninfo = ch.chspec;
|
chaninfo = ch.chspec;
|
||||||
|
|
|
@ -327,8 +327,12 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed) {
|
||||||
*changed = (resp->status == MCC_RESP_NEW_CHAN_PROFILE);
|
u32 status = le32_to_cpu(resp->status);
|
||||||
|
|
||||||
|
*changed = (status == MCC_RESP_NEW_CHAN_PROFILE ||
|
||||||
|
status == MCC_RESP_ILLEGAL);
|
||||||
|
}
|
||||||
|
|
||||||
regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg,
|
regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg,
|
||||||
__le32_to_cpu(resp->n_channels),
|
__le32_to_cpu(resp->n_channels),
|
||||||
|
@ -3976,10 +3980,6 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
|
||||||
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG);
|
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fw_has_capa(&mvm->fw->ucode_capa,
|
|
||||||
IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* if beacon filtering isn't on mac80211 does it anyway */
|
/* if beacon filtering isn't on mac80211 does it anyway */
|
||||||
if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER))
|
if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -739,9 +739,8 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
|
||||||
}
|
}
|
||||||
|
|
||||||
IWL_DEBUG_LAR(mvm,
|
IWL_DEBUG_LAR(mvm,
|
||||||
"MCC response status: 0x%x. new MCC: 0x%x ('%c%c') change: %d n_chans: %d\n",
|
"MCC response status: 0x%x. new MCC: 0x%x ('%c%c') n_chans: %d\n",
|
||||||
status, mcc, mcc >> 8, mcc & 0xff,
|
status, mcc, mcc >> 8, mcc & 0xff, n_channels);
|
||||||
!!(status == MCC_RESP_NEW_CHAN_PROFILE), n_channels);
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
iwl_free_resp(&cmd);
|
iwl_free_resp(&cmd);
|
||||||
|
|
|
@ -1209,6 +1209,12 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
||||||
priv->adapter->curr_iface_comb.p2p_intf--;
|
priv->adapter->curr_iface_comb.p2p_intf--;
|
||||||
priv->adapter->curr_iface_comb.sta_intf++;
|
priv->adapter->curr_iface_comb.sta_intf++;
|
||||||
dev->ieee80211_ptr->iftype = type;
|
dev->ieee80211_ptr->iftype = type;
|
||||||
|
if (mwifiex_deinit_priv_params(priv))
|
||||||
|
return -1;
|
||||||
|
if (mwifiex_init_new_priv_params(priv, dev, type))
|
||||||
|
return -1;
|
||||||
|
if (mwifiex_sta_init_cmd(priv, false, false))
|
||||||
|
return -1;
|
||||||
break;
|
break;
|
||||||
case NL80211_IFTYPE_ADHOC:
|
case NL80211_IFTYPE_ADHOC:
|
||||||
if (mwifiex_cfg80211_deinit_p2p(priv))
|
if (mwifiex_cfg80211_deinit_p2p(priv))
|
||||||
|
@ -3079,8 +3085,10 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
|
||||||
|
|
||||||
mwifiex_stop_net_dev_queue(priv->netdev, adapter);
|
mwifiex_stop_net_dev_queue(priv->netdev, adapter);
|
||||||
|
|
||||||
skb_queue_walk_safe(&priv->bypass_txq, skb, tmp)
|
skb_queue_walk_safe(&priv->bypass_txq, skb, tmp) {
|
||||||
|
skb_unlink(skb, &priv->bypass_txq);
|
||||||
mwifiex_write_data_complete(priv->adapter, skb, 0, -1);
|
mwifiex_write_data_complete(priv->adapter, skb, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
if (netif_carrier_ok(priv->netdev))
|
if (netif_carrier_ok(priv->netdev))
|
||||||
netif_carrier_off(priv->netdev);
|
netif_carrier_off(priv->netdev);
|
||||||
|
|
|
@ -101,7 +101,6 @@ static int mwifiex_pcie_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct mwifiex_adapter *adapter;
|
struct mwifiex_adapter *adapter;
|
||||||
struct pcie_service_card *card;
|
struct pcie_service_card *card;
|
||||||
int hs_actived;
|
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
|
||||||
if (pdev) {
|
if (pdev) {
|
||||||
|
@ -117,7 +116,15 @@ static int mwifiex_pcie_suspend(struct device *dev)
|
||||||
|
|
||||||
adapter = card->adapter;
|
adapter = card->adapter;
|
||||||
|
|
||||||
hs_actived = mwifiex_enable_hs(adapter);
|
/* Enable the Host Sleep */
|
||||||
|
if (!mwifiex_enable_hs(adapter)) {
|
||||||
|
mwifiex_dbg(adapter, ERROR,
|
||||||
|
"cmd: failed to suspend\n");
|
||||||
|
adapter->hs_enabling = false;
|
||||||
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
flush_workqueue(adapter->workqueue);
|
||||||
|
|
||||||
/* Indicate device suspended */
|
/* Indicate device suspended */
|
||||||
adapter->is_suspended = true;
|
adapter->is_suspended = true;
|
||||||
|
@ -1676,9 +1683,6 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
|
||||||
|
|
||||||
if (!adapter->curr_cmd) {
|
if (!adapter->curr_cmd) {
|
||||||
if (adapter->ps_state == PS_STATE_SLEEP_CFM) {
|
if (adapter->ps_state == PS_STATE_SLEEP_CFM) {
|
||||||
mwifiex_process_sleep_confirm_resp(adapter, skb->data,
|
|
||||||
skb->len);
|
|
||||||
mwifiex_pcie_enable_host_int(adapter);
|
|
||||||
if (mwifiex_write_reg(adapter,
|
if (mwifiex_write_reg(adapter,
|
||||||
PCIE_CPU_INT_EVENT,
|
PCIE_CPU_INT_EVENT,
|
||||||
CPU_INTR_SLEEP_CFM_DONE)) {
|
CPU_INTR_SLEEP_CFM_DONE)) {
|
||||||
|
@ -1691,6 +1695,9 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
|
||||||
while (reg->sleep_cookie && (count++ < 10) &&
|
while (reg->sleep_cookie && (count++ < 10) &&
|
||||||
mwifiex_pcie_ok_to_access_hw(adapter))
|
mwifiex_pcie_ok_to_access_hw(adapter))
|
||||||
usleep_range(50, 60);
|
usleep_range(50, 60);
|
||||||
|
mwifiex_pcie_enable_host_int(adapter);
|
||||||
|
mwifiex_process_sleep_confirm_resp(adapter, skb->data,
|
||||||
|
skb->len);
|
||||||
} else {
|
} else {
|
||||||
mwifiex_dbg(adapter, ERROR,
|
mwifiex_dbg(adapter, ERROR,
|
||||||
"There is no command but got cmdrsp\n");
|
"There is no command but got cmdrsp\n");
|
||||||
|
@ -2329,6 +2336,8 @@ static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter)
|
||||||
ret = mwifiex_pcie_process_cmd_complete(adapter);
|
ret = mwifiex_pcie_process_cmd_complete(adapter);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
if (adapter->hs_activated)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card->msi_enable) {
|
if (card->msi_enable) {
|
||||||
|
|
|
@ -503,8 +503,10 @@ mwifiex_wmm_del_pkts_in_ralist_node(struct mwifiex_private *priv,
|
||||||
struct mwifiex_adapter *adapter = priv->adapter;
|
struct mwifiex_adapter *adapter = priv->adapter;
|
||||||
struct sk_buff *skb, *tmp;
|
struct sk_buff *skb, *tmp;
|
||||||
|
|
||||||
skb_queue_walk_safe(&ra_list->skb_head, skb, tmp)
|
skb_queue_walk_safe(&ra_list->skb_head, skb, tmp) {
|
||||||
|
skb_unlink(skb, &ra_list->skb_head);
|
||||||
mwifiex_write_data_complete(adapter, skb, 0, -1);
|
mwifiex_write_data_complete(adapter, skb, 0, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -600,11 +602,15 @@ mwifiex_clean_txrx(struct mwifiex_private *priv)
|
||||||
priv->adapter->if_ops.clean_pcie_ring(priv->adapter);
|
priv->adapter->if_ops.clean_pcie_ring(priv->adapter);
|
||||||
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags);
|
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags);
|
||||||
|
|
||||||
skb_queue_walk_safe(&priv->tdls_txq, skb, tmp)
|
skb_queue_walk_safe(&priv->tdls_txq, skb, tmp) {
|
||||||
|
skb_unlink(skb, &priv->tdls_txq);
|
||||||
mwifiex_write_data_complete(priv->adapter, skb, 0, -1);
|
mwifiex_write_data_complete(priv->adapter, skb, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
skb_queue_walk_safe(&priv->bypass_txq, skb, tmp)
|
skb_queue_walk_safe(&priv->bypass_txq, skb, tmp) {
|
||||||
|
skb_unlink(skb, &priv->bypass_txq);
|
||||||
mwifiex_write_data_complete(priv->adapter, skb, 0, -1);
|
mwifiex_write_data_complete(priv->adapter, skb, 0, -1);
|
||||||
|
}
|
||||||
atomic_set(&priv->adapter->bypass_tx_pending, 0);
|
atomic_set(&priv->adapter->bypass_tx_pending, 0);
|
||||||
|
|
||||||
idr_for_each(&priv->ack_status_frames, mwifiex_free_ack_frame, NULL);
|
idr_for_each(&priv->ack_status_frames, mwifiex_free_ack_frame, NULL);
|
||||||
|
|
|
@ -1805,16 +1805,18 @@ static int wsm_buf_reserve(struct wsm_buf *buf, size_t extra_size)
|
||||||
{
|
{
|
||||||
size_t pos = buf->data - buf->begin;
|
size_t pos = buf->data - buf->begin;
|
||||||
size_t size = pos + extra_size;
|
size_t size = pos + extra_size;
|
||||||
|
u8 *tmp;
|
||||||
|
|
||||||
size = round_up(size, FWLOAD_BLOCK_SIZE);
|
size = round_up(size, FWLOAD_BLOCK_SIZE);
|
||||||
|
|
||||||
buf->begin = krealloc(buf->begin, size, GFP_KERNEL | GFP_DMA);
|
tmp = krealloc(buf->begin, size, GFP_KERNEL | GFP_DMA);
|
||||||
if (buf->begin) {
|
if (!tmp) {
|
||||||
buf->data = &buf->begin[pos];
|
wsm_buf_deinit(buf);
|
||||||
buf->end = &buf->begin[size];
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
buf->end = buf->data = buf->begin;
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf->begin = tmp;
|
||||||
|
buf->data = &buf->begin[pos];
|
||||||
|
buf->end = &buf->begin[size];
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,10 +73,9 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
|
||||||
struct device_node *matched_node;
|
struct device_node *matched_node;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
matched_node = of_find_compatible_node(node, NULL, "marvell,nfc-uart");
|
matched_node = of_get_compatible_child(node, "marvell,nfc-uart");
|
||||||
if (!matched_node) {
|
if (!matched_node) {
|
||||||
matched_node = of_find_compatible_node(node, NULL,
|
matched_node = of_get_compatible_child(node, "mrvl,nfc-uart");
|
||||||
"mrvl,nfc-uart");
|
|
||||||
if (!matched_node)
|
if (!matched_node)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -738,6 +738,31 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(of_get_next_available_child);
|
EXPORT_SYMBOL(of_get_next_available_child);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* of_get_compatible_child - Find compatible child node
|
||||||
|
* @parent: parent node
|
||||||
|
* @compatible: compatible string
|
||||||
|
*
|
||||||
|
* Lookup child node whose compatible property contains the given compatible
|
||||||
|
* string.
|
||||||
|
*
|
||||||
|
* Returns a node pointer with refcount incremented, use of_node_put() on it
|
||||||
|
* when done; or NULL if not found.
|
||||||
|
*/
|
||||||
|
struct device_node *of_get_compatible_child(const struct device_node *parent,
|
||||||
|
const char *compatible)
|
||||||
|
{
|
||||||
|
struct device_node *child;
|
||||||
|
|
||||||
|
for_each_child_of_node(parent, child) {
|
||||||
|
if (of_device_is_compatible(child, compatible))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(of_get_compatible_child);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* of_get_child_by_name - Find the child node by name for a given parent
|
* of_get_child_by_name - Find the child node by name for a given parent
|
||||||
* @node: parent node
|
* @node: parent node
|
||||||
|
|
|
@ -275,7 +275,7 @@ static int meson_pinconf_set(struct pinctrl_dev *pcdev, unsigned int pin,
|
||||||
dev_dbg(pc->dev, "pin %u: disable bias\n", pin);
|
dev_dbg(pc->dev, "pin %u: disable bias\n", pin);
|
||||||
|
|
||||||
meson_calc_reg_and_bit(bank, pin, REG_PULL, ®, &bit);
|
meson_calc_reg_and_bit(bank, pin, REG_PULL, ®, &bit);
|
||||||
ret = regmap_update_bits(pc->reg_pull, reg,
|
ret = regmap_update_bits(pc->reg_pullen, reg,
|
||||||
BIT(bit), 0);
|
BIT(bit), 0);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -237,6 +237,9 @@ static int pcf2127_i2c_gather_write(void *context,
|
||||||
memcpy(buf + 1, val, val_size);
|
memcpy(buf + 1, val, val_size);
|
||||||
|
|
||||||
ret = i2c_master_send(client, buf, val_size + 1);
|
ret = i2c_master_send(client, buf, val_size + 1);
|
||||||
|
|
||||||
|
kfree(buf);
|
||||||
|
|
||||||
if (ret != val_size + 1)
|
if (ret != val_size + 1)
|
||||||
return ret < 0 ? ret : -EIO;
|
return ret < 0 ? ret : -EIO;
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#define QUERY_DESC_HDR_SIZE 2
|
#define QUERY_DESC_HDR_SIZE 2
|
||||||
#define QUERY_OSF_SIZE (GENERAL_UPIU_REQUEST_SIZE - \
|
#define QUERY_OSF_SIZE (GENERAL_UPIU_REQUEST_SIZE - \
|
||||||
(sizeof(struct utp_upiu_header)))
|
(sizeof(struct utp_upiu_header)))
|
||||||
|
#define RESPONSE_UPIU_SENSE_DATA_LENGTH 18
|
||||||
|
|
||||||
#define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
|
#define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
|
||||||
cpu_to_be32((byte3 << 24) | (byte2 << 16) |\
|
cpu_to_be32((byte3 << 24) | (byte2 << 16) |\
|
||||||
|
@ -410,7 +411,7 @@ struct utp_cmd_rsp {
|
||||||
__be32 residual_transfer_count;
|
__be32 residual_transfer_count;
|
||||||
__be32 reserved[4];
|
__be32 reserved[4];
|
||||||
__be16 sense_data_len;
|
__be16 sense_data_len;
|
||||||
u8 sense_data[18];
|
u8 sense_data[RESPONSE_UPIU_SENSE_DATA_LENGTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -104,6 +104,7 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
|
||||||
pm_runtime_forbid(&pdev->dev);
|
pm_runtime_forbid(&pdev->dev);
|
||||||
pm_runtime_get_noresume(&pdev->dev);
|
pm_runtime_get_noresume(&pdev->dev);
|
||||||
ufshcd_remove(hba);
|
ufshcd_remove(hba);
|
||||||
|
ufshcd_dealloc_host(hba);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,6 +148,7 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
err = ufshcd_init(hba, mmio_base, pdev->irq);
|
err = ufshcd_init(hba, mmio_base, pdev->irq);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "Initialization failed\n");
|
dev_err(&pdev->dev, "Initialization failed\n");
|
||||||
|
ufshcd_dealloc_host(hba);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "%s: unable to find %s err %d\n",
|
dev_err(dev, "%s: unable to find %s err %d\n",
|
||||||
__func__, prop_name, ret);
|
__func__, prop_name, ret);
|
||||||
goto out_free;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
vreg->min_uA = 0;
|
vreg->min_uA = 0;
|
||||||
|
@ -185,9 +185,6 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
out_free:
|
|
||||||
devm_kfree(dev, vreg);
|
|
||||||
vreg = NULL;
|
|
||||||
out:
|
out:
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*out_vreg = vreg;
|
*out_vreg = vreg;
|
||||||
|
|
|
@ -673,6 +673,21 @@ int ufshcd_hold(struct ufs_hba *hba, bool async)
|
||||||
start:
|
start:
|
||||||
switch (hba->clk_gating.state) {
|
switch (hba->clk_gating.state) {
|
||||||
case CLKS_ON:
|
case CLKS_ON:
|
||||||
|
/*
|
||||||
|
* Wait for the ungate work to complete if in progress.
|
||||||
|
* Though the clocks may be in ON state, the link could
|
||||||
|
* still be in hibner8 state if hibern8 is allowed
|
||||||
|
* during clock gating.
|
||||||
|
* Make sure we exit hibern8 state also in addition to
|
||||||
|
* clocks being ON.
|
||||||
|
*/
|
||||||
|
if (ufshcd_can_hibern8_during_gating(hba) &&
|
||||||
|
ufshcd_is_link_hibern8(hba)) {
|
||||||
|
spin_unlock_irqrestore(hba->host->host_lock, flags);
|
||||||
|
flush_work(&hba->clk_gating.ungate_work);
|
||||||
|
spin_lock_irqsave(hba->host->host_lock, flags);
|
||||||
|
goto start;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case REQ_CLKS_OFF:
|
case REQ_CLKS_OFF:
|
||||||
if (cancel_delayed_work(&hba->clk_gating.gate_work)) {
|
if (cancel_delayed_work(&hba->clk_gating.gate_work)) {
|
||||||
|
@ -902,10 +917,14 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp)
|
||||||
int len;
|
int len;
|
||||||
if (lrbp->sense_buffer &&
|
if (lrbp->sense_buffer &&
|
||||||
ufshcd_get_rsp_upiu_data_seg_len(lrbp->ucd_rsp_ptr)) {
|
ufshcd_get_rsp_upiu_data_seg_len(lrbp->ucd_rsp_ptr)) {
|
||||||
|
int len_to_copy;
|
||||||
|
|
||||||
len = be16_to_cpu(lrbp->ucd_rsp_ptr->sr.sense_data_len);
|
len = be16_to_cpu(lrbp->ucd_rsp_ptr->sr.sense_data_len);
|
||||||
|
len_to_copy = min_t(int, RESPONSE_UPIU_SENSE_DATA_LENGTH, len);
|
||||||
|
|
||||||
memcpy(lrbp->sense_buffer,
|
memcpy(lrbp->sense_buffer,
|
||||||
lrbp->ucd_rsp_ptr->sr.sense_data,
|
lrbp->ucd_rsp_ptr->sr.sense_data,
|
||||||
min_t(int, len, SCSI_SENSE_BUFFERSIZE));
|
min_t(int, len_to_copy, SCSI_SENSE_BUFFERSIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6402,7 +6421,10 @@ EXPORT_SYMBOL(ufshcd_system_suspend);
|
||||||
|
|
||||||
int ufshcd_system_resume(struct ufs_hba *hba)
|
int ufshcd_system_resume(struct ufs_hba *hba)
|
||||||
{
|
{
|
||||||
if (!hba || !hba->is_powered || pm_runtime_suspended(hba->dev))
|
if (!hba)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!hba->is_powered || pm_runtime_suspended(hba->dev))
|
||||||
/*
|
/*
|
||||||
* Let the runtime resume take care of resuming
|
* Let the runtime resume take care of resuming
|
||||||
* if runtime suspended.
|
* if runtime suspended.
|
||||||
|
@ -6423,7 +6445,10 @@ EXPORT_SYMBOL(ufshcd_system_resume);
|
||||||
*/
|
*/
|
||||||
int ufshcd_runtime_suspend(struct ufs_hba *hba)
|
int ufshcd_runtime_suspend(struct ufs_hba *hba)
|
||||||
{
|
{
|
||||||
if (!hba || !hba->is_powered)
|
if (!hba)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!hba->is_powered)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ufshcd_suspend(hba, UFS_RUNTIME_PM);
|
return ufshcd_suspend(hba, UFS_RUNTIME_PM);
|
||||||
|
@ -6453,10 +6478,13 @@ EXPORT_SYMBOL(ufshcd_runtime_suspend);
|
||||||
*/
|
*/
|
||||||
int ufshcd_runtime_resume(struct ufs_hba *hba)
|
int ufshcd_runtime_resume(struct ufs_hba *hba)
|
||||||
{
|
{
|
||||||
if (!hba || !hba->is_powered)
|
if (!hba)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!hba->is_powered)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
|
||||||
return ufshcd_resume(hba, UFS_RUNTIME_PM);
|
return ufshcd_resume(hba, UFS_RUNTIME_PM);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ufshcd_runtime_resume);
|
EXPORT_SYMBOL(ufshcd_runtime_resume);
|
||||||
|
|
||||||
|
@ -6563,8 +6591,6 @@ void ufshcd_remove(struct ufs_hba *hba)
|
||||||
ufshcd_disable_intr(hba, hba->intr_mask);
|
ufshcd_disable_intr(hba, hba->intr_mask);
|
||||||
ufshcd_hba_stop(hba, true);
|
ufshcd_hba_stop(hba, true);
|
||||||
|
|
||||||
scsi_host_put(hba->host);
|
|
||||||
|
|
||||||
ufshcd_exit_clk_gating(hba);
|
ufshcd_exit_clk_gating(hba);
|
||||||
ufshcd_exit_latency_hist(hba);
|
ufshcd_exit_latency_hist(hba);
|
||||||
if (ufshcd_is_clkscaling_enabled(hba))
|
if (ufshcd_is_clkscaling_enabled(hba))
|
||||||
|
@ -6690,15 +6716,47 @@ static int ufshcd_devfreq_target(struct device *dev,
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
struct ufs_hba *hba = dev_get_drvdata(dev);
|
struct ufs_hba *hba = dev_get_drvdata(dev);
|
||||||
|
bool release_clk_hold = false;
|
||||||
|
unsigned long irq_flags;
|
||||||
|
|
||||||
if (!ufshcd_is_clkscaling_enabled(hba))
|
if (!ufshcd_is_clkscaling_enabled(hba))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
spin_lock_irqsave(hba->host->host_lock, irq_flags);
|
||||||
|
if (ufshcd_eh_in_progress(hba)) {
|
||||||
|
spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ufshcd_is_clkgating_allowed(hba) &&
|
||||||
|
(hba->clk_gating.state != CLKS_ON)) {
|
||||||
|
if (cancel_delayed_work(&hba->clk_gating.gate_work)) {
|
||||||
|
/* hold the vote until the scaling work is completed */
|
||||||
|
hba->clk_gating.active_reqs++;
|
||||||
|
release_clk_hold = true;
|
||||||
|
hba->clk_gating.state = CLKS_ON;
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Clock gating work seems to be running in parallel
|
||||||
|
* hence skip scaling work to avoid deadlock between
|
||||||
|
* current scaling work and gating work.
|
||||||
|
*/
|
||||||
|
spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
|
||||||
|
|
||||||
if (*freq == UINT_MAX)
|
if (*freq == UINT_MAX)
|
||||||
err = ufshcd_scale_clks(hba, true);
|
err = ufshcd_scale_clks(hba, true);
|
||||||
else if (*freq == 0)
|
else if (*freq == 0)
|
||||||
err = ufshcd_scale_clks(hba, false);
|
err = ufshcd_scale_clks(hba, false);
|
||||||
|
|
||||||
|
spin_lock_irqsave(hba->host->host_lock, irq_flags);
|
||||||
|
if (release_clk_hold)
|
||||||
|
__ufshcd_release(hba);
|
||||||
|
spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6904,7 +6962,6 @@ exit_gating:
|
||||||
ufshcd_exit_latency_hist(hba);
|
ufshcd_exit_latency_hist(hba);
|
||||||
out_disable:
|
out_disable:
|
||||||
hba->is_irq_enabled = false;
|
hba->is_irq_enabled = false;
|
||||||
scsi_host_put(host);
|
|
||||||
ufshcd_hba_exit(hba);
|
ufshcd_hba_exit(hba);
|
||||||
out_error:
|
out_error:
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -154,17 +154,28 @@ static inline unsigned char *echo_buf_addr(struct n_tty_data *ldata, size_t i)
|
||||||
return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)];
|
return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we are not echoing the data, perhaps this is a secret so erase it */
|
||||||
|
static void zero_buffer(struct tty_struct *tty, u8 *buffer, int size)
|
||||||
|
{
|
||||||
|
bool icanon = !!L_ICANON(tty);
|
||||||
|
bool no_echo = !L_ECHO(tty);
|
||||||
|
|
||||||
|
if (icanon && no_echo)
|
||||||
|
memset(buffer, 0x00, size);
|
||||||
|
}
|
||||||
|
|
||||||
static int tty_copy_to_user(struct tty_struct *tty, void __user *to,
|
static int tty_copy_to_user(struct tty_struct *tty, void __user *to,
|
||||||
size_t tail, size_t n)
|
size_t tail, size_t n)
|
||||||
{
|
{
|
||||||
struct n_tty_data *ldata = tty->disc_data;
|
struct n_tty_data *ldata = tty->disc_data;
|
||||||
size_t size = N_TTY_BUF_SIZE - tail;
|
size_t size = N_TTY_BUF_SIZE - tail;
|
||||||
const void *from = read_buf_addr(ldata, tail);
|
void *from = read_buf_addr(ldata, tail);
|
||||||
int uncopied;
|
int uncopied;
|
||||||
|
|
||||||
if (n > size) {
|
if (n > size) {
|
||||||
tty_audit_add_data(tty, from, size);
|
tty_audit_add_data(tty, from, size);
|
||||||
uncopied = copy_to_user(to, from, size);
|
uncopied = copy_to_user(to, from, size);
|
||||||
|
zero_buffer(tty, from, size - uncopied);
|
||||||
if (uncopied)
|
if (uncopied)
|
||||||
return uncopied;
|
return uncopied;
|
||||||
to += size;
|
to += size;
|
||||||
|
@ -173,7 +184,9 @@ static int tty_copy_to_user(struct tty_struct *tty, void __user *to,
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_audit_add_data(tty, from, n);
|
tty_audit_add_data(tty, from, n);
|
||||||
return copy_to_user(to, from, n);
|
uncopied = copy_to_user(to, from, n);
|
||||||
|
zero_buffer(tty, from, n - uncopied);
|
||||||
|
return uncopied;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1962,11 +1975,12 @@ static int copy_from_read_buf(struct tty_struct *tty,
|
||||||
n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail);
|
n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail);
|
||||||
n = min(*nr, n);
|
n = min(*nr, n);
|
||||||
if (n) {
|
if (n) {
|
||||||
const unsigned char *from = read_buf_addr(ldata, tail);
|
unsigned char *from = read_buf_addr(ldata, tail);
|
||||||
retval = copy_to_user(*b, from, n);
|
retval = copy_to_user(*b, from, n);
|
||||||
n -= retval;
|
n -= retval;
|
||||||
is_eof = n == 1 && *from == EOF_CHAR(tty);
|
is_eof = n == 1 && *from == EOF_CHAR(tty);
|
||||||
tty_audit_add_data(tty, from, n);
|
tty_audit_add_data(tty, from, n);
|
||||||
|
zero_buffer(tty, from, n);
|
||||||
smp_store_release(&ldata->read_tail, ldata->read_tail + n);
|
smp_store_release(&ldata->read_tail, ldata->read_tail + n);
|
||||||
/* Turn single EOF into zero-length read */
|
/* Turn single EOF into zero-length read */
|
||||||
if (L_EXTPROC(tty) && ldata->icanon && is_eof &&
|
if (L_EXTPROC(tty) && ldata->icanon && is_eof &&
|
||||||
|
|
|
@ -458,6 +458,8 @@ int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
|
||||||
if (count && ld->ops->receive_buf)
|
if (count && ld->ops->receive_buf)
|
||||||
ld->ops->receive_buf(ld->tty, p, f, count);
|
ld->ops->receive_buf(ld->tty, p, f, count);
|
||||||
}
|
}
|
||||||
|
if (count > 0)
|
||||||
|
memset(p, 0, count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf);
|
EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf);
|
||||||
|
|
|
@ -2809,7 +2809,9 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
|
||||||
USB_PORT_FEAT_C_BH_PORT_RESET);
|
USB_PORT_FEAT_C_BH_PORT_RESET);
|
||||||
usb_clear_port_feature(hub->hdev, port1,
|
usb_clear_port_feature(hub->hdev, port1,
|
||||||
USB_PORT_FEAT_C_PORT_LINK_STATE);
|
USB_PORT_FEAT_C_PORT_LINK_STATE);
|
||||||
usb_clear_port_feature(hub->hdev, port1,
|
|
||||||
|
if (udev)
|
||||||
|
usb_clear_port_feature(hub->hdev, port1,
|
||||||
USB_PORT_FEAT_C_CONNECTION);
|
USB_PORT_FEAT_C_CONNECTION);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1145,6 +1145,7 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
err5:
|
err5:
|
||||||
dwc3_event_buffers_cleanup(dwc);
|
dwc3_event_buffers_cleanup(dwc);
|
||||||
|
dwc3_ulpi_exit(dwc);
|
||||||
|
|
||||||
err4:
|
err4:
|
||||||
dwc3_free_scratch_buffers(dwc);
|
dwc3_free_scratch_buffers(dwc);
|
||||||
|
|
|
@ -768,7 +768,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
|
||||||
status |= USB_PORT_STAT_SUSPEND;
|
status |= USB_PORT_STAT_SUSPEND;
|
||||||
}
|
}
|
||||||
if ((raw_port_status & PORT_PLS_MASK) == XDEV_RESUME &&
|
if ((raw_port_status & PORT_PLS_MASK) == XDEV_RESUME &&
|
||||||
!DEV_SUPERSPEED_ANY(raw_port_status)) {
|
!DEV_SUPERSPEED_ANY(raw_port_status) && hcd->speed < HCD_USB3) {
|
||||||
if ((raw_port_status & PORT_RESET) ||
|
if ((raw_port_status & PORT_RESET) ||
|
||||||
!(raw_port_status & PORT_PE))
|
!(raw_port_status & PORT_PE))
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
|
@ -814,7 +814,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
|
||||||
time_left = wait_for_completion_timeout(
|
time_left = wait_for_completion_timeout(
|
||||||
&bus_state->rexit_done[wIndex],
|
&bus_state->rexit_done[wIndex],
|
||||||
msecs_to_jiffies(
|
msecs_to_jiffies(
|
||||||
XHCI_MAX_REXIT_TIMEOUT));
|
XHCI_MAX_REXIT_TIMEOUT_MS));
|
||||||
spin_lock_irqsave(&xhci->lock, flags);
|
spin_lock_irqsave(&xhci->lock, flags);
|
||||||
|
|
||||||
if (time_left) {
|
if (time_left) {
|
||||||
|
@ -828,7 +828,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
|
||||||
} else {
|
} else {
|
||||||
int port_status = readl(port_array[wIndex]);
|
int port_status = readl(port_array[wIndex]);
|
||||||
xhci_warn(xhci, "Port resume took longer than %i msec, port status = 0x%x\n",
|
xhci_warn(xhci, "Port resume took longer than %i msec, port status = 0x%x\n",
|
||||||
XHCI_MAX_REXIT_TIMEOUT,
|
XHCI_MAX_REXIT_TIMEOUT_MS,
|
||||||
port_status);
|
port_status);
|
||||||
status |= USB_PORT_STAT_SUSPEND;
|
status |= USB_PORT_STAT_SUSPEND;
|
||||||
clear_bit(wIndex, &bus_state->rexit_ports);
|
clear_bit(wIndex, &bus_state->rexit_ports);
|
||||||
|
@ -1322,13 +1322,16 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
|
||||||
__le32 __iomem **port_array;
|
__le32 __iomem **port_array;
|
||||||
struct xhci_bus_state *bus_state;
|
struct xhci_bus_state *bus_state;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
u32 portsc_buf[USB_MAXCHILDREN];
|
||||||
|
bool wake_enabled;
|
||||||
|
|
||||||
max_ports = xhci_get_ports(hcd, &port_array);
|
max_ports = xhci_get_ports(hcd, &port_array);
|
||||||
bus_state = &xhci->bus_state[hcd_index(hcd)];
|
bus_state = &xhci->bus_state[hcd_index(hcd)];
|
||||||
|
wake_enabled = hcd->self.root_hub->do_remote_wakeup;
|
||||||
|
|
||||||
spin_lock_irqsave(&xhci->lock, flags);
|
spin_lock_irqsave(&xhci->lock, flags);
|
||||||
|
|
||||||
if (hcd->self.root_hub->do_remote_wakeup) {
|
if (wake_enabled) {
|
||||||
if (bus_state->resuming_ports || /* USB2 */
|
if (bus_state->resuming_ports || /* USB2 */
|
||||||
bus_state->port_remote_wakeup) { /* USB3 */
|
bus_state->port_remote_wakeup) { /* USB3 */
|
||||||
spin_unlock_irqrestore(&xhci->lock, flags);
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
||||||
|
@ -1336,26 +1339,36 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
port_index = max_ports;
|
* Prepare ports for suspend, but don't write anything before all ports
|
||||||
|
* are checked and we know bus suspend can proceed
|
||||||
|
*/
|
||||||
bus_state->bus_suspended = 0;
|
bus_state->bus_suspended = 0;
|
||||||
|
port_index = max_ports;
|
||||||
while (port_index--) {
|
while (port_index--) {
|
||||||
/* suspend the port if the port is not suspended */
|
|
||||||
u32 t1, t2;
|
u32 t1, t2;
|
||||||
int slot_id;
|
|
||||||
|
|
||||||
t1 = readl(port_array[port_index]);
|
t1 = readl(port_array[port_index]);
|
||||||
t2 = xhci_port_state_to_neutral(t1);
|
t2 = xhci_port_state_to_neutral(t1);
|
||||||
|
portsc_buf[port_index] = 0;
|
||||||
|
|
||||||
if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) {
|
/* Bail out if a USB3 port has a new device in link training */
|
||||||
xhci_dbg(xhci, "port %d not suspended\n", port_index);
|
if ((t1 & PORT_PLS_MASK) == XDEV_POLLING) {
|
||||||
slot_id = xhci_find_slot_id_by_port(hcd, xhci,
|
bus_state->bus_suspended = 0;
|
||||||
port_index + 1);
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
||||||
if (slot_id) {
|
xhci_dbg(xhci, "Bus suspend bailout, port in polling\n");
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* suspend ports in U0, or bail out for new connect changes */
|
||||||
|
if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) {
|
||||||
|
if ((t1 & PORT_CSC) && wake_enabled) {
|
||||||
|
bus_state->bus_suspended = 0;
|
||||||
spin_unlock_irqrestore(&xhci->lock, flags);
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
||||||
xhci_stop_device(xhci, slot_id, 1);
|
xhci_dbg(xhci, "Bus suspend bailout, port connect change\n");
|
||||||
spin_lock_irqsave(&xhci->lock, flags);
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
xhci_dbg(xhci, "port %d not suspended\n", port_index);
|
||||||
t2 &= ~PORT_PLS_MASK;
|
t2 &= ~PORT_PLS_MASK;
|
||||||
t2 |= PORT_LINK_STROBE | XDEV_U3;
|
t2 |= PORT_LINK_STROBE | XDEV_U3;
|
||||||
set_bit(port_index, &bus_state->bus_suspended);
|
set_bit(port_index, &bus_state->bus_suspended);
|
||||||
|
@ -1364,7 +1377,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
|
||||||
* including the USB 3.0 roothub, but only if CONFIG_PM
|
* including the USB 3.0 roothub, but only if CONFIG_PM
|
||||||
* is enabled, so also enable remote wake here.
|
* is enabled, so also enable remote wake here.
|
||||||
*/
|
*/
|
||||||
if (hcd->self.root_hub->do_remote_wakeup) {
|
if (wake_enabled) {
|
||||||
if (t1 & PORT_CONNECT) {
|
if (t1 & PORT_CONNECT) {
|
||||||
t2 |= PORT_WKOC_E | PORT_WKDISC_E;
|
t2 |= PORT_WKOC_E | PORT_WKDISC_E;
|
||||||
t2 &= ~PORT_WKCONN_E;
|
t2 &= ~PORT_WKCONN_E;
|
||||||
|
@ -1377,7 +1390,26 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
|
||||||
|
|
||||||
t1 = xhci_port_state_to_neutral(t1);
|
t1 = xhci_port_state_to_neutral(t1);
|
||||||
if (t1 != t2)
|
if (t1 != t2)
|
||||||
writel(t2, port_array[port_index]);
|
portsc_buf[port_index] = t2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write port settings, stopping and suspending ports if needed */
|
||||||
|
port_index = max_ports;
|
||||||
|
while (port_index--) {
|
||||||
|
if (!portsc_buf[port_index])
|
||||||
|
continue;
|
||||||
|
if (test_bit(port_index, &bus_state->bus_suspended)) {
|
||||||
|
int slot_id;
|
||||||
|
|
||||||
|
slot_id = xhci_find_slot_id_by_port(hcd, xhci,
|
||||||
|
port_index + 1);
|
||||||
|
if (slot_id) {
|
||||||
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
||||||
|
xhci_stop_device(xhci, slot_id, 1);
|
||||||
|
spin_lock_irqsave(&xhci->lock, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writel(portsc_buf[port_index], port_array[port_index]);
|
||||||
}
|
}
|
||||||
hcd->state = HC_STATE_SUSPENDED;
|
hcd->state = HC_STATE_SUSPENDED;
|
||||||
bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
|
bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
|
||||||
|
|
|
@ -1676,7 +1676,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
|
||||||
* RExit to a disconnect state). If so, let the the driver know it's
|
* RExit to a disconnect state). If so, let the the driver know it's
|
||||||
* out of the RExit state.
|
* out of the RExit state.
|
||||||
*/
|
*/
|
||||||
if (!DEV_SUPERSPEED_ANY(temp) &&
|
if (!DEV_SUPERSPEED_ANY(temp) && hcd->speed < HCD_USB3 &&
|
||||||
test_and_clear_bit(faked_port_index,
|
test_and_clear_bit(faked_port_index,
|
||||||
&bus_state->rexit_ports)) {
|
&bus_state->rexit_ports)) {
|
||||||
complete(&bus_state->rexit_done[faked_port_index]);
|
complete(&bus_state->rexit_done[faked_port_index]);
|
||||||
|
|
|
@ -1509,7 +1509,7 @@ struct xhci_bus_state {
|
||||||
* It can take up to 20 ms to transition from RExit to U0 on the
|
* It can take up to 20 ms to transition from RExit to U0 on the
|
||||||
* Intel Lynx Point LP xHCI host.
|
* Intel Lynx Point LP xHCI host.
|
||||||
*/
|
*/
|
||||||
#define XHCI_MAX_REXIT_TIMEOUT (20 * 1000)
|
#define XHCI_MAX_REXIT_TIMEOUT_MS 20
|
||||||
|
|
||||||
static inline unsigned int hcd_index(struct usb_hcd *hcd)
|
static inline unsigned int hcd_index(struct usb_hcd *hcd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,15 +76,6 @@ static inline int dt_type(struct p9_wstat *mistat)
|
||||||
return rettype;
|
return rettype;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void p9stat_init(struct p9_wstat *stbuf)
|
|
||||||
{
|
|
||||||
stbuf->name = NULL;
|
|
||||||
stbuf->uid = NULL;
|
|
||||||
stbuf->gid = NULL;
|
|
||||||
stbuf->muid = NULL;
|
|
||||||
stbuf->extension = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* v9fs_alloc_rdir_buf - Allocate buffer used for read and readdir
|
* v9fs_alloc_rdir_buf - Allocate buffer used for read and readdir
|
||||||
* @filp: opened file structure
|
* @filp: opened file structure
|
||||||
|
@ -145,12 +136,10 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx)
|
||||||
rdir->tail = n;
|
rdir->tail = n;
|
||||||
}
|
}
|
||||||
while (rdir->head < rdir->tail) {
|
while (rdir->head < rdir->tail) {
|
||||||
p9stat_init(&st);
|
|
||||||
err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
|
err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
|
||||||
rdir->tail - rdir->head, &st);
|
rdir->tail - rdir->head, &st);
|
||||||
if (err) {
|
if (err) {
|
||||||
p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
|
p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
|
||||||
p9stat_free(&st);
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
reclen = st.size+2;
|
reclen = st.size+2;
|
||||||
|
|
|
@ -350,7 +350,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
|
||||||
|
|
||||||
s->s_magic = BFS_MAGIC;
|
s->s_magic = BFS_MAGIC;
|
||||||
|
|
||||||
if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) {
|
if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end) ||
|
||||||
|
le32_to_cpu(bfs_sb->s_start) < BFS_BSIZE) {
|
||||||
printf("Superblock is corrupted\n");
|
printf("Superblock is corrupted\n");
|
||||||
goto out1;
|
goto out1;
|
||||||
}
|
}
|
||||||
|
@ -359,9 +360,11 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
|
||||||
sizeof(struct bfs_inode)
|
sizeof(struct bfs_inode)
|
||||||
+ BFS_ROOT_INO - 1;
|
+ BFS_ROOT_INO - 1;
|
||||||
imap_len = (info->si_lasti / 8) + 1;
|
imap_len = (info->si_lasti / 8) + 1;
|
||||||
info->si_imap = kzalloc(imap_len, GFP_KERNEL);
|
info->si_imap = kzalloc(imap_len, GFP_KERNEL | __GFP_NOWARN);
|
||||||
if (!info->si_imap)
|
if (!info->si_imap) {
|
||||||
|
printf("Cannot allocate %u bytes\n", imap_len);
|
||||||
goto out1;
|
goto out1;
|
||||||
|
}
|
||||||
for (i = 0; i < BFS_ROOT_INO; i++)
|
for (i = 0; i < BFS_ROOT_INO; i++)
|
||||||
set_bit(i, info->si_imap);
|
set_bit(i, info->si_imap);
|
||||||
|
|
||||||
|
|
|
@ -71,13 +71,13 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
|
||||||
if (!sdp)
|
if (!sdp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sb->s_fs_info = sdp;
|
|
||||||
sdp->sd_vfs = sb;
|
sdp->sd_vfs = sb;
|
||||||
sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats);
|
sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats);
|
||||||
if (!sdp->sd_lkstats) {
|
if (!sdp->sd_lkstats) {
|
||||||
kfree(sdp);
|
kfree(sdp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
sb->s_fs_info = sdp;
|
||||||
|
|
||||||
set_bit(SDF_NOJOURNALID, &sdp->sd_flags);
|
set_bit(SDF_NOJOURNALID, &sdp->sd_flags);
|
||||||
gfs2_tune_init(&sdp->sd_tune);
|
gfs2_tune_init(&sdp->sd_tune);
|
||||||
|
|
53
fs/namei.c
53
fs/namei.c
|
@ -907,6 +907,8 @@ static inline void put_link(struct nameidata *nd)
|
||||||
|
|
||||||
int sysctl_protected_symlinks __read_mostly = 0;
|
int sysctl_protected_symlinks __read_mostly = 0;
|
||||||
int sysctl_protected_hardlinks __read_mostly = 0;
|
int sysctl_protected_hardlinks __read_mostly = 0;
|
||||||
|
int sysctl_protected_fifos __read_mostly;
|
||||||
|
int sysctl_protected_regular __read_mostly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* may_follow_link - Check symlink following for unsafe situations
|
* may_follow_link - Check symlink following for unsafe situations
|
||||||
|
@ -1020,6 +1022,45 @@ static int may_linkat(struct path *link)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* may_create_in_sticky - Check whether an O_CREAT open in a sticky directory
|
||||||
|
* should be allowed, or not, on files that already
|
||||||
|
* exist.
|
||||||
|
* @dir: the sticky parent directory
|
||||||
|
* @inode: the inode of the file to open
|
||||||
|
*
|
||||||
|
* Block an O_CREAT open of a FIFO (or a regular file) when:
|
||||||
|
* - sysctl_protected_fifos (or sysctl_protected_regular) is enabled
|
||||||
|
* - the file already exists
|
||||||
|
* - we are in a sticky directory
|
||||||
|
* - we don't own the file
|
||||||
|
* - the owner of the directory doesn't own the file
|
||||||
|
* - the directory is world writable
|
||||||
|
* If the sysctl_protected_fifos (or sysctl_protected_regular) is set to 2
|
||||||
|
* the directory doesn't have to be world writable: being group writable will
|
||||||
|
* be enough.
|
||||||
|
*
|
||||||
|
* Returns 0 if the open is allowed, -ve on error.
|
||||||
|
*/
|
||||||
|
static int may_create_in_sticky(struct dentry * const dir,
|
||||||
|
struct inode * const inode)
|
||||||
|
{
|
||||||
|
if ((!sysctl_protected_fifos && S_ISFIFO(inode->i_mode)) ||
|
||||||
|
(!sysctl_protected_regular && S_ISREG(inode->i_mode)) ||
|
||||||
|
likely(!(dir->d_inode->i_mode & S_ISVTX)) ||
|
||||||
|
uid_eq(inode->i_uid, dir->d_inode->i_uid) ||
|
||||||
|
uid_eq(current_fsuid(), inode->i_uid))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (likely(dir->d_inode->i_mode & 0002) ||
|
||||||
|
(dir->d_inode->i_mode & 0020 &&
|
||||||
|
((sysctl_protected_fifos >= 2 && S_ISFIFO(inode->i_mode)) ||
|
||||||
|
(sysctl_protected_regular >= 2 && S_ISREG(inode->i_mode))))) {
|
||||||
|
return -EACCES;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static __always_inline
|
static __always_inline
|
||||||
const char *get_link(struct nameidata *nd)
|
const char *get_link(struct nameidata *nd)
|
||||||
{
|
{
|
||||||
|
@ -3387,9 +3428,15 @@ finish_open:
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
audit_inode(nd->name, nd->path.dentry, 0);
|
audit_inode(nd->name, nd->path.dentry, 0);
|
||||||
error = -EISDIR;
|
if (open_flag & O_CREAT) {
|
||||||
if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry))
|
error = -EISDIR;
|
||||||
goto out;
|
if (d_is_dir(nd->path.dentry))
|
||||||
|
goto out;
|
||||||
|
error = may_create_in_sticky(dir,
|
||||||
|
d_backing_inode(nd->path.dentry));
|
||||||
|
if (unlikely(error))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
error = -ENOTDIR;
|
error = -ENOTDIR;
|
||||||
if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry))
|
if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -154,6 +154,7 @@ void can_change_state(struct net_device *dev, struct can_frame *cf,
|
||||||
|
|
||||||
void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
|
void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
|
||||||
unsigned int idx);
|
unsigned int idx);
|
||||||
|
struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr);
|
||||||
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
|
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
|
||||||
void can_free_echo_skb(struct net_device *dev, unsigned int idx);
|
void can_free_echo_skb(struct net_device *dev, unsigned int idx);
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,8 @@ extern struct inodes_stat_t inodes_stat;
|
||||||
extern int leases_enable, lease_break_time;
|
extern int leases_enable, lease_break_time;
|
||||||
extern int sysctl_protected_symlinks;
|
extern int sysctl_protected_symlinks;
|
||||||
extern int sysctl_protected_hardlinks;
|
extern int sysctl_protected_hardlinks;
|
||||||
|
extern int sysctl_protected_fifos;
|
||||||
|
extern int sysctl_protected_regular;
|
||||||
|
|
||||||
struct buffer_head;
|
struct buffer_head;
|
||||||
typedef int (get_block_t)(struct inode *inode, sector_t iblock,
|
typedef int (get_block_t)(struct inode *inode, sector_t iblock,
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
enum integrity_status {
|
enum integrity_status {
|
||||||
INTEGRITY_PASS = 0,
|
INTEGRITY_PASS = 0,
|
||||||
|
INTEGRITY_PASS_IMMUTABLE,
|
||||||
INTEGRITY_FAIL,
|
INTEGRITY_FAIL,
|
||||||
INTEGRITY_NOLABEL,
|
INTEGRITY_NOLABEL,
|
||||||
INTEGRITY_NOXATTRS,
|
INTEGRITY_NOXATTRS,
|
||||||
|
|
|
@ -275,6 +275,8 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
|
||||||
extern struct device_node *of_get_next_available_child(
|
extern struct device_node *of_get_next_available_child(
|
||||||
const struct device_node *node, struct device_node *prev);
|
const struct device_node *node, struct device_node *prev);
|
||||||
|
|
||||||
|
extern struct device_node *of_get_compatible_child(const struct device_node *parent,
|
||||||
|
const char *compatible);
|
||||||
extern struct device_node *of_get_child_by_name(const struct device_node *node,
|
extern struct device_node *of_get_child_by_name(const struct device_node *node,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
|
@ -606,6 +608,12 @@ static inline bool of_have_populated_dt(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct device_node *of_get_compatible_child(const struct device_node *parent,
|
||||||
|
const char *compatible)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct device_node *of_get_child_by_name(
|
static inline struct device_node *of_get_child_by_name(
|
||||||
const struct device_node *node,
|
const struct device_node *node,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* PFN_DEV - pfn is not covered by system memmap by default
|
* PFN_DEV - pfn is not covered by system memmap by default
|
||||||
* PFN_MAP - pfn has a dynamic page mapping established by a device driver
|
* PFN_MAP - pfn has a dynamic page mapping established by a device driver
|
||||||
*/
|
*/
|
||||||
#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - PAGE_SHIFT))
|
#define PFN_FLAGS_MASK (((u64) (~PAGE_MASK)) << (BITS_PER_LONG_LONG - PAGE_SHIFT))
|
||||||
#define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1))
|
#define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1))
|
||||||
#define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2))
|
#define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2))
|
||||||
#define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
|
#define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
|
||||||
|
|
|
@ -215,7 +215,7 @@ static char *kdb_read(char *buffer, size_t bufsize)
|
||||||
int count;
|
int count;
|
||||||
int i;
|
int i;
|
||||||
int diag, dtab_count;
|
int diag, dtab_count;
|
||||||
int key;
|
int key, buf_size, ret;
|
||||||
static int last_crlf;
|
static int last_crlf;
|
||||||
|
|
||||||
diag = kdbgetintenv("DTABCOUNT", &dtab_count);
|
diag = kdbgetintenv("DTABCOUNT", &dtab_count);
|
||||||
|
@ -343,9 +343,8 @@ poll_again:
|
||||||
else
|
else
|
||||||
p_tmp = tmpbuffer;
|
p_tmp = tmpbuffer;
|
||||||
len = strlen(p_tmp);
|
len = strlen(p_tmp);
|
||||||
count = kallsyms_symbol_complete(p_tmp,
|
buf_size = sizeof(tmpbuffer) - (p_tmp - tmpbuffer);
|
||||||
sizeof(tmpbuffer) -
|
count = kallsyms_symbol_complete(p_tmp, buf_size);
|
||||||
(p_tmp - tmpbuffer));
|
|
||||||
if (tab == 2 && count > 0) {
|
if (tab == 2 && count > 0) {
|
||||||
kdb_printf("\n%d symbols are found.", count);
|
kdb_printf("\n%d symbols are found.", count);
|
||||||
if (count > dtab_count) {
|
if (count > dtab_count) {
|
||||||
|
@ -357,9 +356,13 @@ poll_again:
|
||||||
}
|
}
|
||||||
kdb_printf("\n");
|
kdb_printf("\n");
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (WARN_ON(!kallsyms_symbol_next(p_tmp, i)))
|
ret = kallsyms_symbol_next(p_tmp, i, buf_size);
|
||||||
|
if (WARN_ON(!ret))
|
||||||
break;
|
break;
|
||||||
kdb_printf("%s ", p_tmp);
|
if (ret != -E2BIG)
|
||||||
|
kdb_printf("%s ", p_tmp);
|
||||||
|
else
|
||||||
|
kdb_printf("%s... ", p_tmp);
|
||||||
*(p_tmp + len) = '\0';
|
*(p_tmp + len) = '\0';
|
||||||
}
|
}
|
||||||
if (i >= dtab_count)
|
if (i >= dtab_count)
|
||||||
|
|
|
@ -83,7 +83,7 @@ typedef struct __ksymtab {
|
||||||
unsigned long sym_start;
|
unsigned long sym_start;
|
||||||
unsigned long sym_end;
|
unsigned long sym_end;
|
||||||
} kdb_symtab_t;
|
} kdb_symtab_t;
|
||||||
extern int kallsyms_symbol_next(char *prefix_name, int flag);
|
extern int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size);
|
||||||
extern int kallsyms_symbol_complete(char *prefix_name, int max_len);
|
extern int kallsyms_symbol_complete(char *prefix_name, int max_len);
|
||||||
|
|
||||||
/* Exported Symbols for kernel loadable modules to use. */
|
/* Exported Symbols for kernel loadable modules to use. */
|
||||||
|
|
|
@ -221,11 +221,13 @@ int kallsyms_symbol_complete(char *prefix_name, int max_len)
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* prefix_name prefix of a symbol name to lookup
|
* prefix_name prefix of a symbol name to lookup
|
||||||
* flag 0 means search from the head, 1 means continue search.
|
* flag 0 means search from the head, 1 means continue search.
|
||||||
|
* buf_size maximum length that can be written to prefix_name
|
||||||
|
* buffer
|
||||||
* Returns:
|
* Returns:
|
||||||
* 1 if a symbol matches the given prefix.
|
* 1 if a symbol matches the given prefix.
|
||||||
* 0 if no string found
|
* 0 if no string found
|
||||||
*/
|
*/
|
||||||
int kallsyms_symbol_next(char *prefix_name, int flag)
|
int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size)
|
||||||
{
|
{
|
||||||
int prefix_len = strlen(prefix_name);
|
int prefix_len = strlen(prefix_name);
|
||||||
static loff_t pos;
|
static loff_t pos;
|
||||||
|
@ -235,10 +237,8 @@ int kallsyms_symbol_next(char *prefix_name, int flag)
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
while ((name = kdb_walk_kallsyms(&pos))) {
|
while ((name = kdb_walk_kallsyms(&pos))) {
|
||||||
if (strncmp(name, prefix_name, prefix_len) == 0) {
|
if (!strncmp(name, prefix_name, prefix_len))
|
||||||
strncpy(prefix_name, name, strlen(name)+1);
|
return strscpy(prefix_name, name, buf_size);
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4184,8 +4184,8 @@ static int __sched_setscheduler(struct task_struct *p,
|
||||||
int queue_flags = DEQUEUE_SAVE | DEQUEUE_MOVE;
|
int queue_flags = DEQUEUE_SAVE | DEQUEUE_MOVE;
|
||||||
struct rq *rq;
|
struct rq *rq;
|
||||||
|
|
||||||
/* may grab non-irq protected spin_locks */
|
/* The pi code expects interrupts enabled */
|
||||||
BUG_ON(in_interrupt());
|
BUG_ON(pi && in_interrupt());
|
||||||
recheck:
|
recheck:
|
||||||
/* double check policy once rq lock held */
|
/* double check policy once rq lock held */
|
||||||
if (policy < 0) {
|
if (policy < 0) {
|
||||||
|
|
|
@ -1862,6 +1862,24 @@ static struct ctl_table fs_table[] = {
|
||||||
.extra1 = &zero,
|
.extra1 = &zero,
|
||||||
.extra2 = &one,
|
.extra2 = &one,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.procname = "protected_fifos",
|
||||||
|
.data = &sysctl_protected_fifos,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0600,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = &zero,
|
||||||
|
.extra2 = &two,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.procname = "protected_regular",
|
||||||
|
.data = &sysctl_protected_regular,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0600,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = &zero,
|
||||||
|
.extra2 = &two,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.procname = "suid_dumpable",
|
.procname = "suid_dumpable",
|
||||||
.data = &suid_dumpable,
|
.data = &suid_dumpable,
|
||||||
|
|
|
@ -2414,9 +2414,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
inode_lock(inode);
|
inode_lock(inode);
|
||||||
/* We're holding i_mutex so we can access i_size directly */
|
/* We're holding i_mutex so we can access i_size directly */
|
||||||
|
|
||||||
if (offset < 0)
|
if (offset < 0 || offset >= inode->i_size)
|
||||||
offset = -EINVAL;
|
|
||||||
else if (offset >= inode->i_size)
|
|
||||||
offset = -ENXIO;
|
offset = -ENXIO;
|
||||||
else {
|
else {
|
||||||
start = offset >> PAGE_SHIFT;
|
start = offset >> PAGE_SHIFT;
|
||||||
|
|
|
@ -3690,6 +3690,8 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, unsigned long caller)
|
||||||
struct kmem_cache *cachep;
|
struct kmem_cache *cachep;
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
|
if (unlikely(size > KMALLOC_MAX_CACHE_SIZE))
|
||||||
|
return NULL;
|
||||||
cachep = kmalloc_slab(size, flags);
|
cachep = kmalloc_slab(size, flags);
|
||||||
if (unlikely(ZERO_OR_NULL_PTR(cachep)))
|
if (unlikely(ZERO_OR_NULL_PTR(cachep)))
|
||||||
return cachep;
|
return cachep;
|
||||||
|
@ -3725,6 +3727,8 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
|
||||||
struct kmem_cache *cachep;
|
struct kmem_cache *cachep;
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
|
if (unlikely(size > KMALLOC_MAX_CACHE_SIZE))
|
||||||
|
return NULL;
|
||||||
cachep = kmalloc_slab(size, flags);
|
cachep = kmalloc_slab(size, flags);
|
||||||
if (unlikely(ZERO_OR_NULL_PTR(cachep)))
|
if (unlikely(ZERO_OR_NULL_PTR(cachep)))
|
||||||
return cachep;
|
return cachep;
|
||||||
|
|
|
@ -885,18 +885,18 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (unlikely(size > KMALLOC_MAX_SIZE)) {
|
|
||||||
WARN_ON_ONCE(!(flags & __GFP_NOWARN));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size <= 192) {
|
if (size <= 192) {
|
||||||
if (!size)
|
if (!size)
|
||||||
return ZERO_SIZE_PTR;
|
return ZERO_SIZE_PTR;
|
||||||
|
|
||||||
index = size_index[size_index_elem(size)];
|
index = size_index[size_index_elem(size)];
|
||||||
} else
|
} else {
|
||||||
|
if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) {
|
||||||
|
WARN_ON(1);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
index = fls(size - 1);
|
index = fls(size - 1);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_ZONE_DMA
|
#ifdef CONFIG_ZONE_DMA
|
||||||
if (unlikely((flags & GFP_DMA)))
|
if (unlikely((flags & GFP_DMA)))
|
||||||
|
|
|
@ -19,8 +19,8 @@ typedef unsigned __bitwise__ lowpan_rx_result;
|
||||||
struct frag_lowpan_compare_key {
|
struct frag_lowpan_compare_key {
|
||||||
u16 tag;
|
u16 tag;
|
||||||
u16 d_size;
|
u16 d_size;
|
||||||
const struct ieee802154_addr src;
|
struct ieee802154_addr src;
|
||||||
const struct ieee802154_addr dst;
|
struct ieee802154_addr dst;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Equivalent of ipv4 struct ipq
|
/* Equivalent of ipv4 struct ipq
|
||||||
|
|
|
@ -74,14 +74,14 @@ fq_find(struct net *net, const struct lowpan_802154_cb *cb,
|
||||||
{
|
{
|
||||||
struct netns_ieee802154_lowpan *ieee802154_lowpan =
|
struct netns_ieee802154_lowpan *ieee802154_lowpan =
|
||||||
net_ieee802154_lowpan(net);
|
net_ieee802154_lowpan(net);
|
||||||
struct frag_lowpan_compare_key key = {
|
struct frag_lowpan_compare_key key = {};
|
||||||
.tag = cb->d_tag,
|
|
||||||
.d_size = cb->d_size,
|
|
||||||
.src = *src,
|
|
||||||
.dst = *dst,
|
|
||||||
};
|
|
||||||
struct inet_frag_queue *q;
|
struct inet_frag_queue *q;
|
||||||
|
|
||||||
|
key.tag = cb->d_tag;
|
||||||
|
key.d_size = cb->d_size;
|
||||||
|
key.src = *src;
|
||||||
|
key.dst = *dst;
|
||||||
|
|
||||||
q = inet_frag_find(&ieee802154_lowpan->frags, &key);
|
q = inet_frag_find(&ieee802154_lowpan->frags, &key);
|
||||||
if (!q)
|
if (!q)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -371,7 +371,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type)
|
||||||
struct lowpan_frag_queue *fq;
|
struct lowpan_frag_queue *fq;
|
||||||
struct net *net = dev_net(skb->dev);
|
struct net *net = dev_net(skb->dev);
|
||||||
struct lowpan_802154_cb *cb = lowpan_802154_cb(skb);
|
struct lowpan_802154_cb *cb = lowpan_802154_cb(skb);
|
||||||
struct ieee802154_hdr hdr;
|
struct ieee802154_hdr hdr = {};
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
|
if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
|
||||||
|
|
|
@ -726,7 +726,6 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
|
||||||
struct sk_buff *skb = NULL;
|
struct sk_buff *skb = NULL;
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct llc_sock *llc = llc_sk(sk);
|
struct llc_sock *llc = llc_sk(sk);
|
||||||
unsigned long cpu_flags;
|
|
||||||
size_t copied = 0;
|
size_t copied = 0;
|
||||||
u32 peek_seq = 0;
|
u32 peek_seq = 0;
|
||||||
u32 *seq, skb_len;
|
u32 *seq, skb_len;
|
||||||
|
@ -851,9 +850,8 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
|
||||||
goto copy_uaddr;
|
goto copy_uaddr;
|
||||||
|
|
||||||
if (!(flags & MSG_PEEK)) {
|
if (!(flags & MSG_PEEK)) {
|
||||||
spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags);
|
skb_unlink(skb, &sk->sk_receive_queue);
|
||||||
sk_eat_skb(sk, skb);
|
kfree_skb(skb);
|
||||||
spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags);
|
|
||||||
*seq = 0;
|
*seq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,9 +872,8 @@ copy_uaddr:
|
||||||
llc_cmsg_rcv(msg, skb);
|
llc_cmsg_rcv(msg, skb);
|
||||||
|
|
||||||
if (!(flags & MSG_PEEK)) {
|
if (!(flags & MSG_PEEK)) {
|
||||||
spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags);
|
skb_unlink(skb, &sk->sk_receive_queue);
|
||||||
sk_eat_skb(sk, skb);
|
kfree_skb(skb);
|
||||||
spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags);
|
|
||||||
*seq = 0;
|
*seq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -488,8 +488,9 @@ void sctp_assoc_set_primary(struct sctp_association *asoc,
|
||||||
void sctp_assoc_rm_peer(struct sctp_association *asoc,
|
void sctp_assoc_rm_peer(struct sctp_association *asoc,
|
||||||
struct sctp_transport *peer)
|
struct sctp_transport *peer)
|
||||||
{
|
{
|
||||||
struct list_head *pos;
|
struct sctp_transport *transport;
|
||||||
struct sctp_transport *transport;
|
struct list_head *pos;
|
||||||
|
struct sctp_chunk *ch;
|
||||||
|
|
||||||
pr_debug("%s: association:%p addr:%pISpc\n",
|
pr_debug("%s: association:%p addr:%pISpc\n",
|
||||||
__func__, asoc, &peer->ipaddr.sa);
|
__func__, asoc, &peer->ipaddr.sa);
|
||||||
|
@ -547,7 +548,6 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
|
||||||
*/
|
*/
|
||||||
if (!list_empty(&peer->transmitted)) {
|
if (!list_empty(&peer->transmitted)) {
|
||||||
struct sctp_transport *active = asoc->peer.active_path;
|
struct sctp_transport *active = asoc->peer.active_path;
|
||||||
struct sctp_chunk *ch;
|
|
||||||
|
|
||||||
/* Reset the transport of each chunk on this list */
|
/* Reset the transport of each chunk on this list */
|
||||||
list_for_each_entry(ch, &peer->transmitted,
|
list_for_each_entry(ch, &peer->transmitted,
|
||||||
|
@ -569,6 +569,10 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
|
||||||
sctp_transport_hold(active);
|
sctp_transport_hold(active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_for_each_entry(ch, &asoc->outqueue.out_chunk_list, list)
|
||||||
|
if (ch->transport == peer)
|
||||||
|
ch->transport = NULL;
|
||||||
|
|
||||||
asoc->peer.transport_count--;
|
asoc->peer.transport_count--;
|
||||||
|
|
||||||
sctp_transport_free(peer);
|
sctp_transport_free(peer);
|
||||||
|
|
|
@ -281,13 +281,7 @@ static bool generic_key_to_expire(struct rpc_cred *cred)
|
||||||
{
|
{
|
||||||
struct auth_cred *acred = &container_of(cred, struct generic_cred,
|
struct auth_cred *acred = &container_of(cred, struct generic_cred,
|
||||||
gc_base)->acred;
|
gc_base)->acred;
|
||||||
bool ret;
|
return test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags);
|
||||||
|
|
||||||
get_rpccred(cred);
|
|
||||||
ret = test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags);
|
|
||||||
put_rpccred(cred);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct rpc_credops generic_credops = {
|
static const struct rpc_credops generic_credops = {
|
||||||
|
|
|
@ -48,7 +48,7 @@ int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name,
|
||||||
size_t req_xattr_value_len, char *digest);
|
size_t req_xattr_value_len, char *digest);
|
||||||
int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
|
int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
|
||||||
const char *req_xattr_value,
|
const char *req_xattr_value,
|
||||||
size_t req_xattr_value_len, char *digest);
|
size_t req_xattr_value_len, char type, char *digest);
|
||||||
int evm_init_hmac(struct inode *inode, const struct xattr *xattr,
|
int evm_init_hmac(struct inode *inode, const struct xattr *xattr,
|
||||||
char *hmac_val);
|
char *hmac_val);
|
||||||
int evm_init_secfs(void);
|
int evm_init_secfs(void);
|
||||||
|
|
|
@ -139,7 +139,7 @@ out:
|
||||||
* protection.)
|
* protection.)
|
||||||
*/
|
*/
|
||||||
static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
|
static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
|
||||||
char *digest)
|
char type, char *digest)
|
||||||
{
|
{
|
||||||
struct h_misc {
|
struct h_misc {
|
||||||
unsigned long ino;
|
unsigned long ino;
|
||||||
|
@ -150,13 +150,27 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
|
||||||
} hmac_misc;
|
} hmac_misc;
|
||||||
|
|
||||||
memset(&hmac_misc, 0, sizeof(hmac_misc));
|
memset(&hmac_misc, 0, sizeof(hmac_misc));
|
||||||
hmac_misc.ino = inode->i_ino;
|
/* Don't include the inode or generation number in portable
|
||||||
hmac_misc.generation = inode->i_generation;
|
* signatures
|
||||||
hmac_misc.uid = from_kuid(inode->i_sb->s_user_ns, inode->i_uid);
|
*/
|
||||||
hmac_misc.gid = from_kgid(inode->i_sb->s_user_ns, inode->i_gid);
|
if (type != EVM_XATTR_PORTABLE_DIGSIG) {
|
||||||
|
hmac_misc.ino = inode->i_ino;
|
||||||
|
hmac_misc.generation = inode->i_generation;
|
||||||
|
}
|
||||||
|
/* The hmac uid and gid must be encoded in the initial user
|
||||||
|
* namespace (not the filesystems user namespace) as encoding
|
||||||
|
* them in the filesystems user namespace allows an attack
|
||||||
|
* where first they are written in an unprivileged fuse mount
|
||||||
|
* of a filesystem and then the system is tricked to mount the
|
||||||
|
* filesystem for real on next boot and trust it because
|
||||||
|
* everything is signed.
|
||||||
|
*/
|
||||||
|
hmac_misc.uid = from_kuid(&init_user_ns, inode->i_uid);
|
||||||
|
hmac_misc.gid = from_kgid(&init_user_ns, inode->i_gid);
|
||||||
hmac_misc.mode = inode->i_mode;
|
hmac_misc.mode = inode->i_mode;
|
||||||
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
|
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
|
||||||
if (evm_hmac_attrs & EVM_ATTR_FSUUID)
|
if ((evm_hmac_attrs & EVM_ATTR_FSUUID) &&
|
||||||
|
type != EVM_XATTR_PORTABLE_DIGSIG)
|
||||||
crypto_shash_update(desc, inode->i_sb->s_uuid,
|
crypto_shash_update(desc, inode->i_sb->s_uuid,
|
||||||
sizeof(inode->i_sb->s_uuid));
|
sizeof(inode->i_sb->s_uuid));
|
||||||
crypto_shash_final(desc, digest);
|
crypto_shash_final(desc, digest);
|
||||||
|
@ -182,6 +196,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
|
||||||
char *xattr_value = NULL;
|
char *xattr_value = NULL;
|
||||||
int error;
|
int error;
|
||||||
int size;
|
int size;
|
||||||
|
bool ima_present = false;
|
||||||
|
|
||||||
if (!(inode->i_opflags & IOP_XATTR))
|
if (!(inode->i_opflags & IOP_XATTR))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
@ -192,11 +207,18 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
|
||||||
|
|
||||||
error = -ENODATA;
|
error = -ENODATA;
|
||||||
for (xattrname = evm_config_xattrnames; *xattrname != NULL; xattrname++) {
|
for (xattrname = evm_config_xattrnames; *xattrname != NULL; xattrname++) {
|
||||||
|
bool is_ima = false;
|
||||||
|
|
||||||
|
if (strcmp(*xattrname, XATTR_NAME_IMA) == 0)
|
||||||
|
is_ima = true;
|
||||||
|
|
||||||
if ((req_xattr_name && req_xattr_value)
|
if ((req_xattr_name && req_xattr_value)
|
||||||
&& !strcmp(*xattrname, req_xattr_name)) {
|
&& !strcmp(*xattrname, req_xattr_name)) {
|
||||||
error = 0;
|
error = 0;
|
||||||
crypto_shash_update(desc, (const u8 *)req_xattr_value,
|
crypto_shash_update(desc, (const u8 *)req_xattr_value,
|
||||||
req_xattr_value_len);
|
req_xattr_value_len);
|
||||||
|
if (is_ima)
|
||||||
|
ima_present = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
size = vfs_getxattr_alloc(dentry, *xattrname,
|
size = vfs_getxattr_alloc(dentry, *xattrname,
|
||||||
|
@ -211,9 +233,14 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
|
||||||
error = 0;
|
error = 0;
|
||||||
xattr_size = size;
|
xattr_size = size;
|
||||||
crypto_shash_update(desc, (const u8 *)xattr_value, xattr_size);
|
crypto_shash_update(desc, (const u8 *)xattr_value, xattr_size);
|
||||||
|
if (is_ima)
|
||||||
|
ima_present = true;
|
||||||
}
|
}
|
||||||
hmac_add_misc(desc, inode, digest);
|
hmac_add_misc(desc, inode, type, digest);
|
||||||
|
|
||||||
|
/* Portable EVM signatures must include an IMA hash */
|
||||||
|
if (type == EVM_XATTR_PORTABLE_DIGSIG && !ima_present)
|
||||||
|
return -EPERM;
|
||||||
out:
|
out:
|
||||||
kfree(xattr_value);
|
kfree(xattr_value);
|
||||||
kfree(desc);
|
kfree(desc);
|
||||||
|
@ -225,17 +252,45 @@ int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name,
|
||||||
char *digest)
|
char *digest)
|
||||||
{
|
{
|
||||||
return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value,
|
return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value,
|
||||||
req_xattr_value_len, EVM_XATTR_HMAC, digest);
|
req_xattr_value_len, EVM_XATTR_HMAC, digest);
|
||||||
}
|
}
|
||||||
|
|
||||||
int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
|
int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
|
||||||
const char *req_xattr_value, size_t req_xattr_value_len,
|
const char *req_xattr_value, size_t req_xattr_value_len,
|
||||||
char *digest)
|
char type, char *digest)
|
||||||
{
|
{
|
||||||
return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value,
|
return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value,
|
||||||
req_xattr_value_len, IMA_XATTR_DIGEST, digest);
|
req_xattr_value_len, type, digest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int evm_is_immutable(struct dentry *dentry, struct inode *inode)
|
||||||
|
{
|
||||||
|
const struct evm_ima_xattr_data *xattr_data = NULL;
|
||||||
|
struct integrity_iint_cache *iint;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
iint = integrity_iint_find(inode);
|
||||||
|
if (iint && (iint->flags & EVM_IMMUTABLE_DIGSIG))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Do this the hard way */
|
||||||
|
rc = vfs_getxattr_alloc(dentry, XATTR_NAME_EVM, (char **)&xattr_data, 0,
|
||||||
|
GFP_NOFS);
|
||||||
|
if (rc <= 0) {
|
||||||
|
if (rc == -ENODATA)
|
||||||
|
return 0;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
if (xattr_data->type == EVM_XATTR_PORTABLE_DIGSIG)
|
||||||
|
rc = 1;
|
||||||
|
else
|
||||||
|
rc = 0;
|
||||||
|
|
||||||
|
kfree(xattr_data);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate the hmac and update security.evm xattr
|
* Calculate the hmac and update security.evm xattr
|
||||||
*
|
*
|
||||||
|
@ -248,6 +303,16 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name,
|
||||||
struct evm_ima_xattr_data xattr_data;
|
struct evm_ima_xattr_data xattr_data;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Don't permit any transformation of the EVM xattr if the signature
|
||||||
|
* is of an immutable type
|
||||||
|
*/
|
||||||
|
rc = evm_is_immutable(dentry, inode);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
if (rc)
|
||||||
|
return -EPERM;
|
||||||
|
|
||||||
rc = evm_calc_hmac(dentry, xattr_name, xattr_value,
|
rc = evm_calc_hmac(dentry, xattr_name, xattr_value,
|
||||||
xattr_value_len, xattr_data.digest);
|
xattr_value_len, xattr_data.digest);
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
|
@ -273,7 +338,7 @@ int evm_init_hmac(struct inode *inode, const struct xattr *lsm_xattr,
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto_shash_update(desc, lsm_xattr->value, lsm_xattr->value_len);
|
crypto_shash_update(desc, lsm_xattr->value, lsm_xattr->value_len);
|
||||||
hmac_add_misc(desc, inode, hmac_val);
|
hmac_add_misc(desc, inode, EVM_XATTR_HMAC, hmac_val);
|
||||||
kfree(desc);
|
kfree(desc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
int evm_initialized;
|
int evm_initialized;
|
||||||
|
|
||||||
static char *integrity_status_msg[] = {
|
static char *integrity_status_msg[] = {
|
||||||
"pass", "fail", "no_label", "no_xattrs", "unknown"
|
"pass", "pass_immutable", "fail", "no_label", "no_xattrs", "unknown"
|
||||||
};
|
};
|
||||||
char *evm_hmac = "hmac(sha1)";
|
char *evm_hmac = "hmac(sha1)";
|
||||||
char *evm_hash = "sha1";
|
char *evm_hash = "sha1";
|
||||||
|
@ -118,7 +118,8 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
|
||||||
enum integrity_status evm_status = INTEGRITY_PASS;
|
enum integrity_status evm_status = INTEGRITY_PASS;
|
||||||
int rc, xattr_len;
|
int rc, xattr_len;
|
||||||
|
|
||||||
if (iint && iint->evm_status == INTEGRITY_PASS)
|
if (iint && (iint->evm_status == INTEGRITY_PASS ||
|
||||||
|
iint->evm_status == INTEGRITY_PASS_IMMUTABLE))
|
||||||
return iint->evm_status;
|
return iint->evm_status;
|
||||||
|
|
||||||
/* if status is not PASS, try to check again - against -ENOMEM */
|
/* if status is not PASS, try to check again - against -ENOMEM */
|
||||||
|
@ -155,22 +156,26 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
break;
|
break;
|
||||||
case EVM_IMA_XATTR_DIGSIG:
|
case EVM_IMA_XATTR_DIGSIG:
|
||||||
|
case EVM_XATTR_PORTABLE_DIGSIG:
|
||||||
rc = evm_calc_hash(dentry, xattr_name, xattr_value,
|
rc = evm_calc_hash(dentry, xattr_name, xattr_value,
|
||||||
xattr_value_len, calc.digest);
|
xattr_value_len, xattr_data->type,
|
||||||
|
calc.digest);
|
||||||
if (rc)
|
if (rc)
|
||||||
break;
|
break;
|
||||||
rc = integrity_digsig_verify(INTEGRITY_KEYRING_EVM,
|
rc = integrity_digsig_verify(INTEGRITY_KEYRING_EVM,
|
||||||
(const char *)xattr_data, xattr_len,
|
(const char *)xattr_data, xattr_len,
|
||||||
calc.digest, sizeof(calc.digest));
|
calc.digest, sizeof(calc.digest));
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
/* Replace RSA with HMAC if not mounted readonly and
|
if (xattr_data->type == EVM_XATTR_PORTABLE_DIGSIG) {
|
||||||
* not immutable
|
if (iint)
|
||||||
*/
|
iint->flags |= EVM_IMMUTABLE_DIGSIG;
|
||||||
if (!IS_RDONLY(d_backing_inode(dentry)) &&
|
evm_status = INTEGRITY_PASS_IMMUTABLE;
|
||||||
!IS_IMMUTABLE(d_backing_inode(dentry)))
|
} else if (!IS_RDONLY(d_backing_inode(dentry)) &&
|
||||||
|
!IS_IMMUTABLE(d_backing_inode(dentry))) {
|
||||||
evm_update_evmxattr(dentry, xattr_name,
|
evm_update_evmxattr(dentry, xattr_name,
|
||||||
xattr_value,
|
xattr_value,
|
||||||
xattr_value_len);
|
xattr_value_len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -271,7 +276,7 @@ static enum integrity_status evm_verify_current_integrity(struct dentry *dentry)
|
||||||
* affect security.evm. An interesting side affect of writing posix xattr
|
* affect security.evm. An interesting side affect of writing posix xattr
|
||||||
* acls is their modifying of the i_mode, which is included in security.evm.
|
* acls is their modifying of the i_mode, which is included in security.evm.
|
||||||
* For posix xattr acls only, permit security.evm, even if it currently
|
* For posix xattr acls only, permit security.evm, even if it currently
|
||||||
* doesn't exist, to be updated.
|
* doesn't exist, to be updated unless the EVM signature is immutable.
|
||||||
*/
|
*/
|
||||||
static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name,
|
static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name,
|
||||||
const void *xattr_value, size_t xattr_value_len)
|
const void *xattr_value, size_t xattr_value_len)
|
||||||
|
@ -339,7 +344,8 @@ int evm_inode_setxattr(struct dentry *dentry, const char *xattr_name,
|
||||||
if (strcmp(xattr_name, XATTR_NAME_EVM) == 0) {
|
if (strcmp(xattr_name, XATTR_NAME_EVM) == 0) {
|
||||||
if (!xattr_value_len)
|
if (!xattr_value_len)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (xattr_data->type != EVM_IMA_XATTR_DIGSIG)
|
if (xattr_data->type != EVM_IMA_XATTR_DIGSIG &&
|
||||||
|
xattr_data->type != EVM_XATTR_PORTABLE_DIGSIG)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
return evm_protect_xattr(dentry, xattr_name, xattr_value,
|
return evm_protect_xattr(dentry, xattr_name, xattr_value,
|
||||||
|
@ -416,6 +422,9 @@ void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name)
|
||||||
/**
|
/**
|
||||||
* evm_inode_setattr - prevent updating an invalid EVM extended attribute
|
* evm_inode_setattr - prevent updating an invalid EVM extended attribute
|
||||||
* @dentry: pointer to the affected dentry
|
* @dentry: pointer to the affected dentry
|
||||||
|
*
|
||||||
|
* Permit update of file attributes when files have a valid EVM signature,
|
||||||
|
* except in the case of them having an immutable portable signature.
|
||||||
*/
|
*/
|
||||||
int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
|
int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,7 @@ static void iint_free(struct integrity_iint_cache *iint)
|
||||||
iint->ima_hash = NULL;
|
iint->ima_hash = NULL;
|
||||||
iint->version = 0;
|
iint->version = 0;
|
||||||
iint->flags = 0UL;
|
iint->flags = 0UL;
|
||||||
|
iint->atomic_flags = 0UL;
|
||||||
iint->ima_file_status = INTEGRITY_UNKNOWN;
|
iint->ima_file_status = INTEGRITY_UNKNOWN;
|
||||||
iint->ima_mmap_status = INTEGRITY_UNKNOWN;
|
iint->ima_mmap_status = INTEGRITY_UNKNOWN;
|
||||||
iint->ima_bprm_status = INTEGRITY_UNKNOWN;
|
iint->ima_bprm_status = INTEGRITY_UNKNOWN;
|
||||||
|
@ -155,12 +156,14 @@ static void init_once(void *foo)
|
||||||
memset(iint, 0, sizeof(*iint));
|
memset(iint, 0, sizeof(*iint));
|
||||||
iint->version = 0;
|
iint->version = 0;
|
||||||
iint->flags = 0UL;
|
iint->flags = 0UL;
|
||||||
|
iint->atomic_flags = 0;
|
||||||
iint->ima_file_status = INTEGRITY_UNKNOWN;
|
iint->ima_file_status = INTEGRITY_UNKNOWN;
|
||||||
iint->ima_mmap_status = INTEGRITY_UNKNOWN;
|
iint->ima_mmap_status = INTEGRITY_UNKNOWN;
|
||||||
iint->ima_bprm_status = INTEGRITY_UNKNOWN;
|
iint->ima_bprm_status = INTEGRITY_UNKNOWN;
|
||||||
iint->ima_read_status = INTEGRITY_UNKNOWN;
|
iint->ima_read_status = INTEGRITY_UNKNOWN;
|
||||||
iint->evm_status = INTEGRITY_UNKNOWN;
|
iint->evm_status = INTEGRITY_UNKNOWN;
|
||||||
iint->measured_pcrs = 0;
|
iint->measured_pcrs = 0;
|
||||||
|
mutex_init(&iint->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init integrity_iintcache_init(void)
|
static int __init integrity_iintcache_init(void)
|
||||||
|
|
|
@ -198,42 +198,59 @@ int ima_collect_measurement(struct integrity_iint_cache *iint,
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
const char *filename = file->f_path.dentry->d_name.name;
|
const char *filename = file->f_path.dentry->d_name.name;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
int length;
|
||||||
|
void *tmpbuf;
|
||||||
|
u64 i_version;
|
||||||
struct {
|
struct {
|
||||||
struct ima_digest_data hdr;
|
struct ima_digest_data hdr;
|
||||||
char digest[IMA_MAX_DIGEST_SIZE];
|
char digest[IMA_MAX_DIGEST_SIZE];
|
||||||
} hash;
|
} hash;
|
||||||
|
|
||||||
if (!(iint->flags & IMA_COLLECTED)) {
|
if (iint->flags & IMA_COLLECTED)
|
||||||
u64 i_version = file_inode(file)->i_version;
|
goto out;
|
||||||
|
|
||||||
if (file->f_flags & O_DIRECT) {
|
/*
|
||||||
audit_cause = "failed(directio)";
|
* Dectecting file change is based on i_version. On filesystems
|
||||||
result = -EACCES;
|
* which do not support i_version, support is limited to an initial
|
||||||
goto out;
|
* measurement/appraisal/audit.
|
||||||
}
|
*/
|
||||||
|
i_version = file_inode(file)->i_version;
|
||||||
|
hash.hdr.algo = algo;
|
||||||
|
|
||||||
hash.hdr.algo = algo;
|
/* Initialize hash digest to 0's in case of failure */
|
||||||
|
memset(&hash.digest, 0, sizeof(hash.digest));
|
||||||
|
|
||||||
result = (!buf) ? ima_calc_file_hash(file, &hash.hdr) :
|
if (buf)
|
||||||
ima_calc_buffer_hash(buf, size, &hash.hdr);
|
result = ima_calc_buffer_hash(buf, size, &hash.hdr);
|
||||||
if (!result) {
|
else
|
||||||
int length = sizeof(hash.hdr) + hash.hdr.length;
|
result = ima_calc_file_hash(file, &hash.hdr);
|
||||||
void *tmpbuf = krealloc(iint->ima_hash, length,
|
|
||||||
GFP_NOFS);
|
if (result && result != -EBADF && result != -EINVAL)
|
||||||
if (tmpbuf) {
|
goto out;
|
||||||
iint->ima_hash = tmpbuf;
|
|
||||||
memcpy(iint->ima_hash, &hash, length);
|
length = sizeof(hash.hdr) + hash.hdr.length;
|
||||||
iint->version = i_version;
|
tmpbuf = krealloc(iint->ima_hash, length, GFP_NOFS);
|
||||||
iint->flags |= IMA_COLLECTED;
|
if (!tmpbuf) {
|
||||||
} else
|
result = -ENOMEM;
|
||||||
result = -ENOMEM;
|
goto out;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iint->ima_hash = tmpbuf;
|
||||||
|
memcpy(iint->ima_hash, &hash, length);
|
||||||
|
iint->version = i_version;
|
||||||
|
|
||||||
|
/* Possibly temporary failure due to type of read (eg. O_DIRECT) */
|
||||||
|
if (!result)
|
||||||
|
iint->flags |= IMA_COLLECTED;
|
||||||
out:
|
out:
|
||||||
if (result)
|
if (result) {
|
||||||
|
if (file->f_flags & O_DIRECT)
|
||||||
|
audit_cause = "failed(directio)";
|
||||||
|
|
||||||
integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode,
|
integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode,
|
||||||
filename, "collect_data", audit_cause,
|
filename, "collect_data", audit_cause,
|
||||||
result, 0);
|
result, 0);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +294,7 @@ void ima_store_measurement(struct integrity_iint_cache *iint,
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ima_store_template(entry, violation, inode, filename, pcr);
|
result = ima_store_template(entry, violation, inode, filename, pcr);
|
||||||
if (!result || result == -EEXIST) {
|
if ((!result || result == -EEXIST) && !(file->f_flags & O_DIRECT)) {
|
||||||
iint->flags |= IMA_MEASURED;
|
iint->flags |= IMA_MEASURED;
|
||||||
iint->measured_pcrs |= (0x1 << pcr);
|
iint->measured_pcrs |= (0x1 << pcr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,9 @@ int ima_appraise_measurement(enum ima_hooks func,
|
||||||
}
|
}
|
||||||
|
|
||||||
status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint);
|
status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint);
|
||||||
if ((status != INTEGRITY_PASS) && (status != INTEGRITY_UNKNOWN)) {
|
if ((status != INTEGRITY_PASS) &&
|
||||||
|
(status != INTEGRITY_PASS_IMMUTABLE) &&
|
||||||
|
(status != INTEGRITY_UNKNOWN)) {
|
||||||
if ((status == INTEGRITY_NOLABEL)
|
if ((status == INTEGRITY_NOLABEL)
|
||||||
|| (status == INTEGRITY_NOXATTRS))
|
|| (status == INTEGRITY_NOXATTRS))
|
||||||
cause = "missing-HMAC";
|
cause = "missing-HMAC";
|
||||||
|
@ -232,6 +234,7 @@ int ima_appraise_measurement(enum ima_hooks func,
|
||||||
status = INTEGRITY_FAIL;
|
status = INTEGRITY_FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
clear_bit(IMA_DIGSIG, &iint->atomic_flags);
|
||||||
if (xattr_len - sizeof(xattr_value->type) - hash_start >=
|
if (xattr_len - sizeof(xattr_value->type) - hash_start >=
|
||||||
iint->ima_hash->length)
|
iint->ima_hash->length)
|
||||||
/* xattr length may be longer. md5 hash in previous
|
/* xattr length may be longer. md5 hash in previous
|
||||||
|
@ -250,7 +253,7 @@ int ima_appraise_measurement(enum ima_hooks func,
|
||||||
status = INTEGRITY_PASS;
|
status = INTEGRITY_PASS;
|
||||||
break;
|
break;
|
||||||
case EVM_IMA_XATTR_DIGSIG:
|
case EVM_IMA_XATTR_DIGSIG:
|
||||||
iint->flags |= IMA_DIGSIG;
|
set_bit(IMA_DIGSIG, &iint->atomic_flags);
|
||||||
rc = integrity_digsig_verify(INTEGRITY_KEYRING_IMA,
|
rc = integrity_digsig_verify(INTEGRITY_KEYRING_IMA,
|
||||||
(const char *)xattr_value, rc,
|
(const char *)xattr_value, rc,
|
||||||
iint->ima_hash->digest,
|
iint->ima_hash->digest,
|
||||||
|
@ -301,7 +304,7 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
/* do not collect and update hash for digital signatures */
|
/* do not collect and update hash for digital signatures */
|
||||||
if (iint->flags & IMA_DIGSIG)
|
if (test_bit(IMA_DIGSIG, &iint->atomic_flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (iint->ima_file_status != INTEGRITY_PASS)
|
if (iint->ima_file_status != INTEGRITY_PASS)
|
||||||
|
@ -311,7 +314,9 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
inode_lock(file_inode(file));
|
||||||
ima_fix_xattr(dentry, iint);
|
ima_fix_xattr(dentry, iint);
|
||||||
|
inode_unlock(file_inode(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -334,16 +339,14 @@ void ima_inode_post_setattr(struct dentry *dentry)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
must_appraise = ima_must_appraise(inode, MAY_ACCESS, POST_SETATTR);
|
must_appraise = ima_must_appraise(inode, MAY_ACCESS, POST_SETATTR);
|
||||||
iint = integrity_iint_find(inode);
|
|
||||||
if (iint) {
|
|
||||||
iint->flags &= ~(IMA_APPRAISE | IMA_APPRAISED |
|
|
||||||
IMA_APPRAISE_SUBMASK | IMA_APPRAISED_SUBMASK |
|
|
||||||
IMA_ACTION_RULE_FLAGS);
|
|
||||||
if (must_appraise)
|
|
||||||
iint->flags |= IMA_APPRAISE;
|
|
||||||
}
|
|
||||||
if (!must_appraise)
|
if (!must_appraise)
|
||||||
__vfs_removexattr(dentry, XATTR_NAME_IMA);
|
__vfs_removexattr(dentry, XATTR_NAME_IMA);
|
||||||
|
iint = integrity_iint_find(inode);
|
||||||
|
if (iint) {
|
||||||
|
set_bit(IMA_CHANGE_ATTR, &iint->atomic_flags);
|
||||||
|
if (!must_appraise)
|
||||||
|
clear_bit(IMA_UPDATE_XATTR, &iint->atomic_flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -372,12 +375,12 @@ static void ima_reset_appraise_flags(struct inode *inode, int digsig)
|
||||||
iint = integrity_iint_find(inode);
|
iint = integrity_iint_find(inode);
|
||||||
if (!iint)
|
if (!iint)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iint->flags &= ~IMA_DONE_MASK;
|
|
||||||
iint->measured_pcrs = 0;
|
iint->measured_pcrs = 0;
|
||||||
|
set_bit(IMA_CHANGE_XATTR, &iint->atomic_flags);
|
||||||
if (digsig)
|
if (digsig)
|
||||||
iint->flags |= IMA_DIGSIG;
|
set_bit(IMA_DIGSIG, &iint->atomic_flags);
|
||||||
return;
|
else
|
||||||
|
clear_bit(IMA_DIGSIG, &iint->atomic_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
|
int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
|
||||||
|
|
|
@ -443,6 +443,16 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
|
||||||
loff_t i_size;
|
loff_t i_size;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For consistency, fail file's opened with the O_DIRECT flag on
|
||||||
|
* filesystems mounted with/without DAX option.
|
||||||
|
*/
|
||||||
|
if (file->f_flags & O_DIRECT) {
|
||||||
|
hash->length = hash_digest_size[ima_hash_algo];
|
||||||
|
hash->algo = ima_hash_algo;
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
i_size = i_size_read(file_inode(file));
|
i_size = i_size_read(file_inode(file));
|
||||||
|
|
||||||
if (ima_ahash_minsize && i_size >= ima_ahash_minsize) {
|
if (ima_ahash_minsize && i_size >= ima_ahash_minsize) {
|
||||||
|
|
|
@ -99,10 +99,13 @@ static void ima_rdwr_violation_check(struct file *file,
|
||||||
if (!iint)
|
if (!iint)
|
||||||
iint = integrity_iint_find(inode);
|
iint = integrity_iint_find(inode);
|
||||||
/* IMA_MEASURE is set from reader side */
|
/* IMA_MEASURE is set from reader side */
|
||||||
if (iint && (iint->flags & IMA_MEASURE))
|
if (iint && test_bit(IMA_MUST_MEASURE,
|
||||||
|
&iint->atomic_flags))
|
||||||
send_tomtou = true;
|
send_tomtou = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (must_measure)
|
||||||
|
set_bit(IMA_MUST_MEASURE, &iint->atomic_flags);
|
||||||
if ((atomic_read(&inode->i_writecount) > 0) && must_measure)
|
if ((atomic_read(&inode->i_writecount) > 0) && must_measure)
|
||||||
send_writers = true;
|
send_writers = true;
|
||||||
}
|
}
|
||||||
|
@ -124,21 +127,24 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint,
|
||||||
struct inode *inode, struct file *file)
|
struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
fmode_t mode = file->f_mode;
|
fmode_t mode = file->f_mode;
|
||||||
|
bool update;
|
||||||
|
|
||||||
if (!(mode & FMODE_WRITE))
|
if (!(mode & FMODE_WRITE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inode_lock(inode);
|
mutex_lock(&iint->mutex);
|
||||||
if (atomic_read(&inode->i_writecount) == 1) {
|
if (atomic_read(&inode->i_writecount) == 1) {
|
||||||
|
update = test_and_clear_bit(IMA_UPDATE_XATTR,
|
||||||
|
&iint->atomic_flags);
|
||||||
if ((iint->version != inode->i_version) ||
|
if ((iint->version != inode->i_version) ||
|
||||||
(iint->flags & IMA_NEW_FILE)) {
|
(iint->flags & IMA_NEW_FILE)) {
|
||||||
iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE);
|
iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE);
|
||||||
iint->measured_pcrs = 0;
|
iint->measured_pcrs = 0;
|
||||||
if (iint->flags & IMA_APPRAISE)
|
if (update)
|
||||||
ima_update_xattr(iint, file);
|
ima_update_xattr(iint, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inode_unlock(inode);
|
mutex_unlock(&iint->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,7 +177,7 @@ static int process_measurement(struct file *file, char *buf, loff_t size,
|
||||||
char *pathbuf = NULL;
|
char *pathbuf = NULL;
|
||||||
char filename[NAME_MAX];
|
char filename[NAME_MAX];
|
||||||
const char *pathname = NULL;
|
const char *pathname = NULL;
|
||||||
int rc = -ENOMEM, action, must_appraise;
|
int rc = 0, action, must_appraise = 0;
|
||||||
int pcr = CONFIG_IMA_MEASURE_PCR_IDX;
|
int pcr = CONFIG_IMA_MEASURE_PCR_IDX;
|
||||||
struct evm_ima_xattr_data *xattr_value = NULL;
|
struct evm_ima_xattr_data *xattr_value = NULL;
|
||||||
int xattr_len = 0;
|
int xattr_len = 0;
|
||||||
|
@ -202,17 +208,31 @@ static int process_measurement(struct file *file, char *buf, loff_t size,
|
||||||
if (action) {
|
if (action) {
|
||||||
iint = integrity_inode_get(inode);
|
iint = integrity_inode_get(inode);
|
||||||
if (!iint)
|
if (!iint)
|
||||||
goto out;
|
rc = -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (violation_check) {
|
if (!rc && violation_check)
|
||||||
ima_rdwr_violation_check(file, iint, action & IMA_MEASURE,
|
ima_rdwr_violation_check(file, iint, action & IMA_MEASURE,
|
||||||
&pathbuf, &pathname);
|
&pathbuf, &pathname);
|
||||||
if (!action) {
|
|
||||||
rc = 0;
|
inode_unlock(inode);
|
||||||
goto out_free;
|
|
||||||
}
|
if (rc)
|
||||||
}
|
goto out;
|
||||||
|
if (!action)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
mutex_lock(&iint->mutex);
|
||||||
|
|
||||||
|
if (test_and_clear_bit(IMA_CHANGE_ATTR, &iint->atomic_flags))
|
||||||
|
/* reset appraisal flags if ima_inode_post_setattr was called */
|
||||||
|
iint->flags &= ~(IMA_APPRAISE | IMA_APPRAISED |
|
||||||
|
IMA_APPRAISE_SUBMASK | IMA_APPRAISED_SUBMASK |
|
||||||
|
IMA_ACTION_FLAGS);
|
||||||
|
|
||||||
|
if (test_and_clear_bit(IMA_CHANGE_XATTR, &iint->atomic_flags))
|
||||||
|
/* reset all flags if ima_inode_setxattr was called */
|
||||||
|
iint->flags &= ~IMA_DONE_MASK;
|
||||||
|
|
||||||
/* Determine if already appraised/measured based on bitmask
|
/* Determine if already appraised/measured based on bitmask
|
||||||
* (IMA_MEASURE, IMA_MEASURED, IMA_XXXX_APPRAISE, IMA_XXXX_APPRAISED,
|
* (IMA_MEASURE, IMA_MEASURED, IMA_XXXX_APPRAISE, IMA_XXXX_APPRAISED,
|
||||||
|
@ -230,7 +250,7 @@ static int process_measurement(struct file *file, char *buf, loff_t size,
|
||||||
if (!action) {
|
if (!action) {
|
||||||
if (must_appraise)
|
if (must_appraise)
|
||||||
rc = ima_get_cache_status(iint, func);
|
rc = ima_get_cache_status(iint, func);
|
||||||
goto out_digsig;
|
goto out_locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
template_desc = ima_template_desc_current();
|
template_desc = ima_template_desc_current();
|
||||||
|
@ -242,11 +262,8 @@ static int process_measurement(struct file *file, char *buf, loff_t size,
|
||||||
hash_algo = ima_get_hash_algo(xattr_value, xattr_len);
|
hash_algo = ima_get_hash_algo(xattr_value, xattr_len);
|
||||||
|
|
||||||
rc = ima_collect_measurement(iint, file, buf, size, hash_algo);
|
rc = ima_collect_measurement(iint, file, buf, size, hash_algo);
|
||||||
if (rc != 0) {
|
if (rc != 0 && rc != -EBADF && rc != -EINVAL)
|
||||||
if (file->f_flags & O_DIRECT)
|
goto out_locked;
|
||||||
rc = (iint->flags & IMA_PERMIT_DIRECTIO) ? 0 : -EACCES;
|
|
||||||
goto out_digsig;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pathbuf) /* ima_rdwr_violation possibly pre-fetched */
|
if (!pathbuf) /* ima_rdwr_violation possibly pre-fetched */
|
||||||
pathname = ima_d_path(&file->f_path, &pathbuf, filename);
|
pathname = ima_d_path(&file->f_path, &pathbuf, filename);
|
||||||
|
@ -254,24 +271,32 @@ static int process_measurement(struct file *file, char *buf, loff_t size,
|
||||||
if (action & IMA_MEASURE)
|
if (action & IMA_MEASURE)
|
||||||
ima_store_measurement(iint, file, pathname,
|
ima_store_measurement(iint, file, pathname,
|
||||||
xattr_value, xattr_len, pcr);
|
xattr_value, xattr_len, pcr);
|
||||||
if (action & IMA_APPRAISE_SUBMASK)
|
if (rc == 0 && (action & IMA_APPRAISE_SUBMASK)) {
|
||||||
|
inode_lock(inode);
|
||||||
rc = ima_appraise_measurement(func, iint, file, pathname,
|
rc = ima_appraise_measurement(func, iint, file, pathname,
|
||||||
xattr_value, xattr_len, opened);
|
xattr_value, xattr_len, opened);
|
||||||
|
inode_unlock(inode);
|
||||||
|
}
|
||||||
if (action & IMA_AUDIT)
|
if (action & IMA_AUDIT)
|
||||||
ima_audit_measurement(iint, pathname);
|
ima_audit_measurement(iint, pathname);
|
||||||
|
|
||||||
out_digsig:
|
if ((file->f_flags & O_DIRECT) && (iint->flags & IMA_PERMIT_DIRECTIO))
|
||||||
if ((mask & MAY_WRITE) && (iint->flags & IMA_DIGSIG) &&
|
rc = 0;
|
||||||
|
out_locked:
|
||||||
|
if ((mask & MAY_WRITE) && test_bit(IMA_DIGSIG, &iint->atomic_flags) &&
|
||||||
!(iint->flags & IMA_NEW_FILE))
|
!(iint->flags & IMA_NEW_FILE))
|
||||||
rc = -EACCES;
|
rc = -EACCES;
|
||||||
|
mutex_unlock(&iint->mutex);
|
||||||
kfree(xattr_value);
|
kfree(xattr_value);
|
||||||
out_free:
|
out:
|
||||||
if (pathbuf)
|
if (pathbuf)
|
||||||
__putname(pathbuf);
|
__putname(pathbuf);
|
||||||
out:
|
if (must_appraise) {
|
||||||
inode_unlock(inode);
|
if (rc && (ima_appraise & IMA_APPRAISE_ENFORCE))
|
||||||
if ((rc && must_appraise) && (ima_appraise & IMA_APPRAISE_ENFORCE))
|
return -EACCES;
|
||||||
return -EACCES;
|
if (file->f_mode & FMODE_WRITE)
|
||||||
|
set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
/* iint cache flags */
|
/* iint cache flags */
|
||||||
#define IMA_ACTION_FLAGS 0xff000000
|
#define IMA_ACTION_FLAGS 0xff000000
|
||||||
#define IMA_ACTION_RULE_FLAGS 0x06000000
|
#define IMA_ACTION_RULE_FLAGS 0x06000000
|
||||||
#define IMA_DIGSIG 0x01000000
|
#define IMA_DIGSIG_REQUIRED 0x01000000
|
||||||
#define IMA_DIGSIG_REQUIRED 0x02000000
|
#define IMA_PERMIT_DIRECTIO 0x02000000
|
||||||
#define IMA_PERMIT_DIRECTIO 0x04000000
|
#define IMA_NEW_FILE 0x04000000
|
||||||
#define IMA_NEW_FILE 0x08000000
|
#define EVM_IMMUTABLE_DIGSIG 0x08000000
|
||||||
|
|
||||||
#define IMA_DO_MASK (IMA_MEASURE | IMA_APPRAISE | IMA_AUDIT | \
|
#define IMA_DO_MASK (IMA_MEASURE | IMA_APPRAISE | IMA_AUDIT | \
|
||||||
IMA_APPRAISE_SUBMASK)
|
IMA_APPRAISE_SUBMASK)
|
||||||
|
@ -53,11 +53,19 @@
|
||||||
#define IMA_APPRAISED_SUBMASK (IMA_FILE_APPRAISED | IMA_MMAP_APPRAISED | \
|
#define IMA_APPRAISED_SUBMASK (IMA_FILE_APPRAISED | IMA_MMAP_APPRAISED | \
|
||||||
IMA_BPRM_APPRAISED | IMA_READ_APPRAISED)
|
IMA_BPRM_APPRAISED | IMA_READ_APPRAISED)
|
||||||
|
|
||||||
|
/* iint cache atomic_flags */
|
||||||
|
#define IMA_CHANGE_XATTR 0
|
||||||
|
#define IMA_UPDATE_XATTR 1
|
||||||
|
#define IMA_CHANGE_ATTR 2
|
||||||
|
#define IMA_DIGSIG 3
|
||||||
|
#define IMA_MUST_MEASURE 4
|
||||||
|
|
||||||
enum evm_ima_xattr_type {
|
enum evm_ima_xattr_type {
|
||||||
IMA_XATTR_DIGEST = 0x01,
|
IMA_XATTR_DIGEST = 0x01,
|
||||||
EVM_XATTR_HMAC,
|
EVM_XATTR_HMAC,
|
||||||
EVM_IMA_XATTR_DIGSIG,
|
EVM_IMA_XATTR_DIGSIG,
|
||||||
IMA_XATTR_DIGEST_NG,
|
IMA_XATTR_DIGEST_NG,
|
||||||
|
EVM_XATTR_PORTABLE_DIGSIG,
|
||||||
IMA_XATTR_LAST
|
IMA_XATTR_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,10 +108,12 @@ struct signature_v2_hdr {
|
||||||
/* integrity data associated with an inode */
|
/* integrity data associated with an inode */
|
||||||
struct integrity_iint_cache {
|
struct integrity_iint_cache {
|
||||||
struct rb_node rb_node; /* rooted in integrity_iint_tree */
|
struct rb_node rb_node; /* rooted in integrity_iint_tree */
|
||||||
|
struct mutex mutex; /* protects: version, flags, digest */
|
||||||
struct inode *inode; /* back pointer to inode in question */
|
struct inode *inode; /* back pointer to inode in question */
|
||||||
u64 version; /* track inode changes */
|
u64 version; /* track inode changes */
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned long measured_pcrs;
|
unsigned long measured_pcrs;
|
||||||
|
unsigned long atomic_flags;
|
||||||
enum integrity_status ima_file_status:4;
|
enum integrity_status ima_file_status:4;
|
||||||
enum integrity_status ima_mmap_status:4;
|
enum integrity_status ima_mmap_status:4;
|
||||||
enum integrity_status ima_bprm_status:4;
|
enum integrity_status ima_bprm_status:4;
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ static int str_read(char **strp, gfp_t flags, void *fp, u32 len)
|
||||||
if ((len == 0) || (len == (u32)-1))
|
if ((len == 0) || (len == (u32)-1))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
str = kmalloc(len + 1, flags);
|
str = kmalloc(len + 1, flags | __GFP_NOWARN);
|
||||||
if (!str)
|
if (!str)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ endif
|
||||||
ifeq ($(strip $(STATIC)),true)
|
ifeq ($(strip $(STATIC)),true)
|
||||||
LIBS = -L../ -L$(OUTPUT) -lm
|
LIBS = -L../ -L$(OUTPUT) -lm
|
||||||
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \
|
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \
|
||||||
$(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o
|
$(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/cpupower.o
|
||||||
else
|
else
|
||||||
LIBS = -L../ -L$(OUTPUT) -lm -lcpupower
|
LIBS = -L../ -L$(OUTPUT) -lm -lcpupower
|
||||||
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
|
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
|
||||||
|
|
|
@ -28,7 +28,7 @@ static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname,
|
||||||
|
|
||||||
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s",
|
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s",
|
||||||
cpu, fname);
|
cpu, fname);
|
||||||
return sysfs_read_file(path, buf, buflen);
|
return cpupower_read_sysfs(path, buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helper function to write a new value to a /sys file */
|
/* helper function to write a new value to a /sys file */
|
||||||
|
|
|
@ -319,7 +319,7 @@ static unsigned int sysfs_cpuidle_read_file(const char *fname, char *buf,
|
||||||
|
|
||||||
snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname);
|
snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname);
|
||||||
|
|
||||||
return sysfs_read_file(path, buf, buflen);
|
return cpupower_read_sysfs(path, buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "cpupower.h"
|
#include "cpupower.h"
|
||||||
#include "cpupower_intern.h"
|
#include "cpupower_intern.h"
|
||||||
|
|
||||||
unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen)
|
unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t numread;
|
ssize_t numread;
|
||||||
|
@ -95,7 +95,7 @@ static int sysfs_topology_read_file(unsigned int cpu, const char *fname, int *re
|
||||||
|
|
||||||
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s",
|
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s",
|
||||||
cpu, fname);
|
cpu, fname);
|
||||||
if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0)
|
if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
*result = strtol(linebuf, &endp, 0);
|
*result = strtol(linebuf, &endp, 0);
|
||||||
if (endp == linebuf || errno == ERANGE)
|
if (endp == linebuf || errno == ERANGE)
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
#define MAX_LINE_LEN 4096
|
#define MAX_LINE_LEN 4096
|
||||||
#define SYSFS_PATH_MAX 255
|
#define SYSFS_PATH_MAX 255
|
||||||
|
|
||||||
unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen);
|
unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue