3.1.1-stable review
Subsystems (107)
PATCH 160/264 mm: thp: tail page refcounting fix
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 70b50f94f1644e2aa7cb374819cfd93f3c28d725 upstream.
Michel while working on the working set estimation code, noticed that calling get_page_unless_zero() on a random pfn_to_page(random_pfn) wasn't safe, if the pfn ended up being a tail page of a transparent hugepage under splitting by __split_huge_page_refcount().
He then found the problem could also theoretically materialize with page_cache_get_speculative() during the speculative radix tree lookups that uses get_page_unless_zero() in SMP if the radix tree page is freed and reallocated and get_user_pages is called on it before page_cache_get_speculative has a chance to call get_page_unless_zero().
So the best way to fix the problem is to keep page_tail->_count zero at all times. This will guarantee that get_page_unless_zero() can never succeed on any tail page. page_tail->_mapcount is guaranteed zero and is unused for all tail pages of a compound page, so we can simply account the tail page references there and transfer them to tail_page->_count in __split_huge_page_refcount() (in addition to the head_page->_mapcount).
While debugging this s/_count/_mapcount/ change I also noticed get_page is called by direct-io.c on pages returned by get_user_pages. That wasn't entirely safe because the two atomic_inc in get_page weren't atomic. As opposed to other get_user_page users like secondary-MMU page fault to establish the shadow pagetables would never call any superflous get_page after get_user_page returns. It's safer to make get_page universally safe for tail pages and to use get_page_foll() within follow_page (inside get_user_pages()). get_page_foll() is safe to do the refcounting for tail pages without taking any locks because it is run within PT lock protected critical sections (PT lock for pte and page_table_lock for pmd_trans_huge).
The standard get_page() as invoked by direct-io instead will now take the compound_lock but still only for tail pages. The direct-io paths are usually I/O bound and the compound_lock is per THP so very finegrined, so there's no risk of scalability issues with it. A simple direct-io benchmarks with all lockdep prove locking and spinlock debugging infrastructure enabled shows identical performance and no overhead. So it's worth it. Ideally direct-io should stop calling get_page() on pages returned by get_user_pages(). The spinlock in get_page() is already optimized away for no-THP builds but doing get_page() on tail pages returned by GUP is generally a rare operation and usually only run in I/O paths.
This new refcounting on page_tail->_mapcount in addition to avoiding new RCU critical sections will also allow the working set estimation code to work without any further complexity associated to the tail page refcounting with THP.
--- arch/powerpc/mm/gup.c | 5 +- arch/x86/mm/gup.c | 5 +- include/linux/mm.h | 56 ++++++++++++------------------- include/linux/mm_types.h | 21 +++++++++-- mm/huge_memory.c | 37 ++++++++++++++------ mm/internal.h | 46 ++++++++++++++++++++++++++ mm/memory.c | 2 - mm/swap.c | 83 ++++++++++++++++++++++++++++++----------------- 8 files changed, 171 insertions(+), 84 deletions(-)
arch/powerpc/mm/gup.c +3 -2
@@ -22,8 +22,9 @@ static inline void get_huge_page_tail(st* __split_huge_page_refcount() cannot run * from under us. */ -VM_BUG_ON (atomic_read (&page->_count) <0 ); -atomic_inc (&page->_count); +VM_BUG_ON (page_mapcount (page) <0 ); +VM_BUG_ON (atomic_read (&page->_count) !=0 ); +atomic_inc (&page->_mapcount); }/*
arch/x86/mm/gup.c +3 -2
@@ -114,8 +114,9 @@ static inline void get_huge_page_tail(st* __split_huge_page_refcount() cannot run * from under us. */ -VM_BUG_ON (atomic_read (&page->_count) <0 ); -atomic_inc (&page->_count); +VM_BUG_ON (page_mapcount (page) <0 ); +VM_BUG_ON (atomic_read (&page->_count) !=0 ); +atomic_inc (&page->_mapcount); } static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr,
include/linux/mm.h +22 -34
79 lines not on this page · raw message
include/linux/mm_types.h +17 -4
@@ -62,10 +62,23 @@ struct page { struct { union { - atomic_t _mapcount; /* Count of ptes mapped in mms, - * to show when page is mapped - * & limit reverse map searches. - */ + /* + * Count of ptes mapped in + * mms, to show when page is + * mapped & limit reverse map + * searches. + * + * Used also for tail pages + * refcounting instead of + * _count. Tail pages cannot + * be mapped and keeping the + * tail page _count zero at + * all times guarantees + * get_page_unless_zero() will + * never succeed on tail + * pages. + */ + atomic_t _mapcount; struct { unsigned inuse:16;
mm/huge_memory.c +26 -11
@@ -989,7 +989,7 @@ struct page *follow_trans_huge_pmd(struc page += (addr & ~HPAGE_PMD_MASK ) >>PAGE_SHIFT ;VM_BUG_ON (!PageCompound (page));if (flags &FOLL_GET ) -get_page (page); +get_page_foll (page); out:return page;
@@ -1156,6 +1156,7 @@ static void __split_huge_page_refcount(sunsigned long head_index = page->index;struct zone *zone =page_zone (page);int zonestat; +int tail_count =0 ;/* prevent PageLRU to go away from under us, and freeze lru stats */ spin_lock_irq (&zone->lru_lock);
@@ -1164,11 +1165,27 @@ static void __split_huge_page_refcount(sfor (i =1 ; i <HPAGE_PMD_NR ; i++) {struct page *page_tail = page + i; -/* tail_page->_count cannot change */ -atomic_sub (atomic_read (&page_tail->_count), &page->_count); -BUG_ON (page_count (page) <=0 ); -atomic_add (page_mapcount (page) +1 , &page_tail->_count); -BUG_ON (atomic_read (&page_tail->_count) <=0 ); +/* tail_page->_mapcount cannot change */ +BUG_ON (page_mapcount (page_tail) <0 ); + tail_count +=page_mapcount (page_tail); +/* check for overflow */ +BUG_ON (tail_count <0 ); +BUG_ON (atomic_read (&page_tail->_count) !=0 ); +/* +* tail_page->_count is zero and not changing from +* under us. But get_page_unless_zero() may be running +* from under us on the tail_page. If we used +* atomic_set() below instead of atomic_add(), we +* would then run atomic_set() concurrently with +* get_page_unless_zero(), and atomic_set() is +* implemented in C not using locked ops. spin_unlock +* on x86 sometime uses locked ops because of PPro +* errata 66, 92, so unless somebody can guarantee +* atomic_set() here would be safe on all archs (and +* not only on x86), it's safer to use atomic_add(). +*/ +atomic_add (page_mapcount (page) +page_mapcount (page_tail) +1 , + &page_tail->_count);/* after clearing PageTail the gup refcount can be released */ smp_mb ();
@@ -1186,10 +1203,7 @@ static void __split_huge_page_refcount(s (1L << PG_uptodate))); page_tail->flags |= (1L << PG_dirty); -/* -* 1) clear PageTail before overwriting first_page -* 2) clear PageTail before clearing PageHead for VM_BUG_ON -*/ +/* clear PageTail before overwriting first_page */ smp_wmb ();/*
@@ -1206,7 +1220,6 @@ static void __split_huge_page_refcount(s* status is achieved setting a reserved bit in the * pmd, not by clearing the present bit. */ -BUG_ON (page_mapcount (page_tail)); page_tail->_mapcount = page->_mapcount;BUG_ON (page_tail->mapping);
@@ -1223,6 +1236,8 @@ static void __split_huge_page_refcount(slru_add_page_tail (zone, page, page_tail); } +atomic_sub (tail_count, &page->_count); +BUG_ON (atomic_read (&page->_count) <=0 );__dec_zone_page_state (page,NR_ANON_TRANSPARENT_HUGEPAGES );__mod_zone_page_state (zone,NR_ANON_PAGES ,HPAGE_PMD_NR );
mm/internal.h +46 -0
52 lines not on this page · raw message
mm/memory.c +1 -1
@@ -1503,7 +1503,7 @@ split_fallthrough: }if (flags &FOLL_GET ) -get_page (page); +get_page_foll (page);if (flags &FOLL_TOUCH ) {if ((flags &FOLL_WRITE ) && !pte_dirty (pte) && !PageDirty (page))
mm/swap.c +53 -30
114 lines not on this page · raw message
PATCH 161/264 binfmt_elf: fix PIE execution with randomization disabled
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
commit a3defbe5c337dbc6da911f8cc49ae3cc3b49b453 upstream.
The case of address space randomization being disabled in runtime through randomize_va_space sysctl is not treated properly in load_elf_binary(), resulting in SIGKILL coming at exec() time for certain PIE-linked binaries in case the randomization has been disabled at runtime prior to calling exec().
Handle the randomize_va_space == 0 case the same way as if we were not supporting .text randomization at all.
Based on original patch by H.J. Lu and Josh Boyer.
--- fs/binfmt_elf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/binfmt_elf.c +10 -1
@@ -795,7 +795,16 @@ static int load_elf_binary(struct linux_* might try to exec. This is because the brk will * follow the loader, and is not movable. */ #if defined(CONFIG_X86 ) || defined(CONFIG_ARM ) - load_bias =0 ; +/* Memory randomization might have been switched off +* in runtime via sysctl. +* If that is the case, retain the original non-zero +* load_bias value in order to establish proper +* non-randomized mappings. +*/ +if (current->flags &PF_RANDOMIZE ) + load_bias =0 ; +else + load_bias =ELF_PAGESTART (ELF_ET_DYN_BASE - vaddr);#else load_bias =ELF_PAGESTART (ELF_ET_DYN_BASE - vaddr);#endif
PATCH 162/264 ALSA: hda - Add missing static ADC tables for ALC269 quirks
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[There is no upstream commit for this patch since the corresponding code was removed from 3.2 kernel. This is a regression found only in 3.1 kernel, so please apply this only to 3.1.x series.]
Some ALC269 quirks define their own .cap_mixer field but without the static adc_nids[]. This resulted in the mismatch of ADC because ALC269 may have the widget 0x07 for another audio-in, and the auto-parser picks this up instead.
This patch fixes the problem by adding the static adc_nids[] and co again to these entries.
--- sound/pci/hda/alc269_quirks.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/pci/hda/alc269_quirks.c +14 -0
@@ -577,6 +577,9 @@ static const struct alc_config_preset al alc269_laptop_amic_init_verbs }, .num_dacs = ARRAY_SIZE(alc269_dac_nids), .dac_nids = alc269_dac_nids, + .adc_nids = alc269_adc_nids, + .capsrc_nids = alc269_capsrc_nids, + .num_adc_nids = ARRAY_SIZE(alc269_adc_nids), .hp_nid = 0x03, .num_channel_mode = ARRAY_SIZE(alc269_modes), .channel_mode = alc269_modes,
@@ -591,6 +594,9 @@ static const struct alc_config_preset al alc269_laptop_dmic_init_verbs }, .num_dacs = ARRAY_SIZE(alc269_dac_nids), .dac_nids = alc269_dac_nids, + .adc_nids = alc269_adc_nids, + .capsrc_nids = alc269_capsrc_nids, + .num_adc_nids = ARRAY_SIZE(alc269_adc_nids), .hp_nid = 0x03, .num_channel_mode = ARRAY_SIZE(alc269_modes), .channel_mode = alc269_modes,
@@ -605,6 +611,9 @@ static const struct alc_config_preset al alc269vb_laptop_amic_init_verbs }, .num_dacs = ARRAY_SIZE(alc269_dac_nids), .dac_nids = alc269_dac_nids, + .adc_nids = alc269vb_adc_nids, + .capsrc_nids = alc269vb_capsrc_nids, + .num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids), .hp_nid = 0x03, .num_channel_mode = ARRAY_SIZE(alc269_modes), .channel_mode = alc269_modes,
@@ -619,6 +628,9 @@ static const struct alc_config_preset al alc269vb_laptop_dmic_init_verbs }, .num_dacs = ARRAY_SIZE(alc269_dac_nids), .dac_nids = alc269_dac_nids, + .adc_nids = alc269vb_adc_nids, + .capsrc_nids = alc269vb_capsrc_nids, + .num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids), .hp_nid = 0x03, .num_channel_mode = ARRAY_SIZE(alc269_modes), .channel_mode = alc269_modes,
@@ -633,6 +645,8 @@ static const struct alc_config_preset al alc269_laptop_dmic_init_verbs }, .num_dacs = ARRAY_SIZE(alc269_dac_nids), .dac_nids = alc269_dac_nids, + .adc_nids = alc269_adc_nids, + .capsrc_nids = alc269_capsrc_nids, .hp_nid = 0x03, .num_channel_mode = ARRAY_SIZE(alc269_modes), .channel_mode = alc269_modes,
PATCH 163/264 drivers/net/rionet.c: fix ethernet address macros for LE platforms
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Bounine <[email protected]>
commit e0c87bd95e8dad455c23bc56513af8dcb1737e55 upstream.
Modify Ethernet addess macros to be compatible with BE/LE platforms
--- drivers/net/rionet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/rionet.c +2 -2
@@ -88,8 +88,8 @@ static struct rio_dev **rionet_active;#define dev_rionet_capable (dev) \ is_rionet_capable(dev->src_ops, dev->dst_ops) -#define RIONET_MAC_MATCH (x) (*(u32 *)x == 0x00010001) -#define RIONET_GET_DESTID (x) (*(u16 *)(x + 4)) +#define RIONET_MAC_MATCH (x) (!memcmp((x), "\00\01\00\01", 4)) +#define RIONET_GET_DESTID (x) ((*((u8 *)x + 4) << 8) | *((u8 *)x + 5))static int rionet_rx_clean (struct net_device *ndev) {
PATCH 164/264 hwspinlock/core: use a mutex to protect the radix tree
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juan Gutierrez <[email protected]>
commit 93b465c2e186d96fb90012ba0f9372eb9952e732 upstream.
Since we're using non-atomic radix tree allocations, we should be protecting the tree using a mutex and not a spinlock.
Non-atomic allocations and process context locking is good enough, as the tree is manipulated only when locks are registered/ unregistered/requested/freed.
The locks themselves are still protected by spinlocks of course, and mutexes are not involved in the locking/unlocking paths.
[[email protected]: rewrite the commit log, #include mutex.h, add minor commentary]
--- Documentation/hwspinlock.txt | 18 +++++--------- drivers/hwspinlock/hwspinlock_core.c | 45 +++++++++++++++-------------------- 2 files changed, 27 insertions(+), 36 deletions(-)
Documentation/hwspinlock.txt +7 -11
@@ -39,23 +39,20 @@ independent, drivers. in case an unused hwspinlock isn't available. Users of this API will usually want to communicate the lock's id to the remote core before it can be used to achieve synchronization. - Can be called from an atomic context (this function will not sleep) but - not from within interrupt context. + Should be called from a process context (might sleep). struct hwspinlock *hwspin_lock_request_specific(unsigned int id); - assign a specific hwspinlock id and return its address, or NULL if that hwspinlock is already in use. Usually board code will be calling this function in order to reserve specific hwspinlock ids for predefined purposes. - Can be called from an atomic context (this function will not sleep) but - not from within interrupt context. + Should be called from a process context (might sleep). int hwspin_lock_free(struct hwspinlock *hwlock); - free a previously-assigned hwspinlock; returns 0 on success, or an appropriate error code on failure (e.g. -EINVAL if the hwspinlock is already free). - Can be called from an atomic context (this function will not sleep) but - not from within interrupt context. + Should be called from a process context (might sleep). int hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int timeout); - lock a previously-assigned hwspinlock with a timeout limit (specified in
@@ -232,15 +229,14 @@ int hwspinlock_example2(void) int hwspin_lock_register(struct hwspinlock *hwlock); - to be called from the underlying platform-specific implementation, in - order to register a new hwspinlock instance. Can be called from an atomic - context (this function will not sleep) but not from within interrupt - context. Returns 0 on success, or appropriate error code on failure. + order to register a new hwspinlock instance. Should be called from + a process context (this function might sleep). + Returns 0 on success, or appropriate error code on failure. struct hwspinlock *hwspin_lock_unregister(unsigned int id); - to be called from the underlying vendor-specific implementation, in order to unregister an existing (and unused) hwspinlock instance. - Can be called from an atomic context (will not sleep) but not from - within interrupt context. + Should be called from a process context (this function might sleep). Returns the address of hwspinlock on success, or NULL on error (e.g. if the hwspinlock is sill in use).
drivers/hwspinlock/hwspinlock_core.c +20 -25
149 lines not on this page · raw message
PATCH 165/264 drivers/power/ds2780_battery.c: create central point for calling w1 interface
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clifton Barnes <[email protected]>
commit 853eee72f74f449797f0500ea19fc1bf497428d8 upstream.
Simply creates one point to call the w1 interface.
--- drivers/power/ds2780_battery.c | 77 ++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 35 deletions(-)
drivers/power/ds2780_battery.c +42 -35
@@ -49,8 +49,8 @@ enum current_types {static const char model[] ="DS2780" ;static const char manufacturer[] ="Maxim/Dallas" ; -static inline struct ds2780_device_info *to_ds2780_device_info ( -struct power_supply *psy) +static inline struct ds2780_device_info * +to_ds2780_device_info (struct power_supply *psy) { return container_of(psy, struct ds2780_device_info, bat); }
@@ -60,17 +60,25 @@ static inline struct power_supply *to_poreturn dev_get_drvdata (dev); } -static inline int ds2780_read8 (struct device *dev,u8 *val,int addr) +static inline int ds2780_battery_io (struct ds2780_device_info *dev_info, +char *buf,int addr,size_t count,int io) { -return w1_ds2780_io (dev, val, addr,sizeof (u8),0 ); +return w1_ds2780_io (dev_info->w1_dev, buf, addr, count, io); } -static int ds2780_read16 (struct device *dev,s16 *val,int addr) +static inline int ds2780_read8 (struct ds2780_device_info *dev_info,u8 *val, +int addr) +{ +return ds2780_battery_io (dev_info, val, addr,sizeof (u8),0 ); +} + +static int ds2780_read16 (struct ds2780_device_info *dev_info,s16 *val, +int addr) {int ret;u8 raw[2 ]; - ret =w1_ds2780_io (dev, raw, addr,sizeof (u8) *2 ,0 ); + ret =ds2780_battery_io (dev_info, raw, addr,sizeof (raw),0 );if (ret <0 )return ret;
@@ -79,16 +87,16 @@ static int ds2780_read16(struct device *return 0 ; } -static inline int ds2780_read_block (struct device *dev,u8 *val,int addr, -size_t count) +static inline int ds2780_read_block (struct ds2780_device_info *dev_info, +u8 *val,int addr,size_t count) { -return w1_ds2780_io (dev, val, addr, count,0 ); +return ds2780_battery_io (dev_info, val, addr, count,0 ); } -static inline int ds2780_write (struct device *dev,u8 *val,int addr, -size_t count) +static inline int ds2780_write (struct ds2780_device_info *dev_info,u8 *val, +int addr,size_t count) { -return w1_ds2780_io (dev, val, addr, count,1 ); +return ds2780_battery_io (dev_info, val, addr, count,1 ); }static inline int ds2780_store_eeprom (struct device *dev,int addr)
@@ -122,7 +130,7 @@ static int ds2780_set_sense_register(str {int ret; - ret =ds2780_write (dev_info->w1_dev, &conductance, + ret =ds2780_write (dev_info, &conductance,DS2780_RSNSP_REG ,sizeof (u8));if (ret <0 )return ret;
@@ -134,7 +142,7 @@ static int ds2780_set_sense_register(strstatic int ds2780_get_rsgain_register (struct ds2780_device_info *dev_info,u16 *rsgain) { -return ds2780_read16 (dev_info->w1_dev, rsgain,DS2780_RSGAIN_MSB_REG ); +return ds2780_read16 (dev_info, rsgain,DS2780_RSGAIN_MSB_REG ); }/* Set RSGAIN value from 0 to 1.999 in steps of 0.001 */
@@ -144,8 +152,8 @@ static int ds2780_set_rsgain_register(stint ret;u8 raw[] = {rsgain >>8 , rsgain &0xFF }; - ret =ds2780_write (dev_info->w1_dev, raw, -DS2780_RSGAIN_MSB_REG ,sizeof (u8) *2 ); + ret =ds2780_write (dev_info, raw, +DS2780_RSGAIN_MSB_REG ,sizeof (raw));if (ret <0 )return ret;
@@ -167,7 +175,7 @@ static int ds2780_get_voltage(struct ds2* Bits 2 - 0 of the voltage value are in bits 7 - 5 of the * voltage LSB register */ - ret =ds2780_read16 (dev_info->w1_dev, &voltage_raw, + ret =ds2780_read16 (dev_info, &voltage_raw,DS2780_VOLT_MSB_REG );if (ret <0 )return ret;
@@ -196,7 +204,7 @@ static int ds2780_get_temperature(struct* Bits 2 - 0 of the temperature value are in bits 7 - 5 of the * temperature LSB register */ - ret =ds2780_read16 (dev_info->w1_dev, &temperature_raw, + ret =ds2780_read16 (dev_info, &temperature_raw,DS2780_TEMP_MSB_REG );if (ret <0 )return ret;
@@ -222,13 +230,13 @@ static int ds2780_get_current(struct ds2* The units of measurement for current are dependent on the value of * the sense resistor. */ - ret =ds2780_read8 (dev_info->w1_dev, &sense_res_raw,DS2780_RSNSP_REG ); + ret =ds2780_read8 (dev_info, &sense_res_raw,DS2780_RSNSP_REG );if (ret <0 )return ret;if (sense_res_raw ==0 ) {dev_err (dev_info->dev,"sense resistor value is 0\n" ); -return -ENXIO ; +return -EINVAL ; } sense_res =1000 / sense_res_raw;
@@ -248,7 +256,7 @@ static int ds2780_get_current(struct ds2* Bits 7 - 0 of the current value are in bits 7 - 0 of the current * LSB register */ - ret =ds2780_read16 (dev_info->w1_dev, ¤t_raw, reg_msb); + ret =ds2780_read16 (dev_info, ¤t_raw, reg_msb);if (ret <0 )return ret;
@@ -267,7 +275,7 @@ static int ds2780_get_accumulated_curren* The units of measurement for accumulated current are dependent on * the value of the sense resistor. */ - ret =ds2780_read8 (dev_info->w1_dev, &sense_res_raw,DS2780_RSNSP_REG ); + ret =ds2780_read8 (dev_info, &sense_res_raw,DS2780_RSNSP_REG );if (ret <0 )return ret;
@@ -285,7 +293,7 @@ static int ds2780_get_accumulated_curren* Bits 7 - 0 of the ACR value are in bits 7 - 0 of the ACR * LSB register */ - ret =ds2780_read16 (dev_info->w1_dev, ¤t_raw,DS2780_ACR_MSB_REG ); + ret =ds2780_read16 (dev_info, ¤t_raw,DS2780_ACR_MSB_REG );if (ret <0 )return ret;
@@ -299,7 +307,7 @@ static int ds2780_get_capacity(struct dsint ret;u8 raw; - ret =ds2780_read8 (dev_info->w1_dev, &raw,DS2780_RARC_REG ); + ret =ds2780_read8 (dev_info, &raw,DS2780_RARC_REG );if (ret <0 )return ret;
@@ -345,7 +353,7 @@ static int ds2780_get_charge_now(struct* Bits 7 - 0 of the RAAC value are in bits 7 - 0 of the RAAC * LSB register */ - ret =ds2780_read16 (dev_info->w1_dev, &charge_raw,DS2780_RAAC_MSB_REG ); + ret =ds2780_read16 (dev_info, &charge_raw,DS2780_RAAC_MSB_REG );if (ret <0 )return ret;
@@ -356,7 +364,7 @@ static int ds2780_get_charge_now(structstatic int ds2780_get_control_register (struct ds2780_device_info *dev_info,u8 *control_reg) { -return ds2780_read8 (dev_info->w1_dev, control_reg,DS2780_CONTROL_REG ); +return ds2780_read8 (dev_info, control_reg,DS2780_CONTROL_REG ); } static int ds2780_set_control_register(struct ds2780_device_info *dev_info,
@@ -364,7 +372,7 @@ static int ds2780_set_control_register(s {int ret; - ret =ds2780_write (dev_info->w1_dev, &control_reg, + ret =ds2780_write (dev_info, &control_reg,DS2780_CONTROL_REG ,sizeof (u8));if (ret <0 )return ret;
@@ -503,7 +511,7 @@ static ssize_t ds2780_get_sense_resistorstruct power_supply *psy =to_power_supply (dev);struct ds2780_device_info *dev_info =to_ds2780_device_info (psy); - ret =ds2780_read8 (dev_info->w1_dev, &sense_resistor,DS2780_RSNSP_REG ); + ret =ds2780_read8 (dev_info, &sense_resistor,DS2780_RSNSP_REG );if (ret <0 )return ret;
@@ -584,7 +592,7 @@ static ssize_t ds2780_get_pio_pin(structstruct power_supply *psy =to_power_supply (dev);struct ds2780_device_info *dev_info =to_ds2780_device_info (psy); - ret =ds2780_read8 (dev_info->w1_dev, &sfr,DS2780_SFR_REG ); + ret =ds2780_read8 (dev_info, &sfr,DS2780_SFR_REG );if (ret <0 )return ret;
@@ -611,7 +619,7 @@ static ssize_t ds2780_set_pio_pin(structreturn -EINVAL ; } - ret =ds2780_write (dev_info->w1_dev, &new_setting, + ret =ds2780_write (dev_info, &new_setting,DS2780_SFR_REG ,sizeof (u8));if (ret <0 )return ret;
@@ -632,7 +640,7 @@ static ssize_t ds2780_read_param_eeprom_DS2780_EEPROM_BLOCK1_END - DS2780_EEPROM_BLOCK1_START + 1 - off); -return ds2780_read_block (dev_info->w1_dev, buf, +return ds2780_read_block (dev_info, buf,DS2780_EEPROM_BLOCK1_START + off, count); }
@@ -650,7 +658,7 @@ static ssize_t ds2780_write_param_eepromDS2780_EEPROM_BLOCK1_END - DS2780_EEPROM_BLOCK1_START + 1 - off); - ret =ds2780_write (dev_info->w1_dev, buf, + ret =ds2780_write (dev_info, buf,DS2780_EEPROM_BLOCK1_START + off, count);if (ret <0 )return ret;
@@ -685,9 +693,8 @@ static ssize_t ds2780_read_user_eeprom_bDS2780_EEPROM_BLOCK0_END - DS2780_EEPROM_BLOCK0_START + 1 - off); -return ds2780_read_block (dev_info->w1_dev, buf, +return ds2780_read_block (dev_info, buf,DS2780_EEPROM_BLOCK0_START + off, count); - } static ssize_t ds2780_write_user_eeprom_bin(struct file *filp,
@@ -704,7 +711,7 @@ static ssize_t ds2780_write_user_eeprom_DS2780_EEPROM_BLOCK0_END - DS2780_EEPROM_BLOCK0_START + 1 - off); - ret =ds2780_write (dev_info->w1_dev, buf, + ret =ds2780_write (dev_info, buf,DS2780_EEPROM_BLOCK0_START + off, count);if (ret <0 )return ret;
PATCH 166/264 drivers/power/ds2780_battery.c: add a nolock function to w1 interface
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clifton Barnes <[email protected]>
commit 9fe678fa2feb4aaac0b4220de63e1b7f8ccebae6 upstream.
Adds a nolock function to the w1 interface to avoid locking the mutex if needed.
--- drivers/w1/slaves/w1_ds2780.c | 48 ++++++++++++++++++++++++++++++------------ drivers/w1/slaves/w1_ds2780.h | 2 + 2 files changed, 37 insertions(+), 13 deletions(-)
drivers/w1/slaves/w1_ds2780.c +35 -13
@@ -26,20 +26,14 @@#include "../w1_family.h" #include "w1_ds2780.h" -int w1_ds2780_io (struct device *dev,char *buf,int addr,size_t count, -int io) +static int w1_ds2780_do_io (struct device *dev,char *buf,int addr, +size_t count,int io) { struct w1_slave *sl = container_of(dev, struct w1_slave, dev); -if (!dev) -return -ENODEV ; - -mutex_lock (&sl->master->mutex); +if (addr >DS2780_DATA_SIZE || addr <0 ) +return 0 ; -if (addr >DS2780_DATA_SIZE || addr <0 ) { - count =0 ; - goto out; - } count =min_t (int, count,DS2780_DATA_SIZE - addr);if (w1_reset_select_slave (sl) ==0 ) {
@@ -47,7 +41,6 @@ int w1_ds2780_io(struct device *dev, chaw1_write_8 (sl->master,W1_DS2780_WRITE_DATA );w1_write_8 (sl->master, addr);w1_write_block (sl->master, buf, count); -/* XXX w1_write_block returns void, not n_written */ }else {w1_write_8 (sl->master,W1_DS2780_READ_DATA );w1_write_8 (sl->master, addr);
@@ -55,13 +48,42 @@ int w1_ds2780_io(struct device *dev, cha } } -out: +return count; +} + +int w1_ds2780_io (struct device *dev,char *buf,int addr,size_t count, +int io) +{ + struct w1_slave *sl = container_of(dev, struct w1_slave, dev); +int ret; + +if (!dev) +return -ENODEV ; + +mutex_lock (&sl->master->mutex); + + ret =w1_ds2780_do_io (dev, buf, addr, count, io); +mutex_unlock (&sl->master->mutex); -return count; +return ret; }EXPORT_SYMBOL (w1_ds2780_io); +int w1_ds2780_io_nolock (struct device *dev,char *buf,int addr,size_t count, +int io) +{ +int ret; + +if (!dev) +return -ENODEV ; + + ret =w1_ds2780_do_io (dev, buf, addr, count, io); + +return ret; +} +EXPORT_SYMBOL (w1_ds2780_io_nolock); +int w1_ds2780_eeprom_cmd (struct device *dev,int addr,int cmd) { struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
drivers/w1/slaves/w1_ds2780.h +2 -0
@@ -124,6 +124,8 @@extern int w1_ds2780_io (struct device *dev,char *buf,int addr,size_t count,int io); +extern int w1_ds2780_io_nolock (struct device *dev,char *buf,int addr, +size_t count,int io);extern int w1_ds2780_eeprom_cmd (struct device *dev,int addr,int cmd);#endif /* !_W1_DS2780_H */
PATCH 167/264 drivers/power/ds2780_battery.c: fix deadlock upon insertion and removal
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clifton Barnes <[email protected]>
commit 0e053fcbbbc4d945247cb32cad2767b483cb65f8 upstream.
Fixes the deadlock when inserting and removing the ds2780.
--- drivers/power/ds2780_battery.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/power/ds2780_battery.c +9 -0
@@ -39,6 +39,7 @@ struct ds2780_device_info {struct device *dev;struct power_supply bat;struct device *w1_dev; +struct task_struct *mutex_holder; };enum current_types {
@@ -63,6 +64,9 @@ static inline struct power_supply *to_postatic inline int ds2780_battery_io (struct ds2780_device_info *dev_info,char *buf,int addr,size_t count,int io) { +if (dev_info->mutex_holder == current) +return w1_ds2780_io_nolock (dev_info->w1_dev, buf, addr, count, io); +else return w1_ds2780_io (dev_info->w1_dev, buf, addr, count, io); }
@@ -775,6 +779,7 @@ static int __devinit ds2780_battery_prob dev_info->bat.properties = ds2780_battery_props; dev_info->bat.num_properties =ARRAY_SIZE (ds2780_battery_props); dev_info->bat.get_property = ds2780_battery_get_property; + dev_info->mutex_holder = current; ret =power_supply_register (&pdev->dev, &dev_info->bat);if (ret) {
@@ -804,6 +809,8 @@ static int __devinit ds2780_battery_prob goto fail_remove_bin_file; } + dev_info->mutex_holder =NULL ; +return 0 ; fail_remove_bin_file:
@@ -823,6 +830,8 @@ static int __devexit ds2780_battery_remo {struct ds2780_device_info *dev_info =platform_get_drvdata (pdev); + dev_info->mutex_holder = current; +/* remove attributes */ sysfs_remove_group (&dev_info->bat.dev->kobj, &ds2780_attr_group);
PATCH 168/264 ext2,ext3,ext4: dont inherit APPEND_FL or IMMUTABLE_FL for new inodes
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 1cd9f0976aa4606db8d6e3dc3edd0aca8019372a upstream.
This doesn't make much sense, and it exposes a bug in the kernel where attempts to create a new file in an append-only directory using O_CREAT will fail (but still leave a zero-length file). This was discovered when xfstests #79 was generalized so it could run on all file systems.
--- fs/ext4/ext4.h | 3 +-- include/linux/ext2_fs.h | 4 ++-- include/linux/ext3_fs.h | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-)
fs/ext4/ext4.h +1 -2
@@ -358,8 +358,7 @@ struct flex_groups {/* Flags that should be inherited by new inodes from their parent. */ #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ - EXT4_SYNC_FL | EXT4_IMMUTABLE_FL | EXT4_APPEND_FL |\ - EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ + EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL)
include/linux/ext2_fs.h +2 -2
@@ -197,8 +197,8 @@ struct ext2_group_desc/* Flags that should be inherited by new inodes from their parent. */ #define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\ - EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\ - EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\ + EXT2_SYNC_FL | EXT2_NODUMP_FL |\ + EXT2_NOATIME_FL | EXT2_COMPRBLK_FL |\ EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\ EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
include/linux/ext3_fs.h +2 -2
@@ -180,8 +180,8 @@ struct ext3_group_desc/* Flags that should be inherited by new inodes from their parent. */ #define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\ - EXT3_SYNC_FL | EXT3_IMMUTABLE_FL | EXT3_APPEND_FL |\ - EXT3_NODUMP_FL | EXT3_NOATIME_FL | EXT3_COMPRBLK_FL|\ + EXT3_SYNC_FL | EXT3_NODUMP_FL |\ + EXT3_NOATIME_FL | EXT3_COMPRBLK_FL |\ EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\ EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
PATCH 169/264 ext4: ext4_rename should dirty dir_bh with the correct directory
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit bcaa992975041e40449be8c010c26192b8c8b409 upstream.
When ext4_rename performs a directory rename (move), dir_bh is a buffer that is modified to update the '..' link in the directory being moved (old_inode). However, ext4_handle_dirty_metadata is called with the old parent directory inode (old_dir) and dir_bh, which is incorrect because dir_bh does not belong to the parent inode. Fix this error.
--- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
@@ -2530,7 +2530,7 @@ static int ext4_rename(struct inode *oldPARENT_INO (dir_bh->b_data, new_dir->i_sb->s_blocksize) =cpu_to_le32 (new_dir->i_ino);BUFFER_TRACE (dir_bh,"call ext4_handle_dirty_metadata" ); - retval =ext4_handle_dirty_metadata (handle, old_dir, dir_bh); + retval =ext4_handle_dirty_metadata (handle, old_inode, dir_bh);if (retval) {ext4_std_error (old_dir->i_sb, retval); goto end_rename;
PATCH 170/264 ext4: ext4_mkdir should dirty dir_block with newly created directory inode
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit f9287c1f2d329f4d78a3bbc9cf0db0ebae6f146a upstream.
ext4_mkdir calls ext4_handle_dirty_metadata with dir_block and the inode "dir". Unfortunately, dir_block belongs to the newly created directory (which is "inode"), not the parent directory (which is "dir"). Fix the incorrect association.
--- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
@@ -1863,7 +1863,7 @@ retry:ext4_set_de_type (dir->i_sb, de,S_IFDIR ); inode->i_nlink =2 ;BUFFER_TRACE (dir_block,"call ext4_handle_dirty_metadata" ); - err =ext4_handle_dirty_metadata (handle, dir, dir_block); + err =ext4_handle_dirty_metadata (handle, inode, dir_block);if (err) goto out_clear_inode; err =ext4_mark_inode_dirty (handle, inode);
PATCH 171/264 ext4: call ext4_handle_dirty_metadata with correct inode in ext4_dx_add_entry
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 5930ea643805feb50a2f8383ae12eb6f10935e49 upstream.
ext4_dx_add_entry manipulates bh2 and frames[0].bh, which are two buffer_heads that point to directory blocks assigned to the directory inode. However, the function calls ext4_handle_dirty_metadata with the inode of the file that's being added to the directory, not the directory inode itself. Therefore, correct the code to dirty the directory buffers with the directory inode, not the file inode.
--- fs/ext4/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/namei.c +2 -2
@@ -1586,7 +1586,7 @@ static int ext4_dx_add_entry(handle_t *hdxtrace (dx_show_index ("node" , frames[1 ].entries));dxtrace (dx_show_index ("node" , ((struct dx_node *) bh2->b_data)->entries)); - err =ext4_handle_dirty_metadata (handle, inode, bh2); + err =ext4_handle_dirty_metadata (handle, dir, bh2);if (err) goto journal_error;brelse (bh2);
@@ -1612,7 +1612,7 @@ static int ext4_dx_add_entry(handle_t *hif (err) goto journal_error; } - err =ext4_handle_dirty_metadata (handle, inode, frames[0 ].bh); + err =ext4_handle_dirty_metadata (handle, dir, frames[0 ].bh);if (err) {ext4_std_error (inode->i_sb, err); goto cleanup;
PATCH 172/264 ext4: let ext4_page_mkwrite stop started handle in failure
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongqiang Yang <[email protected]>
commit fcbb5515825f1bb20b7a6f75ec48bee61416f879 upstream.
The started journal handle should be stopped in failure case.
--- fs/ext4/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/inode.c +1 -0
@@ -4416,6 +4416,7 @@ retry_alloc: PAGE_CACHE_SIZE, NULL, do_journal_get_write_access)) {unlock_page (page); ret =VM_FAULT_SIGBUS ; +ext4_journal_stop (handle); goto out; }ext4_set_inode_state (inode,EXT4_STATE_JDATA );
PATCH 173/264 ext4: fix race in xattr block allocation path
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit 6d6a435190bdf2e04c9465cde5bdc3ac68cf11a4 upstream.
Ceph users reported that when using Ceph on ext4, the filesystem would often become corrupted, containing inodes with incorrect i_blocks counters.
I managed to reproduce this with a very hacked-up "streamtest" binary from the Ceph tree.
Ceph is doing a lot of xattr writes, to out-of-inode blocks. There is also another thread which does sync_file_range and close, of the same files. The problem appears to happen due to this race:
sync/flush thread xattr-set thread
----------------- ----------------
do_writepages ext4_xattr_set ext4_da_writepages ext4_xattr_set_handle mpage_da_map_blocks ext4_xattr_block_set
set DELALLOC_RESERVE
ext4_new_meta_blocks
ext4_mb_new_blocks
if (!i_delalloc_reserved_flag)
vfs_dq_alloc_blockext4_get_blocks
down_write(i_data_sem)
set i_delalloc_reserved_flag
...
up_write(i_data_sem)
if (i_delalloc_reserved_flag)
vfs_dq_alloc_block_nofailIn other words, the sync/flush thread pops in and sets i_delalloc_reserved_flag on the inode, which makes the xattr thread think that it's in a delalloc path in ext4_new_meta_blocks(), and add the block for a second time, after already having added it once in the !i_delalloc_reserved_flag case in ext4_mb_new_blocks
The real problem is that we shouldn't be using the DELALLOC_RESERVED state flag, and instead we should be passing EXT4_GET_BLOCKS_DELALLOC_RESERVE down to ext4_map_blocks() instead of using an inode state flag. We'll fix this for now with using i_data_sem to prevent this race, but this is really not the right way to fix things.
--- fs/ext4/xattr.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ext4/xattr.c +6 -0
@@ -820,8 +820,14 @@ inserted:if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) goal = goal &EXT4_MAX_BLOCK_FILE_PHYS ; +/* +* take i_data_sem because we will test +* i_delalloc_reserved_flag in ext4_mb_new_blocks +*/ +down_read ((&EXT4_I (inode)->i_data_sem)); block =ext4_new_meta_blocks (handle, inode, goal,0 ,NULL , &error); +up_read ((&EXT4_I (inode)->i_data_sem));if (error) goto cleanup;
PATCH 174/264 usb_storage: Dont freeze in usb-stor-scan
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit f02fe890ece7d695a5744b20525d45312382e6e4 upstream.
Scanning cannot be run during suspend or hibernation, but if usb-stor-scan freezes another thread waiting on scanning to complete may fail to freeze.
However, if usb-stor-scan is left freezable without ever actually freezing then the freezer will wait on it to exit, and threads waiting for scanning to finish will no longer be blocked. One problem with this approach is that usb-stor-scan has a delay to wait for devices to settle (which is currently the only point where it can freeze). To work around this we can request that the freezer send a fake signal when freezing, then use interruptible sleep to wake the thread early when freezing happens.
To make this happen, the following changes are made to usb-stor-scan:
* Use set_freezable_with_signal() instead of set_freezable() to request a fake signal when freezing
* Use wait_event_interruptible_timeout() instead of wait_event_freezable_timeout() to avoid freezing
--- drivers/usb/storage/usb.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/usb/storage/usb.c +13 -3
@@ -831,12 +831,22 @@ static int usb_stor_scan_thread(void * _dev_dbg (dev,"device found\n" ); -set_freezable (); -/* Wait for the timeout to expire or for a disconnect */ +set_freezable_with_signal (); +/* +* Wait for the timeout to expire or for a disconnect +* +* We can't freeze in this thread or we risk causing khubd to +* fail to freeze, but we can't be non-freezable either. Nor can +* khubd freeze while waiting for scanning to complete as it may +* hold the device lock, causing a hang when suspending devices. +* So we request a fake signal when freezing and use +* interruptible sleep to kick us out of our wait early when +* freezing happens. +*/ if (delay_use >0 ) {dev_dbg (dev,"waiting for device to settle " "before scanning\n" ); -wait_event_freezable_timeout (us->delay_wait, +wait_event_interruptible_timeout (us->delay_wait,test_bit (US_FLIDX_DONT_SCAN , &us->dflags), delay_use *HZ ); }
PATCH 175/264 xhci: If no endpoints changed, dont issue BW command.
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 2dc3753997f3c80ce8b950242ab9bb3fb936acfd upstream.
Some alternate interface settings have no endpoints associated with them. This shows up in some USB webcams, particularly the Logitech HD 1080p, which uses the uvcvideo driver. If a driver switches between two alt settings with no endpoints, there is no need to issue a configure endpoint command, because there is no endpoint information to update.
The only time a configure endpoint command with just the add slot flag set makes sense is when the driver is updating hub characteristics in the slot context. However, that code never calls xhci_check_bandwidth, so we should be safe not issuing a command if only the slot context add flag is set.
--- drivers/usb/host/xhci.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/host/xhci.c +6 -0
@@ -1888,6 +1888,12 @@ int xhci_check_bandwidth(struct usb_hcd ctrl_ctx->add_flags |=cpu_to_le32 (SLOT_FLAG ); ctrl_ctx->add_flags &=cpu_to_le32 (~EP0_FLAG ); ctrl_ctx->drop_flags &=cpu_to_le32 (~(SLOT_FLAG |EP0_FLAG )); + +/* Don't issue the command if there's no endpoints to update. */ +if (ctrl_ctx->add_flags ==cpu_to_le32 (SLOT_FLAG ) && + ctrl_ctx->drop_flags ==0 ) +return 0 ; +xhci_dbg (xhci,"New Input Control Context:\n" ); slot_ctx =xhci_get_slot_ctx (xhci, virt_dev->in_ctx); xhci_dbg_ctx(xhci, virt_dev->in_ctx,
PATCH 176/264 xHCI: test and clear RWC bit
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andiry Xu <[email protected]>
commit d2f52c9e585bbb1a3c164e02b8dcd0d996c67353 upstream.
Introduce xhci_test_and_clear_bit() to clear RWC bit in PORTSC register.
--- drivers/usb/host/xhci-hub.c | 22 ++++++++++++++++------ drivers/usb/host/xhci-ring.c | 6 ++---- drivers/usb/host/xhci.h | 2 ++ 3 files changed, 20 insertions(+), 10 deletions(-)
drivers/usb/host/xhci-hub.c +16 -6
@@ -392,6 +392,20 @@ static int xhci_get_ports(struct usb_hcdreturn max_ports; } +/* Test and clear port RWC bit */ +void xhci_test_and_clear_bit (struct xhci_hcd *xhci,__le32 __iomem **port_array, +int port_id,u32 port_bit) +{ +u32 temp; + + temp =xhci_readl (xhci, port_array[port_id]); +if (temp & port_bit) { + temp =xhci_port_state_to_neutral (temp); + temp |= port_bit; +xhci_writel (xhci, temp, port_array[port_id]); + } +} +int xhci_hub_control (struct usb_hcd *hcd,u16 typeReq,u16 wValue,u16 wIndex,char *buf,u16 wLength) {
@@ -938,12 +952,8 @@ int xhci_bus_resume(struct usb_hcd *hcd)spin_lock_irqsave (&xhci->lock, flags);/* Clear PLC */ - temp =xhci_readl (xhci, port_array[port_index]); -if (temp &PORT_PLC ) { - temp =xhci_port_state_to_neutral (temp); - temp |=PORT_PLC ; -xhci_writel (xhci, temp, port_array[port_index]); - } +xhci_test_and_clear_bit (xhci, port_array, port_index, +PORT_PLC ); slot_id =xhci_find_slot_id_by_port (hcd, xhci, port_index +1 );
drivers/usb/host/xhci-ring.c +2 -4
@@ -1344,10 +1344,8 @@ static void handle_port_status(struct xhxhci_ring_device (xhci, slot_id);xhci_dbg (xhci,"resume SS port %d finished\n" , port_id);/* Clear PORT_PLC */ - temp =xhci_readl (xhci, port_array[faked_port_index]); - temp =xhci_port_state_to_neutral (temp); - temp |=PORT_PLC ; -xhci_writel (xhci, temp, port_array[faked_port_index]); +xhci_test_and_clear_bit (xhci, port_array, + faked_port_index,PORT_PLC ); }else {xhci_dbg (xhci,"resume HS port %d\n" , port_id); bus_state->resume_done[faked_port_index] = jiffies +
drivers/usb/host/xhci.h +2 -0
@@ -1573,6 +1573,8 @@ void xhci_ring_ep_doorbell(struct xhci_h unsigned int ep_index, unsigned int stream_id);/* xHCI roothub code */ +void xhci_test_and_clear_bit (struct xhci_hcd *xhci,__le32 __iomem **port_array, +int port_id,u32 port_bit);int xhci_hub_control (struct usb_hcd *hcd,u16 typeReq,u16 wValue,u16 wIndex,char *buf,u16 wLength);int xhci_hub_status_data (struct usb_hcd *hcd,char *buf);
PATCH 177/264 xHCI: Clear PLC for USB2 root hub ports
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andiry Xu <[email protected]>
commit 6fd4562178508a0949c9fdecd8558d8b10d671bd upstream.
When the link state changes, xHC will report a port status change event and set the PORT_PLC bit, for both USB3 and USB2 root hub ports.
The PLC will be cleared by usbcore for USB3 root hub ports, but not for USB2 ports, because they do not report USB_PORT_STAT_C_LINK_STATE in wPortChange.
Clear it for USB2 root hub ports in handle_port_status().
--- drivers/usb/host/xhci-ring.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/host/xhci-ring.c +4 -0
@@ -1356,6 +1356,10 @@ static void handle_port_status(struct xh } } +if (hcd->speed !=HCD_USB3 ) +xhci_test_and_clear_bit (xhci, port_array, faked_port_index, +PORT_PLC ); + cleanup:/* Update event ring dequeue pointer before dropping the lock */ inc_deq (xhci, xhci->event_ring, true);
PATCH 178/264 powerpc: remove superfluous PageTail checks on the pte gup_fast
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 2839bdc1bfc0af76a2f0f11eca011590520a04fa upstream.
This part of gup_fast doesn't seem capable of handling hugetlbfs ptes, those should be handled by gup_hugepd only, so these checks are superfluous.
Plus if this wasn't a noop, it would have oopsed because, the insistence of using the speculative refcounting would trigger a VM_BUG_ON if a tail page was encountered in the page_cache_get_speculative().
--- arch/powerpc/mm/gup.c | 13 ------------- 1 file changed, 13 deletions(-)
arch/powerpc/mm/gup.c +0 -13
@@ -16,17 +16,6 @@#ifdef __HAVE_ARCH_PTE_SPECIAL -static inline void get_huge_page_tail (struct page *page) -{ -/* -* __split_huge_page_refcount() cannot run -* from under us. -*/ -VM_BUG_ON (page_mapcount (page) <0 ); -VM_BUG_ON (atomic_read (&page->_count) !=0 ); -atomic_inc (&page->_mapcount); -} -/* * The performance critical leaf functions are made noinline otherwise gcc * inlines everything into a single function which results in too much
@@ -58,8 +47,6 @@ static noinline int gup_pte_range(pmd_tput_page (page);return 0 ; } -if (PageTail (page)) -get_huge_page_tail (page); pages[*nr] = page; (*nr)++;
PATCH 179/264 powerpc: get_hugepte() dont put_page() the wrong page
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 405e44f2e312dd5dd63e5a9f459bffcbcd4368ef upstream.
"page" may have changed to point to the next hugepage after the loop completed, The references have been taken on the head page, so the put_page must happen there too.
This is a longstanding issue pre-thp inclusion.
It's totally unclear how these page_cache_add_speculative and pte_val(pte) != pte_val(*ptep) checks are necessary across all the powerpc gup_fast code, when x86 doesn't need any of that: there's no way the page can be freed with irq disabled so we're guaranteed the atomic_inc will happen on a page with page_count > 0 (so not needing the speculative check).
The pte check is also meaningless on x86: no need to rollback on x86 if the pte changed, because the pte can still change a CPU tick after the check succeeded and it won't be rolled back in that case. The important thing is we got a reference on a valid page that was mapped there a CPU tick ago. So not knowing the soft tlb refill code of ppc64 in great detail I'm not removing the "speculative" page_count increase and the pte checks across all the code, but unless there's a strong reason for it they should be later cleaned up too.
If a pte can change from huge to non-huge (like it could happen with THP) passing a pte_t *ptep to gup_hugepte() would also require to repeat the is_hugepd in gup_hugepte(), but that shouldn't happen with hugetlbfs only so I'm not altering that.
--- arch/powerpc/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/hugetlbpage.c +1 -1
@@ -429,7 +429,7 @@ static noinline int gup_hugepte(pte_t *pif (unlikely (pte_val (pte) !=pte_val (*ptep))) {/* Could be optimized better */ while (*nr) { -put_page (page); +put_page (head); (*nr)--; } }
PATCH 180/264 powerpc: gup_hugepte() avoid freeing the head page too many times
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 8596468487e2062cae2aad56e973784e03959245 upstream.
We only taken "refs" pins on the head page not "*nr" pins.
--- arch/powerpc/mm/hugetlbpage.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/mm/hugetlbpage.c +2 -3
@@ -428,10 +428,9 @@ static noinline int gup_hugepte(pte_t *pif (unlikely (pte_val (pte) !=pte_val (*ptep))) {/* Could be optimized better */ -while (*nr) { + *nr -= refs; +while (refs--)put_page (head); - (*nr)--; - } }return 1 ;
PATCH 181/264 powerpc: gup_hugepte() support THP based tail recounting
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 3526741f0964c88bc2ce511e1078359052bf225b upstream.
Up to this point the code assumed old refcounting for hugepages (pre-thp). This updates the code directly to the thp mapcount tail page refcounting.
--- arch/powerpc/mm/hugetlbpage.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
arch/powerpc/mm/hugetlbpage.c +23 -1
@@ -385,12 +385,23 @@ follow_huge_pmd(struct mm_struct *mm, unreturn NULL ; } +static inline void get_huge_page_tail (struct page *page) +{ +/* +* __split_huge_page_refcount() cannot run +* from under us. +*/ +VM_BUG_ON (page_mapcount (page) <0 ); +VM_BUG_ON (atomic_read (&page->_count) !=0 ); +atomic_inc (&page->_mapcount); +} + static noinline int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,unsigned long end,int write,struct page **pages,int *nr) {unsigned long mask;unsigned long pte_end; -struct page *head, *page; +struct page *head, *page, *tail;pte_t pte;int refs;
@@ -413,6 +424,7 @@ static noinline int gup_hugepte(pte_t *p head =pte_page (pte); page = head + ((addr & (sz-1 )) >>PAGE_SHIFT ); + tail = page; do { VM_BUG_ON(compound_head(page) != head); pages[*nr] = page;
@@ -431,6 +443,16 @@ static noinline int gup_hugepte(pte_t *p *nr -= refs;while (refs--)put_page (head); + }else { +/* +* Any tail page need their mapcount reference taken +* before we return. +*/ +while (refs--) { +if (PageTail (tail)) +get_huge_page_tail (tail); + tail++; + } }return 1 ;
PATCH 182/264 powerpc: gup_huge_pmd() return 0 if pte changes
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit cf592bf768c4fa40282b8fce58a80820065de2cb upstream.
powerpc didn't return 0 in that case, if it's rolling back the *nr pointer it should also return zero to avoid adding pages to the array at the wrong offset.
--- arch/powerpc/mm/hugetlbpage.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
arch/powerpc/mm/hugetlbpage.c +11 -10
@@ -443,16 +443,17 @@ static noinline int gup_hugepte(pte_t *p *nr -= refs;while (refs--)put_page (head); - }else { -/* -* Any tail page need their mapcount reference taken -* before we return. -*/ -while (refs--) { -if (PageTail (tail)) -get_huge_page_tail (tail); - tail++; - } +return 0 ; + } + +/* +* Any tail page need their mapcount reference taken before we +* return. +*/ +while (refs--) { +if (PageTail (tail)) +get_huge_page_tail (tail); + tail++; }return 1 ;
PATCH 183/264 s390: gup_huge_pmd() support THP tail recounting
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 220a2eb228d032acde60e9fd044ca802706ff583 upstream.
Up to this point the code assumed old refcounting for hugepages (pre-thp). This updates the code directly to the thp mapcount tail page refcounting.
--- arch/s390/mm/gup.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
arch/s390/mm/gup.c +23 -1
@@ -48,11 +48,22 @@ static inline int gup_pte_range(pmd_t *preturn 1 ; } +static inline void get_huge_page_tail (struct page *page) +{ +/* +* __split_huge_page_refcount() cannot run +* from under us. +*/ +VM_BUG_ON (page_mapcount (page) <0 ); +VM_BUG_ON (atomic_read (&page->_count) !=0 ); +atomic_inc (&page->_mapcount); +} +static inline int gup_huge_pmd (pmd_t *pmdp,pmd_t pmd,unsigned long addr,unsigned long end,int write,struct page **pages,int *nr) {unsigned long mask, result; -struct page *head, *page; +struct page *head, *page, *tail;int refs; result = write ?0 : _SEGMENT_ENTRY_RO;
@@ -64,6 +75,7 @@ static inline int gup_huge_pmd(pmd_t *pm refs =0 ; head =pmd_page (pmd); page = head + ((addr & ~PMD_MASK ) >>PAGE_SHIFT ); + tail = page; do { VM_BUG_ON(compound_head(page) != head); pages[*nr] = page;
@@ -81,6 +93,16 @@ static inline int gup_huge_pmd(pmd_t *pm *nr -= refs;while (refs--)put_page (head); + }else { +/* +* Any tail page need their mapcount reference taken +* before we return. +*/ +while (refs--) { +if (PageTail (tail)) +get_huge_page_tail (tail); + tail++; + } }return 1 ;
PATCH 184/264 s390: gup_huge_pmd() return 0 if pte changes
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 0693bc9ce2cc4f6a1b9c3c05790fc149a74c0b87 upstream.
s390 didn't return 0 in that case, if it's rolling back the *nr pointer it should also return zero to avoid adding pages to the array at the wrong offset.
--- arch/s390/mm/gup.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
arch/s390/mm/gup.c +11 -10
@@ -93,16 +93,17 @@ static inline int gup_huge_pmd(pmd_t *pm *nr -= refs;while (refs--)put_page (head); - }else { -/* -* Any tail page need their mapcount reference taken -* before we return. -*/ -while (refs--) { -if (PageTail (tail)) -get_huge_page_tail (tail); - tail++; - } +return 0 ; + } + +/* +* Any tail page need their mapcount reference taken before we +* return. +*/ +while (refs--) { +if (PageTail (tail)) +get_huge_page_tail (tail); + tail++; }return 1 ;
PATCH 185/264 sparc: gup_pte_range() support THP based tail recounting
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit e0d85a366c2300efd230ef82a9b22110b0658331 upstream.
Up to this point the code assumed old refcounting for hugepages (pre-thp).
This updates the code directly to the thp mapcount tail page refcounting.
--- arch/sparc/mm/gup.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/sparc/mm/gup.c +13 -0
@@ -12,6 +12,17 @@#include <linux/rwsem.h> #include <asm/pgtable.h> +static inline void get_huge_page_tail (struct page *page) +{ +/* +* __split_huge_page_refcount() cannot run +* from under us. +*/ +VM_BUG_ON (page_mapcount (page) <0 ); +VM_BUG_ON (atomic_read (&page->_count) !=0 ); +atomic_inc (&page->_mapcount); +} +/* * The performance critical leaf functions are made noinline otherwise gcc * inlines everything into a single function which results in too much
@@ -56,6 +67,8 @@ static noinline int gup_pte_range(pmd_tput_page (head);return 0 ; } +if (head != page) +get_huge_page_tail (page); pages[*nr] = page; (*nr)++;
PATCH 186/264 thp: share get_huge_page_tail()
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit b35a35b556f5e6b7993ad0baf20173e75c09ce8c upstream.
This avoids duplicating the function in every arch gup_fast.
--- arch/powerpc/mm/hugetlbpage.c | 11 ----------- arch/s390/mm/gup.c | 11 ----------- arch/sparc/mm/gup.c | 11 ----------- arch/x86/mm/gup.c | 11 ----------- include/linux/mm.h | 11 +++++++++++ 5 files changed, 11 insertions(+), 44 deletions(-)
arch/powerpc/mm/hugetlbpage.c +0 -11
@@ -385,17 +385,6 @@ follow_huge_pmd(struct mm_struct *mm, unreturn NULL ; } -static inline void get_huge_page_tail (struct page *page) -{ -/* -* __split_huge_page_refcount() cannot run -* from under us. -*/ -VM_BUG_ON (page_mapcount (page) <0 ); -VM_BUG_ON (atomic_read (&page->_count) !=0 ); -atomic_inc (&page->_mapcount); -} - static noinline int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,unsigned long end,int write,struct page **pages,int *nr) {
arch/s390/mm/gup.c +0 -11
@@ -48,17 +48,6 @@ static inline int gup_pte_range(pmd_t *preturn 1 ; } -static inline void get_huge_page_tail (struct page *page) -{ -/* -* __split_huge_page_refcount() cannot run -* from under us. -*/ -VM_BUG_ON (page_mapcount (page) <0 ); -VM_BUG_ON (atomic_read (&page->_count) !=0 ); -atomic_inc (&page->_mapcount); -} -static inline int gup_huge_pmd (pmd_t *pmdp,pmd_t pmd,unsigned long addr,unsigned long end,int write,struct page **pages,int *nr) {
arch/sparc/mm/gup.c +0 -11
@@ -12,17 +12,6 @@#include <linux/rwsem.h> #include <asm/pgtable.h> -static inline void get_huge_page_tail (struct page *page) -{ -/* -* __split_huge_page_refcount() cannot run -* from under us. -*/ -VM_BUG_ON (page_mapcount (page) <0 ); -VM_BUG_ON (atomic_read (&page->_count) !=0 ); -atomic_inc (&page->_mapcount); -} -/* * The performance critical leaf functions are made noinline otherwise gcc * inlines everything into a single function which results in too much
arch/x86/mm/gup.c +0 -11
@@ -108,17 +108,6 @@ static inline void get_head_page_multiplSetPageReferenced (page); } -static inline void get_huge_page_tail (struct page *page) -{ -/* -* __split_huge_page_refcount() cannot run -* from under us. -*/ -VM_BUG_ON (page_mapcount (page) <0 ); -VM_BUG_ON (atomic_read (&page->_count) !=0 ); -atomic_inc (&page->_mapcount); -} - static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr,unsigned long end,int write,struct page **pages,int *nr) {
include/linux/mm.h +11 -0
@@ -376,6 +376,17 @@ static inline int page_count(struct pagereturn atomic_read (&compound_head (page)->_count); } +static inline void get_huge_page_tail (struct page *page) +{ +/* +* __split_huge_page_refcount() cannot run +* from under us. +*/ +VM_BUG_ON (page_mapcount (page) <0 ); +VM_BUG_ON (atomic_read (&page->_count) !=0 ); +atomic_inc (&page->_mapcount); +} +extern bool __get_page_tail (struct page *page);static inline void get_page (struct page *page)
PATCH 187/264 net: Unlock sock before calling sk_free()
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit b0691c8ee7c28a72748ff32e91b165ec12ae4de6 ]
--- net/core/sock.c | 1 + 1 file changed, 1 insertion(+)
net/core/sock.c +1 -0
@@ -1260,6 +1260,7 @@ struct sock *sk_clone(const struct sock/* It is still raw copy of parent, so invalidate * destructor and make plain sk_free() */ newsk->sk_destruct =NULL ; +bh_unlock_sock (newsk);sk_free (newsk); newsk =NULL ; goto out;
PATCH 188/264 ALSA: ua101: fix crash when unplugging
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clemens Ladisch <[email protected]>
commit 862a6244eb9f9f5123fe819454fcfcae0ee1f2f9 upstream.
If the device is unplugged while running, it is possible for a PCM device to be closed after the disconnect callback has returned. This means that kill_stream_urb() and disable_iso_interface() would try to access already-invalid or freed USB data structures.
The function free_usb_related_resources() was intended to prevent this, but forgot to clear the affected variables.
--- sound/usb/misc/ua101.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
sound/usb/misc/ua101.c +21 -7
@@ -459,7 +459,8 @@ static void kill_stream_urbs(struct ua10unsigned int i;for (i =0 ; i < stream->queue_length; ++i) -usb_kill_urb (&stream->urbs[i]->urb); +if (stream->urbs[i]) +usb_kill_urb (&stream->urbs[i]->urb); }static int enable_iso_interface (struct ua101 *ua,unsigned int intf_index)
@@ -484,6 +485,9 @@ static void disable_iso_interface(struct {struct usb_host_interface *alts; +if (!ua->intf[intf_index]) +return ; + alts = ua->intf[intf_index]->cur_altsetting;if (alts->desc.bAlternateSetting !=0 ) { int err = usb_set_interface(ua->dev,
@@ -1144,27 +1148,37 @@ static void free_stream_urbs(struct ua10 {unsigned int i; -for (i =0 ; i < stream->queue_length; ++i) +for (i =0 ; i < stream->queue_length; ++i) {kfree (stream->urbs[i]); + stream->urbs[i] =NULL ; + } }static void free_usb_related_resources (struct ua101 *ua,struct usb_interface *interface) {unsigned int i; +struct usb_interface *intf; +mutex_lock (&ua->mutex);free_stream_urbs (&ua->capture);free_stream_urbs (&ua->playback); +mutex_unlock (&ua->mutex);free_stream_buffers (ua, &ua->capture);free_stream_buffers (ua, &ua->playback); -for (i =0 ; i <ARRAY_SIZE (ua->intf); ++i) -if (ua->intf[i]) { -usb_set_intfdata (ua->intf[i],NULL ); -if (ua->intf[i] != interface) +for (i =0 ; i <ARRAY_SIZE (ua->intf); ++i) { +mutex_lock (&ua->mutex); + intf = ua->intf[i]; + ua->intf[i] =NULL ; +mutex_unlock (&ua->mutex); +if (intf) { +usb_set_intfdata (intf,NULL ); +if (intf != interface)usb_driver_release_interface (&ua101_driver, - ua->intf[i]); + intf); } + } }static void ua101_card_free (struct snd_card *card)
PATCH 189/264 ALSA: hda - Disable power-widget control for IDT 92HD83/93 as default
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Chin <[email protected]>
commit 35c11777b906042eca9e6f1c03e464726c7faa07 upstream.
The power-widget control in patch_stac92hd83xxx() never worked properly, thus it's safer to turn it off as default for now.
--- sound/pci/hda/patch_sigmatel.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
sound/pci/hda/patch_sigmatel.c +1 -19
@@ -5625,26 +5625,8 @@ again:stac92xx_set_config_regs (codec, stac92hd83xxx_brd_tbl[spec->board_config]); -switch (codec->vendor_id) { -case 0x111d76d1 : -case 0x111d76d9 : -case 0x111d76df : -case 0x111d76e5 : -case 0x111d7666 : -case 0x111d7667 : -case 0x111d7668 : -case 0x111d7669 : -case 0x111d76e3 : -case 0x111d7604 : -case 0x111d76d4 : -case 0x111d7605 : -case 0x111d76d5 : -case 0x111d76e7 : -if (spec->board_config ==STAC_92HD83XXX_PWR_REF ) -break ; +if (spec->board_config !=STAC_92HD83XXX_PWR_REF ) spec->num_pwrs =0 ; -break ; - } codec->patch_ops = stac92xx_patch_ops;
PATCH 190/264 ALSA: hda - Add support for 92HD65 / 92HD66 family of codecs
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Chin <[email protected]>
commit ad5d8755116b431f0709c745ee17cb567a478d43 upstream.
These codecs have SPDIF-in, which is new to the 92HD83xxx compatible families, so a bit of logic is added to support them.
--- sound/pci/hda/patch_sigmatel.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +17 -1
@@ -5653,7 +5653,11 @@ again: }#endif - err =stac92xx_parse_auto_config (codec,0x1d ,0 ); +/* 92HD65/66 series has S/PDIF-IN */ +if (codec->vendor_id >=0x111d76e8 && codec->vendor_id <=0x111d76f3 ) + err =stac92xx_parse_auto_config (codec,0x1d ,0x22 ); +else + err =stac92xx_parse_auto_config (codec,0x1d ,0 );if (!err) {if (spec->board_config <0 ) { printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6543,6 +6547,18 @@ static const struct hda_codec_preset snd { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx}, {} /* terminator */ };
PATCH 191/264 ALSA: hda/realtek - Dont create alt-stream for capture when unnecessary
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 1fa1757366783fb52e6e85c2d735db49b818d382 upstream.
When the driver finds multiple ADCs, it tries to create an alternative capture PCM stream. However, these secondary ADCs might be useless or in uncontrolled paths in some cases, e.g. when auto-mic or dynamic ADC-switching is enabled. Also, when only a single capture source is available, the multi-streams don't make sense, too.
With this patch, the driver checks such condition and skips the alt stream appropriately.
--- sound/pci/hda/patch_realtek.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +6 -2
@@ -2232,6 +2232,7 @@ static int alc_build_pcms(struct hda_codstruct alc_spec *spec = codec->spec;struct hda_pcm *info = spec->pcm_rec;const struct hda_pcm_stream *p; +bool have_multi_adcs;int i; codec->num_pcms =1 ;
@@ -2310,8 +2311,11 @@ static int alc_build_pcms(struct hda_cod/* If the use of more than one ADC is requested for the current * model, configure a second analog capture-only PCM. */ + have_multi_adcs = (spec->num_adc_nids >1 ) && + !spec->dyn_adc_switch && !spec->auto_mic && + (!spec->input_mux || spec->input_mux->num_items >1 );/* Additional Analaog capture for index #2 */ -if (spec->alt_dac_nid || spec->num_adc_nids >1 ) { +if (spec->alt_dac_nid || have_multi_adcs) { codec->num_pcms =3 ; info = spec->pcm_rec +2 ; info->name = spec->stream_name_analog;
@@ -2327,7 +2331,7 @@ static int alc_build_pcms(struct hda_cod alc_pcm_null_stream; info->stream[SNDRV_PCM_STREAM_PLAYBACK ].nid =0 ; } -if (spec->num_adc_nids >1 ) { +if (have_multi_adcs) { p = spec->stream_analog_alt_capture;if (!p) p = &alc_pcm_analog_alt_capture;
PATCH 192/264 ALSA: hda/realtek - Skip invalid digital out pins
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 51e4152a969aa6d2306492ebf143932dcb535c9b upstream.
Some BIOS report invalid pins as digital output pins. The driver checks the connection but it doesn't do it fully correctly, and it leaves some undefined value as the audio-out widget, which makes the driver spewing warnings. This patch fixes the issue.
Reference: https://bugzilla.novell.com/show_bug.cgi?id=727348
--- sound/pci/hda/patch_realtek.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
sound/pci/hda/patch_realtek.c +7 -5
@@ -1566,27 +1566,29 @@ static void alc_auto_init_digital(structstatic void alc_auto_parse_digital (struct hda_codec *codec) {struct alc_spec *spec = codec->spec; -int i, err; +int i, err, nums;hda_nid_t dig_nid;/* support multiple SPDIFs; the secondary is set up as a slave */ + nums =0 ;for (i =0 ; i < spec->autocfg.dig_outs; i++) {hda_nid_t conn[4 ]; err =snd_hda_get_connections (codec, spec->autocfg.dig_out_pins[i], conn,ARRAY_SIZE (conn)); -if (err <0 ) +if (err <=0 )continue ; dig_nid = conn[0 ];/* assume the first element is audio-out */ -if (!i) { +if (!nums) { spec->multiout.dig_out_nid = dig_nid; spec->dig_out_type = spec->autocfg.dig_out_type[0 ]; }else { spec->multiout.slave_dig_outs = spec->slave_dig_outs; -if (i >=ARRAY_SIZE (spec->slave_dig_outs) -1 ) +if (nums >=ARRAY_SIZE (spec->slave_dig_outs) -1 )break ; - spec->slave_dig_outs[i -1 ] = dig_nid; + spec->slave_dig_outs[nums -1 ] = dig_nid; } + nums++; }if (spec->autocfg.dig_in_pin) {
PATCH 193/264 ALSA: hda - Fix silent output regression with ALC861
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 43dea228a3ba5463392281535dfb3d3fe56f4c2c upstream.
The 3.1 kernel has a regression for ALC861 codec where no sound output is heard with the default setup. It's because the amps in DACs aren't properly unmuted while the output mixers are assigned only to pins.
This patch fixes the missing initialization of DACs when no mixer is assigned to them.
--- sound/pci/hda/patch_realtek.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/pci/hda/patch_realtek.c +6 -0
@@ -3077,6 +3077,12 @@ static void alc_auto_set_output_and_unmuif (nid)snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_ZERO ); + +/* unmute DAC if it's not assigned to a mixer */ + nid =alc_look_for_out_mute_nid (codec, pin, dac); +if (nid == mix &&nid_has_mute (codec, dac,HDA_OUTPUT )) +snd_hda_codec_write (codec, dac,0 ,AC_VERB_SET_AMP_GAIN_MUTE , +AMP_OUT_ZERO ); }static void alc_auto_init_multi_out (struct hda_codec *codec)
PATCH 194/264 ALSA: hda - Fix a regression for DMA-position check with CA0110
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 69f9ba9b0cad67bc03f0a096f7f274de795ca844 upstream.
The regression-fix in 3.1 for the check of DMA-position validity caused yet another regression for CA0110. As usual, this hardware seems working only with LPIB properly. Adding the appropriate driver-caps bit to force LPIB fixes the problem.
--- sound/pci/hda/hda_intel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_intel.c +2 -2
@@ -2912,12 +2912,12 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, .class_mask = 0xffffff, .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | - AZX_DCAPS_RIRB_PRE_DELAY }, + AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, #else /* this entry seems still valid -- i.e. without emu20kx chip */ { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | - AZX_DCAPS_RIRB_PRE_DELAY }, + AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, #endif /* Vortex86MX */ { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC },
PATCH 195/264 drm/radeon: avoid bouncing connector status btw disconnected & unknown
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 340764465aa4a586ca332e61ae64883e5ad6f183 upstream.
Since force handling rework of d0d0a225e6ad43314c9aa7ea081f76adc5098ad4 we could end up bouncing connector status btw disconnected and unknown. When connector status change a call to output_poll_changed happen which in turn ask again for detect but with force set.
So set the load detect flags whenever we report the connector as connected or unknown this avoid bouncing btw disconnected and unknown.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +3 -2
@@ -764,7 +764,7 @@ radeon_vga_detect(struct drm_connector *if (radeon_connector->dac_load_detect && encoder) { encoder_funcs = encoder->helper_private; ret = encoder_funcs->detect (encoder, connector); -if (ret == connector_status_connected) +if (ret != connector_status_disconnected) radeon_connector->detected_by_load = true; } }
@@ -1005,8 +1005,9 @@ radeon_dvi_detect(struct drm_connector * ret = encoder_funcs->detect (encoder, connector);if (ret == connector_status_connected) { radeon_connector->use_digital = false; - radeon_connector->detected_by_load = true; } +if (ret != connector_status_disconnected) + radeon_connector->detected_by_load = true; }break ; }
PATCH 196/264 drm/radeon/kms: split MSI check into a separate function
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 8f6c25c59b0c895c68cae59d1b34e9a7b36971bc upstream.
This makes it easier to add quirks for certain systems.
--- drivers/gpu/drm/radeon/radeon_irq_kms.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/radeon_irq_kms.c +23 -6
@@ -108,6 +108,27 @@ void radeon_driver_irq_uninstall_kms(strradeon_irq_set (rdev); } +static bool radeon_msi_ok (struct radeon_device *rdev) +{ +/* RV370/RV380 was first asic with MSI support */ +if (rdev->family <CHIP_RV380 ) +return false; + +/* MSIs don't work on AGP */ +if (rdev->flags &RADEON_IS_AGP ) +return false; + +if (rdev->flags &RADEON_IS_IGP ) { +/* APUs work fine with MSIs */ +if (rdev->family >=CHIP_PALM ) +return true; +/* lots of IGPs have problems with MSIs */ +return false; + } + +return true; +} +int radeon_irq_kms_init (struct radeon_device *rdev) {int i;
@@ -124,12 +145,8 @@ int radeon_irq_kms_init(struct radeon_de }/* enable msi */ rdev->msi_enabled =0 ; -/* MSIs don't seem to work reliably on all IGP -* chips. Disable MSI on them for now. -*/ -if ((rdev->family >=CHIP_RV380 ) && - ((!(rdev->flags &RADEON_IS_IGP )) || (rdev->family >=CHIP_PALM )) && - (!(rdev->flags &RADEON_IS_AGP ))) { + +if (radeon_msi_ok (rdev)) {int ret =pci_enable_msi (rdev->pdev);if (!ret) { rdev->msi_enabled =1 ;
PATCH 197/264 drm/radeon/kms: Add MSI quirk for HP RS690
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit b362105f7f5223fa4d2e03ceeea0e51da754ccc6 upstream.
Some HP laptops only seem to work with MSIs. This looks like a platform/bios bug.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=37679
--- drivers/gpu/drm/radeon/radeon_irq_kms.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/radeon/radeon_irq_kms.c +7 -0
@@ -118,6 +118,13 @@ static bool radeon_msi_ok(struct radeon_if (rdev->flags &RADEON_IS_AGP )return false; +/* Quirks */ +/* HP RS690 only seems to work with MSIs. */ +if ((rdev->pdev->device ==0x791f ) && + (rdev->pdev->subsystem_vendor ==0x103c ) && + (rdev->pdev->subsystem_device ==0x30c2 )) +return true; +if (rdev->flags &RADEON_IS_IGP ) {/* APUs work fine with MSIs */ if (rdev->family >=CHIP_PALM )
PATCH 198/264 drm/radeon: set hpd polarity at init time so hotplug detect works
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 8ab250d4484b72ccc78e34276c5ffa84c1d41303 upstream.
Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up at module init so first hotplug works reliably no matter what is the initial set of connector.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/radeon_connectors.c +1 -0
@@ -1790,6 +1790,7 @@ radeon_add_atom_connector(struct drm_dev connector->polled =DRM_CONNECTOR_POLL_CONNECT ; }else connector->polled =DRM_CONNECTOR_POLL_HPD ; +radeon_hpd_set_polarity (rdev, radeon_connector->hpd.hpd); connector->display_info.subpixel_order = subpixel_order;drm_sysfs_connector_add (connector);
PATCH 199/264 drm/radeon/kms: properly set panel mode for eDP
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 00dfb8df5bf8c3afe4c0bb8361133156b06b7a2c upstream.
This should make eDP more reliable.
--- drivers/gpu/drm/radeon/atombios_dp.c | 11 +++++++++++ include/drm/drm_dp_helper.h | 3 +++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/radeon/atombios_dp.c +11 -0
@@ -553,6 +553,7 @@ static void radeon_dp_set_panel_mode(str {struct drm_device *dev = encoder->dev;struct radeon_device *rdev = dev->dev_private; +struct radeon_connector *radeon_connector =to_radeon_connector (connector);int panel_mode =DP_PANEL_MODE_EXTERNAL_DP_MODE ;if (!ASIC_IS_DCE4 (rdev))
@@ -560,10 +561,20 @@ static void radeon_dp_set_panel_mode(strif (radeon_connector_encoder_is_dp_bridge (connector)) panel_mode =DP_PANEL_MODE_INTERNAL_DP1_MODE ; +else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { +u8 tmp =radeon_read_dpcd_reg (radeon_connector,DP_EDP_CONFIGURATION_CAP ); +if (tmp &1 ) + panel_mode =DP_PANEL_MODE_INTERNAL_DP2_MODE ; + }atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP_PANEL_MODE , panel_mode); + +if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) && + (panel_mode ==DP_PANEL_MODE_INTERNAL_DP2_MODE )) { +radeon_write_dpcd_reg (radeon_connector,DP_EDP_CONFIGURATION_SET ,1 ); + } } void radeon_dp_set_link_config(struct drm_connector *connector,
include/drm/drm_dp_helper.h +3 -0
@@ -72,6 +72,7 @@#define DP_MAIN_LINK_CHANNEL_CODING 0x006 +#define DP_EDP_CONFIGURATION_CAP 0x00d#define DP_TRAINING_AUX_RD_INTERVAL 0x00e/* link configuration */
@@ -133,6 +134,8 @@#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108# define DP_SET_ANSI_8B10B (1 << 0) +#define DP_EDP_CONFIGURATION_SET 0x10a +#define DP_LANE0_1_STATUS 0x202#define DP_LANE2_3_STATUS 0x203# define DP_LANE_CR_DONE (1 << 0)
PATCH 200/264 drm/radeon/kms: Add MSI quirk for Dell RS690
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 01e718ec194e30b3e8eb3858c742c13649757efc upstream.
Some Dell laptops only seem to work with MSIs. This looks like a platform/bios bug.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=37679
--- drivers/gpu/drm/radeon/radeon_irq_kms.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/radeon/radeon_irq_kms.c +6 -0
@@ -125,6 +125,12 @@ static bool radeon_msi_ok(struct radeon_ (rdev->pdev->subsystem_device == 0x30c2))return true; +/* Dell RS690 only seems to work with MSIs. */ +if ((rdev->pdev->device ==0x791f ) && + (rdev->pdev->subsystem_vendor ==0x1028 ) && + (rdev->pdev->subsystem_device ==0x01fd )) +return true; +if (rdev->flags &RADEON_IS_IGP ) {/* APUs work fine with MSIs */ if (rdev->family >=CHIP_PALM )
PATCH 201/264 drm/radeon/kms: add MSI module parameter
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit a18cee15ed4c8b6a35f96b7b26a46bac32e04bd9 upstream.
Allow the user to override whether MSIs are enabled or not on supported ASICs. MSIs are disabled by default on IGP chips as they tend not to work. However certain IGP chips only seem to work with MSIs enabled.
I suspect this is a chipset or bios issue, but I'm not sure what the proper fix is. This will at least make diagnosing and working around the problem much easier.
See:
https://bugs.freedesktop.org/show_bug.cgi?id=37679
--- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_drv.c | 4 ++++ drivers/gpu/drm/radeon/radeon_irq_kms.c | 6 ++++++ 3 files changed, 11 insertions(+)
drivers/gpu/drm/radeon/radeon.h +1 -0
@@ -93,6 +93,7 @@ extern int radeon_audio;extern int radeon_disp_priority;extern int radeon_hw_i2c;extern int radeon_pcie_gen2; +extern int radeon_msi;/* * Copy from radeon_drv.h so we don't have to include both and have conflicting
drivers/gpu/drm/radeon/radeon_drv.c +4 -0
@@ -118,6 +118,7 @@ int radeon_audio = 0;int radeon_disp_priority =0 ;int radeon_hw_i2c =0 ;int radeon_pcie_gen2 =0 ; +int radeon_msi =-1 ;MODULE_PARM_DESC (no_wb,"Disable AGP writeback for scratch registers" );module_param_named (no_wb, radeon_no_wb, int,0444 );
@@ -164,6 +165,9 @@ module_param_named(hw_i2c, radeon_hw_i2cMODULE_PARM_DESC (pcie_gen2,"PCIE Gen2 mode (1 = enable)" );module_param_named (pcie_gen2, radeon_pcie_gen2, int,0444 ); +MODULE_PARM_DESC (msi,"MSI support (1 = enable, 0 = disable, -1 = auto)" ); +module_param_named (msi, radeon_msi, int,0444 ); +static int radeon_suspend (struct drm_device *dev,pm_message_t state) {drm_radeon_private_t *dev_priv = dev->dev_private;
drivers/gpu/drm/radeon/radeon_irq_kms.c +6 -0
@@ -118,6 +118,12 @@ static bool radeon_msi_ok(struct radeon_if (rdev->flags &RADEON_IS_AGP )return false; +/* force MSI on */ +if (radeon_msi ==1 ) +return true; +else if (radeon_msi ==0 ) +return false; +/* Quirks */ /* HP RS690 only seems to work with MSIs. */ if ((rdev->pdev->device == 0x791f) &&
PATCH 202/264 drm/radeon/kms: set HPD polarity in hpd_init()
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 64912e997f0fe13512e4c7b90e4f7c11cb922ab5 upstream.
Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up in hpd_init() so first hotplug works reliably no matter what is the initial set of connector. hpd_init() also covers resume so HPD will work correctly after resume as well.
--- drivers/gpu/drm/radeon/evergreen.c | 1 + drivers/gpu/drm/radeon/r100.c | 1 + drivers/gpu/drm/radeon/r600.c | 19 +++++++++---------- drivers/gpu/drm/radeon/radeon_connectors.c | 1 - drivers/gpu/drm/radeon/rs600.c | 1 + 5 files changed, 12 insertions(+), 11 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +1 -0
@@ -353,6 +353,7 @@ void evergreen_hpd_init(struct radeon_dedefault :break ; } +radeon_hpd_set_polarity (rdev, radeon_connector->hpd.hpd); }if (rdev->irq.installed)evergreen_irq_set (rdev);
drivers/gpu/drm/radeon/r100.c +1 -0
@@ -434,6 +434,7 @@ void r100_hpd_init(struct radeon_devicedefault :break ; } +radeon_hpd_set_polarity (rdev, radeon_connector->hpd.hpd); }if (rdev->irq.installed)r100_irq_set (rdev);
drivers/gpu/drm/radeon/r600.c +9 -10
@@ -762,13 +762,14 @@ void r600_hpd_init(struct radeon_devicestruct drm_device *dev = rdev->ddev;struct drm_connector *connector; -if (ASIC_IS_DCE3 (rdev)) { -u32 tmp =DC_HPDx_CONNECTION_TIMER (0x9c4 ) |DC_HPDx_RX_INT_TIMER (0xfa ); -if (ASIC_IS_DCE32 (rdev)) - tmp |= DC_HPDx_EN; +list_for_each_entry (connector, &dev->mode_config.connector_list, head) { +struct radeon_connector *radeon_connector =to_radeon_connector (connector); + +if (ASIC_IS_DCE3 (rdev)) { +u32 tmp =DC_HPDx_CONNECTION_TIMER (0x9c4 ) |DC_HPDx_RX_INT_TIMER (0xfa ); +if (ASIC_IS_DCE32 (rdev)) + tmp |= DC_HPDx_EN; -list_for_each_entry (connector, &dev->mode_config.connector_list, head) { -struct radeon_connector *radeon_connector =to_radeon_connector (connector);switch (radeon_connector->hpd.hpd) {case RADEON_HPD_1 :WREG32 (DC_HPD1_CONTROL , tmp);
@@ -798,10 +799,7 @@ void r600_hpd_init(struct radeon_devicedefault :break ; } - } - }else { -list_for_each_entry (connector, &dev->mode_config.connector_list, head) { -struct radeon_connector *radeon_connector =to_radeon_connector (connector); + }else {switch (radeon_connector->hpd.hpd) {case RADEON_HPD_1 :WREG32 (DC_HOT_PLUG_DETECT1_CONTROL , DC_HOT_PLUG_DETECTx_EN);
@@ -819,6 +817,7 @@ void r600_hpd_init(struct radeon_devicebreak ; } } +radeon_hpd_set_polarity (rdev, radeon_connector->hpd.hpd); }if (rdev->irq.installed)r600_irq_set (rdev);
drivers/gpu/drm/radeon/radeon_connectors.c +0 -1
@@ -1790,7 +1790,6 @@ radeon_add_atom_connector(struct drm_dev connector->polled =DRM_CONNECTOR_POLL_CONNECT ; }else connector->polled =DRM_CONNECTOR_POLL_HPD ; -radeon_hpd_set_polarity (rdev, radeon_connector->hpd.hpd); connector->display_info.subpixel_order = subpixel_order;drm_sysfs_connector_add (connector);
drivers/gpu/drm/radeon/rs600.c +1 -0
@@ -287,6 +287,7 @@ void rs600_hpd_init(struct radeon_devicedefault :break ; } +radeon_hpd_set_polarity (rdev, radeon_connector->hpd.hpd); }if (rdev->irq.installed)rs600_irq_set (rdev);
PATCH 203/264 kbuild: Fix help text not displayed in choice option.
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
commit 3f198dfee49d2e9c30583c62b0c79286c78c7b44 upstream.
Help text under choice menu is never displayed because it does not have symbol name associated with it, however many kconfigs have help text under choice, assuming that it will be displayed when user selects help. for example in Kconfig if we have:
choice
prompt "Choice"
---help---
HELP TEXT ...
config A
bool "A"
config B
bool "B"
endchoice
Without this patch "HELP TEXT" is not displayed when user selects help option when "Choice" is highlighted from menuconfig or xconfig or gconfig.
This patch changes the logic in menu_get_ext_help to display help for cases which dont have symbol names like choice.
--- scripts/kconfig/menu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
scripts/kconfig/menu.c +3 -4
@@ -597,11 +597,10 @@ void menu_get_ext_help(struct menu *menustruct symbol *sym = menu->sym;if (menu_has_help (menu)) { -if (sym->name) { +if (sym->name)str_printf (help,"%s%s:\n\n" ,CONFIG_ , sym->name); -str_append (help,_ (menu_get_help (menu))); -str_append (help,"\n" ); - } +str_append (help,_ (menu_get_help (menu))); +str_append (help,"\n" ); }else {str_append (help, nohelp_text); }
PATCH 204/264 PM / Runtime: Automatically retry failed autosuspends
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 886486b792e4f6f96d4fbe8ec5bf20811cab7d6a upstream.
Originally, the runtime PM core would send an idle notification whenever a suspend attempt failed. The idle callback routine could then schedule a delayed suspend for some time later.
However this behavior was changed by commit f71648d73c1650b8b4aceb3856bebbde6daa3b86 (PM / Runtime: Remove idle notification after failing suspend). No notifications were sent, and there was no clear mechanism to retry failed suspends.
This caused problems for the usbhid driver, because it fails autosuspend attempts as long as a key is being held down. Therefore this patch (as1492) adds a mechanism for retrying failed autosuspends. If the callback routine updates the last_busy field so that the next autosuspend expiration time is in the future, the autosuspend will automatically be rescheduled.
--- Documentation/power/runtime_pm.txt | 10 ++++++++++ drivers/base/power/runtime.c | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-)
Documentation/power/runtime_pm.txt +10 -0
@@ -782,6 +782,16 @@ will behave normally, not taking the aut Similarly, if the power.use_autosuspend field isn't set then the autosuspend helper functions will behave just like the non-autosuspend counterparts. +Under some circumstances a driver or subsystem may want to prevent a device +from autosuspending immediately, even though the usage counter is zero and the +autosuspend delay time has expired. If the ->runtime_suspend() callback +returns -EAGAIN or -EBUSY, and if the next autosuspend delay expiration time is +in the future (as it normally would be if the callback invoked +pm_runtime_mark_last_busy()), the PM core will automatically reschedule the +autosuspend. The ->runtime_suspend() callback can't do this rescheduling +itself because no suspend requests of any kind are accepted while the device is +suspending (i.e., while the callback is running). + The implementation is well suited for asynchronous use in interrupt contexts. However such use inevitably involves races, because the PM core can't synchronize ->runtime_suspend() callbacks with the arrival of I/O requests.
drivers/base/power/runtime.c +16 -2
@@ -285,6 +285,9 @@ static int rpm_callback(int (*cb)(struct* If a deferred resume was requested while the callback was running then carry * it out; otherwise send an idle notification for the device (if the suspend * failed) or for its parent (if the suspend succeeded). +* If ->runtime_suspend failed with -EAGAIN or -EBUSY, and if the RPM_AUTO +* flag is set and the next autosuspend-delay expiration time is in the +* future, schedule another autosuspend attempt. * * This function must be called under dev->power.lock with interrupts disabled. */
@@ -396,10 +399,21 @@ static int rpm_suspend(struct device *deif (retval) {__update_runtime_status (dev,RPM_ACTIVE ); dev->power.deferred_resume = false; -if (retval == -EAGAIN || retval == -EBUSY ) +if (retval == -EAGAIN || retval == -EBUSY ) { dev->power.runtime_error =0 ; -else + +/* +* If the callback routine failed an autosuspend, and +* if the last_busy time has been updated so that there +* is a new autosuspend expiration time, automatically +* reschedule another autosuspend. +*/ +if ((rpmflags &RPM_AUTO ) && +pm_runtime_autosuspend_expiration (dev) !=0 ) + goto repeat; + }else {pm_runtime_cancel_pending (dev); + } }else { no_callback:__update_runtime_status (dev,RPM_SUSPENDED );
PATCH 205/264 USB: Update last_busy time after autosuspend fails
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit b2c0a863e14676fa5760c6d828fd373288e2f64a upstream.
Originally, the runtime PM core would send an idle notification whenever a suspend attempt failed. The idle callback routine could then schedule a delayed suspend for some time later.
However this behavior was changed by commit f71648d73c1650b8b4aceb3856bebbde6daa3b86 (PM / Runtime: Remove idle notification after failing suspend). No notifications were sent, and there was no clear mechanism to retry failed suspends.
This caused problems for the usbhid driver, because it fails autosuspend attempts as long as a key is being held down. A companion patch changes the PM core's behavior, but we also need to change the USB core. In particular, this patch (as1493) updates the device's last_busy time when an autosuspend fails, so that the PM core will retry the autosuspend in the future when the delay time expires again.
--- drivers/usb/core/driver.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/core/driver.c +5 -0
@@ -1668,6 +1668,11 @@ int usb_runtime_suspend(struct device *dreturn -EAGAIN ; status =usb_suspend_both (udev,PMSG_AUTO_SUSPEND ); + +/* Allow a retry if autosuspend failed temporarily */ +if (status == -EAGAIN || status == -EBUSY ) +usb_mark_last_busy (udev); +/* The PM core reacts badly unless the return code is 0, * -EAGAIN, or -EBUSY, so always return -EBUSY on an error. */
PATCH 206/264 cciss: add small delay when using PCI Power Management to reset for kump
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Miller <[email protected]>
commit ab5dbebe33e0c353e8545f09c34553ac3351dad6 upstream.
The P600 requires a small delay when changing states. Otherwise we may think the board did not reset and we bail. This for kdump only and is particular to the P600.
--- drivers/block/cciss.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/block/cciss.c +7 -0
@@ -4533,6 +4533,13 @@ static int cciss_controller_hard_reset(s pmcsr &= ~PCI_PM_CTRL_STATE_MASK ; pmcsr |=PCI_D0 ;pci_write_config_word (pdev, pos +PCI_PM_CTRL , pmcsr); + +/* +* The P600 requires a small delay when changing states. +* Otherwise we may think the board did not reset and we bail. +* This for kdump only and is particular to the P600. +*/ +msleep (500 ); }return 0 ; }
PATCH 207/264 hwmon: (coretemp) Fix for non-SMP builds
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 2aba6cac2a84f3b80e11a680c34d55e7739b474d upstream.
The definition of TO_ATTR_NO in the non-SMP case is wrong. As the SMP definition resolves to the correct value, just use this for both cases.
Without this fix the temperature attributes are named temp0_* instead of temp2_*, so libsensors won't pick them. Broken since kernel 3.0.
--- drivers/hwmon/coretemp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwmon/coretemp.c +1 -2
@@ -60,14 +60,13 @@ MODULE_PARM_DESC(tjmax, "TjMax value in#ifdef CONFIG_SMP #define TO_PHYS_ID (cpu) cpu_data(cpu).phys_proc_id#define TO_CORE_ID (cpu) cpu_data(cpu).cpu_core_id -#define TO_ATTR_NO (cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)#define for_each_sibling (i, cpu) for_each_cpu(i, cpu_sibling_mask(cpu))#else #define TO_PHYS_ID (cpu) (cpu)#define TO_CORE_ID (cpu) (cpu) -#define TO_ATTR_NO (cpu) (cpu)#define for_each_sibling (i, cpu) for (i = 0; false; )#endif +#define TO_ATTR_NO (cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)/* * Per-Core Temperature Data
PATCH 208/264 hwmon: (w83627ehf) Properly report PECI and AMD-SI sensor types
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 2265cef2751b3441df91f85e0107f9f549e5b711 upstream.
When temperature sources are PECI or AMD-SI agents, it makes no sense to report their type as diode or thermistor. Instead we must report their digital nature.
--- drivers/hwmon/w83627ehf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/hwmon/w83627ehf.c +8 -1
@@ -1756,7 +1756,14 @@ static inline void __devinit w83627ehf_i diode =0x70 ; }for (i =0 ; i <3 ; i++) { -if ((tmp & (0x02 << i))) +const char *label = data->temp_label[data->temp_src[i]]; + +/* Digital source overrides analog type */ +if (strncmp (label,"PECI" ,4 ) ==0 ) + data->temp_type[i] =6 ; +else if (strncmp (label,"AMD" ,3 ) ==0 ) + data->temp_type[i] =5 ; +else if ((tmp & (0x02 << i))) data->temp_type[i] = (diode & (0x10 << i)) ?1 :3 ;else data->temp_type[i] =4 ;/* thermistor */
PATCH 209/264 hwmon: (w83627ehf) Fix broken driver init
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit bfa02b0da66965caf46e441270af87edda4fea14 upstream.
Commit 2265cef2 (hwmon: (w83627ehf) Properly report PECI and AMD-SI sensor types) results in kernel panic if data->temp_label was not initialized.
The problem was found with chip W83627DHG-P.
Add check if data->temp->label was set before use.
Based on incomplete patch by Alexander Beregalov.
--- drivers/hwmon/w83627ehf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/hwmon/w83627ehf.c +6 -3
@@ -1756,12 +1756,15 @@ static inline void __devinit w83627ehf_i diode =0x70 ; }for (i =0 ; i <3 ; i++) { -const char *label = data->temp_label[data->temp_src[i]]; +const char *label =NULL ; + +if (data->temp_label) + label = data->temp_label[data->temp_src[i]];/* Digital source overrides analog type */ -if (strncmp (label,"PECI" ,4 ) ==0 ) +if (label &&strncmp (label,"PECI" ,4 ) ==0 ) data->temp_type[i] =6 ; -else if (strncmp (label,"AMD" ,3 ) ==0 ) +else if (label &&strncmp (label,"AMD" ,3 ) ==0 ) data->temp_type[i] =5 ;else if ((tmp & (0x02 << i))) data->temp_type[i] = (diode & (0x10 << i)) ?1 :3 ;
PATCH 210/264 tcm_loop: Add explict read buffer memset for SCF_SCSI_CONTROL_SG_IO_CDB
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 8cd79f24350826b81e16990d9e12bc878e67d385 upstream.
This patch addresses an issue with buggy userspace code sending I/O via scsi-generic that does not explictly clear their associated read buffers. It adds an explict memset of the first SGL entry within tcm_loop_new_cmd_map() for SCF_SCSI_CONTROL_SG_IO_CDB payloads that are currently guaranteed to be a single SGL by target-core code.
This issue is a side effect of the v3.1-rc1 merge to remove the extra memcpy between certain control CDB types using a contigious
+ cleared buffer in target-core, and performing a memcpy into the SGL list within tcm_loop.
It was originally mainfesting itself by udev + scsi_id + scsi-generic not properly setting up the expected /dev/disk/by-id/ symlinks because the INQUIRY payload was containing extra bogus data preventing the proper NAA IEEE WWN from being parsed by userspace.
--- drivers/target/loopback/tcm_loop.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/target/loopback/tcm_loop.c +18 -0
@@ -174,6 +174,24 @@ static int tcm_loop_new_cmd_map(struct s sgl_bidi = sdb->table.sgl; sgl_bidi_count = sdb->table.nents; } +/* +* Because some userspace code via scsi-generic do not memset their +* associated read buffers, go ahead and do that here for type +* SCF_SCSI_CONTROL_SG_IO_CDB. Also note that this is currently +* guaranteed to be a single SGL for SCF_SCSI_CONTROL_SG_IO_CDB +* by target core in transport_generic_allocate_tasks() -> +* transport_generic_cmd_sequencer(). +*/ +if (se_cmd->se_cmd_flags &SCF_SCSI_CONTROL_SG_IO_CDB && + se_cmd->data_direction ==DMA_FROM_DEVICE ) { +struct scatterlist *sg =scsi_sglist (sc); +unsigned char *buf =kmap (sg_page (sg)) + sg->offset; + +if (buf !=NULL ) { +memset (buf,0 , sg->length); +kunmap (sg_page (sg)); + } + }/* Tell the core about our preallocated memory */ ret = transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc),
PATCH 211/264 iscsi-target: Add missing CMDSN_LOWER_THAN_EXP check in iscsit_handle_scsi_cmd
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 7e32da55e26b80d57961681e53aa67938268db3f upstream.
This patch adds a missing CMDSN_LOWER_THAN_EXP return check for iscsit_sequence_cmd() in iscsit_handle_scsi_cmd() that was incorrectly dropped during the v3.1-rc cleanups to use iscsit_sequence_cmd().
--- drivers/target/iscsi/iscsi_target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target.c +3 -1
@@ -1079,7 +1079,9 @@ attach_cmd:*/ if (!cmd->immediate_data) { cmdsn_ret =iscsit_sequence_cmd (conn, cmd, hdr->cmdsn); -if (cmdsn_ret ==CMDSN_ERROR_CANNOT_RECOVER ) +if (cmdsn_ret ==CMDSN_LOWER_THAN_EXP ) +return 0 ; +else if (cmdsn_ret ==CMDSN_ERROR_CANNOT_RECOVER )return iscsit_add_reject_from_cmd (ISCSI_REASON_PROTOCOL_ERROR ,1 ,0 , buf, cmd);
PATCH 212/264 iscsi-target: Fix non-immediate TMR handling
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 5a4c8666c6d576f076a7c6824589cdbb984c0f84 upstream.
This patch addresses two issues with non immediate TMR handling in iscsit_handle_task_mgt_cmd(). The first involves breakage due to v3.1-rc conversion of iscsit_sequence_cmd(), which upon good status would hit the iscsit_add_reject_from_cmd() block of code. This patch adds an explict check for CMDSN_ERROR_CANNOT_RECOVER.
The second adds a check to return when non immediate TMR operation is detected after iscsit_ack_from_expstatsn(), as iscsit_sequence_cmd() -> iscsit_execute_cmd() will have called transport_generic_handle_tmr() for the non immediate TMR case already.
--- drivers/target/iscsi/iscsi_target.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/target/iscsi/iscsi_target.c +3 -4
@@ -1821,17 +1821,16 @@ attach:int cmdsn_ret =iscsit_sequence_cmd (conn, cmd, hdr->cmdsn);if (cmdsn_ret ==CMDSN_HIGHER_THAN_EXP ) out_of_order_cmdsn =1 ; -else if (cmdsn_ret ==CMDSN_LOWER_THAN_EXP ) { +else if (cmdsn_ret ==CMDSN_LOWER_THAN_EXP )return 0 ; - }else {/* (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) */ +else if (cmdsn_ret ==CMDSN_ERROR_CANNOT_RECOVER )return iscsit_add_reject_from_cmd (ISCSI_REASON_PROTOCOL_ERROR ,1 ,0 , buf, cmd); - } }iscsit_ack_from_expstatsn (conn, hdr->exp_statsn); -if (out_of_order_cmdsn) +if (out_of_order_cmdsn || !(hdr->opcode &ISCSI_OP_IMMEDIATE ))return 0 ;/* * Found the referenced task, send to transport for processing.
PATCH 213/264 st: fix race in st_scsi_execute_end
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Uzel <[email protected]>
commit c68bf8eeaa57c852e74adcf597237be149eef830 upstream.
The call to complete() in st_scsi_execute_end() wakes up sleeping thread in write_behind_check(), which frees the st_request, thus invalidating the pointer to the associated bio structure, which is then passed to the blk_rq_unmap_user(). Fix by storing pointer to bio structure into temporary local variable.
This bug is present since at least linux-2.6.32.
--- drivers/scsi/st.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/st.c +3 -1
@@ -462,14 +462,16 @@ static void st_scsi_execute_end(struct r {struct st_request *SRpnt = req->end_io_data;struct scsi_tape *STp = SRpnt->stp; +struct bio *tmp; STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors; STp->buffer->cmdstat.residual = req->resid_len; + tmp = SRpnt->bio;if (SRpnt->waiting)complete (SRpnt->waiting); -blk_rq_unmap_user (SRpnt->bio); +blk_rq_unmap_user (tmp);__blk_put_request (req->q, req); }
PATCH 214/264 scsi_dh: check queuedata pointer before proceeding further
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Moger, Babu" <[email protected]>
commit a18a920c70d48a8e4a2b750d8a183b3c1a4be514 upstream.
This patch validates sdev pointer in scsi_dh_activate before proceeding further.
Without this check we might see the panic as below. I have seen this panic multiple times..
Call trace:
#0 [ffff88007d647b50] machine_kexec at ffffffff81020902 #1 [ffff88007d647ba0] crash_kexec at ffffffff810875b0 #2 [ffff88007d647c70] oops_end at ffffffff8139c650
#3 [ffff88007d647c90] __bad_area_nosemaphore at ffffffff8102dd15 #4 [ffff88007d647d50] page_fault at ffffffff8139b8cf
[exception RIP: scsi_dh_activate+0x82]
RIP: ffffffffa0041922 RSP: ffff88007d647e00 RFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000000000093c5
RDX: 00000000000093c5 RSI: ffffffffa02e6640 RDI: ffff88007cc88988
RBP: 000000000000000f R8: ffff88007d646000 R9: 0000000000000000
R10: ffff880082293790 R11: 00000000ffffffff R12: ffff88007cc88988
R13: 0000000000000000 R14: 0000000000000286 R15: ffff880037b845e0
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0000 #5 [ffff88007d647e38] run_workqueue at ffffffff81060268 #6 [ffff88007d647e78] worker_thread at ffffffff81060386 #7 [ffff88007d647ee8] kthread at ffffffff81064436 #8 [ffff88007d647f48] kernel_thread at ffffffff81003fba
--- drivers/scsi/device_handler/scsi_dh.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/scsi/device_handler/scsi_dh.c +9 -1
@@ -398,7 +398,15 @@ int scsi_dh_activate(struct request_queuspin_lock_irqsave (q->queue_lock, flags); sdev = q->queuedata; -if (sdev && sdev->scsi_dh_data) +if (!sdev) { +spin_unlock_irqrestore (q->queue_lock, flags); + err =SCSI_DH_NOSYS ; +if (fn) +fn (data, err); +return err; + } + +if (sdev->scsi_dh_data) scsi_dh = sdev->scsi_dh_data->scsi_dh; dev =get_device (&sdev->sdev_gendev); if (!scsi_dh || !dev ||
PATCH 215/264 Make scsi_free_queue() kill pending SCSI commands
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 3308511c93e6ad0d3c58984ecd6e5e57f96b12c8 upstream.
Make sure that SCSI device removal via scsi_remove_host() does finish all pending SCSI commands. Currently that's not the case and hence removal of a SCSI host during I/O can cause a deadlock. See also "blkdev_issue_discard() hangs forever if underlying storage device is removed" (http://bugzilla.kernel.org/show_bug.cgi?id=40472). See also
http://lkml.org/lkml/2011/8/27/6.
--- drivers/scsi/hosts.c | 9 ++++++--- drivers/scsi/scsi_lib.c | 9 +++++++++ 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/scsi/hosts.c +6 -3
@@ -286,6 +286,7 @@ static void scsi_host_dev_release(struct {struct Scsi_Host *shost =dev_to_shost (dev);struct device *parent = dev->parent; +struct request_queue *q;scsi_proc_hostdir_rm (shost->hostt);
@@ -293,9 +294,11 @@ static void scsi_host_dev_release(structkthread_stop (shost->ehandler);if (shost->work_q)destroy_workqueue (shost->work_q); -if (shost->uspace_req_q) { -kfree (shost->uspace_req_q->queuedata); -scsi_free_queue (shost->uspace_req_q); + q = shost->uspace_req_q; +if (q) { +kfree (q->queuedata); + q->queuedata =NULL ; +scsi_free_queue (q); }scsi_destroy_command_freelist (shost);
drivers/scsi/scsi_lib.c +9 -0
@@ -1698,6 +1698,15 @@ struct request_queue *scsi_alloc_queue(svoid scsi_free_queue (struct request_queue *q) { +unsigned long flags; + +WARN_ON (q->queuedata); + +/* cause scsi_request_fn() to kill all non-finished requests */ +spin_lock_irqsave (q->queue_lock, flags); + q->request_fn (q); +spin_unlock_irqrestore (q->queue_lock, flags); +blk_cleanup_queue (q); }
PATCH 216/264 Fix block queue and elevator memory leak in scsi_alloc_sdev
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit f7c9c6bb14f3104608a3a83cadea10a6943d2804 upstream.
When looking at memory consumption issues I noticed quite a lot of memory in the kmalloc-2048 bucket:
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
6561 6471 98% 2.30K 243 27 15552K kmalloc-2048
Over 15MB. slub debug shows that cfq is responsible for almost all of it:
# sort -nr /sys/kernel/slab/kmalloc-2048/alloc_calls 6402 .cfq_init_queue+0xec/0x460 age=43423/43564/43655 pid=1 cpus=4,11,13
In scsi_alloc_sdev we do scsi_alloc_queue but if slave_alloc fails we don't free it with scsi_free_queue.
The patch below fixes the issue:
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
135 72 53% 2.30K 5 27 320K kmalloc-2048
# cat /sys/kernel/slab/kmalloc-2048/alloc_calls 3 .cfq_init_queue+0xec/0x460 age=3811/3876/3925 pid=1 cpus=4,11,13
--- drivers/scsi/scsi_scan.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/scsi_scan.c +1 -0
@@ -322,6 +322,7 @@ out_device_destroy:scsi_device_set_state (sdev,SDEV_DEL );transport_destroy_device (&sdev->sdev_gendev);put_device (&sdev->sdev_dev); +scsi_free_queue (sdev->request_queue);put_device (&sdev->sdev_gendev); out:if (display_failure_msg)
PATCH 217/264 mpt2sas: Fix for system hang when discovery in progress
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 0167ac67ff6f35bf2364f7672c8012b0cd40277f upstream.
Fix for issue : While discovery is in progress, hot unplug and hot plug of enclosure connected to the controller card is causing system to hang.
When a device is in the process of being detected at driver load time then if it is removed, the device that is no longer present will not be added to the list. So the code in _scsih_probe_sas() is rearranged as such so the devices that failed to be detected are not added to the list.
--- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_scsih.c +10 -5
@@ -7461,22 +7461,27 @@ _scsih_probe_sas(struct MPT2SAS_ADAPTER/* SAS Device List */ list_for_each_entry_safe (sas_device, next, &ioc->sas_device_init_list, list) { -spin_lock_irqsave (&ioc->sas_device_lock, flags); -list_move_tail (&sas_device->list, &ioc->sas_device_list); -spin_unlock_irqrestore (&ioc->sas_device_lock, flags);if (ioc->hide_drives)continue ;if (!mpt2sas_transport_port_add (ioc, sas_device->handle, sas_device->sas_address_parent)) { -_scsih_sas_device_remove (ioc, sas_device); +list_del (&sas_device->list); +kfree (sas_device); +continue ; }else if (!sas_device->starget) {mpt2sas_transport_port_remove (ioc, sas_device->sas_address, sas_device->sas_address_parent); -_scsih_sas_device_remove (ioc, sas_device); +list_del (&sas_device->list); +kfree (sas_device); +continue ; + } +spin_lock_irqsave (&ioc->sas_device_lock, flags); +list_move_tail (&sas_device->list, &ioc->sas_device_list); +spin_unlock_irqrestore (&ioc->sas_device_lock, flags); } }
PATCH 218/264 ASoC: wm8711: Fix wrong mask for setting input audio data bit length select
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit 04c57163c8edfbc50e022737014069998ba4fc5f upstream.
The Input Audio Data Bit Length Select is controlled by BIT[3:2] of WM8711_IFACE(07h) register.
Current code incorrectly masks BIT[1:0] which is for Audio Data Format Select.
--- sound/soc/codecs/wm8711.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8711.c +1 -1
@@ -150,7 +150,7 @@ static int wm8711_hw_params(struct snd_p {struct snd_soc_codec *codec = dai->codec;struct wm8711_priv *wm8711 =snd_soc_codec_get_drvdata (codec); -u16 iface =snd_soc_read (codec,WM8711_IFACE ) &0xfffc ; +u16 iface =snd_soc_read (codec,WM8711_IFACE ) &0xfff3 ;int i =get_coeff (wm8711->sysclk,params_rate (params));u16 srate = (coeff_div[i].sr <<2 ) | (coeff_div[i].bosr <<1 ) | coeff_div[i].usb;
PATCH 219/264 ASoC: Leave input audio data bit length settings untouched in wm8711_set_dai_fmt
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit d558cfc30064a97c2c65dbd2b3a4f5a1dea7ec1b upstream.
Current implementation in wm8711_set_dai_fmt always clear BIT[3:2] (the Input Audio Data Bit Length Select) of WM8711_IFACE(07h) register. Input Audio Data Bit Length Select bits are set by wm8711_hw_params, we should leave BIT[3:2] untouched in wm8711_set_dai_fmt.
--- sound/soc/codecs/wm8711.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8711.c +1 -1
@@ -231,7 +231,7 @@ static int wm8711_set_dai_fmt(struct snd unsigned int fmt) {struct snd_soc_codec *codec = codec_dai->codec; -u16 iface =0 ; +u16 iface =snd_soc_read (codec,WM8711_IFACE ) &0x000c ;/* set master/slave audio interface */ switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) {
PATCH 220/264 ASoC: WM8904: Set `invert bit for Capture Switch
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hong Xu <[email protected]>
commit 5a7c5f26df3c0122814dfa1c13ef6dfbdbffdb86 upstream.
Set `invert' bit for Capture Switch. Otherwise analogue is muted when Capture Switch is ON.
--- sound/soc/codecs/wm8904.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8904.c +1 -1
@@ -868,7 +868,7 @@ SOC_ENUM("Right Capture Mode", rin_mode)SOC_DOUBLE_R ("Capture Volume" ,WM8904_ANALOGUE_LEFT_INPUT_0 ,WM8904_ANALOGUE_RIGHT_INPUT_0 ,0 ,31 ,0 ),SOC_DOUBLE_R ("Capture Switch" ,WM8904_ANALOGUE_LEFT_INPUT_0 , -WM8904_ANALOGUE_RIGHT_INPUT_0 ,7 ,1 ,0 ), +WM8904_ANALOGUE_RIGHT_INPUT_0 ,7 ,1 ,1 ),SOC_SINGLE ("High Pass Filter Switch" ,WM8904_ADC_DIGITAL_0 ,4 ,1 ,0 ), SOC_ENUM("High Pass Filter Mode", hpf_mode),
PATCH 221/264 ASoC: Ensure WM8962 PLL registers are reset
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 4f4488abc97c1c27ff029f887944e6a6da1f5733 upstream.
The WM8962 has a separate software reset for the PLL registers. Ensure that these are reset also on startup.
--- sound/soc/codecs/wm8962.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/codecs/wm8962.c +7 -1
@@ -1959,7 +1959,13 @@ static int wm8962_readable_register(strustatic int wm8962_reset (struct snd_soc_codec *codec) { -return snd_soc_write (codec,WM8962_SOFTWARE_RESET ,0x6243 ); +int ret; + + ret =snd_soc_write (codec,WM8962_SOFTWARE_RESET ,0x6243 ); +if (ret !=0 ) +return ret; + +return snd_soc_write (codec,WM8962_PLL_SOFTWARE_RESET ,0 ); } static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0);
PATCH 222/264 ASoC: Ensure the WM8962 oscillator and PLLs start up disabled
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 2af8de8c39cf58e5a5e40a9d5d71332da98e6ba7 upstream.
Since there is no current software control for these they would otherwise be left enabled, consuming power.
--- sound/soc/codecs/wm8962.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/codecs/wm8962.c +5 -0
@@ -3854,6 +3854,11 @@ static int wm8962_probe(struct snd_soc_csnd_soc_update_bits (codec,WM8962_CLOCKING2 ,WM8962_CLKREG_OVD ,WM8962_CLKREG_OVD ); +/* Ensure that the oscillator and PLLs are disabled */ +snd_soc_update_bits (codec,WM8962_PLL2 , +WM8962_OSC_ENA |WM8962_PLL2_ENA |WM8962_PLL3_ENA , +0 ); +regulator_bulk_disable (ARRAY_SIZE (wm8962->supplies), wm8962->supplies);if (pdata) {
PATCH 223/264 ASoC: Ensure we always delay for WM8962 FLL when starting from SYSCLK
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 0b7dd6ad92b6cace35dc5d06d6e236c2751c85dc upstream.
--- sound/soc/codecs/wm8962.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
sound/soc/codecs/wm8962.c +7 -8
@@ -2233,15 +2233,14 @@ static int sysclk_event(struct snd_soc_dsnd_soc_update_bits (codec,WM8962_FLL_CONTROL_1 ,WM8962_FLL_ENA ,WM8962_FLL_ENA ); -if (wm8962->irq) { - timeout =msecs_to_jiffies (5 ); - timeout =wait_for_completion_timeout (&wm8962->fll_lock, - timeout); -if (timeout ==0 ) -dev_err (codec->dev, -"Timed out starting FLL\n" ); - } + timeout =msecs_to_jiffies (5 ); + timeout =wait_for_completion_timeout (&wm8962->fll_lock, + timeout); + +if (wm8962->irq && timeout ==0 ) +dev_err (codec->dev, +"Timed out starting FLL\n" ); }break ;
PATCH 224/264 NFS/sunrpc: dont use a credential with extra groups.
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit dc6f55e9f8dac4b6479be67c5c9128ad37bb491f upstream.
The sunrpc layer keeps a cache of recently used credentials and 'unx_match' is used to find the credential which matches the current process.
However unx_match allows a match when the cached credential has extra groups at the end of uc_gids list which are not in the process group list.
So if a process with a list of (say) 4 group accesses a file and gains access because of the last group in the list, then another process with the same uid and gid, and a gid list being the first tree of the gids of the original process tries to access the file, it will be granted access even though it shouldn't as the wrong rpc credential will be used.
--- net/sunrpc/auth_unix.c | 3 +++ 1 file changed, 3 insertions(+)
net/sunrpc/auth_unix.c +3 -0
@@ -129,6 +129,9 @@ unx_match(struct auth_cred *acred, strucfor (i =0 ; i < groups ; i++)if (cred->uc_gids[i] !=GROUP_AT (acred->group_info, i))return 0 ; +if (groups <NFS_NGROUPS && + cred->uc_gids[groups] !=NOGROUP ) +return 0 ;return 1 ; }
PATCH 225/264 block: make gendisk hold a reference to its queue
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit f992ae801a7dec34a4ed99a6598bbbbfb82af4fb upstream.
The following command sequence triggers an oops.
# mount /dev/sdb1 /mnt # echo 1 > /sys/class/scsi_device/0\:0\:1\:0/device/delete # umount /mnt
general protection fault: 0000 [#1] PREEMPT SMP CPU 2 Modules linked in:
Pid: 791, comm: umount Not tainted 3.1.0-rc3-work+ #8 Bochs Bochs
RIP: 0010:[<ffffffff810d0879>] [<ffffffff810d0879>] __lock_acquire+0x389/0x1d60 ... Call Trace: [<ffffffff810d2845>] lock_acquire+0x95/0x140 [<ffffffff81aed87b>] _raw_spin_lock+0x3b/0x50 [<ffffffff811573bc>] bdi_lock_two+0x5c/0x70 [<ffffffff811c2f6c>] bdev_inode_switch_bdi+0x4c/0xf0 [<ffffffff811c3fcb>] __blkdev_put+0x11b/0x1d0 [<ffffffff811c4010>] __blkdev_put+0x160/0x1d0 [<ffffffff811c40df>] blkdev_put+0x5f/0x190 [<ffffffff8118f18d>] kill_block_super+0x4d/0x80 [<ffffffff8118f4a5>] deactivate_locked_super+0x45/0x70 [<ffffffff8119003a>] deactivate_super+0x4a/0x70 [<ffffffff811ac4ad>] mntput_no_expire+0xed/0x130 [<ffffffff811acf2e>] sys_umount+0x7e/0x3a0 [<ffffffff81aeeeab>] system_call_fastpath+0x16/0x1b
This is because bdev holds on to disk but disk doesn't pin the associated queue. If a SCSI device is removed while the device is still open, the sdev puts the base reference to the queue on release. When the bdev is finally released, the associated queue is already gone along with the bdi and bdev_inode_switch_bdi() ends up dereferencing already freed bdi.
Even if it were not for this bug, disk not holding onto the associated queue is very unusual and error-prone.
Fix it by making add_disk() take an extra reference to its queue and put it on disk_release() and ensuring that disk and its fops owner are put in that order after all accesses to the disk and queue are complete.
--- block/genhd.c | 8 ++++++++ fs/block_dev.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-)
block/genhd.c +8 -0
@@ -611,6 +611,12 @@ void add_disk(struct gendisk *disk)register_disk (disk);blk_register_queue (disk); +/* +* Take an extra ref on queue which will be put on disk_release() +* so that it sticks around as long as @disk is there. +*/ +WARN_ON_ONCE (blk_get_queue (disk->queue)); + retval =sysfs_create_link (&disk_to_dev (disk)->kobj, &bdi->dev->kobj,"bdi" );WARN_ON (retval);
@@ -1095,6 +1101,8 @@ static void disk_release(struct device *disk_replace_part_tbl (disk,NULL );free_part_stats (&disk->part0);free_part_info (&disk->part0); +if (disk->queue) +blk_put_queue (disk->queue);kfree (disk); }struct class block_class = {
fs/block_dev.c +8 -5
@@ -1085,6 +1085,7 @@ static int __blkdev_put(struct block_devstatic int __blkdev_get (struct block_device *bdev,fmode_t mode,int for_part) {struct gendisk *disk; +struct module *owner;int ret;int partno;int perm =0 ;
@@ -1110,6 +1111,7 @@ static int __blkdev_get(struct block_dev disk =get_gendisk (bdev->bd_dev, &partno);if (!disk) goto out; + owner = disk->fops->owner;disk_block_events (disk);mutex_lock_nested (&bdev->bd_mutex, for_part);
@@ -1137,8 +1139,8 @@ static int __blkdev_get(struct block_dev bdev->bd_disk =NULL ;mutex_unlock (&bdev->bd_mutex);disk_unblock_events (disk); -module_put (disk->fops->owner);put_disk (disk); +module_put (owner); goto restart; } }
@@ -1194,8 +1196,8 @@ static int __blkdev_get(struct block_dev goto out_unlock_bdev; }/* only one opener holds refs to the module and disk */ -module_put (disk->fops->owner);put_disk (disk); +module_put (owner); } bdev->bd_openers++;if (for_part)
@@ -1215,8 +1217,8 @@ static int __blkdev_get(struct block_dev out_unlock_bdev:mutex_unlock (&bdev->bd_mutex);disk_unblock_events (disk); -module_put (disk->fops->owner);put_disk (disk); +module_put (owner); out:bdput (bdev);
@@ -1442,14 +1444,15 @@ static int __blkdev_put(struct block_devif (!bdev->bd_openers) {struct module *owner = disk->fops->owner; -put_disk (disk); -module_put (owner);disk_put_part (bdev->bd_part); bdev->bd_part =NULL ; bdev->bd_disk =NULL ;if (bdev != bdev->bd_contains) victim = bdev->bd_contains; bdev->bd_contains =NULL ; + +put_disk (disk); +module_put (owner); }mutex_unlock (&bdev->bd_mutex);bdput (bdev);
PATCH 226/264 xen/blkback: Report VBD_WSECT (wr_sect) properly.
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 5c62cb48602dba95159c81ffeca179d3852e25be upstream.
We did not increment the amount of sectors written to disk b/c we tested for the == WRITE which is incorrect - as the operations are more of WRITE_FLUSH, WRITE_ODIRECT. This patch fixes it by doing a & WRITE check.
--- drivers/block/xen-blkback/blkback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkback/blkback.c +1 -1
@@ -685,7 +685,7 @@ static int dispatch_rw_block_io(struct xif (operation ==READ ) blkif->st_rd_sect += preq.nr_sects; -else if (operation ==WRITE || operation ==WRITE_FLUSH ) +else if (operation &WRITE ) blkif->st_wr_sect += preq.nr_sects;return 0 ;
PATCH 227/264 VFS: fix statfs() automounter semantics regression
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan McGee <[email protected]>
commit 5c8a0fbba543d9428a486f0d1282bbcf3cf1d95a upstream.
No one in their right mind would expect statfs() to not work on a automounter managed mount point. Fix it.
[ I'm not sure about the "no one in their right mind" part. It's not
mounted, and you didn't ask for it to be mounted. But nobody will really care, and this probably makes it match previous semantics, so..
- Linus ]
This mirrors the fix made to the quota code in 815d405ceff0d69646.
--- fs/statfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/statfs.c +1 -1
@@ -76,7 +76,7 @@ EXPORT_SYMBOL(vfs_statfs);int user_statfs (const char __user *pathname,struct kstatfs *st) {struct path path; -int error =user_path (pathname, &path); +int error =user_path_at (AT_FDCWD , pathname,LOOKUP_FOLLOW |LOOKUP_AUTOMOUNT , &path);if (!error) { error =vfs_statfs (&path, st);path_put (&path);
PATCH 228/264 hpsa: add small delay when using PCI Power Management to reset for kump
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Miller <[email protected]>
commit c4853efec665134b2e6fc9c13447323240980351 upstream.
The P600 requires a small delay when changing states. Otherwise we may think the board did not reset and we bail. This for kdump only and is particular to the P600.
--- drivers/scsi/hpsa.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/hpsa.c +7 -0
@@ -3300,6 +3300,13 @@ static int hpsa_controller_hard_reset(st pmcsr &= ~PCI_PM_CTRL_STATE_MASK ; pmcsr |=PCI_D0 ;pci_write_config_word (pdev, pos +PCI_PM_CTRL , pmcsr); + +/* +* The P600 requires a small delay when changing states. +* Otherwise we may think the board did not reset and we bail. +* This for kdump only and is particular to the P600. +*/ +msleep (500 ); }return 0 ; }
PATCH 229/264 blk-flush: fix invalid BUG_ON in blk_insert_flush
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Moyer <[email protected]>
commit 834f9f61a525d2f6d3d0c93894e26326c8d3ceed upstream.
A user reported a regression due to commit 4853abaae7e4a2af938115ce9071ef8684fb7af4 (block: fix flush machinery for stacking drivers with differring flush flags). Part of the problem is that blk_insert_flush required a single bio be attached to the request. In reality, having no attached bio is also a valid case, as can be observed with an empty flush.
[1] http://www.redhat.com/archives/dm-devel/2011-September/msg00154.html
--- block/blk-flush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-flush.c +1 -1
@@ -320,7 +320,7 @@ void blk_insert_flush(struct request *rqreturn ; } -BUG_ON (!rq->bio || rq->bio != rq->biotail); +BUG_ON (rq->bio != rq->biotail);/*assumes zero or single bio rq */ /* * If there's data but flush is not necessary, the request can be
PATCH 230/264 blk-flush: move the queue kick into
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Moyer <[email protected]>
commit e67b77c791ca2778198c9e7088f3266ed2da7a55 upstream.
A dm-multipath user reported[1] a problem when trying to boot a kernel with commit 4853abaae7e4a2af938115ce9071ef8684fb7af4 (block: fix flush machinery for stacking drivers with differring flush flags) applied. It turns out that an empty flush request can be sent into blk_insert_flush. When the BUG_ON was fixed to allow for this, I/O on the underlying device would stall. The reason is that blk_insert_cloned_request does not kick the queue. In the aforementioned commit, I had added a special case to kick the queue if data was sent down but the queue flags did not require a flush. A better solution is to push the queue kick up into blk_insert_cloned_request.
This patch, along with a follow-on which fixes the BUG_ON, fixes the issue reported.
[1] http://www.redhat.com/archives/dm-devel/2011-September/msg00154.html
--- block/blk-core.c | 2 ++ block/blk-flush.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
block/blk-core.c +2 -0
@@ -1725,6 +1725,8 @@ int blk_insert_cloned_request(struct req where =ELEVATOR_INSERT_FLUSH ;add_acct_request (q, rq, where); +if (where ==ELEVATOR_INSERT_FLUSH ) +__blk_run_queue (q);spin_unlock_irqrestore (q->queue_lock, flags);return 0 ;
block/blk-flush.c +0 -1
@@ -330,7 +330,6 @@ void blk_insert_flush(struct request *rqif ((policy &REQ_FSEQ_DATA ) && !(policy & (REQ_FSEQ_PREFLUSH |REQ_FSEQ_POSTFLUSH ))) {list_add_tail (&rq->queuelist, &q->queue_head); -blk_run_queue_async (q);return ; }
PATCH 231/264 VFS: we need to set LOOKUP_JUMPED on mountpoint crossing
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit a3fbbde70a0cec017f2431e8f8de208708c76acc upstream.
Mountpoint crossing is similar to following procfs symlinks - we do not get ->d_revalidate() called for dentry we have arrived at, with unpleasant consequences for NFS4.
Simple way to reproduce the problem in mainline:
cat >/tmp/a.c <<'EOF'
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
main()
{
struct flock fl = {.l_type = F_RDLCK, .l_whence = SEEK_SET, .l_len = 1};
if (fcntl(0, F_SETLK, &fl))
perror("setlk");
}
EOF
cc /tmp/a.c -o /tmp/testthen on nfs4:
mount --bind file1 file2
/tmp/test < file1 # ok
/tmp/test < file2 # spews "setlk: No locks available"...What happens is the missing call of ->d_revalidate() after mountpoint crossing and that's where NFS4 would issue OPEN request to server.
The fix is simple - treat mountpoint crossing the same way we deal with following procfs-style symlinks. I.e. set LOOKUP_JUMPED...
--- fs/namei.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
fs/namei.c +15 -1
@@ -852,7 +852,7 @@ static int follow_managed(struct path *pmntput (path->mnt);if (ret == -EISDIR ) ret =0 ; -return ret; +return ret <0 ? ret : need_mntput; }int follow_down_one (struct path *path)
@@ -900,6 +900,7 @@ static bool __follow_mount_rcu(struct nabreak ; path->mnt = mounted; path->dentry = mounted->mnt_root; + nd->flags |=LOOKUP_JUMPED ; nd->seq =read_seqcount_begin (&path->dentry->d_seq);/* * Update the inode too. We don't need to re-check the
@@ -1213,6 +1214,8 @@ retry:path_put_conditional (path, nd);return err; } +if (err) + nd->flags |=LOOKUP_JUMPED ; *inode = path->dentry->d_inode;return 0 ; }
@@ -2149,6 +2152,10 @@ static struct file *do_last(struct namei }/* create side of things */ +/* +* This will *only* deal with leaving RCU mode - LOOKUP_JUMPED has been +* cleared when we got to the last component we are about to look up +*/ error =complete_walk (nd);if (error)return ERR_PTR (error);
@@ -2217,6 +2224,9 @@ static struct file *do_last(struct nameiif (error <0 ) goto exit_dput; +if (error) + nd->flags |=LOOKUP_JUMPED ; + error = -ENOENT ;if (!path->dentry->d_inode) goto exit_dput;
@@ -2226,6 +2236,10 @@ static struct file *do_last(struct nameipath_to_nameidata (path, nd); nd->inode = path->dentry->d_inode; +/* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */ + error =complete_walk (nd); +if (error) + goto exit; error = -EISDIR ;if (S_ISDIR (nd->inode->i_mode)) goto exit;
PATCH 232/264 target: Fix incorrect se_cmd assignment in core_tmr_drain_tmr_list
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joern Engel <[email protected]>
commit 80ccbc8e00f7001d79dd503c2781487906b98611 upstream.
This patch fixes a bug in core_tmr_drain_tmr_list() where drain_tmr_list was using the wrong se_tmr_req for cmd assignment due to a typo during the LUN_RESET re-org. This was resulting in general protection faults while using the leftover bogus *tmr_p pointer from list_for_each_entry_safe().
--- drivers/target/target_core_tmr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_tmr.c +1 -1
@@ -155,7 +155,7 @@ static void core_tmr_drain_tmr_list(while (!list_empty (&drain_tmr_list)) { tmr = list_entry(drain_tmr_list.next, struct se_tmr_req, tmr_list);list_del (&tmr->tmr_list); - cmd = tmr_p->task_cmd; + cmd = tmr->task_cmd; pr_debug("LUN_RESET: %s releasing TMR %p Function: 0x%02x," " Response: 0x%02x, t_state: %d\n",
PATCH 233/264 target: Fix wrong se_tmr being added to drain_tmr_list
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joern Engel <[email protected]>
commit 6eb40b2af4908e9aee71e43e7a384243128c56dd upstream.
This patch fixes another bug from LUN_RESET re-org fallout in core_tmr_drain_tmr_list() that was adding the wrong se_tmr_req into the local drain_tmr_list to be walked + released.
--- drivers/target/target_core_tmr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_tmr.c +1 -1
@@ -148,7 +148,7 @@ static void core_tmr_drain_tmr_list( }spin_unlock (&cmd->t_state_lock); -list_move_tail (&tmr->tmr_list, &drain_tmr_list); +list_move_tail (&tmr_p->tmr_list, &drain_tmr_list); }spin_unlock_irqrestore (&dev->se_tmr_lock, flags);
PATCH 234/264 powerpc/numa: Remove double of_node_put in hot_add_node_scn_to_nid
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 6083184269fd723affca4f6340e491950267622a upstream.
During memory hotplug testing, I got the following warning:
ERROR: Bad of_node_put() on /memory@0
of_node_releasekref_putof_node_putof_find_node_by_typehot_add_node_scn_to_nidhot_add_scn_to_nidmemory_add_physaddr_to_nid
...
of_find_node_by_type() loop does the of_node_put for us so we only need the handle the case where we terminate the loop early.
As suggested by Stephen Rothwell we can do the of_node_put unconditionally outside of the loop since of_node_put handles a NULL argument fine.
--- arch/powerpc/mm/numa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/mm/numa.c +2 -1
@@ -1214,11 +1214,12 @@ int hot_add_node_scn_to_nid(unsigned lonbreak ; } -of_node_put (memory);if (nid >=0 )break ; } +of_node_put (memory); +return nid; }
PATCH 235/264 powerpc: Fix oops when echoing bad values to /sys/devices/system/memory/probe
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit a11940978bd598e65996b4f807cf4904793f7025 upstream.
If we echo an address the hypervisor doesn't like to /sys/devices/system/memory/probe we oops the box:
# echo 0x10000000000 > /sys/devices/system/memory/probe
kernel BUG at arch/powerpc/mm/hash_utils_64.c:541!
The backtrace is:
create_section_mappingarch_add_memoryadd_memorymemory_probe_storesysdev_class_storesysfs_write_filevfs_writeSyS_write
In create_section_mapping we BUG if htab_bolt_mapping returned an error. A better approach is to return an error which will propagate back to userspace.
Rerunning the test with this patch applied:
# echo 0x10000000000 > /sys/devices/system/memory/probe -bash: echo: write error: Invalid argument
--- arch/powerpc/include/asm/sparsemem.h | 2 +- arch/powerpc/mm/hash_utils_64.c | 6 +++--- arch/powerpc/mm/mem.c | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/sparsemem.h +1 -1
@@ -16,7 +16,7 @@#endif /* CONFIG_SPARSEMEM */ #ifdef CONFIG_MEMORY_HOTPLUG -extern void create_section_mapping (unsigned long start,unsigned long end); +extern int create_section_mapping (unsigned long start,unsigned long end);extern int remove_section_mapping (unsigned long start,unsigned long end);#ifdef CONFIG_NUMA extern int hot_add_scn_to_nid (unsigned long scn_addr);
arch/powerpc/mm/hash_utils_64.c +3 -3
@@ -534,11 +534,11 @@ static unsigned long __init htab_get_tab }#ifdef CONFIG_MEMORY_HOTPLUG -void create_section_mapping (unsigned long start,unsigned long end) +int create_section_mapping (unsigned long start,unsigned long end) { -BUG_ON (htab_bolt_mapping (start, end,__pa (start), +return htab_bolt_mapping (start, end,__pa (start),pgprot_val (PAGE_KERNEL ), mmu_linear_psize, - mmu_kernel_ssize)); + mmu_kernel_ssize); }int remove_section_mapping (unsigned long start,unsigned long end)
arch/powerpc/mm/mem.c +2 -1
@@ -123,7 +123,8 @@ int arch_add_memory(int nid, u64 start, pgdata =NODE_DATA (nid); start = (unsigned long )__va (start); -create_section_mapping (start, start + size); +if (create_section_mapping (start, start + size)) +return -EINVAL ;/* this should work for most non-highmem platforms */ zone = pgdata->node_zones;
PATCH 236/264 powerpc/pseries: Avoid spurious error during hotplug CPU add
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 9c740025c51a26ab00192cfc464064d4ccbfe3fc upstream.
During hotplug CPU add we get the following error:
Unexpected Error (0) returned from configure-connector
ibm,configure-connector returns 0 for configuration complete, so catch this and avoid the error.
--- arch/powerpc/platforms/pseries/dlpar.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pseries/dlpar.c +4 -0
@@ -112,6 +112,7 @@ void dlpar_free_cc_nodes(struct device_ndlpar_free_one_cc_node (dn); } +#define COMPLETE 0#define NEXT_SIBLING 1#define NEXT_CHILD 2#define NEXT_PROPERTY 3
@@ -158,6 +159,9 @@ struct device_node *dlpar_configure_connspin_unlock (&rtas_data_buf_lock);switch (rc) { +case COMPLETE : +break ; +case NEXT_SIBLING : dn =dlpar_parse_cc_node (ccwa);if (!dn)
PATCH 237/264 powerpc/eeh: Fix /proc/ppc64/eeh creation
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 8feaa43494cee5e938fd5a57b9e9bf1c827e6ccd upstream.
Since commit 188917e183cf9ad0374b571006d0fc6d48a7f447, /proc/ppc64 is a symlink to /proc/powerpc/. That means that creating /proc/ppc64/eeh will end up with a unaccessible file, that is not listed under /proc/powerpc/ and, then, not listed under /proc/ppc64/.
Creating /proc/powerpc/eeh fixes that problem and maintain the compatibility intended with the ppc64 symlink.
--- arch/powerpc/platforms/pseries/eeh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/eeh.c +1 -1
@@ -1338,7 +1338,7 @@ static const struct file_operations procstatic int __init eeh_init_proc (void ) {if (machine_is (pseries)) -proc_create ("ppc64/eeh" ,0 ,NULL , &proc_eeh_operations); +proc_create ("powerpc/eeh" ,0 ,NULL , &proc_eeh_operations);return 0 ; }__initcall (eeh_init_proc);
PATCH 238/264 powerpc: Fix deadlock in icswx code
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 8bdafa39a47265bc029838b35cc6585f69224afa upstream.
The icswx code introduced an A-B B-A deadlock:
CPU0 CPU1
---- ----
lock(&anon_vma->mutex);
lock(&mm->mmap_sem);
lock(&anon_vma->mutex);lock(&mm->mmap_sem);
Instead of using the mmap_sem to keep mm_users constant, take the page table spinlock.
--- arch/powerpc/mm/mmu_context_hash64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/mm/mmu_context_hash64.c +6 -6
@@ -136,8 +136,8 @@ int use_cop(unsigned long acop, struct mif (!mm || !acop)return -EINVAL ; -/* We need to make sure mm_users doesn't change */ -down_read (&mm->mmap_sem); +/* The page_table_lock ensures mm_users won't change under us */ +spin_lock (&mm->page_table_lock);spin_lock (mm->context.cop_lockp);if (mm->context.cop_pid ==COP_PID_NONE ) {
@@ -164,7 +164,7 @@ int use_cop(unsigned long acop, struct m out:spin_unlock (mm->context.cop_lockp); -up_read (&mm->mmap_sem); +spin_unlock (&mm->page_table_lock);return ret; }
@@ -185,8 +185,8 @@ void drop_cop(unsigned long acop, structif (WARN_ON_ONCE (!mm))return ; -/* We need to make sure mm_users doesn't change */ -down_read (&mm->mmap_sem); +/* The page_table_lock ensures mm_users won't change under us */ +spin_lock (&mm->page_table_lock);spin_lock (mm->context.cop_lockp); mm->context.acop &= ~acop;
@@ -213,7 +213,7 @@ void drop_cop(unsigned long acop, struct }spin_unlock (mm->context.cop_lockp); -up_read (&mm->mmap_sem); +spin_unlock (&mm->page_table_lock); }EXPORT_SYMBOL_GPL (drop_cop);
PATCH 239/264 ACPI atomicio: Convert width in bits to bytes in __acpi_ioremap_fast()
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Luck, Tony" <[email protected]>
commit 3bf3f8b19d2bfccc40f13c456bf339fd8f535ebc upstream.
Callers to __acpi_ioremap_fast() pass the bit_width that they found in the acpi_generic_address structure. Convert from bits to bytes when passing to __acpi_find_iomap() - as it wants to see bytes, not bits.
--- drivers/acpi/atomicio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/atomicio.c +1 -1
@@ -76,7 +76,7 @@ static void __iomem *__acpi_ioremap_fast {struct acpi_iomap *map; - map =__acpi_find_iomap (paddr, size); + map =__acpi_find_iomap (paddr, size/8 );if (map)return map->vaddr + (paddr - map->paddr);else
PATCH 240/264 ACPI: Fix CONFIG_ACPI_DOCK=n compiler warning
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit c1056b42a87b59375f8f81a92ef029165f44fcce upstream.
Recently the ACPI ops structs were constified but the inline version of register_hotplug_dock_device() was overlooked (see also commit 9c8b04b, June 25 2011). Update the inline function register_hotplug_dock_device() that is enabled with CONFIG_ACPI_DOCK=n too. This patch fixes at least the following compiler warnings:
drivers/ata/libata-acpi.c: In function .ata_acpi_associate.:drivers/ata/libata-acpi.c:266:11: warning: passing argument 2 of .register_hotplug_dock_device. discards qualifiers from pointer target type include/acpi/acpi_drivers.h:146:19: note: expected .struct acpi_dock_ops *. but argument is of type .const struct acpi_dock_ops *. drivers/ata/libata-acpi.c:275:11: warning: passing argument 2 of .register_hotplug_dock_device. discards qualifiers from pointer target type include/acpi/acpi_drivers.h:146:19: note: expected .struct acpi_dock_ops *. but argument is of type .const struct acpi_dock_ops *.
--- include/acpi/acpi_drivers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpi_drivers.h +1 -1
@@ -144,7 +144,7 @@ static inline void unregister_dock_notif { }static inline int register_hotplug_dock_device (acpi_handle handle, -struct acpi_dock_ops *ops, +const struct acpi_dock_ops *ops,void *context) {return -ENODEV ;
PATCH 241/264 netlink: validate NLA_MSECS length
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit c30bc94758ae2a38a5eb31767c1985c0aae0950b upstream.
L2TP for example uses NLA_MSECS like this:
policy:
[L2TP_ATTR_RECV_TIMEOUT] = { .type = NLA_MSECS, },
code:
if (info->attrs[L2TP_ATTR_RECV_TIMEOUT])
cfg.reorder_timeout = nla_get_msecs(info->attrs[L2TP_ATTR_RECV_TIMEOUT]);As nla_get_msecs() is essentially nla_get_u64() plus the conversion to a HZ-based value, this will not properly reject attributes from userspace that aren't long enough and might overrun the message.
Add NLA_MSECS to the attribute minlen array to check the size properly.
--- lib/nlattr.c | 1 + 1 file changed, 1 insertion(+)
lib/nlattr.c +1 -0
@@ -20,6 +20,7 @@ static const u16 nla_attr_minlen[NLA_TYP [NLA_U16] = sizeof(u16), [NLA_U32] = sizeof(u32), [NLA_U64] = sizeof(u64), + [NLA_MSECS] = sizeof(u64), [NLA_NESTED] = NLA_HDRLEN, };
PATCH 242/264 ath9k_hw: Update AR9485 initvals to fix system hang issue
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rajkumar Manoharan <[email protected]>
commit 98fb2cc115b4ef1ea0a2d87a170c183bd395dd6c upstream.
This patch fixes system hang when resuming from S3 state and lower rate sens failure issue.
--- drivers/net/wireless/ath/ath9k/ar9485_initvals.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/ar9485_initvals.h +5 -5
@@ -521,7 +521,7 @@ static const u32 ar9485_1_1_radio_postam {0x000160ac, 0x24611800}, {0x000160b0, 0x03284f3e}, {0x0001610c, 0x00170000}, - {0x00016140, 0x10804008}, + {0x00016140, 0x50804008}, }; static const u32 ar9485_1_1_mac_postamble[][5] = {
@@ -603,7 +603,7 @@ static const u32 ar9485_1_1_radio_core[]static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2 ] = {/* Addr allmodes */ - {0x00018c00 ,0x10052e5e }, + {0x00018c00 ,0x18052e5e }, {0x00018c04 ,0x000801d8 }, {0x00018c08 ,0x0000080c }, };
@@ -776,7 +776,7 @@ static const u32 ar9485_modes_green_ob_dstatic const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2 ] = {/* Addr allmodes */ - {0x00018c00 ,0x10013e5e }, + {0x00018c00 ,0x18013e5e }, {0x00018c04 ,0x000801d8 }, {0x00018c08 ,0x0000080c }, };
@@ -882,7 +882,7 @@ static const u32 ar9485_fast_clock_1_1_bstatic const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2 ] = {/* Addr allmodes */ - {0x00018c00 ,0x10012e5e }, + {0x00018c00 ,0x18012e5e }, {0x00018c04 ,0x000801d8 }, {0x00018c08 ,0x0000080c }, };
@@ -1021,7 +1021,7 @@ static const u32 ar9485_common_rx_gain_1static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2 ] = {/* Addr allmodes */ - {0x00018c00 ,0x10053e5e }, + {0x00018c00 ,0x18053e5e }, {0x00018c04 ,0x000801d8 }, {0x00018c08 ,0x0000080c }, };
PATCH 243/264 mac80211: fix remain_off_channel regression
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit eaa7af2ae582c9a8c51b374c48d5970b748a5ce2 upstream.
The offchannel code is currently broken - we should remain_off_channel if the work was started, and the work's channel and channel_type are the same as local->tmp_channel and local->tmp_channel_type.
However, if wk->chan_type and local->tmp_channel_type coexist (e.g. have the same channel type), we won't remain_off_channel.
This behavior was introduced by commit da2fd1f ("mac80211: Allow work items to use existing channel type.")
--- net/mac80211/work.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac80211/work.c +2 -2
@@ -1086,8 +1086,8 @@ static void ieee80211_work_work(struct wcontinue ;if (wk->chan != local->tmp_channel)continue ; -if (ieee80211_work_ct_coexists (wk->chan_type, - local->tmp_channel_type)) +if (!ieee80211_work_ct_coexists (wk->chan_type, + local->tmp_channel_type))continue ; remain_off_channel = true; }
PATCH 244/264 mac80211: config hw when going back on-channel
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit 6911bf0453e0d6ea8eb694a4ce67a68d071c538e upstream.
When going back on-channel, we should reconfigure the hw iff the hardware is not already configured to the operational channel.
--- net/mac80211/work.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/work.c +1 -2
@@ -1093,7 +1093,6 @@ static void ieee80211_work_work(struct w }if (!remain_off_channel && local->tmp_channel) { -bool on_oper_chan =ieee80211_cfg_on_oper_channel (local); local->tmp_channel =NULL ;/* If tmp_channel wasn't operating channel, then * we need to go back on-channel.
@@ -1103,7 +1102,7 @@ static void ieee80211_work_work(struct w* we still need to do a hardware config. Currently, * we cannot be here while scanning, however. */ -if (ieee80211_cfg_on_oper_channel (local) && !on_oper_chan) +if (!ieee80211_cfg_on_oper_channel (local))ieee80211_hw_config (local,0 );/* At the least, we need to disable offchannel_ps,
PATCH 245/264 mac80211: disable powersave for broken APs
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 05cb91085760ca378f28fc274fbf77fc4fd9886c upstream.
Only AID values 1-2007 are valid, but some APs have been found to send random bogus values, in the reported case an AP that was sending the AID field value 0xffff, an AID of 0x3fff (16383).
There isn't much we can do but disable powersave since there's no way it can work properly in this case.
--- net/mac80211/ieee80211_i.h | 1 + net/mac80211/mlme.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
net/mac80211/ieee80211_i.h +1 -0
@@ -390,6 +390,7 @@ struct ieee80211_if_managed {unsigned long timers_running;/* used for quiesce/restart */ bool powersave;/* powersave requested for this iface */ +bool broken_ap;/* AP is broken -- turn off powersave */ enum ieee80211_smps_mode req_smps,/* requested smps mode */ ap_smps,/* smps mode AP thinks we're in */ driver_smps_mode;/* smps mode request */
net/mac80211/mlme.c +16 -2
@@ -613,6 +613,9 @@ static bool ieee80211_powersave_allowed(if (!mgd->powersave)return false; +if (mgd->broken_ap) +return false; +if (!mgd->associated)return false;
@@ -1467,10 +1470,21 @@ static bool ieee80211_assoc_success(stru capab_info =le16_to_cpu (mgmt->u.assoc_resp.capab_info);if ((aid & (BIT (15 ) |BIT (14 ))) != (BIT (15 ) |BIT (14 ))) -printk (KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not " -"set\n" , sdata->name, aid); +printk (KERN_DEBUG +"%s: invalid AID value 0x%x; bits 15:14 not set\n" , + sdata->name, aid); aid &= ~(BIT (15 ) |BIT (14 )); + ifmgd->broken_ap = false; + +if (aid ==0 || aid >IEEE80211_MAX_AID ) { +printk (KERN_DEBUG +"%s: invalid AID value %d (out of range), turn off PS\n" , + sdata->name, aid); + aid =0 ; + ifmgd->broken_ap = true; + } + pos = mgmt->u.assoc_resp.variable;ieee802_11_parse_elems (pos, len - (pos - (u8 *) mgmt), &elems);
PATCH 246/264 mtd: mtdchar: add missing initializer on raw write
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Wippich <[email protected]>
commit bf5140817b2d65faac9b32fc9057a097044ac35b upstream.
On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently initialized which may cause nandwrite to fail. With this patch it is possible to write raw nand/oob data without additional ECC (either for testing or when some sectors need different oob layout e.g. bootloader) like
nandwrite -n -r -o /dev/mtd0 <myfile>
--- drivers/mtd/mtdchar.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/mtdchar.c +1 -0
@@ -320,6 +320,7 @@ static ssize_t mtd_write(struct file *fi ops.mode =MTD_OOB_RAW ; ops.datbuf = kbuf; ops.oobbuf =NULL ; + ops.ooboffs =0 ; ops.len = len; ret = mtd->write_oob (mtd, *ppos, &ops);
PATCH 247/264 mtd: provide an alias for the redboot module name
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andres Salomon <[email protected]>
commit d5de1907d0af22e1a02de2b16a624148517a39c2 upstream.
parse_mtd_partitions takes a list of partition types; if the driver isn't loaded, it attempts to load it, and then it grabs the partition parser. For redboot, the module name is "redboot.ko", while the parser name is "RedBoot". Since modprobe is case-sensitive, attempting to modprobe "RedBoot" will never work. I suspect the embedded systems that make use of redboot just always manually loaded redboot prior to loading their specific nand chip drivers (or statically compiled it in).
--- drivers/mtd/redboot.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/redboot.c +3 -0
@@ -297,6 +297,9 @@ static struct mtd_part_parser redboot_pa .name = "RedBoot", }; +/* mtd parsers will request the module by parser name */ +MODULE_ALIAS ("RedBoot" ); +static int __init redboot_parser_init (void ) {return register_mtd_parser (&redboot_parser);
PATCH 248/264 mtd: pxa3xx_nand: fix nand detection issue
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lei Wen <[email protected]>
commit 0fab028b77d714ad302404b23306cf7adb885223 upstream.
When keep_config is set, the detection would goes different routine. That the driver would read out the setting which is set previously by bootloader. While most bootloader keep the irq mask as off, and current driver need all irq default open, keep_config behavior would lead to no irq at all.
--- drivers/mtd/nand/pxa3xx_nand.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +7 -5
@@ -813,7 +813,7 @@ static int pxa3xx_nand_detect_config(str info->page_size = ndcr &NDCR_PAGE_SZ ?2048 :512 ;/* set info fields needed to read id */ info->read_id_bytes = (info->page_size ==2048 ) ?4 :2 ; - info->reg_ndcr = ndcr; + info->reg_ndcr = ndcr & ~NDCR_INT_MASK ; info->cmdset = &default_cmdset; info->ndtr0cs0 =nand_readl (info,NDTR0CS0 );
@@ -882,7 +882,7 @@ static int pxa3xx_nand_scan(struct mtd_istruct pxa3xx_nand_info *info = mtd->priv;struct platform_device *pdev = info->pdev;struct pxa3xx_nand_platform_data *pdata = pdev->dev.platform_data; -struct nand_flash_dev pxa3xx_flash_ids[2 ] = { {NULL ,}, {NULL ,} }; +struct nand_flash_dev pxa3xx_flash_ids[2 ], *def =NULL ;const struct pxa3xx_nand_flash *f =NULL ;struct nand_chip *chip = mtd->priv;uint32_t id =-1 ;
@@ -942,8 +942,10 @@ static int pxa3xx_nand_scan(struct mtd_i pxa3xx_flash_ids[0 ].erasesize = f->page_size * f->page_per_block;if (f->flash_width ==16 ) pxa3xx_flash_ids[0 ].options =NAND_BUSWIDTH_16 ; + pxa3xx_flash_ids[1 ].name =NULL ; + def = pxa3xx_flash_ids; KEEP_CONFIG: -if (nand_scan_ident (mtd,1 , pxa3xx_flash_ids)) +if (nand_scan_ident (mtd,1 , def))return -ENODEV ;/* calculate addressing information */ info->col_addr_cycles = (mtd->writesize >=2048 ) ?2 :1 ;
@@ -954,9 +956,9 @@ KEEP_CONFIG: info->row_addr_cycles =2 ; mtd->name = mtd_names[0 ]; chip->ecc.mode =NAND_ECC_HW ; - chip->ecc.size = f->page_size; + chip->ecc.size = info->page_size; - chip->options = (f->flash_width ==16 ) ?NAND_BUSWIDTH_16 :0 ; + chip->options = (info->reg_ndcr &NDCR_DWIDTH_M ) ?NAND_BUSWIDTH_16 :0 ; chip->options |=NAND_NO_AUTOINCR ; chip->options |=NAND_NO_READRDY ;
PATCH 249/264 mtd: pxa3xx_nand: Fix blank page ECC mismatch
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit 543e32d5ff165d0d68deedb0e3557478c7c36a4a upstream.
This bug was introduced in f8155a40 ("mtd: pxa3xx_nand: rework irq logic") and causes the PXA3xx NAND controller fail to operate with NAND flash that has empty pages. According to the comment in this block, the hardware controller will report a double-bit error for empty pages, which can and must be ignored.
This patch restores the original behaviour of the driver.
--- drivers/mtd/nand/pxa3xx_nand.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/nand/pxa3xx_nand.c +2 -0
@@ -685,6 +685,8 @@ static int pxa3xx_nand_read_page_hwecc(s* OOB, ignore such double bit errors */ if (is_buf_blank (buf, mtd->writesize)) + info->retcode =ERR_NONE ; +else mtd->ecc_stats.failed++; }
PATCH 250/264 PM / Suspend: Off by one in pm_suspend()
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 528f7ce6e439edeac38f6b3f8561f1be129b5e91 upstream.
In enter_state() we use "state" as an offset for the pm_states[] array. The pm_states[] array only has PM_SUSPEND_MAX elements so this test is off by one.
--- kernel/power/suspend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/suspend.c +1 -1
@@ -315,7 +315,7 @@ int enter_state(suspend_state_t state)*/ int pm_suspend (suspend_state_t state) { -if (state >PM_SUSPEND_ON && state <=PM_SUSPEND_MAX ) +if (state >PM_SUSPEND_ON && state <PM_SUSPEND_MAX )return enter_state (state);return -EINVAL ; }
PATCH 251/264 crypto: cryptd - Use subsys_initcall to prevent races with aesni
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit b2bac6acf86d05d8af0499f37d91ecac15722803 upstream.
As cryptd is depeneded on by other algorithms such as aesni-intel, it needs to be registered before them. When everything is built as modules, this occurs naturally. However, for this to work when they are built-in, we need to use subsys_initcall in cryptd.
--- crypto/cryptd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/cryptd.c +1 -1
@@ -945,7 +945,7 @@ static void __exit cryptd_exit(void)crypto_unregister_template (&cryptd_tmpl); } -module_init (cryptd_init); +subsys_initcall (cryptd_init);module_exit (cryptd_exit);MODULE_LICENSE ("GPL" );
PATCH 252/264 dp83640: use proper function to free transmit time stamping packets
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Cochran <[email protected]>
commit f5ff7cd1a84caa9545d952a37ac872ccb73825fb upstream.
The previous commit enforces a new rule for handling the cloned packets for transmit time stamping. These packets must not be freed using any other function than skb_complete_tx_timestamp. This commit fixes the one and only driver using this API.
The driver first appeared in v3.0.
--- drivers/net/phy/dp83640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/dp83640.c +1 -1
@@ -1067,7 +1067,7 @@ static void dp83640_txtstamp(struct phy_struct dp83640_private *dp83640 = phydev->priv;if (!dp83640->hwts_tx_en) { -kfree_skb (skb); +skb_complete_tx_timestamp (skb,NULL );return ; }skb_queue_tail (&dp83640->tx_queue, skb);
PATCH 253/264 ath9k_hw: Fix regression of register offset for AR9003 chips
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rajkumar Manoharan <[email protected]>
commit 52d6d4ef5e6d1517688e27c11c01ab303ec681dd upstream.
My recent commits (3782c69d, 324c74a) introduced regression for register offset selection that based on the macversion. Not using parentheses in proper manner for ternary operator leads to select wrong offset for the registers.
This issue was observed with AR9462 chip that immediate disconnect after the association with the following message
ieee80211 phy3: wlan0: Failed to send nullfunc to AP 00:23:69:12:ea:47 after 500ms, disconnecting.
--- drivers/net/wireless/ath/ath9k/ar9003_phy.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_phy.h +6 -6
@@ -572,12 +572,12 @@#define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) -#define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + AR_SREV_9485(ah) ? \ - 0x3c8 : 0x448) -#define AR_PHY_TX_IQCAL_START (AR_SM_BASE + AR_SREV_9485(ah) ? \ - 0x3c4 : 0x440) -#define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + AR_SREV_9485(ah) ? \ - 0x3f0 : 0x48c) +#define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ + 0x3c8 : 0x448)) +#define AR_PHY_TX_IQCAL_START (AR_SM_BASE + (AR_SREV_9485(ah) ? \ + 0x3c4 : 0x440)) +#define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ + 0x3f0 : 0x48c))#define AR_PHY_TX_IQCAL_CORR_COEFF_B0 (_i) (AR_SM_BASE + \ (AR_SREV_9485(ah) ? \ 0x3d0 : 0x450) + ((_i) << 2))
PATCH 254/264 md/raid5: abort any pending parity operations when array fails.
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 9a3f530f39f4490eaa18b02719fb74ce5f4d2d86 upstream.
When the number of failed devices exceeds the allowed number we must abort any active parity operations (checks or updates) as they are no longer meaningful, and can lead to a BUG_ON in handle_parity_checks6.
This bug was introduce by commit 6c0069c0ae9659e3a91b68eaed06a5c6c37f45c8 in 2.6.29.
--- drivers/md/raid5.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/md/raid5.c +8 -4
@@ -3165,10 +3165,14 @@ static void handle_stripe(struct stripe_/* check if the array has lost more than max_degraded devices and, * if so, some requests might need to be failed. */ -if (s.failed > conf->max_degraded && s.to_read+s.to_write+s.written) -handle_failed_stripe (conf, sh, &s, disks, &s.return_bi); -if (s.failed > conf->max_degraded && s.syncing) -handle_failed_sync (conf, sh, &s); +if (s.failed > conf->max_degraded) { + sh->check_state =0 ; + sh->reconstruct_state =0 ; +if (s.to_read+s.to_write+s.written) +handle_failed_stripe (conf, sh, &s, disks, &s.return_bi); +if (s.syncing) +handle_failed_sync (conf, sh, &s); + }/* * might be able to return some write requests if the parity blocks
PATCH 255/264 md/raid5: STRIPE_ACTIVE has lock semantics, add barriers
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 257a4b42af7586fab4eaec7f04e6896b86551843 upstream.
All updates that occur under STRIPE_ACTIVE should be globally visible when STRIPE_ACTIVE clears. test_and_set_bit() implies a barrier, but clear_bit() does not.
This is suitable for 3.1-stable.
--- drivers/md/raid5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/raid5.c +2 -2
@@ -3116,7 +3116,7 @@ static void handle_stripe(struct stripe_struct r5dev *pdev, *qdev;clear_bit (STRIPE_HANDLE , &sh->state); -if (test_and_set_bit (STRIPE_ACTIVE , &sh->state)) { +if (test_and_set_bit_lock (STRIPE_ACTIVE , &sh->state)) {/* already being handled, ensure it gets handled * again when current action finishes */ set_bit (STRIPE_HANDLE , &sh->state);
@@ -3381,7 +3381,7 @@ finish:return_io (s.return_bi); -clear_bit (STRIPE_ACTIVE , &sh->state); +clear_bit_unlock (STRIPE_ACTIVE , &sh->state); }static void raid5_activate_delayed (raid5_conf_t *conf)
PATCH 256/264 mtd: nand_base: always initialise oob_poi before writing OOB data
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "THOMSON, Adam (Adam)" <[email protected]>
commit f722013ee9fd24623df31dec9a91a6d02c3e2f2f upstream.
In nand_do_write_ops() code it is possible for a caller to provide ops.oobbuf populated and ops.mode == MTD_OOB_AUTO, which currently means that the chip->oob_poi buffer isn't initialised to all 0xFF. The nand_fill_oob() method then carries out the task of copying the provided OOB data to oob_poi, but with MTD_OOB_AUTO it skips areas marked as unavailable by the layout struct, including the bad block marker bytes.
An example of this causing issues is when the last OOB data read was from the start of a bad block where the markers are not 0xFF, and the caller wishes to write new OOB data at the beginning of another block. In this scenario the caller would provide OOB data, but nand_fill_oob() would skip the bad block marker bytes in oob_poi before copying the OOB data provided by the caller. This means that when the OOB data is written back to NAND, the block is inadvertently marked as bad without the caller knowing. This has been witnessed when using YAFFS2 where tags are stored in the OOB.
To avoid this oob_poi is always initialised to 0xFF to make sure no left over data is inadvertently written back to the OOB area.
Credits to Brian Norris <[email protected]> for fixing this patch.
--- drivers/mtd/nand/nand_base.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/mtd/nand/nand_base.c +16 -11
@@ -2097,14 +2097,22 @@ static int nand_write_page(struct mtd_in/** * nand_fill_oob - [Internal] Transfer client buffer to oob -* @chip: nand chip structure +* @mtd: MTD device structure * @oob: oob data buffer * @len: oob data write length * @ops: oob ops structure */ -static uint8_t *nand_fill_oob (struct nand_chip *chip,uint8_t *oob,size_t len, -struct mtd_oob_ops *ops) +static uint8_t *nand_fill_oob (struct mtd_info *mtd,uint8_t *oob,size_t len, +struct mtd_oob_ops *ops) { +struct nand_chip *chip = mtd->priv; + +/* +* Initialise to all 0xFF, to avoid the possibility of left over OOB +* data from a previous OOB read. +*/ +memset (chip->oob_poi,0xff , mtd->oobsize); +switch (ops->mode) {case MTD_OOB_PLACE :
@@ -2201,10 +2209,6 @@ static int nand_do_write_ops(struct mtd_ (chip->pagebuf << chip->page_shift) < (to + ops->len)) chip->pagebuf = -1; -/* If we're not given explicit OOB data, let it be 0xFF */ -if (likely (!oob)) -memset (chip->oob_poi,0xff , mtd->oobsize); -/* Don't allow multipage oob writes with offset */ if (oob && ops->ooboffs && (ops->ooboffs + ops->ooblen > oobmaxlen))return -EINVAL ;
@@ -2226,8 +2230,11 @@ static int nand_do_write_ops(struct mtd_if (unlikely (oob)) {size_t len =min (oobwritelen, oobmaxlen); - oob =nand_fill_oob (chip, oob, len, ops); + oob =nand_fill_oob (mtd, oob, len, ops); oobwritelen -= len; + }else { +/* We still need to erase leftover OOB data */ +memset (chip->oob_poi,0xff , mtd->oobsize); } ret = chip->write_page(mtd, chip, wbuf, page, cached,
@@ -2401,10 +2408,8 @@ static int nand_do_write_oob(struct mtd_if (page == chip->pagebuf) chip->pagebuf =-1 ; -memset (chip->oob_poi,0xff , mtd->oobsize); -nand_fill_oob (chip, ops->oobbuf, ops->ooblen, ops); +nand_fill_oob (mtd, ops->oobbuf, ops->ooblen, ops); status = chip->ecc.write_oob (mtd, chip, page & chip->pagemask); -memset (chip->oob_poi,0xff , mtd->oobsize);if (status)return status;
PATCH 257/264 HID: add support for MacBookAir4,2 keyboard.
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Joshua V. Dillon" <[email protected]>
commit 5d922baa631058c7e37ae33e81c4d3e6437f8d1d upstream.
Added USB device IDs for MacBookAir4,2 keyboard. Device constants were copied from the MacBookAir3,2 constants. The 4,2 device specification is reportedly unchanged from the 3,2 predecessor and seems to work well.
--- drivers/hid/hid-apple.c | 9 +++++++++ drivers/hid/hid-ids.h | 3 +++ 2 files changed, 12 insertions(+)
drivers/hid/hid-apple.c +9 -0
@@ -183,6 +183,9 @@ static int hidinput_apple_event(struct hif (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS ) table = macbookair_fn_keys; +else if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI && + hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING6_JIS ) + table = macbookair_fn_keys;else if (hid->product <0x21d || hid->product >=0x300 ) table = powerbook_fn_keys;else
@@ -493,6 +496,12 @@ static const struct hid_device_id apple_ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI), + .driver_data = APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO), + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS), + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
drivers/hid/hid-ids.h +3 -0
@@ -109,6 +109,9 @@#define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245#define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246#define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247 +#define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c +#define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d +#define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e#define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f#define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250#define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251
PATCH 258/264 HID: hid-multitouch: Add LG Display Multitouch device.
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Brown <[email protected]>
commit c50bb1a4005630f47b5da26336f74a485033a515 upstream.
This panel is also known as the Dell ST2220Tc.
--- drivers/hid/Kconfig | 1 + drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-multitouch.c | 5 +++++ 4 files changed, 10 insertions(+)
drivers/hid/Kconfig +1 -0
@@ -328,6 +328,7 @@ config HID_MULTITOUCH - Hanvon dual touch panels - Ilitek dual touch panels - IrTouch Infrared USB panels + - LG Display panels (Dell ST2220Tc) - Lumio CrystalTouch panels - MosArt dual-touch panels - PenMount dual touch panels
drivers/hid/hid-core.c +1 -0
@@ -1399,6 +1399,7 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MULTITOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) },
drivers/hid/hid-ids.h +3 -0
@@ -426,6 +426,9 @@#define USB_DEVICE_ID_LD_HYBRID 0x2090#define USB_DEVICE_ID_LD_HEATCONTROL 0x20A0 +#define USB_VENDOR_ID_LG 0x1fd2 +#define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 +#define USB_VENDOR_ID_LOGITECH 0x046d#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
drivers/hid/hid-multitouch.c +5 -0
@@ -672,6 +672,11 @@ static const struct hid_device_id mt_dev HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS, USB_DEVICE_ID_IRTOUCH_INFRARED_USB) }, +/* LG Display panels */ + { .driver_data = MT_CLS_DEFAULT, +HID_USB_DEVICE (USB_VENDOR_ID_LG , + USB_DEVICE_ID_LG_MULTITOUCH) }, + /* Lumio panels */ { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
PATCH 259/264 HID: add MacBookAir4,2 to hid_have_special_driver[]
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
commit f6f554f09c5b831efdaf67c449e18ca06ee648fe upstream.
Otherwise the generic driver wouldn't unbind from it and wouldn't let hid-apple to automatically take over.
--- drivers/hid/hid-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -1340,6 +1340,9 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) },
PATCH 260/264 HID: Add support MacbookAir 4,1 keyboard
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nobuhiro Iwamatsu <[email protected]>
commit d762cc290b9f17e346f4297fd5984b70ce71ef66 upstream.
Added USB device IDs and keyboard map for MacBookAir 4,1 keyboard.
--- drivers/hid/hid-apple.c | 31 +++++++++++++++++++++++++++++++ drivers/hid/hid-core.c | 3 +++ drivers/hid/hid-ids.h | 3 +++ 3 files changed, 37 insertions(+)
drivers/hid/hid-apple.c +31 -0
@@ -82,6 +82,28 @@ static const struct apple_key_translatio { } }; +static const struct apple_key_translation macbookair4_fn_keys[] = { + {KEY_BACKSPACE ,KEY_DELETE }, + {KEY_ENTER ,KEY_INSERT }, + {KEY_F1 ,KEY_BRIGHTNESSDOWN ,APPLE_FLAG_FKEY }, + {KEY_F2 ,KEY_BRIGHTNESSUP ,APPLE_FLAG_FKEY }, + {KEY_F3 ,KEY_SCALE ,APPLE_FLAG_FKEY }, + {KEY_F4 ,KEY_DASHBOARD ,APPLE_FLAG_FKEY }, + {KEY_F5 ,KEY_KBDILLUMDOWN ,APPLE_FLAG_FKEY }, + {KEY_F6 ,KEY_KBDILLUMUP ,APPLE_FLAG_FKEY }, + {KEY_F7 ,KEY_PREVIOUSSONG ,APPLE_FLAG_FKEY }, + {KEY_F8 ,KEY_PLAYPAUSE ,APPLE_FLAG_FKEY }, + {KEY_F9 ,KEY_NEXTSONG ,APPLE_FLAG_FKEY }, + {KEY_F10 ,KEY_MUTE ,APPLE_FLAG_FKEY }, + {KEY_F11 ,KEY_VOLUMEDOWN ,APPLE_FLAG_FKEY }, + {KEY_F12 ,KEY_VOLUMEUP ,APPLE_FLAG_FKEY }, + {KEY_UP ,KEY_PAGEUP }, + {KEY_DOWN ,KEY_PAGEDOWN }, + {KEY_LEFT ,KEY_HOME }, + {KEY_RIGHT ,KEY_END }, + { } +}; +static const struct apple_key_translation apple_fn_keys[] = { {KEY_BACKSPACE ,KEY_DELETE }, {KEY_ENTER ,KEY_INSERT },
@@ -186,6 +208,9 @@ static int hidinput_apple_event(struct helse if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI && hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING6_JIS ) table = macbookair_fn_keys; +else if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI && + hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS ) + table = macbookair4_fn_keys;else if (hid->product <0x21d || hid->product >=0x300 ) table = powerbook_fn_keys;else
@@ -502,6 +527,12 @@ static const struct hid_device_id apple_ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI), + .driver_data = APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO), + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
drivers/hid/hid-core.c +3 -0
@@ -1343,6 +1343,9 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) },
drivers/hid/hid-ids.h +3 -0
@@ -109,6 +109,9 @@#define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245#define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246#define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247 +#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 +#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a +#define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b#define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c#define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d#define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e
PATCH 261/264 HID: Add device IDs for Macbook Pro 8 keyboards
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gökçen Eraslan <[email protected]>
commit 213f9da80533940560bef8fa43b10c590895459c upstream.
This patch adds keyboard support for Macbook Pro 8 models which has WELLSPRING5A model name and 0x0252, 0x0253 and 0x0254 USB IDs. Trackpad support for those models are added to bcm5974 in c331eb580a0a7906c0cdb8dbae3cfe99e3c0e555 ("Input: bcm5974 - Add support for newer MacBookPro8,2).
--- drivers/hid/hid-apple.c | 6 ++++++ drivers/hid/hid-core.c | 6 ++++++ drivers/hid/hid-ids.h | 3 +++ 3 files changed, 15 insertions(+)
drivers/hid/hid-apple.c +6 -0
@@ -533,6 +533,12 @@ static const struct hid_device_id apple_ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), + .driver_data = APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
drivers/hid/hid-core.c +6 -0
@@ -1340,6 +1340,9 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) },
@@ -1899,6 +1902,9 @@ static const struct hid_device_id hid_mo { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, { }
drivers/hid/hid-ids.h +3 -0
@@ -118,6 +118,9 @@#define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f#define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250#define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251 +#define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 +#define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 +#define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
PATCH 262/264 HID: hid-apple: add device ID of another wireless aluminium
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Krist <[email protected]>
commit ad734bc1565364f9e4b70888d3ce5743b3c1030a upstream.
I've recently bought a Apple wireless aluminum keyboard (model 2011) which is not yet supported by the kernel - it seems they just changed the device id. After applying the attached patch, the device is fully functional.
--- drivers/hid/hid-apple.c | 3 +++ drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + 3 files changed, 5 insertions(+)
drivers/hid/hid-apple.c +3 -0
@@ -483,6 +483,9 @@ static const struct hid_device_id apple_ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), .driver_data =APPLE_NUMLOCK_EMULATION |APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), + .driver_data =APPLE_NUMLOCK_EMULATION |APPLE_HAS_FN | + APPLE_ISO_KEYBOARD }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
drivers/hid/hid-core.c +1 -0
@@ -1355,6 +1355,7 @@ static const struct hid_device_id hid_ha { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) },
drivers/hid/hid-ids.h +1 -0
@@ -124,6 +124,7 @@#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b +#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b#define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241
PATCH 263/264 HID: consolidate MacbookAir 4,1 mappings
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
commit da617c7cb915545dda4280df888dd6f8d5697420 upstream.
MacbookAir 4,1 doesn't require extra mapping table, as the mappings are identical to apple_fn_keys[].
--- drivers/hid/hid-apple.c | 25 ------------------------- 1 file changed, 25 deletions(-)
drivers/hid/hid-apple.c +0 -25
@@ -82,28 +82,6 @@ static const struct apple_key_translatio { } }; -static const struct apple_key_translation macbookair4_fn_keys[] = { - {KEY_BACKSPACE ,KEY_DELETE }, - {KEY_ENTER ,KEY_INSERT }, - {KEY_F1 ,KEY_BRIGHTNESSDOWN ,APPLE_FLAG_FKEY }, - {KEY_F2 ,KEY_BRIGHTNESSUP ,APPLE_FLAG_FKEY }, - {KEY_F3 ,KEY_SCALE ,APPLE_FLAG_FKEY }, - {KEY_F4 ,KEY_DASHBOARD ,APPLE_FLAG_FKEY }, - {KEY_F5 ,KEY_KBDILLUMDOWN ,APPLE_FLAG_FKEY }, - {KEY_F6 ,KEY_KBDILLUMUP ,APPLE_FLAG_FKEY }, - {KEY_F7 ,KEY_PREVIOUSSONG ,APPLE_FLAG_FKEY }, - {KEY_F8 ,KEY_PLAYPAUSE ,APPLE_FLAG_FKEY }, - {KEY_F9 ,KEY_NEXTSONG ,APPLE_FLAG_FKEY }, - {KEY_F10 ,KEY_MUTE ,APPLE_FLAG_FKEY }, - {KEY_F11 ,KEY_VOLUMEDOWN ,APPLE_FLAG_FKEY }, - {KEY_F12 ,KEY_VOLUMEUP ,APPLE_FLAG_FKEY }, - {KEY_UP ,KEY_PAGEUP }, - {KEY_DOWN ,KEY_PAGEDOWN }, - {KEY_LEFT ,KEY_HOME }, - {KEY_RIGHT ,KEY_END }, - { } -}; -static const struct apple_key_translation apple_fn_keys[] = { {KEY_BACKSPACE ,KEY_DELETE }, {KEY_ENTER ,KEY_INSERT },
@@ -208,9 +186,6 @@ static int hidinput_apple_event(struct helse if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI && hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING6_JIS ) table = macbookair_fn_keys; -else if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI && - hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS ) - table = macbookair4_fn_keys;else if (hid->product <0x21d || hid->product >=0x300 ) table = powerbook_fn_keys;else
PATCH 264/264 hid/apple: modern macbook airs use the standard apple function key translations
In reply to Greg KH3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 21404b772a1c65f7b935b8c0fddc388a949f4e31 upstream.
This removes the use of the special "macbookair_fn_keys" keyboard translation table for the MacBookAir4,x models (ie the 2011 refresh). They use the standard apple_fn_keys[] translation. Apparently only the old MacBook Air's need a different translation table.
This mirrors the change that commit da617c7cb915 ("HID: consolidate MacbookAir 4,1 mappings") did for the WELLSPRING6A ones, but does it for the WELLSPRING6 model used on the MacBookAir4,2.
drivers/hid/hid-apple.c +0 -3
@@ -183,9 +183,6 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS ) table = macbookair_fn_keys; -else if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI && - hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING6_JIS ) - table = macbookair_fn_keys;else if (hid->product <0x21d || hid->product >=0x300 ) table = powerbook_fn_keys;else