Unified · Split
| @@ -46,7 +46,6 @@ · 45 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | <sect1><title>Atomic and pointer manipulation</title> |
| 48 | 48 | !Iarch/x86/include/asm/atomic.h |
| 49 | −!Iarch/x86/include/asm/unaligned.h | |
| 50 | 49 | </sect1> |
| 51 | 50 | |
| 52 | 51 | <sect1><title>Delaying, scheduling, and timer routines</title> |
| @@ -57,7 +57,6 @@ · 56 unmodified lines | ||
| 57 | 57 | </para> |
| 58 | 58 | |
| 59 | 59 | <sect1><title>String Conversions</title> |
| 60 | −!Ilib/vsprintf.c | |
| 61 | 60 | !Elib/vsprintf.c |
| 62 | 61 | </sect1> |
| 63 | 62 | <sect1><title>String Manipulation</title> |
| @@ -1961,6 +1961,12 @@ machines due to caching. · 1960 unmodified lines | ||
| 1961 | 1961 | </sect1> |
| 1962 | 1962 | </chapter> |
| 1963 | 1963 | |
| 1964 | + <chapter id="apiref"> | |
| 1965 | + <title>Mutex API reference</title> | |
| 1966 | +!Iinclude/linux/mutex.h | |
| 1967 | +!Ekernel/mutex.c | |
| 1968 | + </chapter> | |
| 1969 | + | |
| 1964 | 1970 | <chapter id="references"> |
| 1965 | 1971 | <title>Further reading</title> |
| 1966 | 1972 | |
| @@ -104,4 +104,9 @@ · 103 unmodified lines | ||
| 104 | 104 | <title>Block IO</title> |
| 105 | 105 | !Iinclude/trace/events/block.h |
| 106 | 106 | </chapter> |
| 107 | + | |
| 108 | + <chapter id="workqueue"> | |
| 109 | + <title>Workqueue</title> | |
| 110 | +!Iinclude/trace/events/workqueue.h | |
| 111 | + </chapter> | |
| 107 | 112 | </book> |
| @@ -0,0 +1,45 @@ | ||
| 1 | +CFQ ioscheduler tunables | |
| 2 | +======================== | |
| 3 | + | |
| 4 | +slice_idle | |
| 5 | +---------- | |
| 6 | +This specifies how long CFQ should idle for next request on certain cfq queues | |
| 7 | +(for sequential workloads) and service trees (for random workloads) before | |
| 8 | +queue is expired and CFQ selects next queue to dispatch from. | |
| 9 | + | |
| 10 | +By default slice_idle is a non-zero value. That means by default we idle on | |
| 11 | +queues/service trees. This can be very helpful on highly seeky media like | |
| 12 | +single spindle SATA/SAS disks where we can cut down on overall number of | |
| 13 | +seeks and see improved throughput. | |
| 14 | + | |
| 15 | +Setting slice_idle to 0 will remove all the idling on queues/service tree | |
| 16 | +level and one should see an overall improved throughput on faster storage | |
| 17 | +devices like multiple SATA/SAS disks in hardware RAID configuration. The down | |
| 18 | +side is that isolation provided from WRITES also goes down and notion of | |
| 19 | +IO priority becomes weaker. | |
| 20 | + | |
| 21 | +So depending on storage and workload, it might be useful to set slice_idle=0. | |
| 22 | +In general I think for SATA/SAS disks and software RAID of SATA/SAS disks | |
| 23 | +keeping slice_idle enabled should be useful. For any configurations where | |
| 24 | +there are multiple spindles behind single LUN (Host based hardware RAID | |
| 25 | +controller or for storage arrays), setting slice_idle=0 might end up in better | |
| 26 | +throughput and acceptable latencies. | |
| 27 | + | |
| 28 | +CFQ IOPS Mode for group scheduling | |
| 29 | +=================================== | |
| 30 | +Basic CFQ design is to provide priority based time slices. Higher priority | |
| 31 | +process gets bigger time slice and lower priority process gets smaller time | |
| 32 | +slice. Measuring time becomes harder if storage is fast and supports NCQ and | |
| 33 | +it would be better to dispatch multiple requests from multiple cfq queues in | |
| 34 | +request queue at a time. In such scenario, it is not possible to measure time | |
| 35 | +consumed by single queue accurately. | |
| 36 | + | |
| 37 | +What is possible though is to measure number of requests dispatched from a | |
| 38 | +single queue and also allow dispatch from multiple cfq queue at the same time. | |
| 39 | +This effectively becomes the fairness in terms of IOPS (IO operations per | |
| 40 | +second). | |
| 41 | + | |
| 42 | +If one sets slice_idle=0 and if storage supports NCQ, CFQ internally switches | |
| 43 | +to IOPS mode and starts providing fairness in terms of number of requests | |
| 44 | +dispatched. Note that this mode switching takes effect only for group | |
| 45 | +scheduling. For non-cgroup users nothing should change. | |
| @@ -217,6 +217,7 @@ Details of cgroup files · 216 unmodified lines | ||
| 217 | 217 | CFQ sysfs tunable |
| 218 | 218 | ================= |
| 219 | 219 | /sys/block/<disk>/queue/iosched/group_isolation |
| 220 | +----------------------------------------------- | |
| 220 | 221 | |
| 221 | 222 | If group_isolation=1, it provides stronger isolation between groups at the |
| 222 | 223 | expense of throughput. By default group_isolation is 0. In general that |
| @@ -243,6 +244,33 @@ By default one should run with group_isolation=0. If that is not sufficient · 20 unmodified lines | ||
| 243 | 244 | and one wants stronger isolation between groups, then set group_isolation=1 |
| 244 | 245 | but this will come at cost of reduced throughput. |
| 245 | 246 | |
| 247 | +/sys/block/<disk>/queue/iosched/slice_idle | |
| 248 | +------------------------------------------ | |
| 249 | +On a faster hardware CFQ can be slow, especially with sequential workload. | |
| 250 | +This happens because CFQ idles on a single queue and single queue might not | |
| 251 | +drive deeper request queue depths to keep the storage busy. In such scenarios | |
| 252 | +one can try setting slice_idle=0 and that would switch CFQ to IOPS | |
| 253 | +(IO operations per second) mode on NCQ supporting hardware. | |
| 254 | + | |
| 255 | +That means CFQ will not idle between cfq queues of a cfq group and hence be | |
| 256 | +able to driver higher queue depth and achieve better throughput. That also | |
| 257 | +means that cfq provides fairness among groups in terms of IOPS and not in | |
| 258 | +terms of disk time. | |
| 259 | + | |
| 260 | +/sys/block/<disk>/queue/iosched/group_idle | |
| 261 | +------------------------------------------ | |
| 262 | +If one disables idling on individual cfq queues and cfq service trees by | |
| 263 | +setting slice_idle=0, group_idle kicks in. That means CFQ will still idle | |
| 264 | +on the group in an attempt to provide fairness among groups. | |
| 265 | + | |
| 266 | +By default group_idle is same as slice_idle and does not do anything if | |
| 267 | +slice_idle is enabled. | |
| 268 | + | |
| 269 | +One can experience an overall throughput drop if you have created multiple | |
| 270 | +groups and put applications in that group which are not driving enough | |
| 271 | +IO to keep disk busy. In that case set group_idle=0, and CFQ will not idle | |
| 272 | +on individual groups and throughput should improve. | |
| 273 | + | |
| 246 | 274 | What works |
| 247 | 275 | ========== |
| 248 | 276 | - Currently only sync IO queues are support. All the buffered writes are |
| @@ -109,17 +109,19 @@ use numbers 2000-2063 to identify GPIOs in a bank of I2C GPIO expanders. · 108 unmodified lines | ||
| 109 | 109 | |
| 110 | 110 | If you want to initialize a structure with an invalid GPIO number, use |
| 111 | 111 | some negative number (perhaps "-EINVAL"); that will never be valid. To |
| 112 | −test if a number could reference a GPIO, you may use this predicate: | |
| 112 | +test if such number from such a structure could reference a GPIO, you | |
| 113 | +may use this predicate: | |
| 113 | 114 | |
| 114 | 115 | int gpio_is_valid(int number); |
| 115 | 116 | |
| 116 | 117 | A number that's not valid will be rejected by calls which may request |
| 117 | 118 | or free GPIOs (see below). Other numbers may also be rejected; for |
| 118 | −example, a number might be valid but unused on a given board. | |
| 119 | − | |
| 120 | −Whether a platform supports multiple GPIO controllers is currently a | |
| 121 | −platform-specific implementation issue. | |
| 119 | +example, a number might be valid but temporarily unused on a given board. | |
| 122 | 120 | |
| 121 | +Whether a platform supports multiple GPIO controllers is a platform-specific | |
| 122 | +implementation issue, as are whether that support can leave "holes" in the space | |
| 123 | +of GPIO numbers, and whether new controllers can be added at runtime. Such issues | |
| 124 | +can affect things including whether adjacent GPIO numbers are both valid. | |
| 123 | 125 | |
| 124 | 126 | Using GPIOs |
| 125 | 127 | ----------- |
| @@ -480,12 +482,16 @@ To support this framework, a platform's Kconfig will "select" either · 354 unmodified lines | ||
| 480 | 482 | ARCH_REQUIRE_GPIOLIB or ARCH_WANT_OPTIONAL_GPIOLIB |
| 481 | 483 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines |
| 482 | 484 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). |
| 483 | −They may also want to provide a custom value for ARCH_NR_GPIOS. | |
| 484 | 485 | |
| 485 | −ARCH_REQUIRE_GPIOLIB means that the gpio-lib code will always get compiled | |
| 486 | +It may also provide a custom value for ARCH_NR_GPIOS, so that it better | |
| 487 | +reflects the number of GPIOs in actual use on that platform, without | |
| 488 | +wasting static table space. (It should count both built-in/SoC GPIOs and | |
| 489 | +also ones on GPIO expanders. | |
| 490 | + | |
| 491 | +ARCH_REQUIRE_GPIOLIB means that the gpiolib code will always get compiled | |
| 486 | 492 | into the kernel on that architecture. |
| 487 | 493 | |
| 488 | −ARCH_WANT_OPTIONAL_GPIOLIB means the gpio-lib code defaults to off and the user | |
| 494 | +ARCH_WANT_OPTIONAL_GPIOLIB means the gpiolib code defaults to off and the user | |
| 489 | 495 | can enable it and build it into the kernel optionally. |
| 490 | 496 | |
| 491 | 497 | If neither of these options are selected, the platform does not support |
| @@ -345,5 +345,10 @@ documentation, in <filename>, for the functions listed. · 344 unmodified lines | ||
| 345 | 345 | section titled <section title> from <filename>. |
| 346 | 346 | Spaces are allowed in <section title>; do not quote the <section title>. |
| 347 | 347 | |
| 348 | +!C<filename> is replaced by nothing, but makes the tools check that | |
| 349 | +all DOC: sections and documented functions, symbols, etc. are used. | |
| 350 | +This makes sense to use when you use !F/!P only and want to verify | |
| 351 | +that all documentation is included. | |
| 352 | + | |
| 348 | 353 | Tim. |
| 349 | 354 | */ <twaugh@redhat.com> |
| @@ -1974,15 +1974,18 @@ and is between 256 and 4096 characters. It is defined in the file · 1973 unmodified lines | ||
| 1974 | 1974 | force Enable ASPM even on devices that claim not to support it. |
| 1975 | 1975 | WARNING: Forcing ASPM on may cause system lockups. |
| 1976 | 1976 | |
| 1977 | + pcie_ports= [PCIE] PCIe ports handling: | |
| 1978 | + auto Ask the BIOS whether or not to use native PCIe services | |
| 1979 | + associated with PCIe ports (PME, hot-plug, AER). Use | |
| 1980 | + them only if that is allowed by the BIOS. | |
| 1981 | + native Use native PCIe services associated with PCIe ports | |
| 1982 | + unconditionally. | |
| 1983 | + compat Treat PCIe ports as PCI-to-PCI bridges, disable the PCIe | |
| 1984 | + ports driver. | |
| 1985 | + | |
| 1977 | 1986 | pcie_pme= [PCIE,PM] Native PCIe PME signaling options: |
| 1978 | − Format: {auto|force}[,nomsi] | |
| 1979 | − auto Use native PCIe PME signaling if the BIOS allows the | |
| 1980 | − kernel to control PCIe config registers of root ports. | |
| 1981 | − force Use native PCIe PME signaling even if the BIOS refuses | |
| 1982 | − to allow the kernel to control the relevant PCIe config | |
| 1983 | − registers. | |
| 1984 | 1987 | nomsi Do not use MSI for native PCIe PME signaling (this makes |
| 1985 | − all PCIe root ports use INTx for everything). | |
| 1988 | + all PCIe root ports use INTx for all services). | |
| 1986 | 1989 | |
| 1987 | 1990 | pcmv= [HW,PCMCIA] BadgePAD 4 |
| 1988 | 1991 | |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | # This creates the demonstration utility "lguest" which runs a Linux guest. |
| 2 | −CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -I../../arch/x86/include -U_FORTIFY_SOURCE | |
| 2 | +# Missing headers? Add "-I../../include -I../../arch/x86/include" | |
| 3 | +CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE | |
| 3 | 4 | |
| 4 | 5 | all: lguest |
| 5 | 6 | |
| @@ -39,14 +39,14 @@ · 38 unmodified lines | ||
| 39 | 39 | #include <limits.h> |
| 40 | 40 | #include <stddef.h> |
| 41 | 41 | #include <signal.h> |
| 42 | −#include "linux/lguest_launcher.h" | |
| 43 | −#include "linux/virtio_config.h" | |
| 44 | −#include "linux/virtio_net.h" | |
| 45 | −#include "linux/virtio_blk.h" | |
| 46 | −#include "linux/virtio_console.h" | |
| 47 | −#include "linux/virtio_rng.h" | |
| 48 | −#include "linux/virtio_ring.h" | |
| 49 | −#include "asm/bootparam.h" | |
| 42 | +#include <linux/virtio_config.h> | |
| 43 | +#include <linux/virtio_net.h> | |
| 44 | +#include <linux/virtio_blk.h> | |
| 45 | +#include <linux/virtio_console.h> | |
| 46 | +#include <linux/virtio_rng.h> | |
| 47 | +#include <linux/virtio_ring.h> | |
| 48 | +#include <asm/bootparam.h> | |
| 49 | +#include "../../include/linux/lguest_launcher.h" | |
| 50 | 50 | /*L:110 |
| 51 | 51 | * We can ignore the 42 include files we need for this program, but I do want |
| 52 | 52 | * to draw attention to the use of kernel-style types. |
| @@ -1447,14 +1447,15 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name) · 1394 unmodified lines | ||
| 1447 | 1447 | static void configure_device(int fd, const char *tapif, u32 ipaddr) |
| 1448 | 1448 | { |
| 1449 | 1449 | struct ifreq ifr; |
| 1450 | − struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; | |
| 1450 | + struct sockaddr_in sin; | |
| 1451 | 1451 | |
| 1452 | 1452 | memset(&ifr, 0, sizeof(ifr)); |
| 1453 | 1453 | strcpy(ifr.ifr_name, tapif); |
| 1454 | 1454 | |
| 1455 | 1455 | /* Don't read these incantations. Just cut & paste them like I did! */ |
| 1456 | − sin->sin_family = AF_INET; | |
| 1457 | − sin->sin_addr.s_addr = htonl(ipaddr); | |
| 1456 | + sin.sin_family = AF_INET; | |
| 1457 | + sin.sin_addr.s_addr = htonl(ipaddr); | |
| 1458 | + memcpy(&ifr.ifr_addr, &sin, sizeof(sin)); | |
| 1458 | 1459 | if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) |
| 1459 | 1460 | err(1, "Setting %s interface address", tapif); |
| 1460 | 1461 | ifr.ifr_flags = IFF_UP; |
| @@ -9,7 +9,7 @@ firstly, there's nothing wrong with semaphores. But if the simpler · 8 unmodified lines | ||
| 9 | 9 | mutex semantics are sufficient for your code, then there are a couple |
| 10 | 10 | of advantages of mutexes: |
| 11 | 11 | |
| 12 | − - 'struct mutex' is smaller on most architectures: .e.g on x86, | |
| 12 | + - 'struct mutex' is smaller on most architectures: E.g. on x86, | |
| 13 | 13 | 'struct semaphore' is 20 bytes, 'struct mutex' is 16 bytes. |
| 14 | 14 | A smaller structure size means less RAM footprint, and better |
| 15 | 15 | CPU-cache utilization. |
| @@ -136,3 +136,4 @@ the APIs of 'struct mutex' have been streamlined: · 120 unmodified lines | ||
| 136 | 136 | void mutex_lock_nested(struct mutex *lock, unsigned int subclass); |
| 137 | 137 | int mutex_lock_interruptible_nested(struct mutex *lock, |
| 138 | 138 | unsigned int subclass); |
| 139 | + int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); | |
| @@ -296,6 +296,7 @@ Conexant 5051 · 295 unmodified lines | ||
| 296 | 296 | Conexant 5066 |
| 297 | 297 | ============= |
| 298 | 298 | laptop Basic Laptop config (default) |
| 299 | + hp-laptop HP laptops, e g G60 | |
| 299 | 300 | dell-laptop Dell laptops |
| 300 | 301 | dell-vostro Dell Vostro |
| 301 | 302 | olpc-xo-1_5 OLPC XO 1.5 |
| @@ -1445,6 +1445,16 @@ S: Maintained · 1444 unmodified lines | ||
| 1445 | 1445 | F: Documentation/video4linux/cafe_ccic |
| 1446 | 1446 | F: drivers/media/video/cafe_ccic* |
| 1447 | 1447 | |
| 1448 | +CAIF NETWORK LAYER | |
| 1449 | +M: Sjur Braendeland <sjur.brandeland@stericsson.com> | |
| 1450 | +L: netdev@vger.kernel.org | |
| 1451 | +S: Supported | |
| 1452 | +F: Documentation/networking/caif/ | |
| 1453 | +F: drivers/net/caif/ | |
| 1454 | +F: include/linux/caif/ | |
| 1455 | +F: include/net/caif/ | |
| 1456 | +F: net/caif/ | |
| 1457 | + | |
| 1448 | 1458 | CALGARY x86-64 IOMMU |
| 1449 | 1459 | M: Muli Ben-Yehuda <muli@il.ibm.com> |
| 1450 | 1460 | M: "Jon D. Mason" <jdmason@kudzu.us> |
| @@ -1676,8 +1686,7 @@ F: kernel/cgroup* · 225 unmodified lines | ||
| 1676 | 1686 | F: mm/*cgroup* |
| 1677 | 1687 | |
| 1678 | 1688 | CORETEMP HARDWARE MONITORING DRIVER |
| 1679 | −M: Rudolf Marek <r.marek@assembler.cz> | |
| 1680 | −M: Huaxu Wan <huaxu.wan@intel.com> | |
| 1689 | +M: Fenghua Yu <fenghua.yu@intel.com> | |
| 1681 | 1690 | L: lm-sensors@lm-sensors.org |
| 1682 | 1691 | S: Maintained |
| 1683 | 1692 | F: Documentation/hwmon/coretemp |
| @@ -2202,6 +2211,12 @@ L: linux-rdma@vger.kernel.org · 518 unmodified lines | ||
| 2202 | 2211 | S: Supported |
| 2203 | 2212 | F: drivers/infiniband/hw/ehca/ |
| 2204 | 2213 | |
| 2214 | +EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER | |
| 2215 | +M: Breno Leitao <leitao@linux.vnet.ibm.com> | |
| 2216 | +L: netdev@vger.kernel.org | |
| 2217 | +S: Maintained | |
| 2218 | +F: drivers/net/ehea/ | |
| 2219 | + | |
| 2205 | 2220 | EMBEDDED LINUX |
| 2206 | 2221 | M: Paul Gortmaker <paul.gortmaker@windriver.com> |
| 2207 | 2222 | M: Matt Mackall <mpm@selenic.com> |
| @@ -2297,6 +2312,12 @@ S: Maintained · 89 unmodified lines | ||
| 2297 | 2312 | F: Documentation/hwmon/f71805f |
| 2298 | 2313 | F: drivers/hwmon/f71805f.c |
| 2299 | 2314 | |
| 2315 | +FANOTIFY | |
| 2316 | +M: Eric Paris <eparis@redhat.com> | |
| 2317 | +S: Maintained | |
| 2318 | +F: fs/notify/fanotify/ | |
| 2319 | +F: include/linux/fanotify.h | |
| 2320 | + | |
| 2300 | 2321 | FARSYNC SYNCHRONOUS DRIVER |
| 2301 | 2322 | M: Kevin Curtis <kevin.curtis@farsite.co.uk> |
| 2302 | 2323 | W: http://www.farsite.co.uk/ |
| @@ -2776,11 +2797,6 @@ S: Maintained · 473 unmodified lines | ||
| 2776 | 2797 | F: arch/x86/kernel/hpet.c |
| 2777 | 2798 | F: arch/x86/include/asm/hpet.h |
| 2778 | 2799 | |
| 2779 | −HPET: ACPI | |
| 2780 | −M: Bob Picco <bob.picco@hp.com> | |
| 2781 | −S: Maintained | |
| 2782 | −F: drivers/char/hpet.c | |
| 2783 | − | |
| 2784 | 2800 | HPFS FILESYSTEM |
| 2785 | 2801 | M: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> |
| 2786 | 2802 | W: http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi |
| @@ -3393,7 +3409,7 @@ F: drivers/s390/kvm/ · 606 unmodified lines | ||
| 3393 | 3409 | |
| 3394 | 3410 | KEXEC |
| 3395 | 3411 | M: Eric Biederman <ebiederm@xmission.com> |
| 3396 | −W: http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/ | |
| 3412 | +W: http://kernel.org/pub/linux/utils/kernel/kexec/ | |
| 3397 | 3413 | L: kexec@lists.infradead.org |
| 3398 | 3414 | S: Maintained |
| 3399 | 3415 | F: include/linux/kexec.h |
| @@ -3489,7 +3505,7 @@ LGUEST · 89 unmodified lines | ||
| 3489 | 3505 | M: Rusty Russell <rusty@rustcorp.com.au> |
| 3490 | 3506 | L: lguest@lists.ozlabs.org |
| 3491 | 3507 | W: http://lguest.ozlabs.org/ |
| 3492 | −S: Maintained | |
| 3508 | +S: Odd Fixes | |
| 3493 | 3509 | F: Documentation/lguest/ |
| 3494 | 3510 | F: arch/x86/lguest/ |
| 3495 | 3511 | F: drivers/lguest/ |
| @@ -3918,8 +3934,7 @@ F: Documentation/sound/oss/MultiSound · 422 unmodified lines | ||
| 3918 | 3934 | F: sound/oss/msnd* |
| 3919 | 3935 | |
| 3920 | 3936 | MULTITECH MULTIPORT CARD (ISICOM) |
| 3921 | −M: Jiri Slaby <jirislaby@gmail.com> | |
| 3922 | −S: Maintained | |
| 3937 | +S: Orphan | |
| 3923 | 3938 | F: drivers/char/isicom.c |
| 3924 | 3939 | F: include/linux/isicom.h |
| 3925 | 3940 | |
| @@ -4599,7 +4614,7 @@ F: include/linux/preempt.h · 673 unmodified lines | ||
| 4599 | 4614 | PRISM54 WIRELESS DRIVER |
| 4600 | 4615 | M: "Luis R. Rodriguez" <mcgrof@gmail.com> |
| 4601 | 4616 | L: linux-wireless@vger.kernel.org |
| 4602 | −W: http://prism54.org | |
| 4617 | +W: http://wireless.kernel.org/en/users/Drivers/p54 | |
| 4603 | 4618 | S: Obsolete |
| 4604 | 4619 | F: drivers/net/wireless/prism54/ |
| 4605 | 4620 | |
| @@ -4800,6 +4815,7 @@ RCUTORTURE MODULE · 194 unmodified lines | ||
| 4800 | 4815 | M: Josh Triplett <josh@freedesktop.org> |
| 4801 | 4816 | M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
| 4802 | 4817 | S: Supported |
| 4818 | +T: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git | |
| 4803 | 4819 | F: Documentation/RCU/torture.txt |
| 4804 | 4820 | F: kernel/rcutorture.c |
| 4805 | 4821 | |
| @@ -4824,6 +4840,7 @@ M: Dipankar Sarma <dipankar@in.ibm.com> · 18 unmodified lines | ||
| 4824 | 4840 | M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
| 4825 | 4841 | W: http://www.rdrop.com/users/paulmck/rclock/ |
| 4826 | 4842 | S: Supported |
| 4843 | +T: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git | |
| 4827 | 4844 | F: Documentation/RCU/ |
| 4828 | 4845 | F: include/linux/rcu* |
| 4829 | 4846 | F: include/linux/srcu* |
| @@ -4831,12 +4848,10 @@ F: kernel/rcu* · 1 unmodified line | ||
| 4831 | 4848 | F: kernel/srcu* |
| 4832 | 4849 | X: kernel/rcutorture.c |
| 4833 | 4850 | |
| 4834 | −REAL TIME CLOCK DRIVER | |
| 4851 | +REAL TIME CLOCK DRIVER (LEGACY) | |
| 4835 | 4852 | M: Paul Gortmaker <p_gortmaker@yahoo.com> |
| 4836 | 4853 | S: Maintained |
| 4837 | −F: Documentation/rtc.txt | |
| 4838 | −F: drivers/rtc/ | |
| 4839 | −F: include/linux/rtc.h | |
| 4854 | +F: drivers/char/rtc.c | |
| 4840 | 4855 | |
| 4841 | 4856 | REAL TIME CLOCK (RTC) SUBSYSTEM |
| 4842 | 4857 | M: Alessandro Zummo <a.zummo@towertech.it> |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 2 |
| 2 | 2 | PATCHLEVEL = 6 |
| 3 | 3 | SUBLEVEL = 36 |
| 4 | −EXTRAVERSION = -rc2 | |
| 4 | +EXTRAVERSION = -rc4 | |
| 5 | 5 | NAME = Sheep on Meth |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -17,7 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | # define L1_CACHE_SHIFT 5 |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | −#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) | |
| 21 | 20 | #define SMP_CACHE_BYTES L1_CACHE_BYTES |
| 22 | 21 | |
| 23 | 22 | #endif |
| @@ -109,7 +109,7 @@ marvel_print_err_cyc(u64 err_cyc) · 108 unmodified lines | ||
| 109 | 109 | #define IO7__ERR_CYC__CYCLE__M (0x7) |
| 110 | 110 | |
| 111 | 111 | printk("%s Packet In Error: %s\n" |
| 112 | − "%s Error in %s, cycle %ld%s%s\n", | |
| 112 | + "%s Error in %s, cycle %lld%s%s\n", | |
| 113 | 113 | err_print_prefix, |
| 114 | 114 | packet_desc[EXTRACT(err_cyc, IO7__ERR_CYC__PACKET)], |
| 115 | 115 | err_print_prefix, |
| @@ -313,7 +313,7 @@ marvel_print_po7_ugbge_sym(u64 ugbge_sym) · 197 unmodified lines | ||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | printk("%s Up Hose Garbage Symptom:\n" |
| 316 | − "%s Source Port: %ld - Dest PID: %ld - OpCode: %s\n", | |
| 316 | + "%s Source Port: %lld - Dest PID: %lld - OpCode: %s\n", | |
| 317 | 317 | err_print_prefix, |
| 318 | 318 | err_print_prefix, |
| 319 | 319 | EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_SRC_PORT), |
| @@ -552,7 +552,7 @@ marvel_print_pox_spl_cmplt(u64 spl_cmplt) · 232 unmodified lines | ||
| 552 | 552 | #define IO7__POX_SPLCMPLT__REM_BYTE_COUNT__M (0xfff) |
| 553 | 553 | |
| 554 | 554 | printk("%s Split Completion Error:\n" |
| 555 | − "%s Source (Bus:Dev:Func): %ld:%ld:%ld\n", | |
| 555 | + "%s Source (Bus:Dev:Func): %lld:%lld:%lld\n", | |
| 556 | 556 | err_print_prefix, |
| 557 | 557 | err_print_prefix, |
| 558 | 558 | EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__SOURCE_BUS), |
| @@ -252,7 +252,7 @@ SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname, · 251 unmodified lines | ||
| 252 | 252 | |
| 253 | 253 | retval = user_path(pathname, &path); |
| 254 | 254 | if (!retval) { |
| 255 | − retval = do_osf_statfs(&path buffer, bufsiz); | |
| 255 | + retval = do_osf_statfs(&path, buffer, bufsiz); | |
| 256 | 256 | path_put(&path); |
| 257 | 257 | } |
| 258 | 258 | return retval; |
| @@ -241,20 +241,20 @@ static inline unsigned long alpha_read_pmc(int idx) · 240 unmodified lines | ||
| 241 | 241 | static int alpha_perf_event_set_period(struct perf_event *event, |
| 242 | 242 | struct hw_perf_event *hwc, int idx) |
| 243 | 243 | { |
| 244 | − long left = atomic64_read(&hwc->period_left); | |
| 244 | + long left = local64_read(&hwc->period_left); | |
| 245 | 245 | long period = hwc->sample_period; |
| 246 | 246 | int ret = 0; |
| 247 | 247 | |
| 248 | 248 | if (unlikely(left <= -period)) { |
| 249 | 249 | left = period; |
| 250 | − atomic64_set(&hwc->period_left, left); | |
| 250 | + local64_set(&hwc->period_left, left); | |
| 251 | 251 | hwc->last_period = period; |
| 252 | 252 | ret = 1; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (unlikely(left <= 0)) { |
| 256 | 256 | left += period; |
| 257 | − atomic64_set(&hwc->period_left, left); | |
| 257 | + local64_set(&hwc->period_left, left); | |
| 258 | 258 | hwc->last_period = period; |
| 259 | 259 | ret = 1; |
| 260 | 260 | } |
| @@ -269,7 +269,7 @@ static int alpha_perf_event_set_period(struct perf_event *event, · 8 unmodified lines | ||
| 269 | 269 | if (left > (long)alpha_pmu->pmc_max_period[idx]) |
| 270 | 270 | left = alpha_pmu->pmc_max_period[idx]; |
| 271 | 271 | |
| 272 | − atomic64_set(&hwc->prev_count, (unsigned long)(-left)); | |
| 272 | + local64_set(&hwc->prev_count, (unsigned long)(-left)); | |
| 273 | 273 | |
| 274 | 274 | alpha_write_pmc(idx, (unsigned long)(-left)); |
| 275 | 275 | |
| @@ -300,10 +300,10 @@ static unsigned long alpha_perf_event_update(struct perf_event *event, · 24 unmodified lines | ||
| 300 | 300 | long delta; |
| 301 | 301 | |
| 302 | 302 | again: |
| 303 | − prev_raw_count = atomic64_read(&hwc->prev_count); | |
| 303 | + prev_raw_count = local64_read(&hwc->prev_count); | |
| 304 | 304 | new_raw_count = alpha_read_pmc(idx); |
| 305 | 305 | |
| 306 | − if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count, | |
| 306 | + if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, | |
| 307 | 307 | new_raw_count) != prev_raw_count) |
| 308 | 308 | goto again; |
| 309 | 309 | |
| @@ -316,8 +316,8 @@ again: · 6 unmodified lines | ||
| 316 | 316 | delta += alpha_pmu->pmc_max_period[idx] + 1; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | − atomic64_add(delta, &event->count); | |
| 320 | − atomic64_sub(delta, &hwc->period_left); | |
| 319 | + local64_add(delta, &event->count); | |
| 320 | + local64_sub(delta, &hwc->period_left); | |
| 321 | 321 | |
| 322 | 322 | return new_raw_count; |
| 323 | 323 | } |
| @@ -670,7 +670,7 @@ static int __hw_perf_event_init(struct perf_event *event) · 346 unmodified lines | ||
| 670 | 670 | if (!hwc->sample_period) { |
| 671 | 671 | hwc->sample_period = alpha_pmu->pmc_max_period[0]; |
| 672 | 672 | hwc->last_period = hwc->sample_period; |
| 673 | − atomic64_set(&hwc->period_left, hwc->sample_period); | |
| 673 | + local64_set(&hwc->period_left, hwc->sample_period); | |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | return 0; |
| @@ -156,9 +156,6 @@ extern void SMC669_Init(int); · 155 unmodified lines | ||
| 156 | 156 | /* es1888.c */ |
| 157 | 157 | extern void es1888_init(void); |
| 158 | 158 | |
| 159 | −/* ns87312.c */ | |
| 160 | −extern void ns87312_enable_ide(long ide_base); | |
| 161 | − | |
| 162 | 159 | /* ../lib/fpreg.c */ |
| 163 | 160 | extern void alpha_write_fp_reg (unsigned long reg, unsigned long val); |
| 164 | 161 | extern unsigned long alpha_read_fp_reg (unsigned long reg); |
| @@ -33,7 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #include "irq_impl.h" |
| 34 | 34 | #include "pci_impl.h" |
| 35 | 35 | #include "machvec_impl.h" |
| 36 | − | |
| 36 | +#include "pc873xx.h" | |
| 37 | 37 | |
| 38 | 38 | /* Note mask bit is true for DISABLED irqs. */ |
| 39 | 39 | static unsigned long cached_irq_mask = ~0UL; |
| @@ -235,18 +235,31 @@ cabriolet_map_irq(struct pci_dev *dev, u8 slot, u8 pin) · 195 unmodified lines | ||
| 235 | 235 | return COMMON_TABLE_LOOKUP; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | +static inline void __init | |
| 239 | +cabriolet_enable_ide(void) | |
| 240 | +{ | |
| 241 | + if (pc873xx_probe() == -1) { | |
| 242 | + printk(KERN_ERR "Probing for PC873xx Super IO chip failed.\n"); | |
| 243 | + } else { | |
| 244 | + printk(KERN_INFO "Found %s Super IO chip at 0x%x\n", | |
| 245 | + pc873xx_get_model(), pc873xx_get_base()); | |
| 246 | + | |
| 247 | + pc873xx_enable_ide(); | |
| 248 | + } | |
| 249 | +} | |
| 250 | + | |
| 238 | 251 | static inline void __init |
| 239 | 252 | cabriolet_init_pci(void) |
| 240 | 253 | { |
| 241 | 254 | common_init_pci(); |
| 242 | − ns87312_enable_ide(0x398); | |
| 255 | + cabriolet_enable_ide(); | |
| 243 | 256 | } |
| 244 | 257 | |
| 245 | 258 | static inline void __init |
| 246 | 259 | cia_cab_init_pci(void) |
| 247 | 260 | { |
| 248 | 261 | cia_init_pci(); |
| 249 | − ns87312_enable_ide(0x398); | |
| 262 | + cabriolet_enable_ide(); | |
| 250 | 263 | } |
| 251 | 264 | |
| 252 | 265 | /* |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "irq_impl.h" |
| 30 | 30 | #include "pci_impl.h" |
| 31 | 31 | #include "machvec_impl.h" |
| 32 | − | |
| 32 | +#include "pc873xx.h" | |
| 33 | 33 | |
| 34 | 34 | /* Note mask bit is true for DISABLED irqs. */ |
| 35 | 35 | static unsigned long cached_irq_mask[2] = { -1, -1 }; |
| @@ -264,7 +264,14 @@ takara_init_pci(void) · 228 unmodified lines | ||
| 264 | 264 | alpha_mv.pci_map_irq = takara_map_irq_srm; |
| 265 | 265 | |
| 266 | 266 | cia_init_pci(); |
| 267 | − ns87312_enable_ide(0x26e); | |
| 267 | + | |
| 268 | + if (pc873xx_probe() == -1) { | |
| 269 | + printk(KERN_ERR "Probing for PC873xx Super IO chip failed.\n"); | |
| 270 | + } else { | |
| 271 | + printk(KERN_INFO "Found %s Super IO chip at 0x%x\n", | |
| 272 | + pc873xx_get_model(), pc873xx_get_base()); | |
| 273 | + pc873xx_enable_ide(); | |
| 274 | + } | |
| 268 | 275 | } |
| 269 | 276 | |
| 270 | 277 | |
| @@ -1576,95 +1576,6 @@ config AUTO_ZRELADDR · 1575 unmodified lines | ||
| 1576 | 1576 | 0xf8000000. This assumes the zImage being placed in the first 128MB |
| 1577 | 1577 | from start of memory. |
| 1578 | 1578 | |
| 1579 | −config ZRELADDR | |
| 1580 | − hex "Physical address of the decompressed kernel image" | |
| 1581 | − depends on !AUTO_ZRELADDR | |
| 1582 | − default 0x00008000 if ARCH_BCMRING ||\ | |
| 1583 | − ARCH_CNS3XXX ||\ | |
| 1584 | − ARCH_DOVE ||\ | |
| 1585 | − ARCH_EBSA110 ||\ | |
| 1586 | − ARCH_FOOTBRIDGE ||\ | |
| 1587 | − ARCH_INTEGRATOR ||\ | |
| 1588 | − ARCH_IOP13XX ||\ | |
| 1589 | − ARCH_IOP33X ||\ | |
| 1590 | − ARCH_IXP2000 ||\ | |
| 1591 | − ARCH_IXP23XX ||\ | |
| 1592 | − ARCH_IXP4XX ||\ | |
| 1593 | − ARCH_KIRKWOOD ||\ | |
| 1594 | − ARCH_KS8695 ||\ | |
| 1595 | − ARCH_LOKI ||\ | |
| 1596 | − ARCH_MMP ||\ | |
| 1597 | − ARCH_MV78XX0 ||\ | |
| 1598 | − ARCH_NOMADIK ||\ | |
| 1599 | − ARCH_NUC93X ||\ | |
| 1600 | − ARCH_NS9XXX ||\ | |
| 1601 | − ARCH_ORION5X ||\ | |
| 1602 | − ARCH_SPEAR3XX ||\ | |
| 1603 | − ARCH_SPEAR6XX ||\ | |
| 1604 | − ARCH_U8500 ||\ | |
| 1605 | − ARCH_VERSATILE ||\ | |
| 1606 | − ARCH_W90X900 | |
| 1607 | − default 0x08008000 if ARCH_MX1 ||\ | |
| 1608 | − ARCH_SHARK | |
| 1609 | − default 0x10008000 if ARCH_MSM ||\ | |
| 1610 | − ARCH_OMAP1 ||\ | |
| 1611 | − ARCH_RPC | |
| 1612 | − default 0x20008000 if ARCH_S5P6440 ||\ | |
| 1613 | − ARCH_S5P6442 ||\ | |
| 1614 | − ARCH_S5PC100 ||\ | |
| 1615 | − ARCH_S5PV210 | |
| 1616 | − default 0x30008000 if ARCH_S3C2410 ||\ | |
| 1617 | − ARCH_S3C2400 ||\ | |
| 1618 | − ARCH_S3C2412 ||\ | |
| 1619 | − ARCH_S3C2416 ||\ | |
| 1620 | − ARCH_S3C2440 ||\ | |
| 1621 | − ARCH_S3C2443 | |
| 1622 | − default 0x40008000 if ARCH_STMP378X ||\ | |
| 1623 | − ARCH_STMP37XX ||\ | |
| 1624 | − ARCH_SH7372 ||\ | |
| 1625 | − ARCH_SH7377 | |
| 1626 | − default 0x50008000 if ARCH_S3C64XX ||\ | |
| 1627 | − ARCH_SH7367 | |
| 1628 | − default 0x60008000 if ARCH_VEXPRESS | |
| 1629 | − default 0x80008000 if ARCH_MX25 ||\ | |
| 1630 | − ARCH_MX3 ||\ | |
| 1631 | − ARCH_NETX ||\ | |
| 1632 | − ARCH_OMAP2PLUS ||\ | |
| 1633 | − ARCH_PNX4008 | |
| 1634 | − default 0x90008000 if ARCH_MX5 ||\ | |
| 1635 | − ARCH_MX91231 | |
| 1636 | − default 0xa0008000 if ARCH_IOP32X ||\ | |
| 1637 | − ARCH_PXA ||\ | |
| 1638 | − MACH_MX27 | |
| 1639 | − default 0xc0008000 if ARCH_LH7A40X ||\ | |
| 1640 | − MACH_MX21 | |
| 1641 | − default 0xf0008000 if ARCH_AAEC2000 ||\ | |
| 1642 | − ARCH_L7200 | |
| 1643 | − default 0xc0028000 if ARCH_CLPS711X | |
| 1644 | − default 0x70008000 if ARCH_AT91 && (ARCH_AT91CAP9 || ARCH_AT91SAM9G45) | |
| 1645 | − default 0x20008000 if ARCH_AT91 && !(ARCH_AT91CAP9 || ARCH_AT91SAM9G45) | |
| 1646 | − default 0xc0008000 if ARCH_DAVINCI && ARCH_DAVINCI_DA8XX | |
| 1647 | − default 0x80008000 if ARCH_DAVINCI && !ARCH_DAVINCI_DA8XX | |
| 1648 | − default 0x00008000 if ARCH_EP93XX && EP93XX_SDCE3_SYNC_PHYS_OFFSET | |
| 1649 | − default 0xc0008000 if ARCH_EP93XX && EP93XX_SDCE0_PHYS_OFFSET | |
| 1650 | − default 0xd0008000 if ARCH_EP93XX && EP93XX_SDCE1_PHYS_OFFSET | |
| 1651 | − default 0xe0008000 if ARCH_EP93XX && EP93XX_SDCE2_PHYS_OFFSET | |
| 1652 | − default 0xf0008000 if ARCH_EP93XX && EP93XX_SDCE3_ASYNC_PHYS_OFFSET | |
| 1653 | − default 0x00008000 if ARCH_GEMINI && GEMINI_MEM_SWAP | |
| 1654 | − default 0x10008000 if ARCH_GEMINI && !GEMINI_MEM_SWAP | |
| 1655 | − default 0x70008000 if ARCH_REALVIEW && REALVIEW_HIGH_PHYS_OFFSET | |
| 1656 | − default 0x00008000 if ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET | |
| 1657 | − default 0xc0208000 if ARCH_SA1100 && SA1111 | |
| 1658 | − default 0xc0008000 if ARCH_SA1100 && !SA1111 | |
| 1659 | − default 0x30108000 if ARCH_S3C2410 && PM_H1940 | |
| 1660 | − default 0x28E08000 if ARCH_U300 && MACH_U300_SINGLE_RAM | |
| 1661 | − default 0x48008000 if ARCH_U300 && !MACH_U300_SINGLE_RAM | |
| 1662 | − help | |
| 1663 | − ZRELADDR is the physical address where the decompressed kernel | |
| 1664 | − image will be placed. ZRELADDR has to be specified when the | |
| 1665 | − assumption of AUTO_ZRELADDR is not valid, or when ZBOOT_ROM is | |
| 1666 | − selected. | |
| 1667 | − | |
| 1668 | 1579 | endmenu |
| 1669 | 1580 | |
| 1670 | 1581 | menu "CPU Power Management" |
| @@ -14,16 +14,18 @@ · 13 unmodified lines | ||
| 14 | 14 | MKIMAGE := $(srctree)/scripts/mkuboot.sh |
| 15 | 15 | |
| 16 | 16 | ifneq ($(MACHINE),) |
| 17 | −-include $(srctree)/$(MACHINE)/Makefile.boot | |
| 17 | +include $(srctree)/$(MACHINE)/Makefile.boot | |
| 18 | 18 | endif |
| 19 | 19 | |
| 20 | 20 | # Note: the following conditions must always be true: |
| 21 | +# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET) | |
| 21 | 22 | # PARAMS_PHYS must be within 4MB of ZRELADDR |
| 22 | 23 | # INITRD_PHYS must be in RAM |
| 24 | +ZRELADDR := $(zreladdr-y) | |
| 23 | 25 | PARAMS_PHYS := $(params_phys-y) |
| 24 | 26 | INITRD_PHYS := $(initrd_phys-y) |
| 25 | 27 | |
| 26 | −export INITRD_PHYS PARAMS_PHYS | |
| 28 | +export ZRELADDR INITRD_PHYS PARAMS_PHYS | |
| 27 | 29 | |
| 28 | 30 | targets := Image zImage xipImage bootpImage uImage |
| 29 | 31 | |
| @@ -65,7 +67,7 @@ quiet_cmd_uimage = UIMAGE $@ · 35 unmodified lines | ||
| 65 | 67 | ifeq ($(CONFIG_ZBOOT_ROM),y) |
| 66 | 68 | $(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT) |
| 67 | 69 | else |
| 68 | −$(obj)/uImage: LOADADDR=$(CONFIG_ZRELADDR) | |
| 70 | +$(obj)/uImage: LOADADDR=$(ZRELADDR) | |
| 69 | 71 | endif |
| 70 | 72 | |
| 71 | 73 | ifeq ($(CONFIG_THUMB2_KERNEL),y) |
| @@ -79,6 +79,10 @@ endif · 78 unmodified lines | ||
| 79 | 79 | EXTRA_CFLAGS := -fpic -fno-builtin |
| 80 | 80 | EXTRA_AFLAGS := -Wa,-march=all |
| 81 | 81 | |
| 82 | +# Supply ZRELADDR to the decompressor via a linker symbol. | |
| 83 | +ifneq ($(CONFIG_AUTO_ZRELADDR),y) | |
| 84 | +LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR) | |
| 85 | +endif | |
| 82 | 86 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) |
| 83 | 87 | LDFLAGS_vmlinux += --be8 |
| 84 | 88 | endif |
| @@ -177,7 +177,7 @@ not_angel: · 176 unmodified lines | ||
| 177 | 177 | and r4, pc, #0xf8000000 |
| 178 | 178 | add r4, r4, #TEXT_OFFSET |
| 179 | 179 | #else |
| 180 | − ldr r4, =CONFIG_ZRELADDR | |
| 180 | + ldr r4, =zreladdr | |
| 181 | 181 | #endif |
| 182 | 182 | subs r0, r0, r1 @ calculate the delta offset |
| 183 | 183 | |
| @@ -263,6 +263,14 @@ static int it8152_pci_platform_notify_remove(struct device *dev) · 262 unmodified lines | ||
| 263 | 263 | return 0; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | +int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) | |
| 267 | +{ | |
| 268 | + dev_dbg(dev, "%s: dma_addr %08x, size %08x\n", | |
| 269 | + __func__, dma_addr, size); | |
| 270 | + return (dev->bus == &pci_bus_type) && | |
| 271 | + ((dma_addr + size - PHYS_OFFSET) >= SZ_64M); | |
| 272 | +} | |
| 273 | + | |
| 266 | 274 | int __init it8152_pci_setup(int nr, struct pci_sys_data *sys) |
| 267 | 275 | { |
| 268 | 276 | it8152_io.start = IT8152_IO_BASE + 0x12000; |
| @@ -13,6 +13,9 @@ CONFIG_MODULE_SRCVERSION_ALL=y · 12 unmodified lines | ||
| 13 | 13 | # CONFIG_BLK_DEV_BSG is not set |
| 14 | 14 | CONFIG_ARCH_OMAP=y |
| 15 | 15 | CONFIG_ARCH_OMAP4=y |
| 16 | +# CONFIG_ARCH_OMAP2PLUS_TYPICAL is not set | |
| 17 | +# CONFIG_ARCH_OMAP2 is not set | |
| 18 | +# CONFIG_ARCH_OMAP3 is not set | |
| 16 | 19 | # CONFIG_OMAP_MUX is not set |
| 17 | 20 | CONFIG_OMAP_32K_TIMER=y |
| 18 | 21 | CONFIG_OMAP_DM_TIMER=y |
| @@ -288,15 +288,7 @@ extern void dmabounce_unregister_dev(struct device *); · 287 unmodified lines | ||
| 288 | 288 | * DMA access and 1 if the buffer needs to be bounced. |
| 289 | 289 | * |
| 290 | 290 | */ |
| 291 | −#ifdef CONFIG_SA1111 | |
| 292 | 291 | extern int dma_needs_bounce(struct device*, dma_addr_t, size_t); |
| 293 | −#else | |
| 294 | −static inline int dma_needs_bounce(struct device *dev, dma_addr_t addr, | |
| 295 | − size_t size) | |
| 296 | −{ | |
| 297 | − return 0; | |
| 298 | −} | |
| 299 | −#endif | |
| 300 | 292 | |
| 301 | 293 | /* |
| 302 | 294 | * The DMA API, implemented by dmabounce.c. See below for descriptions. |
| @@ -17,7 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | * counter interrupts are regular interrupts and not an NMI. This |
| 18 | 18 | * means that when we receive the interrupt we can call |
| 19 | 19 | * perf_event_do_pending() that handles all of the work with |
| 20 | − * interrupts enabled. | |
| 20 | + * interrupts disabled. | |
| 21 | 21 | */ |
| 22 | 22 | static inline void |
| 23 | 23 | set_perf_event_pending(void) |
| @@ -393,6 +393,9 @@ · 392 unmodified lines | ||
| 393 | 393 | #define __NR_perf_event_open (__NR_SYSCALL_BASE+364) |
| 394 | 394 | #define __NR_recvmmsg (__NR_SYSCALL_BASE+365) |
| 395 | 395 | #define __NR_accept4 (__NR_SYSCALL_BASE+366) |
| 396 | +#define __NR_fanotify_init (__NR_SYSCALL_BASE+367) | |
| 397 | +#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) | |
| 398 | +#define __NR_prlimit64 (__NR_SYSCALL_BASE+369) | |
| 396 | 399 | |
| 397 | 400 | /* |
| 398 | 401 | * The following SWIs are ARM private. |
| @@ -376,6 +376,9 @@ · 375 unmodified lines | ||
| 376 | 376 | CALL(sys_perf_event_open) |
| 377 | 377 | /* 365 */ CALL(sys_recvmmsg) |
| 378 | 378 | CALL(sys_accept4) |
| 379 | + CALL(sys_fanotify_init) | |
| 380 | + CALL(sys_fanotify_mark) | |
| 381 | + CALL(sys_prlimit64) | |
| 379 | 382 | #ifndef syscalls_counted |
| 380 | 383 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
| 381 | 384 | #define syscalls_counted |
| @@ -230,7 +230,7 @@ static void etm_dump(void) · 229 unmodified lines | ||
| 230 | 230 | etb_lock(t); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | −static void sysrq_etm_dump(int key, struct tty_struct *tty) | |
| 233 | +static void sysrq_etm_dump(int key) | |
| 234 | 234 | { |
| 235 | 235 | dev_dbg(tracer.dev, "Dumping ETB buffer\n"); |
| 236 | 236 | etm_dump(); |
| @@ -342,8 +342,8 @@ validate_event(struct cpu_hw_events *cpuc, · 341 unmodified lines | ||
| 342 | 342 | { |
| 343 | 343 | struct hw_perf_event fake_event = event->hw; |
| 344 | 344 | |
| 345 | − if (event->pmu && event->pmu != &pmu) | |
| 346 | − return 0; | |
| 345 | + if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF) | |
| 346 | + return 1; | |
| 347 | 347 | |
| 348 | 348 | return armpmu->get_event_idx(cpuc, &fake_event) >= 0; |
| 349 | 349 | } |
| @@ -1082,8 +1082,8 @@ armv6pmu_handle_irq(int irq_num, · 732 unmodified lines | ||
| 1082 | 1082 | /* |
| 1083 | 1083 | * Handle the pending perf events. |
| 1084 | 1084 | * |
| 1085 | − * Note: this call *must* be run with interrupts enabled. For | |
| 1086 | − * platforms that can have the PMU interrupts raised as a PMI, this | |
| 1085 | + * Note: this call *must* be run with interrupts disabled. For | |
| 1086 | + * platforms that can have the PMU interrupts raised as an NMI, this | |
| 1087 | 1087 | * will not work. |
| 1088 | 1088 | */ |
| 1089 | 1089 | perf_event_do_pending(); |
| @@ -2058,8 +2058,8 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev) · 968 unmodified lines | ||
| 2058 | 2058 | /* |
| 2059 | 2059 | * Handle the pending perf events. |
| 2060 | 2060 | * |
| 2061 | − * Note: this call *must* be run with interrupts enabled. For | |
| 2062 | − * platforms that can have the PMU interrupts raised as a PMI, this | |
| 2061 | + * Note: this call *must* be run with interrupts disabled. For | |
| 2062 | + * platforms that can have the PMU interrupts raised as an NMI, this | |
| 2063 | 2063 | * will not work. |
| 2064 | 2064 | */ |
| 2065 | 2065 | perf_event_do_pending(); |
| @@ -121,8 +121,8 @@ static struct clk ssc1_clk = { · 120 unmodified lines | ||
| 121 | 121 | .pmc_mask = 1 << AT91SAM9G45_ID_SSC1, |
| 122 | 122 | .type = CLK_TYPE_PERIPHERAL, |
| 123 | 123 | }; |
| 124 | −static struct clk tcb_clk = { | |
| 125 | − .name = "tcb_clk", | |
| 124 | +static struct clk tcb0_clk = { | |
| 125 | + .name = "tcb0_clk", | |
| 126 | 126 | .pmc_mask = 1 << AT91SAM9G45_ID_TCB, |
| 127 | 127 | .type = CLK_TYPE_PERIPHERAL, |
| 128 | 128 | }; |
| @@ -192,6 +192,14 @@ static struct clk ohci_clk = { · 63 unmodified lines | ||
| 192 | 192 | .parent = &uhphs_clk, |
| 193 | 193 | }; |
| 194 | 194 | |
| 195 | +/* One additional fake clock for second TC block */ | |
| 196 | +static struct clk tcb1_clk = { | |
| 197 | + .name = "tcb1_clk", | |
| 198 | + .pmc_mask = 0, | |
| 199 | + .type = CLK_TYPE_PERIPHERAL, | |
| 200 | + .parent = &tcb0_clk, | |
| 201 | +}; | |
| 202 | + | |
| 195 | 203 | static struct clk *periph_clocks[] __initdata = { |
| 196 | 204 | &pioA_clk, |
| 197 | 205 | &pioB_clk, |
| @@ -208,7 +216,7 @@ static struct clk *periph_clocks[] __initdata = { · 10 unmodified lines | ||
| 208 | 216 | &spi1_clk, |
| 209 | 217 | &ssc0_clk, |
| 210 | 218 | &ssc1_clk, |
| 211 | − &tcb_clk, | |
| 219 | + &tcb0_clk, | |
| 212 | 220 | &pwm_clk, |
| 213 | 221 | &tsc_clk, |
| 214 | 222 | &dma_clk, |
| @@ -221,6 +229,7 @@ static struct clk *periph_clocks[] __initdata = { · 6 unmodified lines | ||
| 221 | 229 | &mmc1_clk, |
| 222 | 230 | // irq0 |
| 223 | 231 | &ohci_clk, |
| 232 | + &tcb1_clk, | |
| 224 | 233 | }; |
| 225 | 234 | |
| 226 | 235 | /* |
| @@ -46,7 +46,7 @@ static struct resource hdmac_resources[] = { · 45 unmodified lines | ||
| 46 | 46 | .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, |
| 47 | 47 | .flags = IORESOURCE_MEM, |
| 48 | 48 | }, |
| 49 | − [2] = { | |
| 49 | + [1] = { | |
| 50 | 50 | .start = AT91SAM9G45_ID_DMA, |
| 51 | 51 | .end = AT91SAM9G45_ID_DMA, |
| 52 | 52 | .flags = IORESOURCE_IRQ, |
| @@ -835,9 +835,9 @@ static struct platform_device at91sam9g45_tcb1_device = { · 782 unmodified lines | ||
| 835 | 835 | static void __init at91_add_device_tc(void) |
| 836 | 836 | { |
| 837 | 837 | /* this chip has one clock and irq for all six TC channels */ |
| 838 | − at91_clock_associate("tcb_clk", &at91sam9g45_tcb0_device.dev, "t0_clk"); | |
| 838 | + at91_clock_associate("tcb0_clk", &at91sam9g45_tcb0_device.dev, "t0_clk"); | |
| 839 | 839 | platform_device_register(&at91sam9g45_tcb0_device); |
| 840 | − at91_clock_associate("tcb_clk", &at91sam9g45_tcb1_device.dev, "t0_clk"); | |
| 840 | + at91_clock_associate("tcb1_clk", &at91sam9g45_tcb1_device.dev, "t0_clk"); | |
| 841 | 841 | platform_device_register(&at91sam9g45_tcb1_device); |
| 842 | 842 | } |
| 843 | 843 | #else |
| @@ -93,11 +93,12 @@ static struct resource dm9000_resource[] = { · 92 unmodified lines | ||
| 93 | 93 | .start = AT91_PIN_PC11, |
| 94 | 94 | .end = AT91_PIN_PC11, |
| 95 | 95 | .flags = IORESOURCE_IRQ |
| 96 | + | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, | |
| 96 | 97 | } |
| 97 | 98 | }; |
| 98 | 99 | |
| 99 | 100 | static struct dm9000_plat_data dm9000_platdata = { |
| 100 | − .flags = DM9000_PLATF_16BITONLY, | |
| 101 | + .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM, | |
| 101 | 102 | }; |
| 102 | 103 | |
| 103 | 104 | static struct platform_device dm9000_device = { |
| @@ -167,17 +168,6 @@ static struct at91_udc_data __initdata ek_udc_data = { · 63 unmodified lines | ||
| 167 | 168 | }; |
| 168 | 169 | |
| 169 | 170 | |
| 170 | −/* | |
| 171 | − * MCI (SD/MMC) | |
| 172 | − */ | |
| 173 | −static struct at91_mmc_data __initdata ek_mmc_data = { | |
| 174 | − .wire4 = 1, | |
| 175 | −// .det_pin = ... not connected | |
| 176 | −// .wp_pin = ... not connected | |
| 177 | −// .vcc_pin = ... not connected | |
| 178 | −}; | |
| 179 | − | |
| 180 | − | |
| 181 | 171 | /* |
| 182 | 172 | * NAND flash |
| 183 | 173 | */ |
| @@ -246,6 +236,10 @@ static void __init ek_add_device_nand(void) · 62 unmodified lines | ||
| 246 | 236 | at91_add_device_nand(&ek_nand_data); |
| 247 | 237 | } |
| 248 | 238 | |
| 239 | +/* | |
| 240 | + * SPI related devices | |
| 241 | + */ | |
| 242 | +#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | |
| 249 | 243 | |
| 250 | 244 | /* |
| 251 | 245 | * ADS7846 Touchscreen |
| @@ -356,6 +350,19 @@ static struct spi_board_info ek_spi_devices[] = { · 104 unmodified lines | ||
| 356 | 350 | #endif |
| 357 | 351 | }; |
| 358 | 352 | |
| 353 | +#else /* CONFIG_SPI_ATMEL_* */ | |
| 354 | +/* spi0 and mmc/sd share the same PIO pins: cannot be used at the same time */ | |
| 355 | + | |
| 356 | +/* | |
| 357 | + * MCI (SD/MMC) | |
| 358 | + * det_pin, wp_pin and vcc_pin are not connected | |
| 359 | + */ | |
| 360 | +static struct at91_mmc_data __initdata ek_mmc_data = { | |
| 361 | + .wire4 = 1, | |
| 362 | +}; | |
| 363 | + | |
| 364 | +#endif /* CONFIG_SPI_ATMEL_* */ | |
| 365 | + | |
| 359 | 366 | |
| 360 | 367 | /* |
| 361 | 368 | * LCD Controller |
| @@ -501,7 +501,8 @@ postcore_initcall(at91_clk_debugfs_init); · 500 unmodified lines | ||
| 501 | 501 | int __init clk_register(struct clk *clk) |
| 502 | 502 | { |
| 503 | 503 | if (clk_is_peripheral(clk)) { |
| 504 | − clk->parent = &mck; | |
| 504 | + if (!clk->parent) | |
| 505 | + clk->parent = &mck; | |
| 505 | 506 | clk->mode = pmc_periph_mode; |
| 506 | 507 | list_add_tail(&clk->node, &clocks); |
| 507 | 508 | } |
| @@ -560,4 +560,4 @@ static int __init ep93xx_clock_init(void) · 559 unmodified lines | ||
| 560 | 560 | clkdev_add_table(clocks, ARRAY_SIZE(clocks)); |
| 561 | 561 | return 0; |
| 562 | 562 | } |
| 563 | −arch_initcall(ep93xx_clock_init); | |
| 563 | +postcore_initcall(ep93xx_clock_init); | |
| @@ -215,7 +215,7 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = { · 214 unmodified lines | ||
| 215 | 215 | * Add platform devices present on this baseboard and init |
| 216 | 216 | * them from CPU side as far as required to use them later on |
| 217 | 217 | */ |
| 218 | −void __init eukrea_mbimxsd_baseboard_init(void) | |
| 218 | +void __init eukrea_mbimxsd25_baseboard_init(void) | |
| 219 | 219 | { |
| 220 | 220 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, |
| 221 | 221 | ARRAY_SIZE(eukrea_mbimxsd_pads))) |
| @@ -147,8 +147,8 @@ static void __init eukrea_cpuimx25_init(void) · 146 unmodified lines | ||
| 147 | 147 | if (!otg_mode_host) |
| 148 | 148 | mxc_register_device(&otg_udc_device, &otg_device_pdata); |
| 149 | 149 | |
| 150 | −#ifdef CONFIG_MACH_EUKREA_MBIMXSD_BASEBOARD | |
| 151 | − eukrea_mbimxsd_baseboard_init(); | |
| 150 | +#ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD | |
| 151 | + eukrea_mbimxsd25_baseboard_init(); | |
| 152 | 152 | #endif |
| 153 | 153 | } |
| 154 | 154 | |
| @@ -155,7 +155,7 @@ static unsigned long get_rate_arm(void) · 154 unmodified lines | ||
| 155 | 155 | |
| 156 | 156 | aad = &clk_consumer[(pdr0 >> 16) & 0xf]; |
| 157 | 157 | if (aad->sel) |
| 158 | − fref = fref * 2 / 3; | |
| 158 | + fref = fref * 3 / 4; | |
| 159 | 159 | |
| 160 | 160 | return fref / aad->arm; |
| 161 | 161 | } |
| @@ -164,7 +164,7 @@ static unsigned long get_rate_ahb(struct clk *clk) · 2 unmodified lines | ||
| 164 | 164 | { |
| 165 | 165 | unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0); |
| 166 | 166 | struct arm_ahb_div *aad; |
| 167 | − unsigned long fref = get_rate_mpll(); | |
| 167 | + unsigned long fref = get_rate_arm(); | |
| 168 | 168 | |
| 169 | 169 | aad = &clk_consumer[(pdr0 >> 16) & 0xf]; |
| 170 | 170 | |
| @@ -176,16 +176,11 @@ static unsigned long get_rate_ipg(struct clk *clk) · 5 unmodified lines | ||
| 176 | 176 | return get_rate_ahb(NULL) >> 1; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | −static unsigned long get_3_3_div(unsigned long in) | |
| 180 | −{ | |
| 181 | − return (((in >> 3) & 0x7) + 1) * ((in & 0x7) + 1); | |
| 182 | −} | |
| 183 | − | |
| 184 | 179 | static unsigned long get_rate_uart(struct clk *clk) |
| 185 | 180 | { |
| 186 | 181 | unsigned long pdr3 = __raw_readl(CCM_BASE + CCM_PDR3); |
| 187 | 182 | unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4); |
| 188 | − unsigned long div = get_3_3_div(pdr4 >> 10); | |
| 183 | + unsigned long div = ((pdr4 >> 10) & 0x3f) + 1; | |
| 189 | 184 | |
| 190 | 185 | if (pdr3 & (1 << 14)) |
| 191 | 186 | return get_rate_arm() / div; |
| @@ -216,7 +211,7 @@ static unsigned long get_rate_sdhc(struct clk *clk) · 24 unmodified lines | ||
| 216 | 211 | break; |
| 217 | 212 | } |
| 218 | 213 | |
| 219 | − return rate / get_3_3_div(div); | |
| 214 | + return rate / (div + 1); | |
| 220 | 215 | } |
| 221 | 216 | |
| 222 | 217 | static unsigned long get_rate_mshc(struct clk *clk) |
| @@ -270,7 +265,7 @@ static unsigned long get_rate_csi(struct clk *clk) · 47 unmodified lines | ||
| 270 | 265 | else |
| 271 | 266 | rate = get_rate_ppll(); |
| 272 | 267 | |
| 273 | − return rate / get_3_3_div((pdr2 >> 16) & 0x3f); | |
| 268 | + return rate / (((pdr2 >> 16) & 0x3f) + 1); | |
| 274 | 269 | } |
| 275 | 270 | |
| 276 | 271 | static unsigned long get_rate_otg(struct clk *clk) |
| @@ -283,25 +278,51 @@ static unsigned long get_rate_otg(struct clk *clk) · 6 unmodified lines | ||
| 283 | 278 | else |
| 284 | 279 | rate = get_rate_ppll(); |
| 285 | 280 | |
| 286 | − return rate / get_3_3_div((pdr4 >> 22) & 0x3f); | |
| 281 | + return rate / (((pdr4 >> 22) & 0x3f) + 1); | |
| 287 | 282 | } |
| 288 | 283 | |
| 289 | 284 | static unsigned long get_rate_ipg_per(struct clk *clk) |
| 290 | 285 | { |
| 291 | 286 | unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0); |
| 292 | 287 | unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4); |
| 293 | − unsigned long div1, div2; | |
| 288 | + unsigned long div; | |
| 294 | 289 | |
| 295 | 290 | if (pdr0 & (1 << 26)) { |
| 296 | − div1 = (pdr4 >> 19) & 0x7; | |
| 297 | − div2 = (pdr4 >> 16) & 0x7; | |
| 298 | − return get_rate_arm() / ((div1 + 1) * (div2 + 1)); | |
| 291 | + div = (pdr4 >> 16) & 0x3f; | |
| 292 | + return get_rate_arm() / (div + 1); | |
| 299 | 293 | } else { |
| 300 | − div1 = (pdr0 >> 12) & 0x7; | |
| 301 | − return get_rate_ahb(NULL) / div1; | |
| 294 | + div = (pdr0 >> 12) & 0x7; | |
| 295 | + return get_rate_ahb(NULL) / (div + 1); | |
| 302 | 296 | } |
| 303 | 297 | } |
| 304 | 298 | |
| 299 | +static unsigned long get_rate_hsp(struct clk *clk) | |
| 300 | +{ | |
| 301 | + unsigned long hsp_podf = (__raw_readl(CCM_BASE + CCM_PDR0) >> 20) & 0x03; | |
| 302 | + unsigned long fref = get_rate_mpll(); | |
| 303 | + | |
| 304 | + if (fref > 400 * 1000 * 1000) { | |
| 305 | + switch (hsp_podf) { | |
| 306 | + case 0: | |
| 307 | + return fref >> 2; | |
| 308 | + case 1: | |
| 309 | + return fref >> 3; | |
| 310 | + case 2: | |
| 311 | + return fref / 3; | |
| 312 | + } | |
| 313 | + } else { | |
| 314 | + switch (hsp_podf) { | |
| 315 | + case 0: | |
| 316 | + case 2: | |
| 317 | + return fref / 3; | |
| 318 | + case 1: | |
| 319 | + return fref / 6; | |
| 320 | + } | |
| 321 | + } | |
| 322 | + | |
| 323 | + return 0; | |
| 324 | +} | |
| 325 | + | |
| 305 | 326 | static int clk_cgr_enable(struct clk *clk) |
| 306 | 327 | { |
| 307 | 328 | u32 reg; |
| @@ -359,7 +380,7 @@ DEFINE_CLOCK(i2c1_clk, 0, CCM_CGR1, 10, get_rate_ipg_per, NULL); · 51 unmodified lines | ||
| 359 | 380 | DEFINE_CLOCK(i2c2_clk, 1, CCM_CGR1, 12, get_rate_ipg_per, NULL); |
| 360 | 381 | DEFINE_CLOCK(i2c3_clk, 2, CCM_CGR1, 14, get_rate_ipg_per, NULL); |
| 361 | 382 | DEFINE_CLOCK(iomuxc_clk, 0, CCM_CGR1, 16, NULL, NULL); |
| 362 | −DEFINE_CLOCK(ipu_clk, 0, CCM_CGR1, 18, get_rate_ahb, NULL); | |
| 383 | +DEFINE_CLOCK(ipu_clk, 0, CCM_CGR1, 18, get_rate_hsp, NULL); | |
| 363 | 384 | DEFINE_CLOCK(kpp_clk, 0, CCM_CGR1, 20, get_rate_ipg, NULL); |
| 364 | 385 | DEFINE_CLOCK(mlb_clk, 0, CCM_CGR1, 22, get_rate_ahb, NULL); |
| 365 | 386 | DEFINE_CLOCK(mshc_clk, 0, CCM_CGR1, 24, get_rate_mshc, NULL); |
| @@ -485,10 +506,10 @@ static struct clk_lookup lookups[] = { · 119 unmodified lines | ||
| 485 | 506 | |
| 486 | 507 | int __init mx35_clocks_init() |
| 487 | 508 | { |
| 488 | − unsigned int ll = 0; | |
| 509 | + unsigned int cgr2 = 3 << 26, cgr3 = 0; | |
| 489 | 510 | |
| 490 | 511 | #if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC) |
| 491 | − ll = (3 << 16); | |
| 512 | + cgr2 |= 3 << 16; | |
| 492 | 513 | #endif |
| 493 | 514 | |
| 494 | 515 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
| @@ -499,8 +520,20 @@ int __init mx35_clocks_init() · 4 unmodified lines | ||
| 499 | 520 | __raw_writel((3 << 18), CCM_BASE + CCM_CGR0); |
| 500 | 521 | __raw_writel((3 << 2) | (3 << 4) | (3 << 6) | (3 << 8) | (3 << 16), |
| 501 | 522 | CCM_BASE + CCM_CGR1); |
| 502 | − __raw_writel((3 << 26) | ll, CCM_BASE + CCM_CGR2); | |
| 503 | − __raw_writel(0, CCM_BASE + CCM_CGR3); | |
| 523 | + | |
| 524 | + /* | |
| 525 | + * Check if we came up in internal boot mode. If yes, we need some | |
| 526 | + * extra clocks turned on, otherwise the MX35 boot ROM code will | |
| 527 | + * hang after a watchdog reset. | |
| 528 | + */ | |
| 529 | + if (!(__raw_readl(CCM_BASE + CCM_RCSR) & (3 << 10))) { | |
| 530 | + /* Additionally turn on UART1, SCC, and IIM clocks */ | |
| 531 | + cgr2 |= 3 << 16 | 3 << 4; | |
| 532 | + cgr3 |= 3 << 2; | |
| 533 | + } | |
| 534 | + | |
| 535 | + __raw_writel(cgr2, CCM_BASE + CCM_CGR2); | |
| 536 | + __raw_writel(cgr3, CCM_BASE + CCM_CGR3); | |
| 504 | 537 | |
| 505 | 538 | mxc_timer_init(&gpt_clk, |
| 506 | 539 | MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), MX35_INT_GPT); |
| @@ -216,7 +216,7 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = { · 215 unmodified lines | ||
| 216 | 216 | * Add platform devices present on this baseboard and init |
| 217 | 217 | * them from CPU side as far as required to use them later on |
| 218 | 218 | */ |
| 219 | −void __init eukrea_mbimxsd_baseboard_init(void) | |
| 219 | +void __init eukrea_mbimxsd35_baseboard_init(void) | |
| 220 | 220 | { |
| 221 | 221 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, |
| 222 | 222 | ARRAY_SIZE(eukrea_mbimxsd_pads))) |
| @@ -201,8 +201,8 @@ static void __init mxc_board_init(void) · 200 unmodified lines | ||
| 201 | 201 | if (!otg_mode_host) |
| 202 | 202 | mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); |
| 203 | 203 | |
| 204 | −#ifdef CONFIG_MACH_EUKREA_MBIMXSD_BASEBOARD | |
| 205 | − eukrea_mbimxsd_baseboard_init(); | |
| 204 | +#ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD | |
| 205 | + eukrea_mbimxsd35_baseboard_init(); | |
| 206 | 206 | #endif |
| 207 | 207 | } |
| 208 | 208 | |
| @@ -56,7 +56,7 @@ static void _clk_ccgr_disable(struct clk *clk) · 55 unmodified lines | ||
| 56 | 56 | { |
| 57 | 57 | u32 reg; |
| 58 | 58 | reg = __raw_readl(clk->enable_reg); |
| 59 | − reg &= ~(MXC_CCM_CCGRx_MOD_OFF << clk->enable_shift); | |
| 59 | + reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift); | |
| 60 | 60 | __raw_writel(reg, clk->enable_reg); |
| 61 | 61 | |
| 62 | 62 | } |
| @@ -25,6 +25,7 @@ obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o · 24 unmodified lines | ||
| 25 | 25 | obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o |
| 26 | 26 | obj-$(CONFIG_ARCH_OMAP4) += omap44xx-smc.o omap4-common.o |
| 27 | 27 | |
| 28 | +AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a | |
| 28 | 29 | AFLAGS_omap44xx-smc.o :=-Wa,-march=armv7-a |
| 29 | 30 | |
| 30 | 31 | # Functions loaded to SRAM |
| @@ -3417,7 +3417,13 @@ int __init omap3xxx_clk_init(void) · 3416 unmodified lines | ||
| 3417 | 3417 | struct omap_clk *c; |
| 3418 | 3418 | u32 cpu_clkflg = CK_3XXX; |
| 3419 | 3419 | |
| 3420 | − if (cpu_is_omap34xx()) { | |
| 3420 | + if (cpu_is_omap3517()) { | |
| 3421 | + cpu_mask = RATE_IN_3XXX | RATE_IN_3430ES2PLUS; | |
| 3422 | + cpu_clkflg |= CK_3517; | |
| 3423 | + } else if (cpu_is_omap3505()) { | |
| 3424 | + cpu_mask = RATE_IN_3XXX | RATE_IN_3430ES2PLUS; | |
| 3425 | + cpu_clkflg |= CK_3505; | |
| 3426 | + } else if (cpu_is_omap34xx()) { | |
| 3421 | 3427 | cpu_mask = RATE_IN_3XXX; |
| 3422 | 3428 | cpu_clkflg |= CK_343X; |
| 3423 | 3429 | |
| @@ -3432,12 +3438,6 @@ int __init omap3xxx_clk_init(void) · 8 unmodified lines | ||
| 3432 | 3438 | cpu_mask |= RATE_IN_3430ES2PLUS; |
| 3433 | 3439 | cpu_clkflg |= CK_3430ES2; |
| 3434 | 3440 | } |
| 3435 | − } else if (cpu_is_omap3517()) { | |
| 3436 | − cpu_mask = RATE_IN_3XXX | RATE_IN_3430ES2PLUS; | |
| 3437 | − cpu_clkflg |= CK_3517; | |
| 3438 | − } else if (cpu_is_omap3505()) { | |
| 3439 | − cpu_mask = RATE_IN_3XXX | RATE_IN_3430ES2PLUS; | |
| 3440 | − cpu_clkflg |= CK_3505; | |
| 3441 | 3441 | } |
| 3442 | 3442 | |
| 3443 | 3443 | if (omap3_has_192mhz_clk()) |
| @@ -284,8 +284,8 @@ static void __init omap3_check_revision(void) · 283 unmodified lines | ||
| 284 | 284 | default: |
| 285 | 285 | omap_revision = OMAP3630_REV_ES1_2; |
| 286 | 286 | omap_chip.oc |= CHIP_IS_OMAP3630ES1_2; |
| 287 | − break; | |
| 288 | 287 | } |
| 288 | + break; | |
| 289 | 289 | default: |
| 290 | 290 | /* Unknown default to latest silicon rev as default*/ |
| 291 | 291 | omap_revision = OMAP3630_REV_ES1_2; |
| @@ -177,7 +177,10 @@ omap_irq_base: .word 0 · 176 unmodified lines | ||
| 177 | 177 | cmpne \irqnr, \tmp |
| 178 | 178 | cmpcs \irqnr, \irqnr |
| 179 | 179 | .endm |
| 180 | +#endif | |
| 181 | +#endif /* MULTI_OMAP2 */ | |
| 180 | 182 | |
| 183 | +#ifdef CONFIG_SMP | |
| 181 | 184 | /* We assume that irqstat (the raw value of the IRQ acknowledge |
| 182 | 185 | * register) is preserved from the macro above. |
| 183 | 186 | * If there is an IPI, we immediately signal end of interrupt |
| @@ -205,8 +208,7 @@ omap_irq_base: .word 0 · 21 unmodified lines | ||
| 205 | 208 | streq \irqstat, [\base, #GIC_CPU_EOI] |
| 206 | 209 | cmp \tmp, #0 |
| 207 | 210 | .endm |
| 208 | −#endif | |
| 209 | −#endif /* MULTI_OMAP2 */ | |
| 211 | +#endif /* CONFIG_SMP */ | |
| 210 | 212 | |
| 211 | 213 | .macro irq_prio_table |
| 212 | 214 | .endm |
| @@ -102,8 +102,7 @@ static void __init wakeup_secondary(void) · 101 unmodified lines | ||
| 102 | 102 | * Send a 'sev' to wake the secondary core from WFE. |
| 103 | 103 | * Drain the outstanding writes to memory |
| 104 | 104 | */ |
| 105 | − dsb(); | |
| 106 | − set_event(); | |
| 105 | + dsb_sev(); | |
| 107 | 106 | mb(); |
| 108 | 107 | } |
| 109 | 108 | |
| @@ -480,7 +480,9 @@ void omap_sram_idle(void) · 479 unmodified lines | ||
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | /* Disable IO-PAD and IO-CHAIN wakeup */ |
| 483 | − if (omap3_has_io_wakeup() && core_next_state < PWRDM_POWER_ON) { | |
| 483 | + if (omap3_has_io_wakeup() && | |
| 484 | + (per_next_state < PWRDM_POWER_ON || | |
| 485 | + core_next_state < PWRDM_POWER_ON)) { | |
| 484 | 486 | prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN); |
| 485 | 487 | omap3_disable_io_chain(); |
| 486 | 488 | } |
| @@ -398,7 +398,7 @@ static int pxa_set_target(struct cpufreq_policy *policy, · 397 unmodified lines | ||
| 398 | 398 | return 0; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | −static __init int pxa_cpufreq_init(struct cpufreq_policy *policy) | |
| 401 | +static int pxa_cpufreq_init(struct cpufreq_policy *policy) | |
| 402 | 402 | { |
| 403 | 403 | int i; |
| 404 | 404 | unsigned int freq; |
| @@ -204,7 +204,7 @@ static int pxa3xx_cpufreq_set(struct cpufreq_policy *policy, · 203 unmodified lines | ||
| 204 | 204 | return 0; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | −static __init int pxa3xx_cpufreq_init(struct cpufreq_policy *policy) | |
| 207 | +static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy) | |
| 208 | 208 | { |
| 209 | 209 | int ret = -EINVAL; |
| 210 | 210 | |
| @@ -71,10 +71,10 @@ · 70 unmodified lines | ||
| 71 | 71 | #define GPIO46_CI_DD_7 MFP_CFG_DRV(GPIO46, AF0, DS04X) |
| 72 | 72 | #define GPIO47_CI_DD_8 MFP_CFG_DRV(GPIO47, AF1, DS04X) |
| 73 | 73 | #define GPIO48_CI_DD_9 MFP_CFG_DRV(GPIO48, AF1, DS04X) |
| 74 | −#define GPIO52_CI_HSYNC MFP_CFG_DRV(GPIO52, AF0, DS04X) | |
| 75 | −#define GPIO51_CI_VSYNC MFP_CFG_DRV(GPIO51, AF0, DS04X) | |
| 76 | 74 | #define GPIO49_CI_MCLK MFP_CFG_DRV(GPIO49, AF0, DS04X) |
| 77 | 75 | #define GPIO50_CI_PCLK MFP_CFG_DRV(GPIO50, AF0, DS04X) |
| 76 | +#define GPIO51_CI_HSYNC MFP_CFG_DRV(GPIO51, AF0, DS04X) | |
| 77 | +#define GPIO52_CI_VSYNC MFP_CFG_DRV(GPIO52, AF0, DS04X) | |
| 78 | 78 | |
| 79 | 79 | /* KEYPAD */ |
| 80 | 80 | #define GPIO3_KP_DKIN_6 MFP_CFG_LPM(GPIO3, AF2, FLOAT) |
| @@ -15,6 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #ifndef __ASM_ARCH_VMALLOC_H |
| 16 | 16 | #define __ASM_ARCH_VMALLOC_H |
| 17 | 17 | |
| 18 | −#define VMALLOC_END (0xE0000000) | |
| 18 | +#define VMALLOC_END 0xE0000000UL | |
| 19 | 19 | |
| 20 | 20 | #endif /* __ASM_ARCH_VMALLOC_H */ |
| @@ -15,6 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #ifndef __ASM_ARCH_VMALLOC_H |
| 16 | 16 | #define __ASM_ARCH_VMALLOC_H |
| 17 | 17 | |
| 18 | −#define VMALLOC_END (0xE0000000) | |
| 18 | +#define VMALLOC_END 0xE0000000UL | |
| 19 | 19 | |
| 20 | 20 | #endif /* __ASM_ARCH_VMALLOC_H */ |
| @@ -12,6 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | #ifndef __ASM_ARCH_VMALLOC_H |
| 13 | 13 | #define __ASM_ARCH_VMALLOC_H |
| 14 | 14 | |
| 15 | −#define VMALLOC_END (0xE0000000) | |
| 15 | +#define VMALLOC_END 0xE0000000UL | |
| 16 | 16 | |
| 17 | 17 | #endif /* __ASM_ARCH_VMALLOC_H */ |
| @@ -12,6 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | #ifndef __ASM_ARCH_VMALLOC_H |
| 13 | 13 | #define __ASM_ARCH_VMALLOC_H |
| 14 | 14 | |
| 15 | −#define VMALLOC_END (0xE0000000) | |
| 15 | +#define VMALLOC_END 0xE0000000UL | |
| 16 | 16 | |
| 17 | 17 | #endif /* __ASM_ARCH_VMALLOC_H */ |
| @@ -17,6 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #ifndef __ASM_ARCH_VMALLOC_H |
| 18 | 18 | #define __ASM_ARCH_VMALLOC_H __FILE__ |
| 19 | 19 | |
| 20 | −#define VMALLOC_END (0xE0000000) | |
| 20 | +#define VMALLOC_END (0xE0000000UL) | |
| 21 | 21 | |
| 22 | 22 | #endif /* __ASM_ARCH_VMALLOC_H */ |
| @@ -30,6 +30,16 @@ static struct clk clk_sclk_hdmi27m = { · 29 unmodified lines | ||
| 30 | 30 | .rate = 27000000, |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | +static int s5pv310_clksrc_mask_peril0_ctrl(struct clk *clk, int enable) | |
| 34 | +{ | |
| 35 | + return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable); | |
| 36 | +} | |
| 37 | + | |
| 38 | +static int s5pv310_clk_ip_peril_ctrl(struct clk *clk, int enable) | |
| 39 | +{ | |
| 40 | + return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable); | |
| 41 | +} | |
| 42 | + | |
| 33 | 43 | /* Core list of CMU_CPU side */ |
| 34 | 44 | |
| 35 | 45 | static struct clksrc_clk clk_mout_apll = { |
| @@ -39,6 +49,14 @@ static struct clksrc_clk clk_mout_apll = { · 3 unmodified lines | ||
| 39 | 49 | }, |
| 40 | 50 | .sources = &clk_src_apll, |
| 41 | 51 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 }, |
| 52 | +}; | |
| 53 | + | |
| 54 | +static struct clksrc_clk clk_sclk_apll = { | |
| 55 | + .clk = { | |
| 56 | + .name = "sclk_apll", | |
| 57 | + .id = -1, | |
| 58 | + .parent = &clk_mout_apll.clk, | |
| 59 | + }, | |
| 42 | 60 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 }, |
| 43 | 61 | }; |
| 44 | 62 | |
| @@ -61,7 +79,7 @@ static struct clksrc_clk clk_mout_mpll = { · 16 unmodified lines | ||
| 61 | 79 | }; |
| 62 | 80 | |
| 63 | 81 | static struct clk *clkset_moutcore_list[] = { |
| 64 | − [0] = &clk_mout_apll.clk, | |
| 82 | + [0] = &clk_sclk_apll.clk, | |
| 65 | 83 | [1] = &clk_mout_mpll.clk, |
| 66 | 84 | }; |
| 67 | 85 | |
| @@ -154,7 +172,7 @@ static struct clksrc_clk clk_pclk_dbg = { · 86 unmodified lines | ||
| 154 | 172 | |
| 155 | 173 | static struct clk *clkset_corebus_list[] = { |
| 156 | 174 | [0] = &clk_mout_mpll.clk, |
| 157 | − [1] = &clk_mout_apll.clk, | |
| 175 | + [1] = &clk_sclk_apll.clk, | |
| 158 | 176 | }; |
| 159 | 177 | |
| 160 | 178 | static struct clksrc_sources clkset_mout_corebus = { |
| @@ -220,7 +238,7 @@ static struct clksrc_clk clk_pclk_acp = { · 59 unmodified lines | ||
| 220 | 238 | |
| 221 | 239 | static struct clk *clkset_aclk_top_list[] = { |
| 222 | 240 | [0] = &clk_mout_mpll.clk, |
| 223 | − [1] = &clk_mout_apll.clk, | |
| 241 | + [1] = &clk_sclk_apll.clk, | |
| 224 | 242 | }; |
| 225 | 243 | |
| 226 | 244 | static struct clksrc_sources clkset_aclk_200 = { |
| @@ -321,11 +339,6 @@ static struct clksrc_clk clk_sclk_vpll = { · 94 unmodified lines | ||
| 321 | 339 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 }, |
| 322 | 340 | }; |
| 323 | 341 | |
| 324 | −static int s5pv310_clk_ip_peril_ctrl(struct clk *clk, int enable) | |
| 325 | −{ | |
| 326 | − return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable); | |
| 327 | −} | |
| 328 | − | |
| 329 | 342 | static struct clk init_clocks_disable[] = { |
| 330 | 343 | { |
| 331 | 344 | .name = "timers", |
| @@ -337,7 +350,37 @@ static struct clk init_clocks_disable[] = { · 5 unmodified lines | ||
| 337 | 350 | }; |
| 338 | 351 | |
| 339 | 352 | static struct clk init_clocks[] = { |
| 340 | − /* Nothing here yet */ | |
| 353 | + { | |
| 354 | + .name = "uart", | |
| 355 | + .id = 0, | |
| 356 | + .enable = s5pv310_clk_ip_peril_ctrl, | |
| 357 | + .ctrlbit = (1 << 0), | |
| 358 | + }, { | |
| 359 | + .name = "uart", | |
| 360 | + .id = 1, | |
| 361 | + .enable = s5pv310_clk_ip_peril_ctrl, | |
| 362 | + .ctrlbit = (1 << 1), | |
| 363 | + }, { | |
| 364 | + .name = "uart", | |
| 365 | + .id = 2, | |
| 366 | + .enable = s5pv310_clk_ip_peril_ctrl, | |
| 367 | + .ctrlbit = (1 << 2), | |
| 368 | + }, { | |
| 369 | + .name = "uart", | |
| 370 | + .id = 3, | |
| 371 | + .enable = s5pv310_clk_ip_peril_ctrl, | |
| 372 | + .ctrlbit = (1 << 3), | |
| 373 | + }, { | |
| 374 | + .name = "uart", | |
| 375 | + .id = 4, | |
| 376 | + .enable = s5pv310_clk_ip_peril_ctrl, | |
| 377 | + .ctrlbit = (1 << 4), | |
| 378 | + }, { | |
| 379 | + .name = "uart", | |
| 380 | + .id = 5, | |
| 381 | + .enable = s5pv310_clk_ip_peril_ctrl, | |
| 382 | + .ctrlbit = (1 << 5), | |
| 383 | + } | |
| 341 | 384 | }; |
| 342 | 385 | |
| 343 | 386 | static struct clk *clkset_group_list[] = { |
| @@ -359,8 +402,8 @@ static struct clksrc_clk clksrcs[] = { · 15 unmodified lines | ||
| 359 | 402 | .clk = { |
| 360 | 403 | .name = "uclk1", |
| 361 | 404 | .id = 0, |
| 405 | + .enable = s5pv310_clksrc_mask_peril0_ctrl, | |
| 362 | 406 | .ctrlbit = (1 << 0), |
| 363 | − .enable = s5pv310_clk_ip_peril_ctrl, | |
| 364 | 407 | }, |
| 365 | 408 | .sources = &clkset_group, |
| 366 | 409 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 }, |
| @@ -369,8 +412,8 @@ static struct clksrc_clk clksrcs[] = { · 2 unmodified lines | ||
| 369 | 412 | .clk = { |
| 370 | 413 | .name = "uclk1", |
| 371 | 414 | .id = 1, |
| 372 | − .enable = s5pv310_clk_ip_peril_ctrl, | |
| 373 | − .ctrlbit = (1 << 1), | |
| 415 | + .enable = s5pv310_clksrc_mask_peril0_ctrl, | |
| 416 | + .ctrlbit = (1 << 4), | |
| 374 | 417 | }, |
| 375 | 418 | .sources = &clkset_group, |
| 376 | 419 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 }, |
| @@ -379,8 +422,8 @@ static struct clksrc_clk clksrcs[] = { · 2 unmodified lines | ||
| 379 | 422 | .clk = { |
| 380 | 423 | .name = "uclk1", |
| 381 | 424 | .id = 2, |
| 382 | − .enable = s5pv310_clk_ip_peril_ctrl, | |
| 383 | − .ctrlbit = (1 << 2), | |
| 425 | + .enable = s5pv310_clksrc_mask_peril0_ctrl, | |
| 426 | + .ctrlbit = (1 << 8), | |
| 384 | 427 | }, |
| 385 | 428 | .sources = &clkset_group, |
| 386 | 429 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 }, |
| @@ -389,8 +432,8 @@ static struct clksrc_clk clksrcs[] = { · 2 unmodified lines | ||
| 389 | 432 | .clk = { |
| 390 | 433 | .name = "uclk1", |
| 391 | 434 | .id = 3, |
| 392 | − .enable = s5pv310_clk_ip_peril_ctrl, | |
| 393 | − .ctrlbit = (1 << 3), | |
| 435 | + .enable = s5pv310_clksrc_mask_peril0_ctrl, | |
| 436 | + .ctrlbit = (1 << 12), | |
| 394 | 437 | }, |
| 395 | 438 | .sources = &clkset_group, |
| 396 | 439 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 }, |
| @@ -399,7 +442,7 @@ static struct clksrc_clk clksrcs[] = { · 2 unmodified lines | ||
| 399 | 442 | .clk = { |
| 400 | 443 | .name = "sclk_pwm", |
| 401 | 444 | .id = -1, |
| 402 | − .enable = s5pv310_clk_ip_peril_ctrl, | |
| 445 | + .enable = s5pv310_clksrc_mask_peril0_ctrl, | |
| 403 | 446 | .ctrlbit = (1 << 24), |
| 404 | 447 | }, |
| 405 | 448 | .sources = &clkset_group, |
| @@ -411,6 +454,7 @@ static struct clksrc_clk clksrcs[] = { · 5 unmodified lines | ||
| 411 | 454 | /* Clock initialization code */ |
| 412 | 455 | static struct clksrc_clk *sysclks[] = { |
| 413 | 456 | &clk_mout_apll, |
| 457 | + &clk_sclk_apll, | |
| 414 | 458 | &clk_mout_epll, |
| 415 | 459 | &clk_mout_mpll, |
| 416 | 460 | &clk_moutcore, |
| @@ -470,11 +514,11 @@ void __init_or_cpufreq s5pv310_setup_clocks(void) · 53 unmodified lines | ||
| 470 | 514 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), pll_4508); |
| 471 | 515 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), pll_4508); |
| 472 | 516 | epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0), |
| 473 | − __raw_readl(S5P_EPLL_CON1), pll_4500); | |
| 517 | + __raw_readl(S5P_EPLL_CON1), pll_4600); | |
| 474 | 518 | |
| 475 | 519 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); |
| 476 | 520 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), |
| 477 | − __raw_readl(S5P_VPLL_CON1), pll_4502); | |
| 521 | + __raw_readl(S5P_VPLL_CON1), pll_4650); | |
| 478 | 522 | |
| 479 | 523 | clk_fout_apll.rate = apll; |
| 480 | 524 | clk_fout_mpll.rate = mpll; |
| @@ -45,6 +45,16 @@ static struct map_desc s5pv310_iodesc[] __initdata = { · 44 unmodified lines | ||
| 45 | 45 | .pfn = __phys_to_pfn(S5PV310_PA_L2CC), |
| 46 | 46 | .length = SZ_4K, |
| 47 | 47 | .type = MT_DEVICE, |
| 48 | + }, { | |
| 49 | + .virtual = (unsigned long)S5P_VA_SYSRAM, | |
| 50 | + .pfn = __phys_to_pfn(S5PV310_PA_SYSRAM), | |
| 51 | + .length = SZ_4K, | |
| 52 | + .type = MT_DEVICE, | |
| 53 | + }, { | |
| 54 | + .virtual = (unsigned long)S5P_VA_CMU, | |
| 55 | + .pfn = __phys_to_pfn(S5PV310_PA_CMU), | |
| 56 | + .length = SZ_128K, | |
| 57 | + .type = MT_DEVICE, | |
| 48 | 58 | }, |
| 49 | 59 | }; |
| 50 | 60 | |
| @@ -15,12 +15,14 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | #include <plat/irqs.h> |
| 17 | 17 | |
| 18 | −/* Private Peripheral Interrupt */ | |
| 18 | +/* PPI: Private Peripheral Interrupt */ | |
| 19 | + | |
| 19 | 20 | #define IRQ_PPI(x) S5P_IRQ(x+16) |
| 20 | 21 | |
| 21 | 22 | #define IRQ_LOCALTIMER IRQ_PPI(13) |
| 22 | 23 | |
| 23 | −/* Shared Peripheral Interrupt */ | |
| 24 | +/* SPI: Shared Peripheral Interrupt */ | |
| 25 | + | |
| 24 | 26 | #define IRQ_SPI(x) S5P_IRQ(x+32) |
| 25 | 27 | |
| 26 | 28 | #define IRQ_EINT0 IRQ_SPI(40) |
| @@ -36,7 +38,7 @@ · 9 unmodified lines | ||
| 36 | 38 | #define IRQ_PCIE IRQ_SPI(50) |
| 37 | 39 | #define IRQ_SYSTEM_TIMER IRQ_SPI(51) |
| 38 | 40 | #define IRQ_MFC IRQ_SPI(52) |
| 39 | −#define IRQ_WTD IRQ_SPI(53) | |
| 41 | +#define IRQ_WDT IRQ_SPI(53) | |
| 40 | 42 | #define IRQ_AUDIO_SS IRQ_SPI(54) |
| 41 | 43 | #define IRQ_AC97 IRQ_SPI(55) |
| 42 | 44 | #define IRQ_SPDIF IRQ_SPI(56) |
| @@ -67,8 +69,9 @@ · 24 unmodified lines | ||
| 67 | 69 | #define IRQ_IIC COMBINER_IRQ(27, 0) |
| 68 | 70 | |
| 69 | 71 | /* Set the default NR_IRQS */ |
| 72 | + | |
| 70 | 73 | #define NR_IRQS COMBINER_IRQ(MAX_COMBINER_NR, 0) |
| 71 | 74 | |
| 72 | 75 | #define MAX_COMBINER_NR 39 |
| 73 | 76 | |
| 74 | −#endif /* ASM_ARCH_IRQS_H */ | |
| 77 | +#endif /* __ASM_ARCH_IRQS_H */ | |
| @@ -23,12 +23,16 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | #include <plat/map-s5p.h> |
| 25 | 25 | |
| 26 | +#define S5PV310_PA_SYSRAM (0x02025000) | |
| 27 | + | |
| 26 | 28 | #define S5PV310_PA_CHIPID (0x10000000) |
| 27 | 29 | #define S5P_PA_CHIPID S5PV310_PA_CHIPID |
| 28 | 30 | |
| 29 | 31 | #define S5PV310_PA_SYSCON (0x10020000) |
| 30 | 32 | #define S5P_PA_SYSCON S5PV310_PA_SYSCON |
| 31 | 33 | |
| 34 | +#define S5PV310_PA_CMU (0x10030000) | |
| 35 | + | |
| 32 | 36 | #define S5PV310_PA_WATCHDOG (0x10060000) |
| 33 | 37 | |
| 34 | 38 | #define S5PV310_PA_COMBINER (0x10448000) |
| @@ -39,8 +43,12 @@ · 4 unmodified lines | ||
| 39 | 43 | #define S5PV310_PA_GIC_DIST (0x10501000) |
| 40 | 44 | #define S5PV310_PA_L2CC (0x10502000) |
| 41 | 45 | |
| 42 | −#define S5PV310_PA_GPIO (0x11000000) | |
| 43 | −#define S5P_PA_GPIO S5PV310_PA_GPIO | |
| 46 | +#define S5PV310_PA_GPIO1 (0x11400000) | |
| 47 | +#define S5PV310_PA_GPIO2 (0x11000000) | |
| 48 | +#define S5PV310_PA_GPIO3 (0x03860000) | |
| 49 | +#define S5P_PA_GPIO S5PV310_PA_GPIO1 | |
| 50 | + | |
| 51 | +#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) | |
| 44 | 52 | |
| 45 | 53 | #define S5PV310_PA_UART (0x13800000) |
| 46 | 54 | |
| @@ -63,6 +71,10 @@ · 16 unmodified lines | ||
| 63 | 71 | |
| 64 | 72 | /* compatibiltiy defines. */ |
| 65 | 73 | #define S3C_PA_UART S5PV310_PA_UART |
| 74 | +#define S3C_PA_HSMMC0 S5PV310_PA_HSMMC(0) | |
| 75 | +#define S3C_PA_HSMMC1 S5PV310_PA_HSMMC(1) | |
| 76 | +#define S3C_PA_HSMMC2 S5PV310_PA_HSMMC(2) | |
| 77 | +#define S3C_PA_HSMMC3 S5PV310_PA_HSMMC(3) | |
| 66 | 78 | #define S3C_PA_IIC S5PV310_PA_IIC0 |
| 67 | 79 | #define S3C_PA_WDT S5PV310_PA_WATCHDOG |
| 68 | 80 | |
| @@ -15,48 +15,49 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | #include <mach/map.h> |
| 17 | 17 | |
| 18 | −#define S5P_CLKREG(x) (S3C_VA_SYS + (x)) | |
| 18 | +#define S5P_CLKREG(x) (S5P_VA_CMU + (x)) | |
| 19 | 19 | |
| 20 | 20 | #define S5P_INFORM0 S5P_CLKREG(0x800) |
| 21 | 21 | |
| 22 | −#define S5P_EPLL_CON0 S5P_CLKREG(0x1C110) | |
| 23 | −#define S5P_EPLL_CON1 S5P_CLKREG(0x1C114) | |
| 24 | −#define S5P_VPLL_CON0 S5P_CLKREG(0x1C120) | |
| 25 | −#define S5P_VPLL_CON1 S5P_CLKREG(0x1C124) | |
| 22 | +#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) | |
| 23 | +#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) | |
| 24 | +#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) | |
| 25 | +#define S5P_VPLL_CON1 S5P_CLKREG(0x0C124) | |
| 26 | 26 | |
| 27 | −#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x1C210) | |
| 28 | −#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x1C214) | |
| 27 | +#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) | |
| 28 | +#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) | |
| 29 | 29 | |
| 30 | −#define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x1C250) | |
| 30 | +#define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x0C250) | |
| 31 | 31 | |
| 32 | −#define S5P_CLKDIV_TOP S5P_CLKREG(0x1C510) | |
| 32 | +#define S5P_CLKDIV_TOP S5P_CLKREG(0x0C510) | |
| 33 | 33 | |
| 34 | −#define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x1C550) | |
| 35 | −#define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x1C554) | |
| 36 | −#define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x1C558) | |
| 37 | −#define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x1C55C) | |
| 38 | −#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x1C560) | |
| 39 | −#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x1C564) | |
| 34 | +#define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550) | |
| 35 | +#define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554) | |
| 36 | +#define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558) | |
| 37 | +#define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C) | |
| 38 | +#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) | |
| 39 | +#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) | |
| 40 | 40 | |
| 41 | −#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x1C950) | |
| 41 | +#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) | |
| 42 | 42 | |
| 43 | −#define S5P_CLKSRC_CORE S5P_CLKREG(0x20200) | |
| 43 | +#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) | |
| 44 | 44 | |
| 45 | −#define S5P_CLKDIV_CORE0 S5P_CLKREG(0x20500) | |
| 45 | +#define S5P_CLKSRC_CORE S5P_CLKREG(0x10200) | |
| 46 | +#define S5P_CLKDIV_CORE0 S5P_CLKREG(0x10500) | |
| 46 | 47 | |
| 47 | −#define S5P_APLL_LOCK S5P_CLKREG(0x24000) | |
| 48 | −#define S5P_MPLL_LOCK S5P_CLKREG(0x24004) | |
| 49 | −#define S5P_APLL_CON0 S5P_CLKREG(0x24100) | |
| 50 | −#define S5P_APLL_CON1 S5P_CLKREG(0x24104) | |
| 51 | −#define S5P_MPLL_CON0 S5P_CLKREG(0x24108) | |
| 52 | −#define S5P_MPLL_CON1 S5P_CLKREG(0x2410C) | |
| 48 | +#define S5P_APLL_LOCK S5P_CLKREG(0x14000) | |
| 49 | +#define S5P_MPLL_LOCK S5P_CLKREG(0x14004) | |
| 50 | +#define S5P_APLL_CON0 S5P_CLKREG(0x14100) | |
| 51 | +#define S5P_APLL_CON1 S5P_CLKREG(0x14104) | |
| 52 | +#define S5P_MPLL_CON0 S5P_CLKREG(0x14108) | |
| 53 | +#define S5P_MPLL_CON1 S5P_CLKREG(0x1410C) | |
| 53 | 54 | |
| 54 | −#define S5P_CLKSRC_CPU S5P_CLKREG(0x24200) | |
| 55 | −#define S5P_CLKMUX_STATCPU S5P_CLKREG(0x24400) | |
| 55 | +#define S5P_CLKSRC_CPU S5P_CLKREG(0x14200) | |
| 56 | +#define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400) | |
| 56 | 57 | |
| 57 | −#define S5P_CLKDIV_CPU S5P_CLKREG(0x24500) | |
| 58 | −#define S5P_CLKDIV_STATCPU S5P_CLKREG(0x24600) | |
| 58 | +#define S5P_CLKDIV_CPU S5P_CLKREG(0x14500) | |
| 59 | +#define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600) | |
| 59 | 60 | |
| 60 | −#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x24800) | |
| 61 | +#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) | |
| 61 | 62 | |
| 62 | 63 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ |
| @@ -17,6 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #ifndef __ASM_ARCH_VMALLOC_H |
| 18 | 18 | #define __ASM_ARCH_VMALLOC_H __FILE__ |
| 19 | 19 | |
| 20 | −#define VMALLOC_END (0xF0000000) | |
| 20 | +#define VMALLOC_END (0xF0000000UL) | |
| 21 | 21 | |
| 22 | 22 | #endif /* __ASM_ARCH_VMALLOC_H */ |
| @@ -187,6 +187,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) · 186 unmodified lines | ||
| 187 | 187 | * until it receives a soft interrupt, and then the |
| 188 | 188 | * secondary CPU branches to this address. |
| 189 | 189 | */ |
| 190 | − __raw_writel(BSYM(virt_to_phys(s5pv310_secondary_startup)), S5P_INFORM0); | |
| 190 | + __raw_writel(BSYM(virt_to_phys(s5pv310_secondary_startup)), S5P_VA_SYSRAM); | |
| 191 | 191 | } |
| 192 | 192 | } |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | # |
| 4 | 4 | |
| 5 | 5 | # Common objects |
| 6 | −obj-y := timer.o console.o clock.o | |
| 6 | +obj-y := timer.o console.o clock.o pm_runtime.o | |
| 7 | 7 | |
| 8 | 8 | # CPU objects |
| 9 | 9 | obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include <linux/platform_device.h> |
| 26 | 26 | #include <linux/delay.h> |
| 27 | 27 | #include <linux/mfd/sh_mobile_sdhi.h> |
| 28 | +#include <linux/mfd/tmio.h> | |
| 28 | 29 | #include <linux/mmc/host.h> |
| 29 | 30 | #include <linux/mtd/mtd.h> |
| 30 | 31 | #include <linux/mtd/partitions.h> |
| @@ -39,6 +40,7 @@ · 8 unmodified lines | ||
| 39 | 40 | #include <linux/sh_clk.h> |
| 40 | 41 | #include <linux/gpio.h> |
| 41 | 42 | #include <linux/input.h> |
| 43 | +#include <linux/leds.h> | |
| 42 | 44 | #include <linux/input/sh_keysc.h> |
| 43 | 45 | #include <linux/usb/r8a66597.h> |
| 44 | 46 | |
| @@ -307,6 +309,7 @@ static struct sh_mobile_sdhi_info sdhi1_info = { · 262 unmodified lines | ||
| 307 | 309 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, |
| 308 | 310 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, |
| 309 | 311 | .tmio_ocr_mask = MMC_VDD_165_195, |
| 312 | + .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, | |
| 310 | 313 | }; |
| 311 | 314 | |
| 312 | 315 | static struct resource sdhi1_resources[] = { |
| @@ -558,7 +561,7 @@ static struct resource fsi_resources[] = { · 245 unmodified lines | ||
| 558 | 561 | |
| 559 | 562 | static struct platform_device fsi_device = { |
| 560 | 563 | .name = "sh_fsi2", |
| 561 | − .id = 0, | |
| 564 | + .id = -1, | |
| 562 | 565 | .num_resources = ARRAY_SIZE(fsi_resources), |
| 563 | 566 | .resource = fsi_resources, |
| 564 | 567 | .dev = { |
| @@ -650,7 +653,44 @@ static struct platform_device hdmi_device = { · 85 unmodified lines | ||
| 650 | 653 | }, |
| 651 | 654 | }; |
| 652 | 655 | |
| 656 | +static struct gpio_led ap4evb_leds[] = { | |
| 657 | + { | |
| 658 | + .name = "led4", | |
| 659 | + .gpio = GPIO_PORT185, | |
| 660 | + .default_state = LEDS_GPIO_DEFSTATE_ON, | |
| 661 | + }, | |
| 662 | + { | |
| 663 | + .name = "led2", | |
| 664 | + .gpio = GPIO_PORT186, | |
| 665 | + .default_state = LEDS_GPIO_DEFSTATE_ON, | |
| 666 | + }, | |
| 667 | + { | |
| 668 | + .name = "led3", | |
| 669 | + .gpio = GPIO_PORT187, | |
| 670 | + .default_state = LEDS_GPIO_DEFSTATE_ON, | |
| 671 | + }, | |
| 672 | + { | |
| 673 | + .name = "led1", | |
| 674 | + .gpio = GPIO_PORT188, | |
| 675 | + .default_state = LEDS_GPIO_DEFSTATE_ON, | |
| 676 | + } | |
| 677 | +}; | |
| 678 | + | |
| 679 | +static struct gpio_led_platform_data ap4evb_leds_pdata = { | |
| 680 | + .num_leds = ARRAY_SIZE(ap4evb_leds), | |
| 681 | + .leds = ap4evb_leds, | |
| 682 | +}; | |
| 683 | + | |
| 684 | +static struct platform_device leds_device = { | |
| 685 | + .name = "leds-gpio", | |
| 686 | + .id = 0, | |
| 687 | + .dev = { | |
| 688 | + .platform_data = &ap4evb_leds_pdata, | |
| 689 | + }, | |
| 690 | +}; | |
| 691 | + | |
| 653 | 692 | static struct platform_device *ap4evb_devices[] __initdata = { |
| 693 | + &leds_device, | |
| 654 | 694 | &nor_flash_device, |
| 655 | 695 | &smc911x_device, |
| 656 | 696 | &sdhi0_device, |
| @@ -840,20 +880,6 @@ static void __init ap4evb_init(void) · 183 unmodified lines | ||
| 840 | 880 | gpio_request(GPIO_FN_CS5A, NULL); |
| 841 | 881 | gpio_request(GPIO_FN_IRQ6_39, NULL); |
| 842 | 882 | |
| 843 | − /* enable LED 1 - 4 */ | |
| 844 | − gpio_request(GPIO_PORT185, NULL); | |
| 845 | − gpio_request(GPIO_PORT186, NULL); | |
| 846 | − gpio_request(GPIO_PORT187, NULL); | |
| 847 | − gpio_request(GPIO_PORT188, NULL); | |
| 848 | − gpio_direction_output(GPIO_PORT185, 1); | |
| 849 | − gpio_direction_output(GPIO_PORT186, 1); | |
| 850 | − gpio_direction_output(GPIO_PORT187, 1); | |
| 851 | − gpio_direction_output(GPIO_PORT188, 1); | |
| 852 | − gpio_export(GPIO_PORT185, 0); | |
| 853 | − gpio_export(GPIO_PORT186, 0); | |
| 854 | − gpio_export(GPIO_PORT187, 0); | |
| 855 | − gpio_export(GPIO_PORT188, 0); | |
| 856 | − | |
| 857 | 883 | /* enable Debug switch (S6) */ |
| 858 | 884 | gpio_request(GPIO_PORT32, NULL); |
| 859 | 885 | gpio_request(GPIO_PORT33, NULL); |
| @@ -286,7 +286,6 @@ static struct clk_ops pllc2_clk_ops = { · 285 unmodified lines | ||
| 286 | 286 | |
| 287 | 287 | struct clk pllc2_clk = { |
| 288 | 288 | .ops = &pllc2_clk_ops, |
| 289 | − .flags = CLK_ENABLE_ON_INIT, | |
| 290 | 289 | .parent = &extal1_div2_clk, |
| 291 | 290 | .freq_table = pllc2_freq_table, |
| 292 | 291 | .parent_table = pllc2_parent, |
| @@ -395,7 +394,7 @@ static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = { · 102 unmodified lines | ||
| 395 | 394 | |
| 396 | 395 | enum { MSTP001, |
| 397 | 396 | MSTP131, MSTP130, |
| 398 | − MSTP129, MSTP128, | |
| 397 | + MSTP129, MSTP128, MSTP127, MSTP126, | |
| 399 | 398 | MSTP118, MSTP117, MSTP116, |
| 400 | 399 | MSTP106, MSTP101, MSTP100, |
| 401 | 400 | MSTP223, |
| @@ -413,6 +412,8 @@ static struct clk mstp_clks[MSTP_NR] = { · 11 unmodified lines | ||
| 413 | 412 | [MSTP130] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 30, 0), /* VEU2 */ |
| 414 | 413 | [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* VEU1 */ |
| 415 | 414 | [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* VEU0 */ |
| 415 | + [MSTP127] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 27, 0), /* CEU */ | |
| 416 | + [MSTP126] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 26, 0), /* CSI2 */ | |
| 416 | 417 | [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX */ |
| 417 | 418 | [MSTP117] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ |
| 418 | 419 | [MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ |
| @@ -428,7 +429,7 @@ static struct clk mstp_clks[MSTP_NR] = { · 9 unmodified lines | ||
| 428 | 429 | [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */ |
| 429 | 430 | [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */ |
| 430 | 431 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ |
| 431 | − [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, CLK_ENABLE_ON_INIT), /* FSIA */ | |
| 432 | + [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSIA */ | |
| 432 | 433 | [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */ |
| 433 | 434 | [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */ |
| 434 | 435 | [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */ |
| @@ -498,6 +499,8 @@ static struct clk_lookup lookups[] = { · 63 unmodified lines | ||
| 498 | 499 | CLKDEV_DEV_ID("uio_pdrv_genirq.3", &mstp_clks[MSTP130]), /* VEU2 */ |
| 499 | 500 | CLKDEV_DEV_ID("uio_pdrv_genirq.2", &mstp_clks[MSTP129]), /* VEU1 */ |
| 500 | 501 | CLKDEV_DEV_ID("uio_pdrv_genirq.1", &mstp_clks[MSTP128]), /* VEU0 */ |
| 502 | + CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU */ | |
| 503 | + CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2 */ | |
| 501 | 504 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ |
| 502 | 505 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */ |
| 503 | 506 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */ |
| @@ -1,8 +1,10 @@ | ||
| 1 | 1 | /* |
| 2 | − * SH-Mobile Timer | |
| 2 | + * SH-Mobile Clock Framework | |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2010 Magnus Damm |
| 5 | 5 | * |
| 6 | + * Used together with arch/arm/common/clkdev.c and drivers/sh/clk.c. | |
| 7 | + * | |
| 6 | 8 | * This program is free software; you can redistribute it and/or modify |
| 7 | 9 | * it under the terms of the GNU General Public License as published by |
| 8 | 10 | * the Free Software Foundation; version 2 of the License. |
| @@ -0,0 +1,169 @@ | ||
| 1 | +/* | |
| 2 | + * arch/arm/mach-shmobile/pm_runtime.c | |
| 3 | + * | |
| 4 | + * Runtime PM support code for SuperH Mobile ARM | |
| 5 | + * | |
| 6 | + * Copyright (C) 2009-2010 Magnus Damm | |
| 7 | + * | |
| 8 | + * This file is subject to the terms and conditions of the GNU General Public | |
| 9 | + * License. See the file "COPYING" in the main directory of this archive | |
| 10 | + * for more details. | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#include <linux/init.h> | |
| 14 | +#include <linux/kernel.h> | |
| 15 | +#include <linux/io.h> | |
| 16 | +#include <linux/pm_runtime.h> | |
| 17 | +#include <linux/platform_device.h> | |
| 18 | +#include <linux/clk.h> | |
| 19 | +#include <linux/sh_clk.h> | |
| 20 | +#include <linux/bitmap.h> | |
| 21 | + | |
| 22 | +#ifdef CONFIG_PM_RUNTIME | |
| 23 | +#define BIT_ONCE 0 | |
| 24 | +#define BIT_ACTIVE 1 | |
| 25 | +#define BIT_CLK_ENABLED 2 | |
| 26 | + | |
| 27 | +struct pm_runtime_data { | |
| 28 | + unsigned long flags; | |
| 29 | + struct clk *clk; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +static void __devres_release(struct device *dev, void *res) | |
| 33 | +{ | |
| 34 | + struct pm_runtime_data *prd = res; | |
| 35 | + | |
| 36 | + dev_dbg(dev, "__devres_release()\n"); | |
| 37 | + | |
| 38 | + if (test_bit(BIT_CLK_ENABLED, &prd->flags)) | |
| 39 | + clk_disable(prd->clk); | |
| 40 | + | |
| 41 | + if (test_bit(BIT_ACTIVE, &prd->flags)) | |
| 42 | + clk_put(prd->clk); | |
| 43 | +} | |
| 44 | + | |
| 45 | +static struct pm_runtime_data *__to_prd(struct device *dev) | |
| 46 | +{ | |
| 47 | + return devres_find(dev, __devres_release, NULL, NULL); | |
| 48 | +} | |
| 49 | + | |
| 50 | +static void platform_pm_runtime_init(struct device *dev, | |
| 51 | + struct pm_runtime_data *prd) | |
| 52 | +{ | |
| 53 | + if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) { | |
| 54 | + prd->clk = clk_get(dev, NULL); | |
| 55 | + if (!IS_ERR(prd->clk)) { | |
| 56 | + set_bit(BIT_ACTIVE, &prd->flags); | |
| 57 | + dev_info(dev, "clocks managed by runtime pm\n"); | |
| 58 | + } | |
| 59 | + } | |
| 60 | +} | |
| 61 | + | |
| 62 | +static void platform_pm_runtime_bug(struct device *dev, | |
| 63 | + struct pm_runtime_data *prd) | |
| 64 | +{ | |
| 65 | + if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) | |
| 66 | + dev_err(dev, "runtime pm suspend before resume\n"); | |
| 67 | +} | |
| 68 | + | |
| 69 | +int platform_pm_runtime_suspend(struct device *dev) | |
| 70 | +{ | |
| 71 | + struct pm_runtime_data *prd = __to_prd(dev); | |
| 72 | + | |
| 73 | + dev_dbg(dev, "platform_pm_runtime_suspend()\n"); | |
| 74 | + | |
| 75 | + platform_pm_runtime_bug(dev, prd); | |
| 76 | + | |
| 77 | + if (prd && test_bit(BIT_ACTIVE, &prd->flags)) { | |
| 78 | + clk_disable(prd->clk); | |
| 79 | + clear_bit(BIT_CLK_ENABLED, &prd->flags); | |
| 80 | + } | |
| 81 | + | |
| 82 | + return 0; | |
| 83 | +} | |
| 84 | + | |
| 85 | +int platform_pm_runtime_resume(struct device *dev) | |
| 86 | +{ | |
| 87 | + struct pm_runtime_data *prd = __to_prd(dev); | |
| 88 | + | |
| 89 | + dev_dbg(dev, "platform_pm_runtime_resume()\n"); | |
| 90 | + | |
| 91 | + platform_pm_runtime_init(dev, prd); | |
| 92 | + | |
| 93 | + if (prd && test_bit(BIT_ACTIVE, &prd->flags)) { | |
| 94 | + clk_enable(prd->clk); | |
| 95 | + set_bit(BIT_CLK_ENABLED, &prd->flags); | |
| 96 | + } | |
| 97 | + | |
| 98 | + return 0; | |
| 99 | +} | |
| 100 | + | |
| 101 | +int platform_pm_runtime_idle(struct device *dev) | |
| 102 | +{ | |
| 103 | + /* suspend synchronously to disable clocks immediately */ | |
| 104 | + return pm_runtime_suspend(dev); | |
| 105 | +} | |
| 106 | + | |
| 107 | +static int platform_bus_notify(struct notifier_block *nb, | |
| 108 | + unsigned long action, void *data) | |
| 109 | +{ | |
| 110 | + struct device *dev = data; | |
| 111 | + struct pm_runtime_data *prd; | |
| 112 | + | |
| 113 | + dev_dbg(dev, "platform_bus_notify() %ld !\n", action); | |
| 114 | + | |
| 115 | + if (action == BUS_NOTIFY_BIND_DRIVER) { | |
| 116 | + prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL); | |
| 117 | + if (prd) | |
| 118 | + devres_add(dev, prd); | |
| 119 | + else | |
| 120 | + dev_err(dev, "unable to alloc memory for runtime pm\n"); | |
| 121 | + } | |
| 122 | + | |
| 123 | + return 0; | |
| 124 | +} | |
| 125 | + | |
| 126 | +#else /* CONFIG_PM_RUNTIME */ | |
| 127 | + | |
| 128 | +static int platform_bus_notify(struct notifier_block *nb, | |
| 129 | + unsigned long action, void *data) | |
| 130 | +{ | |
| 131 | + struct device *dev = data; | |
| 132 | + struct clk *clk; | |
| 133 | + | |
| 134 | + dev_dbg(dev, "platform_bus_notify() %ld !\n", action); | |
| 135 | + | |
| 136 | + switch (action) { | |
| 137 | + case BUS_NOTIFY_BIND_DRIVER: | |
| 138 | + clk = clk_get(dev, NULL); | |
| 139 | + if (!IS_ERR(clk)) { | |
| 140 | + clk_enable(clk); | |
| 141 | + clk_put(clk); | |
| 142 | + dev_info(dev, "runtime pm disabled, clock forced on\n"); | |
| 143 | + } | |
| 144 | + break; | |
| 145 | + case BUS_NOTIFY_UNBOUND_DRIVER: | |
| 146 | + clk = clk_get(dev, NULL); | |
| 147 | + if (!IS_ERR(clk)) { | |
| 148 | + clk_disable(clk); | |
| 149 | + clk_put(clk); | |
| 150 | + dev_info(dev, "runtime pm disabled, clock forced off\n"); | |
| 151 | + } | |
| 152 | + break; | |
| 153 | + } | |
| 154 | + | |
| 155 | + return 0; | |
| 156 | +} | |
| 157 | + | |
| 158 | +#endif /* CONFIG_PM_RUNTIME */ | |
| 159 | + | |
| 160 | +static struct notifier_block platform_bus_notifier = { | |
| 161 | + .notifier_call = platform_bus_notify | |
| 162 | +}; | |
| 163 | + | |
| 164 | +static int __init sh_pm_runtime_init(void) | |
| 165 | +{ | |
| 166 | + bus_register_notifier(&platform_bus_type, &platform_bus_notifier); | |
| 167 | + return 0; | |
| 168 | +} | |
| 169 | +core_initcall(sh_pm_runtime_init); | |
| @@ -91,10 +91,8 @@ static void __init tegra_harmony_fixup(struct machine_desc *desc, · 90 unmodified lines | ||
| 91 | 91 | { |
| 92 | 92 | mi->nr_banks = 2; |
| 93 | 93 | mi->bank[0].start = PHYS_OFFSET; |
| 94 | − mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET); | |
| 95 | 94 | mi->bank[0].size = 448 * SZ_1M; |
| 96 | 95 | mi->bank[1].start = SZ_512M; |
| 97 | − mi->bank[1].node = PHYS_TO_NID(SZ_512M); | |
| 98 | 96 | mi->bank[1].size = SZ_512M; |
| 99 | 97 | } |
| 100 | 98 | |
| @@ -23,6 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | #include <asm/sizes.h> |
| 25 | 25 | |
| 26 | −#define VMALLOC_END 0xFE000000 | |
| 26 | +#define VMALLOC_END 0xFE000000UL | |
| 27 | 27 | |
| 28 | 28 | #endif |
| @@ -398,7 +398,7 @@ config CPU_V6 · 397 unmodified lines | ||
| 398 | 398 | # ARMv6k |
| 399 | 399 | config CPU_32v6K |
| 400 | 400 | bool "Support ARM V6K processor extensions" if !SMP |
| 401 | − depends on CPU_V6 | |
| 401 | + depends on CPU_V6 || CPU_V7 | |
| 402 | 402 | default y if SMP && !(ARCH_MX3 || ARCH_OMAP2) |
| 403 | 403 | help |
| 404 | 404 | Say Y here if your ARMv6 processor supports the 'K' extension. |
| @@ -229,6 +229,8 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) · 228 unmodified lines | ||
| 229 | 229 | } |
| 230 | 230 | } while (size -= PAGE_SIZE); |
| 231 | 231 | |
| 232 | + dsb(); | |
| 233 | + | |
| 232 | 234 | return (void *)c->vm_start; |
| 233 | 235 | } |
| 234 | 236 | return NULL; |
| @@ -43,6 +43,7 @@ config ARCH_MXC91231 · 42 unmodified lines | ||
| 43 | 43 | config ARCH_MX5 |
| 44 | 44 | bool "MX5-based" |
| 45 | 45 | select CPU_V7 |
| 46 | + select ARM_L1_CACHE_SHIFT_6 | |
| 46 | 47 | help |
| 47 | 48 | This enables support for systems based on the Freescale i.MX51 family |
| 48 | 49 | |
| @@ -37,9 +37,9 @@ · 36 unmodified lines | ||
| 37 | 37 | * mach-mx5/eukrea_mbimx51-baseboard.c for cpuimx51 |
| 38 | 38 | */ |
| 39 | 39 | |
| 40 | −extern void eukrea_mbimx25_baseboard_init(void); | |
| 40 | +extern void eukrea_mbimxsd25_baseboard_init(void); | |
| 41 | 41 | extern void eukrea_mbimx27_baseboard_init(void); |
| 42 | −extern void eukrea_mbimx35_baseboard_init(void); | |
| 42 | +extern void eukrea_mbimxsd35_baseboard_init(void); | |
| 43 | 43 | extern void eukrea_mbimx51_baseboard_init(void); |
| 44 | 44 | |
| 45 | 45 | #endif |
| @@ -164,8 +164,9 @@ int tzic_enable_wake(int is_idle) · 163 unmodified lines | ||
| 164 | 164 | return -EAGAIN; |
| 165 | 165 | |
| 166 | 166 | for (i = 0; i < 4; i++) { |
| 167 | − v = is_idle ? __raw_readl(TZIC_ENSET0(i)) : wakeup_intr[i]; | |
| 168 | − __raw_writel(v, TZIC_WAKEUP0(i)); | |
| 167 | + v = is_idle ? __raw_readl(tzic_base + TZIC_ENSET0(i)) : | |
| 168 | + wakeup_intr[i]; | |
| 169 | + __raw_writel(v, tzic_base + TZIC_WAKEUP0(i)); | |
| 169 | 170 | } |
| 170 | 171 | |
| 171 | 172 | return 0; |
| @@ -19,13 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #include <asm/hardware/gic.h> |
| 21 | 21 | |
| 22 | −/* | |
| 23 | − * set_event() is used to wake up secondary core from wfe using sev. ROM | |
| 24 | − * code puts the second core into wfe(standby). | |
| 25 | − * | |
| 26 | − */ | |
| 27 | −#define set_event() __asm__ __volatile__ ("sev" : : : "memory") | |
| 28 | − | |
| 29 | 22 | /* Needed for secondary core boot */ |
| 30 | 23 | extern void omap_secondary_startup(void); |
| 31 | 24 | extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask); |
| @@ -176,7 +176,7 @@ static inline void __add_pwm(struct pwm_device *pwm) · 175 unmodified lines | ||
| 176 | 176 | |
| 177 | 177 | static int __devinit pwm_probe(struct platform_device *pdev) |
| 178 | 178 | { |
| 179 | − struct platform_device_id *id = platform_get_device_id(pdev); | |
| 179 | + const struct platform_device_id *id = platform_get_device_id(pdev); | |
| 180 | 180 | struct pwm_device *pwm, *secondary = NULL; |
| 181 | 181 | struct resource *r; |
| 182 | 182 | int ret = 0; |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #define S5P_VA_GPIO S3C_ADDR(0x00500000) |
| 18 | 18 | #define S5P_VA_SYSTIMER S3C_ADDR(0x01200000) |
| 19 | 19 | #define S5P_VA_SROMC S3C_ADDR(0x01100000) |
| 20 | +#define S5P_VA_SYSRAM S3C_ADDR(0x01180000) | |
| 20 | 21 | |
| 21 | 22 | #define S5P_VA_COMBINER_BASE S3C_ADDR(0x00600000) |
| 22 | 23 | #define S5P_VA_COMBINER(x) (S5P_VA_COMBINER_BASE + ((x) >> 2) * 0x10) |
| @@ -29,6 +30,7 @@ · 6 unmodified lines | ||
| 29 | 30 | #define S5P_VA_GIC_DIST S5P_VA_COREPERI(0x1000) |
| 30 | 31 | |
| 31 | 32 | #define S5P_VA_L2CC S3C_ADDR(0x00900000) |
| 33 | +#define S5P_VA_CMU S3C_ADDR(0x00920000) | |
| 32 | 34 | |
| 33 | 35 | #define S5P_VA_UART(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) |
| 34 | 36 | #define S5P_VA_UART0 S5P_VA_UART(0) |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | # |
| 13 | 13 | # http://www.arm.linux.org.uk/developer/machines/?action=new |
| 14 | 14 | # |
| 15 | −# Last update: Mon Jul 12 21:10:14 2010 | |
| 15 | +# Last update: Thu Sep 9 22:43:01 2010 | |
| 16 | 16 | # |
| 17 | 17 | # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number |
| 18 | 18 | # |
| @@ -2622,7 +2622,7 @@ kraken MACH_KRAKEN KRAKEN 2634 · 2603 unmodified lines | ||
| 2622 | 2622 | gw2388 MACH_GW2388 GW2388 2635 |
| 2623 | 2623 | jadecpu MACH_JADECPU JADECPU 2636 |
| 2624 | 2624 | carlisle MACH_CARLISLE CARLISLE 2637 |
| 2625 | −lux_sf9 MACH_LUX_SFT9 LUX_SFT9 2638 | |
| 2625 | +lux_sf9 MACH_LUX_SF9 LUX_SF9 2638 | |
| 2626 | 2626 | nemid_tb MACH_NEMID_TB NEMID_TB 2639 |
| 2627 | 2627 | terrier MACH_TERRIER TERRIER 2640 |
| 2628 | 2628 | turbot MACH_TURBOT TURBOT 2641 |
| @@ -2950,3 +2950,97 @@ davinci_dm365_dvr MACH_DAVINCI_DM365_DVR DAVINCI_DM365_DVR 2963 · 321 unmodified lines | ||
| 2950 | 2950 | netviz MACH_NETVIZ NETVIZ 2964 |
| 2951 | 2951 | flexibity MACH_FLEXIBITY FLEXIBITY 2965 |
| 2952 | 2952 | wlan_computer MACH_WLAN_COMPUTER WLAN_COMPUTER 2966 |
| 2953 | +lpc24xx MACH_LPC24XX LPC24XX 2967 | |
| 2954 | +spica MACH_SPICA SPICA 2968 | |
| 2955 | +gpsdisplay MACH_GPSDISPLAY GPSDISPLAY 2969 | |
| 2956 | +bipnet MACH_BIPNET BIPNET 2970 | |
| 2957 | +overo_ctu_inertial MACH_OVERO_CTU_INERTIAL OVERO_CTU_INERTIAL 2971 | |
| 2958 | +davinci_dm355_mmm MACH_DAVINCI_DM355_MMM DAVINCI_DM355_MMM 2972 | |
| 2959 | +pc9260_v2 MACH_PC9260_V2 PC9260_V2 2973 | |
| 2960 | +ptx7545 MACH_PTX7545 PTX7545 2974 | |
| 2961 | +tm_efdc MACH_TM_EFDC TM_EFDC 2975 | |
| 2962 | +omap3_waldo1 MACH_OMAP3_WALDO1 OMAP3_WALDO1 2977 | |
| 2963 | +flyer MACH_FLYER FLYER 2978 | |
| 2964 | +tornado3240 MACH_TORNADO3240 TORNADO3240 2979 | |
| 2965 | +soli_01 MACH_SOLI_01 SOLI_01 2980 | |
| 2966 | +omapl138_europalc MACH_OMAPL138_EUROPALC OMAPL138_EUROPALC 2981 | |
| 2967 | +helios_v1 MACH_HELIOS_V1 HELIOS_V1 2982 | |
| 2968 | +netspace_lite_v2 MACH_NETSPACE_LITE_V2 NETSPACE_LITE_V2 2983 | |
| 2969 | +ssc MACH_SSC SSC 2984 | |
| 2970 | +premierwave_en MACH_PREMIERWAVE_EN PREMIERWAVE_EN 2985 | |
| 2971 | +wasabi MACH_WASABI WASABI 2986 | |
| 2972 | +vivow MACH_VIVOW VIVOW 2987 | |
| 2973 | +mx50_rdp MACH_MX50_RDP MX50_RDP 2988 | |
| 2974 | +universal MACH_UNIVERSAL UNIVERSAL 2989 | |
| 2975 | +real6410 MACH_REAL6410 REAL6410 2990 | |
| 2976 | +spx_sakura MACH_SPX_SAKURA SPX_SAKURA 2991 | |
| 2977 | +ij3k_2440 MACH_IJ3K_2440 IJ3K_2440 2992 | |
| 2978 | +omap3_bc10 MACH_OMAP3_BC10 OMAP3_BC10 2993 | |
| 2979 | +thebe MACH_THEBE THEBE 2994 | |
| 2980 | +rv082 MACH_RV082 RV082 2995 | |
| 2981 | +armlguest MACH_ARMLGUEST ARMLGUEST 2996 | |
| 2982 | +tjinc1000 MACH_TJINC1000 TJINC1000 2997 | |
| 2983 | +dockstar MACH_DOCKSTAR DOCKSTAR 2998 | |
| 2984 | +ax8008 MACH_AX8008 AX8008 2999 | |
| 2985 | +gnet_sgce MACH_GNET_SGCE GNET_SGCE 3000 | |
| 2986 | +pxwnas_500_1000 MACH_PXWNAS_500_1000 PXWNAS_500_1000 3001 | |
| 2987 | +ea20 MACH_EA20 EA20 3002 | |
| 2988 | +awm2 MACH_AWM2 AWM2 3003 | |
| 2989 | +ti8148evm MACH_TI8148EVM TI8148EVM 3004 | |
| 2990 | +tegra_seaboard MACH_TEGRA_SEABOARD TEGRA_SEABOARD 3005 | |
| 2991 | +linkstation_chlv2 MACH_LINKSTATION_CHLV2 LINKSTATION_CHLV2 3006 | |
| 2992 | +tera_pro2_rack MACH_TERA_PRO2_RACK TERA_PRO2_RACK 3007 | |
| 2993 | +rubys MACH_RUBYS RUBYS 3008 | |
| 2994 | +aquarius MACH_AQUARIUS AQUARIUS 3009 | |
| 2995 | +mx53_ard MACH_MX53_ARD MX53_ARD 3010 | |
| 2996 | +mx53_smd MACH_MX53_SMD MX53_SMD 3011 | |
| 2997 | +lswxl MACH_LSWXL LSWXL 3012 | |
| 2998 | +dove_avng_v3 MACH_DOVE_AVNG_V3 DOVE_AVNG_V3 3013 | |
| 2999 | +sdi_ess_9263 MACH_SDI_ESS_9263 SDI_ESS_9263 3014 | |
| 3000 | +jocpu550 MACH_JOCPU550 JOCPU550 3015 | |
| 3001 | +msm8x60_rumi3 MACH_MSM8X60_RUMI3 MSM8X60_RUMI3 3016 | |
| 3002 | +msm8x60_ffa MACH_MSM8X60_FFA MSM8X60_FFA 3017 | |
| 3003 | +yanomami MACH_YANOMAMI YANOMAMI 3018 | |
| 3004 | +gta04 MACH_GTA04 GTA04 3019 | |
| 3005 | +cm_a510 MACH_CM_A510 CM_A510 3020 | |
| 3006 | +omap3_rfs200 MACH_OMAP3_RFS200 OMAP3_RFS200 3021 | |
| 3007 | +kx33xx MACH_KX33XX KX33XX 3022 | |
| 3008 | +ptx7510 MACH_PTX7510 PTX7510 3023 | |
| 3009 | +top9000 MACH_TOP9000 TOP9000 3024 | |
| 3010 | +teenote MACH_TEENOTE TEENOTE 3025 | |
| 3011 | +ts3 MACH_TS3 TS3 3026 | |
| 3012 | +a0 MACH_A0 A0 3027 | |
| 3013 | +fsm9xxx_surf MACH_FSM9XXX_SURF FSM9XXX_SURF 3028 | |
| 3014 | +fsm9xxx_ffa MACH_FSM9XXX_FFA FSM9XXX_FFA 3029 | |
| 3015 | +frrhwcdma60w MACH_FRRHWCDMA60W FRRHWCDMA60W 3030 | |
| 3016 | +remus MACH_REMUS REMUS 3031 | |
| 3017 | +at91cap7xdk MACH_AT91CAP7XDK AT91CAP7XDK 3032 | |
| 3018 | +at91cap7stk MACH_AT91CAP7STK AT91CAP7STK 3033 | |
| 3019 | +kt_sbc_sam9_1 MACH_KT_SBC_SAM9_1 KT_SBC_SAM9_1 3034 | |
| 3020 | +oratisrouter MACH_ORATISROUTER ORATISROUTER 3035 | |
| 3021 | +armada_xp_db MACH_ARMADA_XP_DB ARMADA_XP_DB 3036 | |
| 3022 | +spdm MACH_SPDM SPDM 3037 | |
| 3023 | +gtib MACH_GTIB GTIB 3038 | |
| 3024 | +dgm3240 MACH_DGM3240 DGM3240 3039 | |
| 3025 | +atlas_i_lpe MACH_ATLAS_I_LPE ATLAS_I_LPE 3040 | |
| 3026 | +htcmega MACH_HTCMEGA HTCMEGA 3041 | |
| 3027 | +tricorder MACH_TRICORDER TRICORDER 3042 | |
| 3028 | +tx28 MACH_TX28 TX28 3043 | |
| 3029 | +bstbrd MACH_BSTBRD BSTBRD 3044 | |
| 3030 | +pwb3090 MACH_PWB3090 PWB3090 3045 | |
| 3031 | +idea6410 MACH_IDEA6410 IDEA6410 3046 | |
| 3032 | +qbc9263 MACH_QBC9263 QBC9263 3047 | |
| 3033 | +borabora MACH_BORABORA BORABORA 3048 | |
| 3034 | +valdez MACH_VALDEZ VALDEZ 3049 | |
| 3035 | +ls9g20 MACH_LS9G20 LS9G20 3050 | |
| 3036 | +mios_v1 MACH_MIOS_V1 MIOS_V1 3051 | |
| 3037 | +s5pc110_crespo MACH_S5PC110_CRESPO S5PC110_CRESPO 3052 | |
| 3038 | +controltek9g20 MACH_CONTROLTEK9G20 CONTROLTEK9G20 3053 | |
| 3039 | +tin307 MACH_TIN307 TIN307 3054 | |
| 3040 | +tin510 MACH_TIN510 TIN510 3055 | |
| 3041 | +bluecheese MACH_BLUECHEESE BLUECHEESE 3057 | |
| 3042 | +tem3x30 MACH_TEM3X30 TEM3X30 3058 | |
| 3043 | +harvest_desoto MACH_HARVEST_DESOTO HARVEST_DESOTO 3059 | |
| 3044 | +msm8x60_qrdc MACH_MSM8X60_QRDC MSM8X60_QRDC 3060 | |
| 3045 | +spear900 MACH_SPEAR900 SPEAR900 3061 | |
| 3046 | +pcontrol_g20 MACH_PCONTROL_G20 PCONTROL_G20 3062 | |
| @@ -115,12 +115,6 @@ struct sport_register { · 114 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | #endif |
| 117 | 117 | |
| 118 | −/* Workaround defBF*.h SPORT MMRs till they get cleansed */ | |
| 119 | −#undef DTYPE_NORM | |
| 120 | −#undef SLEN | |
| 121 | −#undef SP_WOFF | |
| 122 | −#undef SP_WSIZE | |
| 123 | − | |
| 124 | 118 | /* SPORT_TCR1 Masks */ |
| 125 | 119 | #define TSPEN 0x0001 /* TX enable */ |
| 126 | 120 | #define ITCLK 0x0002 /* Internal TX Clock Select */ |
| @@ -913,88 +913,6 @@ · 912 unmodified lines | ||
| 913 | 913 | #define PH6 0x0040 |
| 914 | 914 | #define PH7 0x0080 |
| 915 | 915 | |
| 916 | − | |
| 917 | −/* ******************* SERIAL PORT MASKS **************************************/ | |
| 918 | −/* SPORTx_TCR1 Masks */ | |
| 919 | −#define TSPEN 0x0001 /* Transmit Enable */ | |
| 920 | −#define ITCLK 0x0002 /* Internal Transmit Clock Select */ | |
| 921 | −#define DTYPE_NORM 0x0004 /* Data Format Normal */ | |
| 922 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 923 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 924 | −#define TLSBIT 0x0010 /* Transmit Bit Order */ | |
| 925 | −#define ITFS 0x0200 /* Internal Transmit Frame Sync Select */ | |
| 926 | −#define TFSR 0x0400 /* Transmit Frame Sync Required Select */ | |
| 927 | −#define DITFS 0x0800 /* Data-Independent Transmit Frame Sync Select */ | |
| 928 | −#define LTFS 0x1000 /* Low Transmit Frame Sync Select */ | |
| 929 | −#define LATFS 0x2000 /* Late Transmit Frame Sync Select */ | |
| 930 | −#define TCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 931 | − | |
| 932 | −/* SPORTx_TCR2 Masks and Macro */ | |
| 933 | −#define SLEN(x) ((x)&0x1F) /* SPORT TX Word Length (2 - 31) */ | |
| 934 | −#define TXSE 0x0100 /* TX Secondary Enable */ | |
| 935 | −#define TSFSE 0x0200 /* Transmit Stereo Frame Sync Enable */ | |
| 936 | −#define TRFST 0x0400 /* Left/Right Order (1 = Right Channel 1st) */ | |
| 937 | − | |
| 938 | −/* SPORTx_RCR1 Masks */ | |
| 939 | −#define RSPEN 0x0001 /* Receive Enable */ | |
| 940 | −#define IRCLK 0x0002 /* Internal Receive Clock Select */ | |
| 941 | −#define DTYPE_NORM 0x0004 /* Data Format Normal */ | |
| 942 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 943 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 944 | −#define RLSBIT 0x0010 /* Receive Bit Order */ | |
| 945 | −#define IRFS 0x0200 /* Internal Receive Frame Sync Select */ | |
| 946 | −#define RFSR 0x0400 /* Receive Frame Sync Required Select */ | |
| 947 | −#define LRFS 0x1000 /* Low Receive Frame Sync Select */ | |
| 948 | −#define LARFS 0x2000 /* Late Receive Frame Sync Select */ | |
| 949 | −#define RCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 950 | − | |
| 951 | −/* SPORTx_RCR2 Masks */ | |
| 952 | −#define SLEN(x) ((x)&0x1F) /* SPORT RX Word Length (2 - 31) */ | |
| 953 | −#define RXSE 0x0100 /* RX Secondary Enable */ | |
| 954 | −#define RSFSE 0x0200 /* RX Stereo Frame Sync Enable */ | |
| 955 | −#define RRFST 0x0400 /* Right-First Data Order */ | |
| 956 | − | |
| 957 | −/* SPORTx_STAT Masks */ | |
| 958 | −#define RXNE 0x0001 /* Receive FIFO Not Empty Status */ | |
| 959 | −#define RUVF 0x0002 /* Sticky Receive Underflow Status */ | |
| 960 | −#define ROVF 0x0004 /* Sticky Receive Overflow Status */ | |
| 961 | −#define TXF 0x0008 /* Transmit FIFO Full Status */ | |
| 962 | −#define TUVF 0x0010 /* Sticky Transmit Underflow Status */ | |
| 963 | −#define TOVF 0x0020 /* Sticky Transmit Overflow Status */ | |
| 964 | −#define TXHRE 0x0040 /* Transmit Hold Register Empty */ | |
| 965 | − | |
| 966 | −/* SPORTx_MCMC1 Macros */ | |
| 967 | −#define SP_WOFF(x) ((x) & 0x3FF) /* Multichannel Window Offset Field */ | |
| 968 | − | |
| 969 | −/* Only use WSIZE Macro With Logic OR While Setting Lower Order Bits */ | |
| 970 | −#define SP_WSIZE(x) (((((x)>>0x3)-1)&0xF) << 0xC) /* Multichannel Window Size = (x/8)-1 */ | |
| 971 | − | |
| 972 | −/* SPORTx_MCMC2 Masks */ | |
| 973 | −#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */ | |
| 974 | −#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */ | |
| 975 | −#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */ | |
| 976 | −#define MCDTXPE 0x0004 /* Multichannel DMA Transmit Packing */ | |
| 977 | −#define MCDRXPE 0x0008 /* Multichannel DMA Receive Packing */ | |
| 978 | −#define MCMEN 0x0010 /* Multichannel Frame Mode Enable */ | |
| 979 | −#define FSDR 0x0080 /* Multichannel Frame Sync to Data Relationship */ | |
| 980 | −#define MFD_0 0x0000 /* Multichannel Frame Delay = 0 */ | |
| 981 | −#define MFD_1 0x1000 /* Multichannel Frame Delay = 1 */ | |
| 982 | −#define MFD_2 0x2000 /* Multichannel Frame Delay = 2 */ | |
| 983 | −#define MFD_3 0x3000 /* Multichannel Frame Delay = 3 */ | |
| 984 | −#define MFD_4 0x4000 /* Multichannel Frame Delay = 4 */ | |
| 985 | −#define MFD_5 0x5000 /* Multichannel Frame Delay = 5 */ | |
| 986 | −#define MFD_6 0x6000 /* Multichannel Frame Delay = 6 */ | |
| 987 | −#define MFD_7 0x7000 /* Multichannel Frame Delay = 7 */ | |
| 988 | −#define MFD_8 0x8000 /* Multichannel Frame Delay = 8 */ | |
| 989 | −#define MFD_9 0x9000 /* Multichannel Frame Delay = 9 */ | |
| 990 | −#define MFD_10 0xA000 /* Multichannel Frame Delay = 10 */ | |
| 991 | −#define MFD_11 0xB000 /* Multichannel Frame Delay = 11 */ | |
| 992 | −#define MFD_12 0xC000 /* Multichannel Frame Delay = 12 */ | |
| 993 | −#define MFD_13 0xD000 /* Multichannel Frame Delay = 13 */ | |
| 994 | −#define MFD_14 0xE000 /* Multichannel Frame Delay = 14 */ | |
| 995 | −#define MFD_15 0xF000 /* Multichannel Frame Delay = 15 */ | |
| 996 | − | |
| 997 | − | |
| 998 | 916 | /* ********************* ASYNCHRONOUS MEMORY CONTROLLER MASKS *************************/ |
| 999 | 917 | /* EBIU_AMGCTL Masks */ |
| 1000 | 918 | #define AMCKEN 0x0001 /* Enable CLKOUT */ |
| @@ -145,7 +145,6 @@ static struct mtd_partition partition_info[] = { · 144 unmodified lines | ||
| 145 | 145 | }; |
| 146 | 146 | |
| 147 | 147 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 148 | − .page_size = NFC_PG_SIZE_256, | |
| 149 | 148 | .data_width = NFC_NWIDTH_8, |
| 150 | 149 | .partitions = partition_info, |
| 151 | 150 | .nr_partitions = ARRAY_SIZE(partition_info), |
| @@ -149,7 +149,6 @@ static struct mtd_partition partition_info[] = { · 148 unmodified lines | ||
| 149 | 149 | }; |
| 150 | 150 | |
| 151 | 151 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 152 | − .page_size = NFC_PG_SIZE_256, | |
| 153 | 152 | .data_width = NFC_NWIDTH_8, |
| 154 | 153 | .partitions = partition_info, |
| 155 | 154 | .nr_partitions = ARRAY_SIZE(partition_info), |
| @@ -234,7 +234,6 @@ static struct mtd_partition partition_info[] = { · 233 unmodified lines | ||
| 234 | 234 | }; |
| 235 | 235 | |
| 236 | 236 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 237 | − .page_size = NFC_PG_SIZE_256, | |
| 238 | 237 | .data_width = NFC_NWIDTH_8, |
| 239 | 238 | .partitions = partition_info, |
| 240 | 239 | .nr_partitions = ARRAY_SIZE(partition_info), |
| @@ -922,88 +922,6 @@ · 921 unmodified lines | ||
| 922 | 922 | #define PH14 0x4000 |
| 923 | 923 | #define PH15 0x8000 |
| 924 | 924 | |
| 925 | − | |
| 926 | −/* ******************* SERIAL PORT MASKS **************************************/ | |
| 927 | −/* SPORTx_TCR1 Masks */ | |
| 928 | −#define TSPEN 0x0001 /* Transmit Enable */ | |
| 929 | −#define ITCLK 0x0002 /* Internal Transmit Clock Select */ | |
| 930 | −#define DTYPE_NORM 0x0004 /* Data Format Normal */ | |
| 931 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 932 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 933 | −#define TLSBIT 0x0010 /* Transmit Bit Order */ | |
| 934 | −#define ITFS 0x0200 /* Internal Transmit Frame Sync Select */ | |
| 935 | −#define TFSR 0x0400 /* Transmit Frame Sync Required Select */ | |
| 936 | −#define DITFS 0x0800 /* Data-Independent Transmit Frame Sync Select */ | |
| 937 | −#define LTFS 0x1000 /* Low Transmit Frame Sync Select */ | |
| 938 | −#define LATFS 0x2000 /* Late Transmit Frame Sync Select */ | |
| 939 | −#define TCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 940 | − | |
| 941 | −/* SPORTx_TCR2 Masks and Macro */ | |
| 942 | −#define SLEN(x) ((x)&0x1F) /* SPORT TX Word Length (2 - 31) */ | |
| 943 | −#define TXSE 0x0100 /* TX Secondary Enable */ | |
| 944 | −#define TSFSE 0x0200 /* Transmit Stereo Frame Sync Enable */ | |
| 945 | −#define TRFST 0x0400 /* Left/Right Order (1 = Right Channel 1st) */ | |
| 946 | − | |
| 947 | −/* SPORTx_RCR1 Masks */ | |
| 948 | −#define RSPEN 0x0001 /* Receive Enable */ | |
| 949 | −#define IRCLK 0x0002 /* Internal Receive Clock Select */ | |
| 950 | −#define DTYPE_NORM 0x0004 /* Data Format Normal */ | |
| 951 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 952 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 953 | −#define RLSBIT 0x0010 /* Receive Bit Order */ | |
| 954 | −#define IRFS 0x0200 /* Internal Receive Frame Sync Select */ | |
| 955 | −#define RFSR 0x0400 /* Receive Frame Sync Required Select */ | |
| 956 | −#define LRFS 0x1000 /* Low Receive Frame Sync Select */ | |
| 957 | −#define LARFS 0x2000 /* Late Receive Frame Sync Select */ | |
| 958 | −#define RCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 959 | − | |
| 960 | −/* SPORTx_RCR2 Masks */ | |
| 961 | −#define SLEN(x) ((x)&0x1F) /* SPORT RX Word Length (2 - 31) */ | |
| 962 | −#define RXSE 0x0100 /* RX Secondary Enable */ | |
| 963 | −#define RSFSE 0x0200 /* RX Stereo Frame Sync Enable */ | |
| 964 | −#define RRFST 0x0400 /* Right-First Data Order */ | |
| 965 | − | |
| 966 | −/* SPORTx_STAT Masks */ | |
| 967 | −#define RXNE 0x0001 /* Receive FIFO Not Empty Status */ | |
| 968 | −#define RUVF 0x0002 /* Sticky Receive Underflow Status */ | |
| 969 | −#define ROVF 0x0004 /* Sticky Receive Overflow Status */ | |
| 970 | −#define TXF 0x0008 /* Transmit FIFO Full Status */ | |
| 971 | −#define TUVF 0x0010 /* Sticky Transmit Underflow Status */ | |
| 972 | −#define TOVF 0x0020 /* Sticky Transmit Overflow Status */ | |
| 973 | −#define TXHRE 0x0040 /* Transmit Hold Register Empty */ | |
| 974 | − | |
| 975 | −/* SPORTx_MCMC1 Macros */ | |
| 976 | −#define SP_WOFF(x) ((x) & 0x3FF) /* Multichannel Window Offset Field */ | |
| 977 | − | |
| 978 | −/* Only use WSIZE Macro With Logic OR While Setting Lower Order Bits */ | |
| 979 | −#define SP_WSIZE(x) (((((x)>>0x3)-1)&0xF) << 0xC) /* Multichannel Window Size = (x/8)-1 */ | |
| 980 | − | |
| 981 | −/* SPORTx_MCMC2 Masks */ | |
| 982 | −#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */ | |
| 983 | −#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */ | |
| 984 | −#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */ | |
| 985 | −#define MCDTXPE 0x0004 /* Multichannel DMA Transmit Packing */ | |
| 986 | −#define MCDRXPE 0x0008 /* Multichannel DMA Receive Packing */ | |
| 987 | −#define MCMEN 0x0010 /* Multichannel Frame Mode Enable */ | |
| 988 | −#define FSDR 0x0080 /* Multichannel Frame Sync to Data Relationship */ | |
| 989 | −#define MFD_0 0x0000 /* Multichannel Frame Delay = 0 */ | |
| 990 | −#define MFD_1 0x1000 /* Multichannel Frame Delay = 1 */ | |
| 991 | −#define MFD_2 0x2000 /* Multichannel Frame Delay = 2 */ | |
| 992 | −#define MFD_3 0x3000 /* Multichannel Frame Delay = 3 */ | |
| 993 | −#define MFD_4 0x4000 /* Multichannel Frame Delay = 4 */ | |
| 994 | −#define MFD_5 0x5000 /* Multichannel Frame Delay = 5 */ | |
| 995 | −#define MFD_6 0x6000 /* Multichannel Frame Delay = 6 */ | |
| 996 | −#define MFD_7 0x7000 /* Multichannel Frame Delay = 7 */ | |
| 997 | −#define MFD_8 0x8000 /* Multichannel Frame Delay = 8 */ | |
| 998 | −#define MFD_9 0x9000 /* Multichannel Frame Delay = 9 */ | |
| 999 | −#define MFD_10 0xA000 /* Multichannel Frame Delay = 10 */ | |
| 1000 | −#define MFD_11 0xB000 /* Multichannel Frame Delay = 11 */ | |
| 1001 | −#define MFD_12 0xC000 /* Multichannel Frame Delay = 12 */ | |
| 1002 | −#define MFD_13 0xD000 /* Multichannel Frame Delay = 13 */ | |
| 1003 | −#define MFD_14 0xE000 /* Multichannel Frame Delay = 14 */ | |
| 1004 | −#define MFD_15 0xF000 /* Multichannel Frame Delay = 15 */ | |
| 1005 | − | |
| 1006 | − | |
| 1007 | 925 | /* ********************* ASYNCHRONOUS MEMORY CONTROLLER MASKS *************************/ |
| 1008 | 926 | /* EBIU_AMGCTL Masks */ |
| 1009 | 927 | #define AMCKEN 0x0001 /* Enable CLKOUT */ |
| @@ -509,98 +509,6 @@ · 508 unmodified lines | ||
| 509 | 509 | #define IREN_P 0x01 |
| 510 | 510 | #define UCEN_P 0x00 |
| 511 | 511 | |
| 512 | −/* ********** SERIAL PORT MASKS ********************** */ | |
| 513 | − | |
| 514 | −/* SPORTx_TCR1 Masks */ | |
| 515 | −#define TSPEN 0x0001 /* TX enable */ | |
| 516 | −#define ITCLK 0x0002 /* Internal TX Clock Select */ | |
| 517 | −#define TDTYPE 0x000C /* TX Data Formatting Select */ | |
| 518 | −#define DTYPE_NORM 0x0000 /* Data Format Normal */ | |
| 519 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 520 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 521 | −#define TLSBIT 0x0010 /* TX Bit Order */ | |
| 522 | −#define ITFS 0x0200 /* Internal TX Frame Sync Select */ | |
| 523 | −#define TFSR 0x0400 /* TX Frame Sync Required Select */ | |
| 524 | −#define DITFS 0x0800 /* Data Independent TX Frame Sync Select */ | |
| 525 | −#define LTFS 0x1000 /* Low TX Frame Sync Select */ | |
| 526 | −#define LATFS 0x2000 /* Late TX Frame Sync Select */ | |
| 527 | −#define TCKFE 0x4000 /* TX Clock Falling Edge Select */ | |
| 528 | − | |
| 529 | −/* SPORTx_TCR2 Masks */ | |
| 530 | −#if defined(__ADSPBF531__) || defined(__ADSPBF532__) || \ | |
| 531 | − defined(__ADSPBF533__) | |
| 532 | −# define SLEN 0x001F /*TX Word Length */ | |
| 533 | −#else | |
| 534 | −# define SLEN(x) ((x)&0x1F) /* SPORT TX Word Length (2 - 31) */ | |
| 535 | −#endif | |
| 536 | −#define TXSE 0x0100 /*TX Secondary Enable */ | |
| 537 | −#define TSFSE 0x0200 /*TX Stereo Frame Sync Enable */ | |
| 538 | −#define TRFST 0x0400 /*TX Right-First Data Order */ | |
| 539 | − | |
| 540 | −/* SPORTx_RCR1 Masks */ | |
| 541 | −#define RSPEN 0x0001 /* RX enable */ | |
| 542 | −#define IRCLK 0x0002 /* Internal RX Clock Select */ | |
| 543 | −#define RDTYPE 0x000C /* RX Data Formatting Select */ | |
| 544 | −#define DTYPE_NORM 0x0000 /* no companding */ | |
| 545 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 546 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 547 | −#define RLSBIT 0x0010 /* RX Bit Order */ | |
| 548 | −#define IRFS 0x0200 /* Internal RX Frame Sync Select */ | |
| 549 | −#define RFSR 0x0400 /* RX Frame Sync Required Select */ | |
| 550 | −#define LRFS 0x1000 /* Low RX Frame Sync Select */ | |
| 551 | −#define LARFS 0x2000 /* Late RX Frame Sync Select */ | |
| 552 | −#define RCKFE 0x4000 /* RX Clock Falling Edge Select */ | |
| 553 | − | |
| 554 | −/* SPORTx_RCR2 Masks */ | |
| 555 | −/* SLEN defined above */ | |
| 556 | −#define RXSE 0x0100 /*RX Secondary Enable */ | |
| 557 | −#define RSFSE 0x0200 /*RX Stereo Frame Sync Enable */ | |
| 558 | −#define RRFST 0x0400 /*Right-First Data Order */ | |
| 559 | − | |
| 560 | −/*SPORTx_STAT Masks */ | |
| 561 | −#define RXNE 0x0001 /*RX FIFO Not Empty Status */ | |
| 562 | −#define RUVF 0x0002 /*RX Underflow Status */ | |
| 563 | −#define ROVF 0x0004 /*RX Overflow Status */ | |
| 564 | −#define TXF 0x0008 /*TX FIFO Full Status */ | |
| 565 | −#define TUVF 0x0010 /*TX Underflow Status */ | |
| 566 | −#define TOVF 0x0020 /*TX Overflow Status */ | |
| 567 | −#define TXHRE 0x0040 /*TX Hold Register Empty */ | |
| 568 | − | |
| 569 | −/*SPORTx_MCMC1 Masks */ | |
| 570 | −#define SP_WSIZE 0x0000F000 /*Multichannel Window Size Field */ | |
| 571 | −#define SP_WOFF 0x000003FF /*Multichannel Window Offset Field */ | |
| 572 | −/* SPORTx_MCMC1 Macros */ | |
| 573 | −#define SET_SP_WOFF(x) ((x) & 0x3FF) /* Multichannel Window Offset Field */ | |
| 574 | −/* Only use SET_WSIZE Macro With Logic OR While Setting Lower Order Bits */ | |
| 575 | −#define SET_SP_WSIZE(x) (((((x)>>0x3)-1)&0xF) << 0xC) /* Multichannel Window Size = (x/8)-1 */ | |
| 576 | − | |
| 577 | −/*SPORTx_MCMC2 Masks */ | |
| 578 | −#define MCCRM 0x00000003 /*Multichannel Clock Recovery Mode */ | |
| 579 | −#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */ | |
| 580 | −#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */ | |
| 581 | −#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */ | |
| 582 | −#define MCDTXPE 0x00000004 /*Multichannel DMA Transmit Packing */ | |
| 583 | −#define MCDRXPE 0x00000008 /*Multichannel DMA Receive Packing */ | |
| 584 | −#define MCMEN 0x00000010 /*Multichannel Frame Mode Enable */ | |
| 585 | −#define FSDR 0x00000080 /*Multichannel Frame Sync to Data Relationship */ | |
| 586 | −#define MFD 0x0000F000 /*Multichannel Frame Delay */ | |
| 587 | −#define MFD_0 0x0000 /* Multichannel Frame Delay = 0 */ | |
| 588 | −#define MFD_1 0x1000 /* Multichannel Frame Delay = 1 */ | |
| 589 | −#define MFD_2 0x2000 /* Multichannel Frame Delay = 2 */ | |
| 590 | −#define MFD_3 0x3000 /* Multichannel Frame Delay = 3 */ | |
| 591 | −#define MFD_4 0x4000 /* Multichannel Frame Delay = 4 */ | |
| 592 | −#define MFD_5 0x5000 /* Multichannel Frame Delay = 5 */ | |
| 593 | −#define MFD_6 0x6000 /* Multichannel Frame Delay = 6 */ | |
| 594 | −#define MFD_7 0x7000 /* Multichannel Frame Delay = 7 */ | |
| 595 | −#define MFD_8 0x8000 /* Multichannel Frame Delay = 8 */ | |
| 596 | −#define MFD_9 0x9000 /* Multichannel Frame Delay = 9 */ | |
| 597 | −#define MFD_10 0xA000 /* Multichannel Frame Delay = 10 */ | |
| 598 | −#define MFD_11 0xB000 /* Multichannel Frame Delay = 11 */ | |
| 599 | −#define MFD_12 0xC000 /* Multichannel Frame Delay = 12 */ | |
| 600 | −#define MFD_13 0xD000 /* Multichannel Frame Delay = 13 */ | |
| 601 | −#define MFD_14 0xE000 /* Multichannel Frame Delay = 14 */ | |
| 602 | −#define MFD_15 0xF000 /* Multichannel Frame Delay = 15 */ | |
| 603 | − | |
| 604 | 512 | /* ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** */ |
| 605 | 513 | |
| 606 | 514 | /* PPI_CONTROL Masks */ |
| @@ -1241,86 +1241,6 @@ · 1240 unmodified lines | ||
| 1241 | 1241 | #define PH14 0x4000 |
| 1242 | 1242 | #define PH15 0x8000 |
| 1243 | 1243 | |
| 1244 | −/* ******************* SERIAL PORT MASKS **************************************/ | |
| 1245 | −/* SPORTx_TCR1 Masks */ | |
| 1246 | −#define TSPEN 0x0001 /* Transmit Enable */ | |
| 1247 | −#define ITCLK 0x0002 /* Internal Transmit Clock Select */ | |
| 1248 | −#define DTYPE_NORM 0x0004 /* Data Format Normal */ | |
| 1249 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 1250 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 1251 | −#define TLSBIT 0x0010 /* Transmit Bit Order */ | |
| 1252 | −#define ITFS 0x0200 /* Internal Transmit Frame Sync Select */ | |
| 1253 | −#define TFSR 0x0400 /* Transmit Frame Sync Required Select */ | |
| 1254 | −#define DITFS 0x0800 /* Data-Independent Transmit Frame Sync Select */ | |
| 1255 | −#define LTFS 0x1000 /* Low Transmit Frame Sync Select */ | |
| 1256 | −#define LATFS 0x2000 /* Late Transmit Frame Sync Select */ | |
| 1257 | −#define TCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 1258 | − | |
| 1259 | −/* SPORTx_TCR2 Masks and Macro */ | |
| 1260 | −#define SLEN(x) ((x)&0x1F) /* SPORT TX Word Length (2 - 31) */ | |
| 1261 | −#define TXSE 0x0100 /* TX Secondary Enable */ | |
| 1262 | −#define TSFSE 0x0200 /* Transmit Stereo Frame Sync Enable */ | |
| 1263 | −#define TRFST 0x0400 /* Left/Right Order (1 = Right Channel 1st) */ | |
| 1264 | − | |
| 1265 | −/* SPORTx_RCR1 Masks */ | |
| 1266 | −#define RSPEN 0x0001 /* Receive Enable */ | |
| 1267 | −#define IRCLK 0x0002 /* Internal Receive Clock Select */ | |
| 1268 | −#define DTYPE_NORM 0x0004 /* Data Format Normal */ | |
| 1269 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 1270 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 1271 | −#define RLSBIT 0x0010 /* Receive Bit Order */ | |
| 1272 | −#define IRFS 0x0200 /* Internal Receive Frame Sync Select */ | |
| 1273 | −#define RFSR 0x0400 /* Receive Frame Sync Required Select */ | |
| 1274 | −#define LRFS 0x1000 /* Low Receive Frame Sync Select */ | |
| 1275 | −#define LARFS 0x2000 /* Late Receive Frame Sync Select */ | |
| 1276 | −#define RCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 1277 | − | |
| 1278 | −/* SPORTx_RCR2 Masks */ | |
| 1279 | −#define SLEN(x) ((x)&0x1F) /* SPORT RX Word Length (2 - 31) */ | |
| 1280 | −#define RXSE 0x0100 /* RX Secondary Enable */ | |
| 1281 | −#define RSFSE 0x0200 /* RX Stereo Frame Sync Enable */ | |
| 1282 | −#define RRFST 0x0400 /* Right-First Data Order */ | |
| 1283 | − | |
| 1284 | −/* SPORTx_STAT Masks */ | |
| 1285 | −#define RXNE 0x0001 /* Receive FIFO Not Empty Status */ | |
| 1286 | −#define RUVF 0x0002 /* Sticky Receive Underflow Status */ | |
| 1287 | −#define ROVF 0x0004 /* Sticky Receive Overflow Status */ | |
| 1288 | −#define TXF 0x0008 /* Transmit FIFO Full Status */ | |
| 1289 | −#define TUVF 0x0010 /* Sticky Transmit Underflow Status */ | |
| 1290 | −#define TOVF 0x0020 /* Sticky Transmit Overflow Status */ | |
| 1291 | −#define TXHRE 0x0040 /* Transmit Hold Register Empty */ | |
| 1292 | − | |
| 1293 | −/* SPORTx_MCMC1 Macros */ | |
| 1294 | −#define SP_WOFF(x) ((x) & 0x3FF) /* Multichannel Window Offset Field */ | |
| 1295 | − | |
| 1296 | −/* Only use WSIZE Macro With Logic OR While Setting Lower Order Bits */ | |
| 1297 | −#define SP_WSIZE(x) (((((x)>>0x3)-1)&0xF) << 0xC) /* Multichannel Window Size = (x/8)-1 */ | |
| 1298 | − | |
| 1299 | −/* SPORTx_MCMC2 Masks */ | |
| 1300 | −#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */ | |
| 1301 | −#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */ | |
| 1302 | −#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */ | |
| 1303 | −#define MCDTXPE 0x0004 /* Multichannel DMA Transmit Packing */ | |
| 1304 | −#define MCDRXPE 0x0008 /* Multichannel DMA Receive Packing */ | |
| 1305 | −#define MCMEN 0x0010 /* Multichannel Frame Mode Enable */ | |
| 1306 | −#define FSDR 0x0080 /* Multichannel Frame Sync to Data Relationship */ | |
| 1307 | −#define MFD_0 0x0000 /* Multichannel Frame Delay = 0 */ | |
| 1308 | −#define MFD_1 0x1000 /* Multichannel Frame Delay = 1 */ | |
| 1309 | −#define MFD_2 0x2000 /* Multichannel Frame Delay = 2 */ | |
| 1310 | −#define MFD_3 0x3000 /* Multichannel Frame Delay = 3 */ | |
| 1311 | −#define MFD_4 0x4000 /* Multichannel Frame Delay = 4 */ | |
| 1312 | −#define MFD_5 0x5000 /* Multichannel Frame Delay = 5 */ | |
| 1313 | −#define MFD_6 0x6000 /* Multichannel Frame Delay = 6 */ | |
| 1314 | −#define MFD_7 0x7000 /* Multichannel Frame Delay = 7 */ | |
| 1315 | −#define MFD_8 0x8000 /* Multichannel Frame Delay = 8 */ | |
| 1316 | −#define MFD_9 0x9000 /* Multichannel Frame Delay = 9 */ | |
| 1317 | −#define MFD_10 0xA000 /* Multichannel Frame Delay = 10 */ | |
| 1318 | −#define MFD_11 0xB000 /* Multichannel Frame Delay = 11 */ | |
| 1319 | −#define MFD_12 0xC000 /* Multichannel Frame Delay = 12 */ | |
| 1320 | −#define MFD_13 0xD000 /* Multichannel Frame Delay = 13 */ | |
| 1321 | −#define MFD_14 0xE000 /* Multichannel Frame Delay = 14 */ | |
| 1322 | −#define MFD_15 0xF000 /* Multichannel Frame Delay = 15 */ | |
| 1323 | − | |
| 1324 | 1244 | /* ********************* ASYNCHRONOUS MEMORY CONTROLLER MASKS *************************/ |
| 1325 | 1245 | /* EBIU_AMGCTL Masks */ |
| 1326 | 1246 | #define AMCKEN 0x0001 /* Enable CLKOUT */ |
| @@ -1610,113 +1610,6 @@ · 1609 unmodified lines | ||
| 1610 | 1610 | #define UCEN_P 0x00 |
| 1611 | 1611 | |
| 1612 | 1612 | |
| 1613 | −/* ********** SERIAL PORT MASKS ********************** */ | |
| 1614 | −/* SPORTx_TCR1 Masks */ | |
| 1615 | −#define TSPEN 0x0001 /* TX enable */ | |
| 1616 | −#define ITCLK 0x0002 /* Internal TX Clock Select */ | |
| 1617 | −#define TDTYPE 0x000C /* TX Data Formatting Select */ | |
| 1618 | −#define DTYPE_NORM 0x0000 /* Data Format Normal */ | |
| 1619 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 1620 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 1621 | −#define TLSBIT 0x0010 /* TX Bit Order */ | |
| 1622 | −#define ITFS 0x0200 /* Internal TX Frame Sync Select */ | |
| 1623 | −#define TFSR 0x0400 /* TX Frame Sync Required Select */ | |
| 1624 | −#define DITFS 0x0800 /* Data Independent TX Frame Sync Select */ | |
| 1625 | −#define LTFS 0x1000 /* Low TX Frame Sync Select */ | |
| 1626 | −#define LATFS 0x2000 /* Late TX Frame Sync Select */ | |
| 1627 | −#define TCKFE 0x4000 /* TX Clock Falling Edge Select */ | |
| 1628 | −/* SPORTx_RCR1 Deprecated Masks */ | |
| 1629 | −#define TULAW DTYPE_ULAW /* Compand Using u-Law */ | |
| 1630 | −#define TALAW DTYPE_ALAW /* Compand Using A-Law */ | |
| 1631 | − | |
| 1632 | −/* SPORTx_TCR2 Masks */ | |
| 1633 | −#ifdef _MISRA_RULES | |
| 1634 | −#define SLEN(x) ((x)&0x1Fu) /* SPORT TX Word Length (2 - 31) */ | |
| 1635 | −#else | |
| 1636 | −#define SLEN(x) ((x)&0x1F) /* SPORT TX Word Length (2 - 31) */ | |
| 1637 | −#endif /* _MISRA_RULES */ | |
| 1638 | −#define TXSE 0x0100 /*TX Secondary Enable */ | |
| 1639 | −#define TSFSE 0x0200 /*TX Stereo Frame Sync Enable */ | |
| 1640 | −#define TRFST 0x0400 /*TX Right-First Data Order */ | |
| 1641 | − | |
| 1642 | −/* SPORTx_RCR1 Masks */ | |
| 1643 | −#define RSPEN 0x0001 /* RX enable */ | |
| 1644 | −#define IRCLK 0x0002 /* Internal RX Clock Select */ | |
| 1645 | −#define RDTYPE 0x000C /* RX Data Formatting Select */ | |
| 1646 | −#define DTYPE_NORM 0x0000 /* no companding */ | |
| 1647 | −#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */ | |
| 1648 | −#define DTYPE_ALAW 0x000C /* Compand Using A-Law */ | |
| 1649 | −#define RLSBIT 0x0010 /* RX Bit Order */ | |
| 1650 | −#define IRFS 0x0200 /* Internal RX Frame Sync Select */ | |
| 1651 | −#define RFSR 0x0400 /* RX Frame Sync Required Select */ | |
| 1652 | −#define LRFS 0x1000 /* Low RX Frame Sync Select */ | |
| 1653 | −#define LARFS 0x2000 /* Late RX Frame Sync Select */ | |
| 1654 | −#define RCKFE 0x4000 /* RX Clock Falling Edge Select */ | |
| 1655 | −/* SPORTx_RCR1 Deprecated Masks */ | |
| 1656 | −#define RULAW DTYPE_ULAW /* Compand Using u-Law */ | |
| 1657 | −#define RALAW DTYPE_ALAW /* Compand Using A-Law */ | |
| 1658 | − | |
| 1659 | −/* SPORTx_RCR2 Masks */ | |
| 1660 | −#ifdef _MISRA_RULES | |
| 1661 | −#define SLEN(x) ((x)&0x1Fu) /* SPORT RX Word Length (2 - 31) */ | |
| 1662 | −#else | |
| 1663 | −#define SLEN(x) ((x)&0x1F) /* SPORT RX Word Length (2 - 31) */ | |
| 1664 | −#endif /* _MISRA_RULES */ | |
| 1665 | −#define RXSE 0x0100 /*RX Secondary Enable */ | |
| 1666 | −#define RSFSE 0x0200 /*RX Stereo Frame Sync Enable */ | |
| 1667 | −#define RRFST 0x0400 /*Right-First Data Order */ | |
| 1668 | − | |
| 1669 | −/*SPORTx_STAT Masks */ | |
| 1670 | −#define RXNE 0x0001 /*RX FIFO Not Empty Status */ | |
| 1671 | −#define RUVF 0x0002 /*RX Underflow Status */ | |
| 1672 | −#define ROVF 0x0004 /*RX Overflow Status */ | |
| 1673 | −#define TXF 0x0008 /*TX FIFO Full Status */ | |
| 1674 | −#define TUVF 0x0010 /*TX Underflow Status */ | |
| 1675 | −#define TOVF 0x0020 /*TX Overflow Status */ | |
| 1676 | −#define TXHRE 0x0040 /*TX Hold Register Empty */ | |
| 1677 | − | |
| 1678 | −/*SPORTx_MCMC1 Masks */ | |
| 1679 | −#define WOFF 0x000003FF /*Multichannel Window Offset Field */ | |
| 1680 | −/* SPORTx_MCMC1 Macros */ | |
| 1681 | −#ifdef _MISRA_RULES | |
| 1682 | −#define SET_WOFF(x) ((x) & 0x3FFu) /* Multichannel Window Offset Field */ | |
| 1683 | −/* Only use SET_WSIZE Macro With Logic OR While Setting Lower Order Bits */ | |
| 1684 | −#define SET_WSIZE(x) (((((x)>>0x3)-1u)&0xFu) << 0xC) /* Multichannel Window Size = (x/8)-1 */ | |
| 1685 | −#else | |
| 1686 | −#define SET_WOFF(x) ((x) & 0x3FF) /* Multichannel Window Offset Field */ | |
| 1687 | −/* Only use SET_WSIZE Macro With Logic OR While Setting Lower Order Bits */ | |
| 1688 | −#define SET_WSIZE(x) (((((x)>>0x3)-1)&0xF) << 0xC) /* Multichannel Window Size = (x/8)-1 */ | |
| 1689 | −#endif /* _MISRA_RULES */ | |
| 1690 | − | |
| 1691 | − | |
| 1692 | −/*SPORTx_MCMC2 Masks */ | |
| 1693 | −#define MCCRM 0x0003 /*Multichannel Clock Recovery Mode */ | |
| 1694 | −#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */ | |
| 1695 | −#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */ | |
| 1696 | −#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */ | |
| 1697 | −#define MCDTXPE 0x0004 /*Multichannel DMA Transmit Packing */ | |
| 1698 | −#define MCDRXPE 0x0008 /*Multichannel DMA Receive Packing */ | |
| 1699 | −#define MCMEN 0x0010 /*Multichannel Frame Mode Enable */ | |
| 1700 | −#define FSDR 0x0080 /*Multichannel Frame Sync to Data Relationship */ | |
| 1701 | −#define MFD 0xF000 /*Multichannel Frame Delay */ | |
| 1702 | −#define MFD_0 0x0000 /* Multichannel Frame Delay = 0 */ | |
| 1703 | −#define MFD_1 0x1000 /* Multichannel Frame Delay = 1 */ | |
| 1704 | −#define MFD_2 0x2000 /* Multichannel Frame Delay = 2 */ | |
| 1705 | −#define MFD_3 0x3000 /* Multichannel Frame Delay = 3 */ | |
| 1706 | −#define MFD_4 0x4000 /* Multichannel Frame Delay = 4 */ | |
| 1707 | −#define MFD_5 0x5000 /* Multichannel Frame Delay = 5 */ | |
| 1708 | −#define MFD_6 0x6000 /* Multichannel Frame Delay = 6 */ | |
| 1709 | −#define MFD_7 0x7000 /* Multichannel Frame Delay = 7 */ | |
| 1710 | −#define MFD_8 0x8000 /* Multichannel Frame Delay = 8 */ | |
| 1711 | −#define MFD_9 0x9000 /* Multichannel Frame Delay = 9 */ | |
| 1712 | −#define MFD_10 0xA000 /* Multichannel Frame Delay = 10 */ | |
| 1713 | −#define MFD_11 0xB000 /* Multichannel Frame Delay = 11 */ | |
| 1714 | −#define MFD_12 0xC000 /* Multichannel Frame Delay = 12 */ | |
| 1715 | −#define MFD_13 0xD000 /* Multichannel Frame Delay = 13 */ | |
| 1716 | −#define MFD_14 0xE000 /* Multichannel Frame Delay = 14 */ | |
| 1717 | −#define MFD_15 0xF000 /* Multichannel Frame Delay = 15 */ | |
| 1718 | − | |
| 1719 | − | |
| 1720 | 1613 | /* ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** */ |
| 1721 | 1614 | /* PPI_CONTROL Masks */ |
| 1722 | 1615 | #define PORT_EN 0x0001 /* PPI Port Enable */ |
| @@ -706,7 +706,6 @@ static struct mtd_partition partition_info[] = { · 705 unmodified lines | ||
| 706 | 706 | }; |
| 707 | 707 | |
| 708 | 708 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 709 | − .page_size = NFC_PG_SIZE_256, | |
| 710 | 709 | .data_width = NFC_NWIDTH_8, |
| 711 | 710 | .partitions = partition_info, |
| 712 | 711 | .nr_partitions = ARRAY_SIZE(partition_info), |
| @@ -849,7 +849,6 @@ static struct mtd_partition partition_info[] = { · 848 unmodified lines | ||
| 849 | 849 | }; |
| 850 | 850 | |
| 851 | 851 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 852 | − .page_size = NFC_PG_SIZE_256, | |
| 853 | 852 | .data_width = NFC_NWIDTH_8, |
| 854 | 853 | .partitions = partition_info, |
| 855 | 854 | .nr_partitions = ARRAY_SIZE(partition_info), |
| @@ -2221,73 +2221,6 @@ · 2220 unmodified lines | ||
| 2221 | 2221 | |
| 2222 | 2222 | #define RCVDATA16 0xffff /* Receive FIFO 16-Bit Data */ |
| 2223 | 2223 | |
| 2224 | −/* Bit masks for SPORTx_TCR1 */ | |
| 2225 | − | |
| 2226 | −#define TCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 2227 | −#define LATFS 0x2000 /* Late Transmit Frame Sync */ | |
| 2228 | −#define LTFS 0x1000 /* Low Transmit Frame Sync Select */ | |
| 2229 | −#define DITFS 0x800 /* Data-Independent Transmit Frame Sync Select */ | |
| 2230 | −#define TFSR 0x400 /* Transmit Frame Sync Required Select */ | |
| 2231 | −#define ITFS 0x200 /* Internal Transmit Frame Sync Select */ | |
| 2232 | −#define TLSBIT 0x10 /* Transmit Bit Order */ | |
| 2233 | −#define TDTYPE 0xc /* Data Formatting Type Select */ | |
| 2234 | −#define ITCLK 0x2 /* Internal Transmit Clock Select */ | |
| 2235 | −#define TSPEN 0x1 /* Transmit Enable */ | |
| 2236 | − | |
| 2237 | −/* Bit masks for SPORTx_TCR2 */ | |
| 2238 | − | |
| 2239 | −#define TRFST 0x400 /* Left/Right Order */ | |
| 2240 | −#define TSFSE 0x200 /* Transmit Stereo Frame Sync Enable */ | |
| 2241 | −#define TXSE 0x100 /* TxSEC Enable */ | |
| 2242 | −#define SLEN_T 0x1f /* SPORT Word Length */ | |
| 2243 | − | |
| 2244 | −/* Bit masks for SPORTx_RCR1 */ | |
| 2245 | − | |
| 2246 | −#define RCKFE 0x4000 /* Clock Falling Edge Select */ | |
| 2247 | −#define LARFS 0x2000 /* Late Receive Frame Sync */ | |
| 2248 | −#define LRFS 0x1000 /* Low Receive Frame Sync Select */ | |
| 2249 | −#define RFSR 0x400 /* Receive Frame Sync Required Select */ | |
| 2250 | −#define IRFS 0x200 /* Internal Receive Frame Sync Select */ | |
| 2251 | −#define RLSBIT 0x10 /* Receive Bit Order */ | |
| 2252 | −#define RDTYPE 0xc /* Data Formatting Type Select */ | |
| 2253 | −#define IRCLK 0x2 /* Internal Receive Clock Select */ | |
| 2254 | −#define RSPEN 0x1 /* Receive Enable */ | |
| 2255 | − | |
| 2256 | −/* Bit masks for SPORTx_RCR2 */ | |
| 2257 | − | |
| 2258 | −#define RRFST 0x400 /* Left/Right Order */ | |
| 2259 | −#define RSFSE 0x200 /* Receive Stereo Frame Sync Enable */ | |
| 2260 | −#define RXSE 0x100 /* RxSEC Enable */ | |
| 2261 | −#define SLEN_R 0x1f /* SPORT Word Length */ | |
| 2262 | − | |
| 2263 | −/* Bit masks for SPORTx_STAT */ | |
| 2264 | − | |
| 2265 | −#define TXHRE 0x40 /* Transmit Hold Register Empty */ | |
| 2266 | −#define TOVF 0x20 /* Sticky Transmit Overflow Status */ | |
| 2267 | −#define TUVF 0x10 /* Sticky Transmit Underflow Status */ | |
| 2268 | −#define TXF 0x8 /* Transmit FIFO Full Status */ | |
| 2269 | −#define ROVF 0x4 /* Sticky Receive Overflow Status */ | |
| 2270 | −#define RUVF 0x2 /* Sticky Receive Underflow Status */ | |
| 2271 | −#define RXNE 0x1 /* Receive FIFO Not Empty Status */ | |
| 2272 | − | |
| 2273 | −/* Bit masks for SPORTx_MCMC1 */ | |
| 2274 | − | |
| 2275 | −#define SP_WSIZE 0xf000 /* Window Size */ | |
| 2276 | −#define SP_WOFF 0x3ff /* Windows Offset */ | |
| 2277 | − | |
| 2278 | −/* Bit masks for SPORTx_MCMC2 */ | |
| 2279 | − | |
| 2280 | −#define MFD 0xf000 /* Multi channel Frame Delay */ | |
| 2281 | −#define FSDR 0x80 /* Frame Sync to Data Relationship */ | |
| 2282 | −#define MCMEN 0x10 /* Multi channel Frame Mode Enable */ | |
| 2283 | −#define MCDRXPE 0x8 /* Multi channel DMA Receive Packing */ | |
| 2284 | −#define MCDTXPE 0x4 /* Multi channel DMA Transmit Packing */ | |
| 2285 | −#define MCCRM 0x3 /* 2X Clock Recovery Mode */ | |
| 2286 | − | |
| 2287 | −/* Bit masks for SPORTx_CHNL */ | |
| 2288 | − | |
| 2289 | −#define CUR_CHNL 0x3ff /* Current Channel Indicator */ | |
| 2290 | − | |
| 2291 | 2224 | /* Bit masks for UARTx_LCR */ |
| 2292 | 2225 | |
| 2293 | 2226 | #if 0 |
| @@ -1007,66 +1007,6 @@ · 1006 unmodified lines | ||
| 1007 | 1007 | #define IREN_P 0x01 |
| 1008 | 1008 | #define UCEN_P 0x00 |
| 1009 | 1009 | |
| 1010 | −/* ********** SERIAL PORT MASKS ********************** */ | |
| 1011 | − | |
| 1012 | −/* SPORTx_TCR1 Masks */ | |
| 1013 | −#define TSPEN 0x0001 /* TX enable */ | |
| 1014 | −#define ITCLK 0x0002 /* Internal TX Clock Select */ | |
| 1015 | −#define TDTYPE 0x000C /* TX Data Formatting Select */ | |
| 1016 | −#define TLSBIT 0x0010 /* TX Bit Order */ | |
| 1017 | −#define ITFS 0x0200 /* Internal TX Frame Sync Select */ | |
| 1018 | −#define TFSR 0x0400 /* TX Frame Sync Required Select */ | |
| 1019 | −#define DITFS 0x0800 /* Data Independent TX Frame Sync Select */ | |
| 1020 | −#define LTFS 0x1000 /* Low TX Frame Sync Select */ | |
| 1021 | −#define LATFS 0x2000 /* Late TX Frame Sync Select */ | |
| 1022 | −#define TCKFE 0x4000 /* TX Clock Falling Edge Select */ | |
| 1023 | − | |
| 1024 | −/* SPORTx_TCR2 Masks */ | |
| 1025 | −#define SLEN 0x001F /*TX Word Length */ | |
| 1026 | −#define TXSE 0x0100 /*TX Secondary Enable */ | |
| 1027 | −#define TSFSE 0x0200 /*TX Stereo Frame Sync Enable */ | |
| 1028 | −#define TRFST 0x0400 /*TX Right-First Data Order */ | |
| 1029 | − | |
| 1030 | −/* SPORTx_RCR1 Masks */ | |
| 1031 | −#define RSPEN 0x0001 /* RX enable */ | |
| 1032 | −#define IRCLK 0x0002 /* Internal RX Clock Select */ | |
| 1033 | −#define RDTYPE 0x000C /* RX Data Formatting Select */ | |
| 1034 | −#define RULAW 0x0008 /* u-Law enable */ | |
| 1035 | −#define RALAW 0x000C /* A-Law enable */ | |
| 1036 | −#define RLSBIT 0x0010 /* RX Bit Order */ | |
| 1037 | −#define IRFS 0x0200 /* Internal RX Frame Sync Select */ | |
| 1038 | −#define RFSR 0x0400 /* RX Frame Sync Required Select */ | |
| 1039 | −#define LRFS 0x1000 /* Low RX Frame Sync Select */ | |
| 1040 | −#define LARFS 0x2000 /* Late RX Frame Sync Select */ | |
| 1041 | −#define RCKFE 0x4000 /* RX Clock Falling Edge Select */ | |
| 1042 | − | |
| 1043 | −/* SPORTx_RCR2 Masks */ | |
| 1044 | −#define SLEN 0x001F /*RX Word Length */ | |
| 1045 | −#define RXSE 0x0100 /*RX Secondary Enable */ | |
| 1046 | −#define RSFSE 0x0200 /*RX Stereo Frame Sync Enable */ | |
| 1047 | −#define RRFST 0x0400 /*Right-First Data Order */ | |
| 1048 | − | |
| 1049 | −/*SPORTx_STAT Masks */ | |
| 1050 | −#define RXNE 0x0001 /*RX FIFO Not Empty Status */ | |
| 1051 | −#define RUVF 0x0002 /*RX Underflow Status */ | |
| 1052 | −#define ROVF 0x0004 /*RX Overflow Status */ | |
| 1053 | −#define TXF 0x0008 /*TX FIFO Full Status */ | |
| 1054 | −#define TUVF 0x0010 /*TX Underflow Status */ | |
| 1055 | −#define TOVF 0x0020 /*TX Overflow Status */ | |
| 1056 | −#define TXHRE 0x0040 /*TX Hold Register Empty */ | |
| 1057 | − | |
| 1058 | −/*SPORTx_MCMC1 Masks */ | |
| 1059 | −#define SP_WSIZE 0x0000F000 /*Multichannel Window Size Field */ | |
| 1060 | −#define SP_WOFF 0x000003FF /*Multichannel Window Offset Field */ | |
| 1061 | − | |
| 1062 | −/*SPORTx_MCMC2 Masks */ | |
| 1063 | −#define MCCRM 0x00000003 /*Multichannel Clock Recovery Mode */ | |
| 1064 | −#define MCDTXPE 0x00000004 /*Multichannel DMA Transmit Packing */ | |
| 1065 | −#define MCDRXPE 0x00000008 /*Multichannel DMA Receive Packing */ | |
| 1066 | −#define MCMEN 0x00000010 /*Multichannel Frame Mode Enable */ | |
| 1067 | −#define FSDR 0x00000080 /*Multichannel Frame Sync to Data Relationship */ | |
| 1068 | −#define MFD 0x0000F000 /*Multichannel Frame Delay */ | |
| 1069 | − | |
| 1070 | 1010 | /* ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** */ |
| 1071 | 1011 | |
| 1072 | 1012 | /* PPI_CONTROL Masks */ |
| @@ -18,7 +18,8 @@ · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | static __inline__ int atomic_add_return(int i, atomic_t *v) |
| 20 | 20 | { |
| 21 | − int ret,flags; | |
| 21 | + unsigned long flags; | |
| 22 | + int ret; | |
| 22 | 23 | local_irq_save(flags); |
| 23 | 24 | ret = v->counter += i; |
| 24 | 25 | local_irq_restore(flags); |
| @@ -30,7 +31,8 @@ static __inline__ int atomic_add_return(int i, atomic_t *v) · 5 unmodified lines | ||
| 30 | 31 | |
| 31 | 32 | static __inline__ int atomic_sub_return(int i, atomic_t *v) |
| 32 | 33 | { |
| 33 | − int ret,flags; | |
| 34 | + unsigned long flags; | |
| 35 | + int ret; | |
| 34 | 36 | local_irq_save(flags); |
| 35 | 37 | ret = v->counter -= i; |
| 36 | 38 | local_irq_restore(flags); |
| @@ -42,7 +44,8 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v) · 5 unmodified lines | ||
| 42 | 44 | |
| 43 | 45 | static __inline__ int atomic_inc_return(atomic_t *v) |
| 44 | 46 | { |
| 45 | − int ret,flags; | |
| 47 | + unsigned long flags; | |
| 48 | + int ret; | |
| 46 | 49 | local_irq_save(flags); |
| 47 | 50 | v->counter++; |
| 48 | 51 | ret = v->counter; |
| @@ -64,7 +67,8 @@ static __inline__ int atomic_inc_return(atomic_t *v) · 15 unmodified lines | ||
| 64 | 67 | |
| 65 | 68 | static __inline__ int atomic_dec_return(atomic_t *v) |
| 66 | 69 | { |
| 67 | − int ret,flags; | |
| 70 | + unsigned long flags; | |
| 71 | + int ret; | |
| 68 | 72 | local_irq_save(flags); |
| 69 | 73 | --v->counter; |
| 70 | 74 | ret = v->counter; |
| @@ -76,7 +80,8 @@ static __inline__ int atomic_dec_return(atomic_t *v) · 5 unmodified lines | ||
| 76 | 80 | |
| 77 | 81 | static __inline__ int atomic_dec_and_test(atomic_t *v) |
| 78 | 82 | { |
| 79 | − int ret,flags; | |
| 83 | + unsigned long flags; | |
| 84 | + int ret; | |
| 80 | 85 | local_irq_save(flags); |
| 81 | 86 | --v->counter; |
| 82 | 87 | ret = v->counter; |
| @@ -3,6 +3,8 @@ · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | #include <linux/linkage.h> |
| 5 | 5 | |
| 6 | +struct pt_regs; | |
| 7 | + | |
| 6 | 8 | /* |
| 7 | 9 | * switch_to(n) should switch tasks to task ptr, first checking that |
| 8 | 10 | * ptr isn't the current task, in which case it does nothing. This |
| @@ -155,6 +157,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz · 146 unmodified lines | ||
| 155 | 157 | |
| 156 | 158 | #define arch_align_stack(x) (x) |
| 157 | 159 | |
| 158 | −void die(char *str, struct pt_regs *fp, unsigned long err); | |
| 160 | +extern void die(const char *str, struct pt_regs *fp, unsigned long err); | |
| 159 | 161 | |
| 160 | 162 | #endif /* _H8300_SYSTEM_H */ |
| @@ -56,8 +56,8 @@ int kernel_execve(const char *filename, · 55 unmodified lines | ||
| 56 | 56 | const char *const envp[]) |
| 57 | 57 | { |
| 58 | 58 | register long res __asm__("er0"); |
| 59 | − register char *const *_c __asm__("er3") = envp; | |
| 60 | − register char *const *_b __asm__("er2") = argv; | |
| 59 | + register const char *const *_c __asm__("er3") = envp; | |
| 60 | + register const char *const *_b __asm__("er2") = argv; | |
| 61 | 61 | register const char * _a __asm__("er1") = filename; |
| 62 | 62 | __asm__ __volatile__ ("mov.l %1,er0\n\t" |
| 63 | 63 | "trapa #0\n\t" |
| @@ -96,7 +96,7 @@ static void dump(struct pt_regs *fp) · 95 unmodified lines | ||
| 96 | 96 | printk("\n\n"); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | −void die(char *str, struct pt_regs *fp, unsigned long err) | |
| 99 | +void die(const char *str, struct pt_regs *fp, unsigned long err) | |
| 100 | 100 | { |
| 101 | 101 | static int diecount; |
| 102 | 102 | |
| @@ -149,7 +149,7 @@ static void receive_chars(struct tty_struct *tty) · 148 unmodified lines | ||
| 149 | 149 | ch = ia64_ssc(0, 0, 0, 0, |
| 150 | 150 | SSC_GETCHAR); |
| 151 | 151 | while (!ch); |
| 152 | − handle_sysrq(ch, NULL); | |
| 152 | + handle_sysrq(ch); | |
| 153 | 153 | } |
| 154 | 154 | #endif |
| 155 | 155 | seen_esc = 0; |
| @@ -424,14 +424,26 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set · 423 unmodified lines | ||
| 424 | 424 | andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP |
| 425 | 425 | |
| 426 | 426 | #ifdef CONFIG_SMP |
| 427 | − mov r17=1 | |
| 428 | − ;; | |
| 429 | − cmpxchg4.acq r18=[r31],r17,ar.ccv // try to acquire the lock | |
| 427 | + // __ticket_spin_trylock(r31) | |
| 428 | + ld4 r17=[r31] | |
| 430 | 429 | mov r8=EINVAL // default to EINVAL |
| 431 | 430 | ;; |
| 431 | + extr r9=r17,17,15 | |
| 432 | + ;; | |
| 433 | + xor r18=r17,r9 | |
| 434 | + adds r19=1,r17 | |
| 435 | + ;; | |
| 436 | + extr.u r18=r18,0,15 | |
| 437 | + ;; | |
| 438 | + cmp.eq p0,p7=0,r18 | |
| 439 | +(p7) br.cond.spnt.many .lock_contention | |
| 440 | + mov.m ar.ccv=r17 | |
| 441 | + ;; | |
| 442 | + cmpxchg4.acq r9=[r31],r19,ar.ccv | |
| 443 | + ;; | |
| 444 | + cmp4.eq p0,p7=r9,r17 | |
| 445 | +(p7) br.cond.spnt.many .lock_contention | |
| 432 | 446 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock |
| 433 | − cmp4.ne p6,p0=r18,r0 | |
| 434 | −(p6) br.cond.spnt.many .lock_contention | |
| 435 | 447 | ;; |
| 436 | 448 | #else |
| 437 | 449 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock |
| @@ -490,7 +502,17 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set · 52 unmodified lines | ||
| 490 | 502 | (p6) br.cond.spnt.few 1b // yes -> retry |
| 491 | 503 | |
| 492 | 504 | #ifdef CONFIG_SMP |
| 493 | − st4.rel [r31]=r0 // release the lock | |
| 505 | + // __ticket_spin_unlock(r31) | |
| 506 | + adds r31=2,r31 | |
| 507 | + ;; | |
| 508 | + ld2.bias r2=[r31] | |
| 509 | + mov r3=65534 | |
| 510 | + ;; | |
| 511 | + adds r2=2,r2 | |
| 512 | + ;; | |
| 513 | + and r3=r3,r2 | |
| 514 | + ;; | |
| 515 | + st2.rel [r31]=r3 | |
| 494 | 516 | #endif |
| 495 | 517 | SSM_PSR_I(p0, p9, r31) |
| 496 | 518 | ;; |
| @@ -512,7 +534,17 @@ EX(.fail_efault, (p15) st8 [r34]=r3) · 15 unmodified lines | ||
| 512 | 534 | |
| 513 | 535 | .sig_pending: |
| 514 | 536 | #ifdef CONFIG_SMP |
| 515 | − st4.rel [r31]=r0 // release the lock | |
| 537 | + // __ticket_spin_unlock(r31) | |
| 538 | + adds r31=2,r31 | |
| 539 | + ;; | |
| 540 | + ld2.bias r2=[r31] | |
| 541 | + mov r3=65534 | |
| 542 | + ;; | |
| 543 | + adds r2=2,r2 | |
| 544 | + ;; | |
| 545 | + and r3=r3,r2 | |
| 546 | + ;; | |
| 547 | + st2.rel [r31]=r3 | |
| 516 | 548 | #endif |
| 517 | 549 | SSM_PSR_I(p0, p9, r17) |
| 518 | 550 | ;; |
| @@ -340,10 +340,13 @@ · 339 unmodified lines | ||
| 340 | 340 | #define __NR_set_thread_area 334 |
| 341 | 341 | #define __NR_atomic_cmpxchg_32 335 |
| 342 | 342 | #define __NR_atomic_barrier 336 |
| 343 | +#define __NR_fanotify_init 337 | |
| 344 | +#define __NR_fanotify_mark 338 | |
| 345 | +#define __NR_prlimit64 339 | |
| 343 | 346 | |
| 344 | 347 | #ifdef __KERNEL__ |
| 345 | 348 | |
| 346 | −#define NR_syscalls 337 | |
| 349 | +#define NR_syscalls 340 | |
| 347 | 350 | |
| 348 | 351 | #define __ARCH_WANT_IPC_PARSE_VERSION |
| 349 | 352 | #define __ARCH_WANT_OLD_READDIR |
| @@ -765,4 +765,7 @@ sys_call_table: · 764 unmodified lines | ||
| 765 | 765 | .long sys_set_thread_area |
| 766 | 766 | .long sys_atomic_cmpxchg_32 /* 335 */ |
| 767 | 767 | .long sys_atomic_barrier |
| 768 | + .long sys_fanotify_init | |
| 769 | + .long sys_fanotify_mark | |
| 770 | + .long sys_prlimit64 | |
| 768 | 771 | |
| @@ -355,6 +355,9 @@ ENTRY(sys_call_table) · 354 unmodified lines | ||
| 355 | 355 | .long sys_set_thread_area |
| 356 | 356 | .long sys_atomic_cmpxchg_32 /* 335 */ |
| 357 | 357 | .long sys_atomic_barrier |
| 358 | + .long sys_fanotify_init | |
| 359 | + .long sys_fanotify_mark | |
| 360 | + .long sys_prlimit64 | |
| 358 | 361 | |
| 359 | 362 | .rept NR_syscalls-(.-sys_call_table)/4 |
| 360 | 363 | .long sys_ni_syscall |
| @@ -150,6 +150,8 @@ SECTIONS { · 149 unmodified lines | ||
| 150 | 150 | _sdata = . ; |
| 151 | 151 | DATA_DATA |
| 152 | 152 | CACHELINE_ALIGNED_DATA(32) |
| 153 | + PAGE_ALIGNED_DATA(PAGE_SIZE) | |
| 154 | + *(.data..shared_aligned) | |
| 153 | 155 | INIT_TASK_DATA(THREAD_SIZE) |
| 154 | 156 | _edata = . ; |
| 155 | 157 | } > DATA |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #ifndef __ARCH_POWERPC_ASM_FSLDMA_H__ |
| 12 | 12 | #define __ARCH_POWERPC_ASM_FSLDMA_H__ |
| 13 | 13 | |
| 14 | +#include <linux/slab.h> | |
| 14 | 15 | #include <linux/dmaengine.h> |
| 15 | 16 | |
| 16 | 17 | /* |
| @@ -575,13 +575,19 @@ __secondary_start: · 574 unmodified lines | ||
| 575 | 575 | /* Initialize the kernel stack. Just a repeat for iSeries. */ |
| 576 | 576 | LOAD_REG_ADDR(r3, current_set) |
| 577 | 577 | sldi r28,r24,3 /* get current_set[cpu#] */ |
| 578 | − ldx r1,r3,r28 | |
| 579 | − addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD | |
| 580 | − std r1,PACAKSAVE(r13) | |
| 578 | + ldx r14,r3,r28 | |
| 579 | + addi r14,r14,THREAD_SIZE-STACK_FRAME_OVERHEAD | |
| 580 | + std r14,PACAKSAVE(r13) | |
| 581 | 581 | |
| 582 | 582 | /* Do early setup for that CPU (stab, slb, hash table pointer) */ |
| 583 | 583 | bl .early_setup_secondary |
| 584 | 584 | |
| 585 | + /* | |
| 586 | + * setup the new stack pointer, but *don't* use this until | |
| 587 | + * translation is on. | |
| 588 | + */ | |
| 589 | + mr r1, r14 | |
| 590 | + | |
| 585 | 591 | /* Clear backchain so we get nice backtraces */ |
| 586 | 592 | li r7,0 |
| 587 | 593 | mtlr r7 |
| @@ -810,6 +810,9 @@ relocate_new_kernel: · 809 unmodified lines | ||
| 810 | 810 | isync |
| 811 | 811 | sync |
| 812 | 812 | |
| 813 | + mfspr r3, SPRN_PIR /* current core we are running on */ | |
| 814 | + mr r4, r5 /* load physical address of chunk called */ | |
| 815 | + | |
| 813 | 816 | /* jump to the entry point, usually the setup routine */ |
| 814 | 817 | mtlr r5 |
| 815 | 818 | blrl |
| @@ -577,20 +577,11 @@ void timer_interrupt(struct pt_regs * regs) · 576 unmodified lines | ||
| 577 | 577 | * some CPUs will continuue to take decrementer exceptions */ |
| 578 | 578 | set_dec(DECREMENTER_MAX); |
| 579 | 579 | |
| 580 | −#ifdef CONFIG_PPC32 | |
| 580 | +#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC) | |
| 581 | 581 | if (atomic_read(&ppc_n_lost_interrupts) != 0) |
| 582 | 582 | do_IRQ(regs); |
| 583 | 583 | #endif |
| 584 | 584 | |
| 585 | − now = get_tb_or_rtc(); | |
| 586 | − if (now < decrementer->next_tb) { | |
| 587 | − /* not time for this event yet */ | |
| 588 | − now = decrementer->next_tb - now; | |
| 589 | − if (now <= DECREMENTER_MAX) | |
| 590 | − set_dec((int)now); | |
| 591 | − trace_timer_interrupt_exit(regs); | |
| 592 | − return; | |
| 593 | − } | |
| 594 | 585 | old_regs = set_irq_regs(regs); |
| 595 | 586 | irq_enter(); |
| 596 | 587 | |
| @@ -606,8 +597,16 @@ void timer_interrupt(struct pt_regs * regs) · 9 unmodified lines | ||
| 606 | 597 | get_lppaca()->int_dword.fields.decr_int = 0; |
| 607 | 598 | #endif |
| 608 | 599 | |
| 609 | − if (evt->event_handler) | |
| 610 | − evt->event_handler(evt); | |
| 600 | + now = get_tb_or_rtc(); | |
| 601 | + if (now >= decrementer->next_tb) { | |
| 602 | + decrementer->next_tb = ~(u64)0; | |
| 603 | + if (evt->event_handler) | |
| 604 | + evt->event_handler(evt); | |
| 605 | + } else { | |
| 606 | + now = decrementer->next_tb - now; | |
| 607 | + if (now <= DECREMENTER_MAX) | |
| 608 | + set_dec((int)now); | |
| 609 | + } | |
| 611 | 610 | |
| 612 | 611 | #ifdef CONFIG_PPC_ISERIES |
| 613 | 612 | if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending()) |
| @@ -48,8 +48,10 @@ static int mpc837xmds_usb_cfg(void) · 47 unmodified lines | ||
| 48 | 48 | return -1; |
| 49 | 49 | |
| 50 | 50 | np = of_find_node_by_name(NULL, "usb"); |
| 51 | − if (!np) | |
| 52 | − return -ENODEV; | |
| 51 | + if (!np) { | |
| 52 | + ret = -ENODEV; | |
| 53 | + goto out; | |
| 54 | + } | |
| 53 | 55 | phy_type = of_get_property(np, "phy_type", NULL); |
| 54 | 56 | if (phy_type && !strcmp(phy_type, "ulpi")) { |
| 55 | 57 | clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN); |
| @@ -65,8 +67,9 @@ static int mpc837xmds_usb_cfg(void) · 9 unmodified lines | ||
| 65 | 67 | } |
| 66 | 68 | |
| 67 | 69 | of_node_put(np); |
| 70 | +out: | |
| 68 | 71 | iounmap(bcsr_regs); |
| 69 | − return 0; | |
| 72 | + return ret; | |
| 70 | 73 | } |
| 71 | 74 | |
| 72 | 75 | /* ************************************************************************ |
| @@ -357,6 +357,7 @@ static void __init mpc85xx_mds_setup_arch(void) · 356 unmodified lines | ||
| 357 | 357 | { |
| 358 | 358 | #ifdef CONFIG_PCI |
| 359 | 359 | struct pci_controller *hose; |
| 360 | + struct device_node *np; | |
| 360 | 361 | #endif |
| 361 | 362 | dma_addr_t max = 0xffffffff; |
| 362 | 363 | |
| @@ -19,7 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #include <linux/pci.h> |
| 21 | 21 | #include <linux/of_platform.h> |
| 22 | −#include <linux/lmb.h> | |
| 22 | +#include <linux/memblock.h> | |
| 23 | 23 | |
| 24 | 24 | #include <asm/mpic.h> |
| 25 | 25 | #include <asm/swiotlb.h> |
| @@ -97,7 +97,7 @@ static void __init p1022_ds_setup_arch(void) · 71 unmodified lines | ||
| 97 | 97 | #endif |
| 98 | 98 | |
| 99 | 99 | #ifdef CONFIG_SWIOTLB |
| 100 | − if (lmb_end_of_DRAM() > max) { | |
| 100 | + if (memblock_end_of_DRAM() > max) { | |
| 101 | 101 | ppc_swiotlb_enable = 1; |
| 102 | 102 | set_pci_dma_ops(&swiotlb_dma_ops); |
| 103 | 103 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; |
| @@ -129,20 +129,35 @@ struct device_node *dlpar_configure_connector(u32 drc_index) · 128 unmodified lines | ||
| 129 | 129 | struct property *property; |
| 130 | 130 | struct property *last_property = NULL; |
| 131 | 131 | struct cc_workarea *ccwa; |
| 132 | + char *data_buf; | |
| 132 | 133 | int cc_token; |
| 133 | − int rc; | |
| 134 | + int rc = -1; | |
| 134 | 135 | |
| 135 | 136 | cc_token = rtas_token("ibm,configure-connector"); |
| 136 | 137 | if (cc_token == RTAS_UNKNOWN_SERVICE) |
| 137 | 138 | return NULL; |
| 138 | 139 | |
| 139 | − spin_lock(&rtas_data_buf_lock); | |
| 140 | − ccwa = (struct cc_workarea *)&rtas_data_buf[0]; | |
| 140 | + data_buf = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); | |
| 141 | + if (!data_buf) | |
| 142 | + return NULL; | |
| 143 | + | |
| 144 | + ccwa = (struct cc_workarea *)&data_buf[0]; | |
| 141 | 145 | ccwa->drc_index = drc_index; |
| 142 | 146 | ccwa->zero = 0; |
| 143 | 147 | |
| 144 | − rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL); | |
| 145 | − while (rc) { | |
| 148 | + do { | |
| 149 | + /* Since we release the rtas_data_buf lock between configure | |
| 150 | + * connector calls we want to re-populate the rtas_data_buffer | |
| 151 | + * with the contents of the previous call. | |
| 152 | + */ | |
| 153 | + spin_lock(&rtas_data_buf_lock); | |
| 154 | + | |
| 155 | + memcpy(rtas_data_buf, data_buf, RTAS_DATA_BUF_SIZE); | |
| 156 | + rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL); | |
| 157 | + memcpy(data_buf, rtas_data_buf, RTAS_DATA_BUF_SIZE); | |
| 158 | + | |
| 159 | + spin_unlock(&rtas_data_buf_lock); | |
| 160 | + | |
| 146 | 161 | switch (rc) { |
| 147 | 162 | case NEXT_SIBLING: |
| 148 | 163 | dn = dlpar_parse_cc_node(ccwa); |
| @@ -197,18 +212,19 @@ struct device_node *dlpar_configure_connector(u32 drc_index) · 48 unmodified lines | ||
| 197 | 212 | "returned from configure-connector\n", rc); |
| 198 | 213 | goto cc_error; |
| 199 | 214 | } |
| 215 | + } while (rc); | |
| 200 | 216 | |
| 201 | − rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL); | |
| 217 | +cc_error: | |
| 218 | + kfree(data_buf); | |
| 219 | + | |
| 220 | + if (rc) { | |
| 221 | + if (first_dn) | |
| 222 | + dlpar_free_cc_nodes(first_dn); | |
| 223 | + | |
| 224 | + return NULL; | |
| 202 | 225 | } |
| 203 | 226 | |
| 204 | − spin_unlock(&rtas_data_buf_lock); | |
| 205 | 227 | return first_dn; |
| 206 | − | |
| 207 | −cc_error: | |
| 208 | − if (first_dn) | |
| 209 | − dlpar_free_cc_nodes(first_dn); | |
| 210 | − spin_unlock(&rtas_data_buf_lock); | |
| 211 | − return NULL; | |
| 212 | 228 | } |
| 213 | 229 | |
| 214 | 230 | static struct device_node *derive_parent(const char *path) |
| @@ -399,6 +399,8 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013E, quirk_fsl_pcie_header); · 398 unmodified lines | ||
| 399 | 399 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013, quirk_fsl_pcie_header); |
| 400 | 400 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020E, quirk_fsl_pcie_header); |
| 401 | 401 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020, quirk_fsl_pcie_header); |
| 402 | +DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1021E, quirk_fsl_pcie_header); | |
| 403 | +DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1021, quirk_fsl_pcie_header); | |
| 402 | 404 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022E, quirk_fsl_pcie_header); |
| 403 | 405 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022, quirk_fsl_pcie_header); |
| 404 | 406 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010E, quirk_fsl_pcie_header); |
| @@ -240,12 +240,13 @@ struct rio_priv { · 239 unmodified lines | ||
| 240 | 240 | |
| 241 | 241 | static void __iomem *rio_regs_win; |
| 242 | 242 | |
| 243 | +#ifdef CONFIG_E500 | |
| 243 | 244 | static int (*saved_mcheck_exception)(struct pt_regs *regs); |
| 244 | 245 | |
| 245 | 246 | static int fsl_rio_mcheck_exception(struct pt_regs *regs) |
| 246 | 247 | { |
| 247 | 248 | const struct exception_table_entry *entry = NULL; |
| 248 | − unsigned long reason = (mfspr(SPRN_MCSR) & MCSR_MASK); | |
| 249 | + unsigned long reason = mfspr(SPRN_MCSR); | |
| 249 | 250 | |
| 250 | 251 | if (reason & MCSR_BUS_RBERR) { |
| 251 | 252 | reason = in_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR)); |
| @@ -269,6 +270,7 @@ static int fsl_rio_mcheck_exception(struct pt_regs *regs) · 17 unmodified lines | ||
| 269 | 270 | else |
| 270 | 271 | return cur_cpu_spec->machine_check(regs); |
| 271 | 272 | } |
| 273 | +#endif | |
| 272 | 274 | |
| 273 | 275 | /** |
| 274 | 276 | * fsl_rio_doorbell_send - Send a MPC85xx doorbell message |
| @@ -1517,8 +1519,10 @@ int fsl_rio_setup(struct platform_device *dev) · 1242 unmodified lines | ||
| 1517 | 1519 | fsl_rio_doorbell_init(port); |
| 1518 | 1520 | fsl_rio_port_write_init(port); |
| 1519 | 1521 | |
| 1522 | +#ifdef CONFIG_E500 | |
| 1520 | 1523 | saved_mcheck_exception = ppc_md.machine_check_exception; |
| 1521 | 1524 | ppc_md.machine_check_exception = fsl_rio_mcheck_exception; |
| 1525 | +#endif | |
| 1522 | 1526 | /* Ensure that RFXE is set */ |
| 1523 | 1527 | mtspr(SPRN_HID1, (mfspr(SPRN_HID1) | 0x20000)); |
| 1524 | 1528 | |
| @@ -640,6 +640,7 @@ unsigned int qe_get_num_of_snums(void) · 639 unmodified lines | ||
| 640 | 640 | if ((num_of_snums < 28) || (num_of_snums > QE_NUM_OF_SNUM)) { |
| 641 | 641 | /* No QE ever has fewer than 28 SNUMs */ |
| 642 | 642 | pr_err("QE: number of snum is invalid\n"); |
| 643 | + of_node_put(qe); | |
| 643 | 644 | return -EINVAL; |
| 644 | 645 | } |
| 645 | 646 | } |
| @@ -2880,15 +2880,14 @@ static void xmon_init(int enable) · 2879 unmodified lines | ||
| 2880 | 2880 | } |
| 2881 | 2881 | |
| 2882 | 2882 | #ifdef CONFIG_MAGIC_SYSRQ |
| 2883 | −static void sysrq_handle_xmon(int key, struct tty_struct *tty) | |
| 2883 | +static void sysrq_handle_xmon(int key) | |
| 2884 | 2884 | { |
| 2885 | 2885 | /* ensure xmon is enabled */ |
| 2886 | 2886 | xmon_init(1); |
| 2887 | 2887 | debugger(get_irq_regs()); |
| 2888 | 2888 | } |
| 2889 | 2889 | |
| 2890 | −static struct sysrq_key_op sysrq_xmon_op = | |
| 2891 | −{ | |
| 2890 | +static struct sysrq_key_op sysrq_xmon_op = { | |
| 2892 | 2891 | .handler = sysrq_handle_xmon, |
| 2893 | 2892 | .help_msg = "Xmon", |
| 2894 | 2893 | .action_msg = "Entering xmon", |
| @@ -303,7 +303,7 @@ void arch_trigger_all_cpu_backtrace(void) · 302 unmodified lines | ||
| 303 | 303 | |
| 304 | 304 | #ifdef CONFIG_MAGIC_SYSRQ |
| 305 | 305 | |
| 306 | −static void sysrq_handle_globreg(int key, struct tty_struct *tty) | |
| 306 | +static void sysrq_handle_globreg(int key) | |
| 307 | 307 | { |
| 308 | 308 | arch_trigger_all_cpu_backtrace(); |
| 309 | 309 | } |
| @@ -166,7 +166,6 @@ sparc_breakpoint (struct pt_regs *regs) · 165 unmodified lines | ||
| 166 | 166 | { |
| 167 | 167 | siginfo_t info; |
| 168 | 168 | |
| 169 | − lock_kernel(); | |
| 170 | 169 | #ifdef DEBUG_SPARC_BREAKPOINT |
| 171 | 170 | printk ("TRAP: Entering kernel PC=%x, nPC=%x\n", regs->pc, regs->npc); |
| 172 | 171 | #endif |
| @@ -180,7 +179,6 @@ sparc_breakpoint (struct pt_regs *regs) · 7 unmodified lines | ||
| 180 | 179 | #ifdef DEBUG_SPARC_BREAKPOINT |
| 181 | 180 | printk ("TRAP: Returning to space: PC=%x nPC=%x\n", regs->pc, regs->npc); |
| 182 | 181 | #endif |
| 183 | − unlock_kernel(); | |
| 184 | 182 | } |
| 185 | 183 | |
| 186 | 184 | asmlinkage int |
| @@ -323,7 +323,6 @@ asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn) · 322 unmodified lines | ||
| 323 | 323 | { |
| 324 | 324 | enum direction dir; |
| 325 | 325 | |
| 326 | − lock_kernel(); | |
| 327 | 326 | if(!(current->thread.flags & SPARC_FLAG_UNALIGNED) || |
| 328 | 327 | (((insn >> 30) & 3) != 3)) |
| 329 | 328 | goto kill_user; |
| @@ -377,5 +376,5 @@ asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn) · 47 unmodified lines | ||
| 377 | 376 | kill_user: |
| 378 | 377 | user_mna_trap_fault(regs, insn); |
| 379 | 378 | out: |
| 380 | − unlock_kernel(); | |
| 379 | + ; | |
| 381 | 380 | } |
| @@ -112,7 +112,6 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who) · 111 unmodified lines | ||
| 112 | 112 | struct thread_info *tp = current_thread_info(); |
| 113 | 113 | int window; |
| 114 | 114 | |
| 115 | − lock_kernel(); | |
| 116 | 115 | flush_user_windows(); |
| 117 | 116 | for(window = 0; window < tp->w_saved; window++) { |
| 118 | 117 | unsigned long sp = tp->rwbuf_stkptrs[window]; |
| @@ -123,5 +122,4 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who) · 4 unmodified lines | ||
| 123 | 122 | do_exit(SIGILL); |
| 124 | 123 | } |
| 125 | 124 | tp->w_saved = 0; |
| 126 | − unlock_kernel(); | |
| 127 | 125 | } |
| @@ -690,7 +690,7 @@ static void with_console(struct mc_request *req, void (*proc)(void *), · 689 unmodified lines | ||
| 690 | 690 | static void sysrq_proc(void *arg) |
| 691 | 691 | { |
| 692 | 692 | char *op = arg; |
| 693 | − handle_sysrq(*op, NULL); | |
| 693 | + handle_sysrq(*op); | |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | void mconsole_sysrq(struct mc_request *req) |
| @@ -26,11 +26,11 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <asm/pgtable.h> |
| 27 | 27 | #include <asm/tlbflush.h> |
| 28 | 28 | |
| 29 | −void * | |
| 29 | +void __iomem * | |
| 30 | 30 | iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot); |
| 31 | 31 | |
| 32 | 32 | void |
| 33 | −iounmap_atomic(void *kvaddr, enum km_type type); | |
| 33 | +iounmap_atomic(void __iomem *kvaddr, enum km_type type); | |
| 34 | 34 | |
| 35 | 35 | int |
| 36 | 36 | iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot); |
| @@ -152,9 +152,14 @@ struct x86_emulate_ops { · 151 unmodified lines | ||
| 152 | 152 | struct operand { |
| 153 | 153 | enum { OP_REG, OP_MEM, OP_IMM, OP_NONE } type; |
| 154 | 154 | unsigned int bytes; |
| 155 | − unsigned long orig_val, *ptr; | |
| 155 | + union { | |
| 156 | + unsigned long orig_val; | |
| 157 | + u64 orig_val64; | |
| 158 | + }; | |
| 159 | + unsigned long *ptr; | |
| 156 | 160 | union { |
| 157 | 161 | unsigned long val; |
| 162 | + u64 val64; | |
| 158 | 163 | char valptr[sizeof(unsigned long) + 2]; |
| 159 | 164 | }; |
| 160 | 165 | }; |
| @@ -27,6 +27,9 @@ extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, · 26 unmodified lines | ||
| 27 | 27 | int node); |
| 28 | 28 | extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); |
| 29 | 29 | |
| 30 | +#ifdef CONFIG_PCI | |
| 31 | + | |
| 32 | +#ifdef CONFIG_PCI_DOMAINS | |
| 30 | 33 | static inline int pci_domain_nr(struct pci_bus *bus) |
| 31 | 34 | { |
| 32 | 35 | struct pci_sysdata *sd = bus->sysdata; |
| @@ -37,13 +40,12 @@ static inline int pci_proc_domain(struct pci_bus *bus) · 4 unmodified lines | ||
| 37 | 40 | { |
| 38 | 41 | return pci_domain_nr(bus); |
| 39 | 42 | } |
| 40 | − | |
| 43 | +#endif | |
| 41 | 44 | |
| 42 | 45 | /* Can be used to override the logic in pci_scan_bus for skipping |
| 43 | 46 | already-configured bus numbers - to be used for buggy BIOSes |
| 44 | 47 | or architectures with incomplete PCI setup by the loader */ |
| 45 | 48 | |
| 46 | −#ifdef CONFIG_PCI | |
| 47 | 49 | extern unsigned int pcibios_assign_all_busses(void); |
| 48 | 50 | extern int pci_legacy_init(void); |
| 49 | 51 | # ifdef CONFIG_ACPI |
| @@ -59,5 +59,7 @@ extern void check_tsc_sync_source(int cpu); · 58 unmodified lines | ||
| 59 | 59 | extern void check_tsc_sync_target(void); |
| 60 | 60 | |
| 61 | 61 | extern int notsc_setup(char *); |
| 62 | +extern void save_sched_clock_state(void); | |
| 63 | +extern void restore_sched_clock_state(void); | |
| 62 | 64 | |
| 63 | 65 | #endif /* _ASM_X86_TSC_H */ |
| @@ -530,7 +530,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) · 529 unmodified lines | ||
| 530 | 530 | err = -ENOMEM; |
| 531 | 531 | goto out; |
| 532 | 532 | } |
| 533 | − if (!alloc_cpumask_var(&b->cpus, GFP_KERNEL)) { | |
| 533 | + if (!zalloc_cpumask_var(&b->cpus, GFP_KERNEL)) { | |
| 534 | 534 | kfree(b); |
| 535 | 535 | err = -ENOMEM; |
| 536 | 536 | goto out; |
| @@ -543,7 +543,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) · 6 unmodified lines | ||
| 543 | 543 | #ifndef CONFIG_SMP |
| 544 | 544 | cpumask_setall(b->cpus); |
| 545 | 545 | #else |
| 546 | − cpumask_copy(b->cpus, c->llc_shared_map); | |
| 546 | + cpumask_set_cpu(cpu, b->cpus); | |
| 547 | 547 | #endif |
| 548 | 548 | |
| 549 | 549 | per_cpu(threshold_banks, cpu)[bank] = b; |
| @@ -202,10 +202,11 @@ static int therm_throt_process(bool new_event, int event, int level) · 201 unmodified lines | ||
| 202 | 202 | |
| 203 | 203 | #ifdef CONFIG_SYSFS |
| 204 | 204 | /* Add/Remove thermal_throttle interface for CPU device: */ |
| 205 | −static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev) | |
| 205 | +static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, | |
| 206 | + unsigned int cpu) | |
| 206 | 207 | { |
| 207 | 208 | int err; |
| 208 | − struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); | |
| 209 | + struct cpuinfo_x86 *c = &cpu_data(cpu); | |
| 209 | 210 | |
| 210 | 211 | err = sysfs_create_group(&sys_dev->kobj, &thermal_attr_group); |
| 211 | 212 | if (err) |
| @@ -251,7 +252,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb, · 39 unmodified lines | ||
| 251 | 252 | case CPU_UP_PREPARE: |
| 252 | 253 | case CPU_UP_PREPARE_FROZEN: |
| 253 | 254 | mutex_lock(&therm_cpu_lock); |
| 254 | − err = thermal_throttle_add_dev(sys_dev); | |
| 255 | + err = thermal_throttle_add_dev(sys_dev, cpu); | |
| 255 | 256 | mutex_unlock(&therm_cpu_lock); |
| 256 | 257 | WARN_ON(err); |
| 257 | 258 | break; |
| @@ -287,7 +288,7 @@ static __init int thermal_throttle_init_device(void) · 29 unmodified lines | ||
| 287 | 288 | #endif |
| 288 | 289 | /* connect live CPUs to sysfs */ |
| 289 | 290 | for_each_online_cpu(cpu) { |
| 290 | − err = thermal_throttle_add_dev(get_cpu_sysdev(cpu)); | |
| 291 | + err = thermal_throttle_add_dev(get_cpu_sysdev(cpu), cpu); | |
| 291 | 292 | WARN_ON(err); |
| 292 | 293 | } |
| 293 | 294 | #ifdef CONFIG_HOTPLUG_CPU |
| @@ -45,8 +45,7 @@ void __init setup_trampoline_page_table(void) · 44 unmodified lines | ||
| 45 | 45 | /* Copy kernel address range */ |
| 46 | 46 | clone_pgd_range(trampoline_pg_dir + KERNEL_PGD_BOUNDARY, |
| 47 | 47 | swapper_pg_dir + KERNEL_PGD_BOUNDARY, |
| 48 | − min_t(unsigned long, KERNEL_PGD_PTRS, | |
| 49 | − KERNEL_PGD_BOUNDARY)); | |
| 48 | + KERNEL_PGD_PTRS); | |
| 50 | 49 | |
| 51 | 50 | /* Initialize low mappings */ |
| 52 | 51 | clone_pgd_range(trampoline_pg_dir, |
| @@ -626,6 +626,44 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) · 625 unmodified lines | ||
| 626 | 626 | local_irq_restore(flags); |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | +static unsigned long long cyc2ns_suspend; | |
| 630 | + | |
| 631 | +void save_sched_clock_state(void) | |
| 632 | +{ | |
| 633 | + if (!sched_clock_stable) | |
| 634 | + return; | |
| 635 | + | |
| 636 | + cyc2ns_suspend = sched_clock(); | |
| 637 | +} | |
| 638 | + | |
| 639 | +/* | |
| 640 | + * Even on processors with invariant TSC, TSC gets reset in some the | |
| 641 | + * ACPI system sleep states. And in some systems BIOS seem to reinit TSC to | |
| 642 | + * arbitrary value (still sync'd across cpu's) during resume from such sleep | |
| 643 | + * states. To cope up with this, recompute the cyc2ns_offset for each cpu so | |
| 644 | + * that sched_clock() continues from the point where it was left off during | |
| 645 | + * suspend. | |
| 646 | + */ | |
| 647 | +void restore_sched_clock_state(void) | |
| 648 | +{ | |
| 649 | + unsigned long long offset; | |
| 650 | + unsigned long flags; | |
| 651 | + int cpu; | |
| 652 | + | |
| 653 | + if (!sched_clock_stable) | |
| 654 | + return; | |
| 655 | + | |
| 656 | + local_irq_save(flags); | |
| 657 | + | |
| 658 | + __get_cpu_var(cyc2ns_offset) = 0; | |
| 659 | + offset = cyc2ns_suspend - sched_clock(); | |
| 660 | + | |
| 661 | + for_each_possible_cpu(cpu) | |
| 662 | + per_cpu(cyc2ns_offset, cpu) = offset; | |
| 663 | + | |
| 664 | + local_irq_restore(flags); | |
| 665 | +} | |
| 666 | + | |
| 629 | 667 | #ifdef CONFIG_CPU_FREQ |
| 630 | 668 | |
| 631 | 669 | /* Frequency scaling support. Adjust the TSC based timer when the cpu frequency |
| @@ -1870,17 +1870,16 @@ static inline int emulate_grp9(struct x86_emulate_ctxt *ctxt, · 1869 unmodified lines | ||
| 1870 | 1870 | struct x86_emulate_ops *ops) |
| 1871 | 1871 | { |
| 1872 | 1872 | struct decode_cache *c = &ctxt->decode; |
| 1873 | − u64 old = c->dst.orig_val; | |
| 1873 | + u64 old = c->dst.orig_val64; | |
| 1874 | 1874 | |
| 1875 | 1875 | if (((u32) (old >> 0) != (u32) c->regs[VCPU_REGS_RAX]) || |
| 1876 | 1876 | ((u32) (old >> 32) != (u32) c->regs[VCPU_REGS_RDX])) { |
| 1877 | − | |
| 1878 | 1877 | c->regs[VCPU_REGS_RAX] = (u32) (old >> 0); |
| 1879 | 1878 | c->regs[VCPU_REGS_RDX] = (u32) (old >> 32); |
| 1880 | 1879 | ctxt->eflags &= ~EFLG_ZF; |
| 1881 | 1880 | } else { |
| 1882 | − c->dst.val = ((u64)c->regs[VCPU_REGS_RCX] << 32) | | |
| 1883 | − (u32) c->regs[VCPU_REGS_RBX]; | |
| 1881 | + c->dst.val64 = ((u64)c->regs[VCPU_REGS_RCX] << 32) | | |
| 1882 | + (u32) c->regs[VCPU_REGS_RBX]; | |
| 1884 | 1883 | |
| 1885 | 1884 | ctxt->eflags |= EFLG_ZF; |
| 1886 | 1885 | } |
| @@ -2616,7 +2615,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) · 729 unmodified lines | ||
| 2616 | 2615 | c->src.valptr, c->src.bytes); |
| 2617 | 2616 | if (rc != X86EMUL_CONTINUE) |
| 2618 | 2617 | goto done; |
| 2619 | − c->src.orig_val = c->src.val; | |
| 2618 | + c->src.orig_val64 = c->src.val64; | |
| 2620 | 2619 | } |
| 2621 | 2620 | |
| 2622 | 2621 | if (c->src2.type == OP_MEM) { |
| @@ -64,6 +64,9 @@ static void pic_unlock(struct kvm_pic *s) · 63 unmodified lines | ||
| 64 | 64 | if (!found) |
| 65 | 65 | found = s->kvm->bsp_vcpu; |
| 66 | 66 | |
| 67 | + if (!found) | |
| 68 | + return; | |
| 69 | + | |
| 67 | 70 | kvm_vcpu_kick(found); |
| 68 | 71 | } |
| 69 | 72 | } |
| @@ -43,7 +43,6 @@ struct kvm_kpic_state { · 42 unmodified lines | ||
| 43 | 43 | u8 irr; /* interrupt request register */ |
| 44 | 44 | u8 imr; /* interrupt mask register */ |
| 45 | 45 | u8 isr; /* interrupt service register */ |
| 46 | − u8 isr_ack; /* interrupt ack detection */ | |
| 47 | 46 | u8 priority_add; /* highest irq priority */ |
| 48 | 47 | u8 irq_base; |
| 49 | 48 | u8 read_reg_select; |
| @@ -56,6 +55,7 @@ struct kvm_kpic_state { · 6 unmodified lines | ||
| 56 | 55 | u8 init4; /* true if 4 byte init */ |
| 57 | 56 | u8 elcr; /* PIIX edge/trigger selection */ |
| 58 | 57 | u8 elcr_mask; |
| 58 | + u8 isr_ack; /* interrupt ack detection */ | |
| 59 | 59 | struct kvm_pic *pics_state; |
| 60 | 60 | }; |
| 61 | 61 | |
| @@ -74,7 +74,7 @@ void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot) · 73 unmodified lines | ||
| 74 | 74 | /* |
| 75 | 75 | * Map 'pfn' using fixed map 'type' and protections 'prot' |
| 76 | 76 | */ |
| 77 | −void * | |
| 77 | +void __iomem * | |
| 78 | 78 | iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot) |
| 79 | 79 | { |
| 80 | 80 | /* |
| @@ -86,12 +86,12 @@ iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot) · 5 unmodified lines | ||
| 86 | 86 | if (!pat_enabled && pgprot_val(prot) == pgprot_val(PAGE_KERNEL_WC)) |
| 87 | 87 | prot = PAGE_KERNEL_UC_MINUS; |
| 88 | 88 | |
| 89 | − return kmap_atomic_prot_pfn(pfn, type, prot); | |
| 89 | + return (void __force __iomem *) kmap_atomic_prot_pfn(pfn, type, prot); | |
| 90 | 90 | } |
| 91 | 91 | EXPORT_SYMBOL_GPL(iomap_atomic_prot_pfn); |
| 92 | 92 | |
| 93 | 93 | void |
| 94 | −iounmap_atomic(void *kvaddr, enum km_type type) | |
| 94 | +iounmap_atomic(void __iomem *kvaddr, enum km_type type) | |
| 95 | 95 | { |
| 96 | 96 | unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; |
| 97 | 97 | enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); |
| @@ -113,6 +113,7 @@ static void __save_processor_state(struct saved_context *ctxt) · 112 unmodified lines | ||
| 113 | 113 | void save_processor_state(void) |
| 114 | 114 | { |
| 115 | 115 | __save_processor_state(&saved_context); |
| 116 | + save_sched_clock_state(); | |
| 116 | 117 | } |
| 117 | 118 | #ifdef CONFIG_X86_32 |
| 118 | 119 | EXPORT_SYMBOL(save_processor_state); |
| @@ -229,6 +230,7 @@ static void __restore_processor_state(struct saved_context *ctxt) · 110 unmodified lines | ||
| 229 | 230 | void restore_processor_state(void) |
| 230 | 231 | { |
| 231 | 232 | __restore_processor_state(&saved_context); |
| 233 | + restore_sched_clock_state(); | |
| 232 | 234 | } |
| 233 | 235 | #ifdef CONFIG_X86_32 |
| 234 | 236 | EXPORT_SYMBOL(restore_processor_state); |
| @@ -966,7 +966,7 @@ blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) · 965 unmodified lines | ||
| 966 | 966 | |
| 967 | 967 | /* Currently we do not support hierarchy deeper than two level (0,1) */ |
| 968 | 968 | if (parent != cgroup->top_cgroup) |
| 969 | − return ERR_PTR(-EINVAL); | |
| 969 | + return ERR_PTR(-EPERM); | |
| 970 | 970 | |
| 971 | 971 | blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL); |
| 972 | 972 | if (!blkcg) |
| @@ -1198,9 +1198,9 @@ static int __make_request(struct request_queue *q, struct bio *bio) · 1197 unmodified lines | ||
| 1198 | 1198 | int el_ret; |
| 1199 | 1199 | unsigned int bytes = bio->bi_size; |
| 1200 | 1200 | const unsigned short prio = bio_prio(bio); |
| 1201 | − const bool sync = (bio->bi_rw & REQ_SYNC); | |
| 1202 | − const bool unplug = (bio->bi_rw & REQ_UNPLUG); | |
| 1203 | − const unsigned int ff = bio->bi_rw & REQ_FAILFAST_MASK; | |
| 1201 | + const bool sync = !!(bio->bi_rw & REQ_SYNC); | |
| 1202 | + const bool unplug = !!(bio->bi_rw & REQ_UNPLUG); | |
| 1203 | + const unsigned long ff = bio->bi_rw & REQ_FAILFAST_MASK; | |
| 1204 | 1204 | int rw_flags; |
| 1205 | 1205 | |
| 1206 | 1206 | if ((bio->bi_rw & REQ_HARDBARRIER) && |
| @@ -511,6 +511,7 @@ int blk_register_queue(struct gendisk *disk) · 510 unmodified lines | ||
| 511 | 511 | kobject_uevent(&q->kobj, KOBJ_REMOVE); |
| 512 | 512 | kobject_del(&q->kobj); |
| 513 | 513 | blk_trace_remove_sysfs(disk_to_dev(disk)); |
| 514 | + kobject_put(&dev->kobj); | |
| 514 | 515 | return ret; |
| 515 | 516 | } |
| 516 | 517 | |
| @@ -142,14 +142,18 @@ static inline int queue_congestion_off_threshold(struct request_queue *q) · 141 unmodified lines | ||
| 142 | 142 | |
| 143 | 143 | static inline int blk_cpu_to_group(int cpu) |
| 144 | 144 | { |
| 145 | + int group = NR_CPUS; | |
| 145 | 146 | #ifdef CONFIG_SCHED_MC |
| 146 | 147 | const struct cpumask *mask = cpu_coregroup_mask(cpu); |
| 147 | − return cpumask_first(mask); | |
| 148 | + group = cpumask_first(mask); | |
| 148 | 149 | #elif defined(CONFIG_SCHED_SMT) |
| 149 | − return cpumask_first(topology_thread_cpumask(cpu)); | |
| 150 | + group = cpumask_first(topology_thread_cpumask(cpu)); | |
| 150 | 151 | #else |
| 151 | 152 | return cpu; |
| 152 | 153 | #endif |
| 154 | + if (likely(group < NR_CPUS)) | |
| 155 | + return group; | |
| 156 | + return cpu; | |
| 153 | 157 | } |
| 154 | 158 | |
| 155 | 159 | /* |
| @@ -30,6 +30,7 @@ static const int cfq_slice_sync = HZ / 10; · 29 unmodified lines | ||
| 30 | 30 | static int cfq_slice_async = HZ / 25; |
| 31 | 31 | static const int cfq_slice_async_rq = 2; |
| 32 | 32 | static int cfq_slice_idle = HZ / 125; |
| 33 | +static int cfq_group_idle = HZ / 125; | |
| 33 | 34 | static const int cfq_target_latency = HZ * 3/10; /* 300 ms */ |
| 34 | 35 | static const int cfq_hist_divisor = 4; |
| 35 | 36 | |
| @@ -147,6 +148,8 @@ struct cfq_queue { · 111 unmodified lines | ||
| 147 | 148 | struct cfq_queue *new_cfqq; |
| 148 | 149 | struct cfq_group *cfqg; |
| 149 | 150 | struct cfq_group *orig_cfqg; |
| 151 | + /* Number of sectors dispatched from queue in single dispatch round */ | |
| 152 | + unsigned long nr_sectors; | |
| 150 | 153 | }; |
| 151 | 154 | |
| 152 | 155 | /* |
| @@ -198,6 +201,8 @@ struct cfq_group { · 45 unmodified lines | ||
| 198 | 201 | struct hlist_node cfqd_node; |
| 199 | 202 | atomic_t ref; |
| 200 | 203 | #endif |
| 204 | + /* number of requests that are on the dispatch list or inside driver */ | |
| 205 | + int dispatched; | |
| 201 | 206 | }; |
| 202 | 207 | |
| 203 | 208 | /* |
| @@ -271,6 +276,7 @@ struct cfq_data { · 67 unmodified lines | ||
| 271 | 276 | unsigned int cfq_slice[2]; |
| 272 | 277 | unsigned int cfq_slice_async_rq; |
| 273 | 278 | unsigned int cfq_slice_idle; |
| 279 | + unsigned int cfq_group_idle; | |
| 274 | 280 | unsigned int cfq_latency; |
| 275 | 281 | unsigned int cfq_group_isolation; |
| 276 | 282 | |
| @@ -378,6 +384,21 @@ CFQ_CFQQ_FNS(wait_busy); · 101 unmodified lines | ||
| 378 | 384 | &cfqg->service_trees[i][j]: NULL) \ |
| 379 | 385 | |
| 380 | 386 | |
| 387 | +static inline bool iops_mode(struct cfq_data *cfqd) | |
| 388 | +{ | |
| 389 | + /* | |
| 390 | + * If we are not idling on queues and it is a NCQ drive, parallel | |
| 391 | + * execution of requests is on and measuring time is not possible | |
| 392 | + * in most of the cases until and unless we drive shallower queue | |
| 393 | + * depths and that becomes a performance bottleneck. In such cases | |
| 394 | + * switch to start providing fairness in terms of number of IOs. | |
| 395 | + */ | |
| 396 | + if (!cfqd->cfq_slice_idle && cfqd->hw_tag) | |
| 397 | + return true; | |
| 398 | + else | |
| 399 | + return false; | |
| 400 | +} | |
| 401 | + | |
| 381 | 402 | static inline enum wl_prio_t cfqq_prio(struct cfq_queue *cfqq) |
| 382 | 403 | { |
| 383 | 404 | if (cfq_class_idle(cfqq)) |
| @@ -906,7 +927,6 @@ static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq) · 522 unmodified lines | ||
| 906 | 927 | slice_used = cfqq->allocated_slice; |
| 907 | 928 | } |
| 908 | 929 | |
| 909 | − cfq_log_cfqq(cfqq->cfqd, cfqq, "sl_used=%u", slice_used); | |
| 910 | 930 | return slice_used; |
| 911 | 931 | } |
| 912 | 932 | |
| @@ -914,19 +934,21 @@ static void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg, · 1 unmodified line | ||
| 914 | 934 | struct cfq_queue *cfqq) |
| 915 | 935 | { |
| 916 | 936 | struct cfq_rb_root *st = &cfqd->grp_service_tree; |
| 917 | − unsigned int used_sl, charge_sl; | |
| 937 | + unsigned int used_sl, charge; | |
| 918 | 938 | int nr_sync = cfqg->nr_cfqq - cfqg_busy_async_queues(cfqd, cfqg) |
| 919 | 939 | - cfqg->service_tree_idle.count; |
| 920 | 940 | |
| 921 | 941 | BUG_ON(nr_sync < 0); |
| 922 | − used_sl = charge_sl = cfq_cfqq_slice_usage(cfqq); | |
| 942 | + used_sl = charge = cfq_cfqq_slice_usage(cfqq); | |
| 923 | 943 | |
| 924 | − if (!cfq_cfqq_sync(cfqq) && !nr_sync) | |
| 925 | − charge_sl = cfqq->allocated_slice; | |
| 944 | + if (iops_mode(cfqd)) | |
| 945 | + charge = cfqq->slice_dispatch; | |
| 946 | + else if (!cfq_cfqq_sync(cfqq) && !nr_sync) | |
| 947 | + charge = cfqq->allocated_slice; | |
| 926 | 948 | |
| 927 | 949 | /* Can't update vdisktime while group is on service tree */ |
| 928 | 950 | cfq_rb_erase(&cfqg->rb_node, st); |
| 929 | − cfqg->vdisktime += cfq_scale_slice(charge_sl, cfqg); | |
| 951 | + cfqg->vdisktime += cfq_scale_slice(charge, cfqg); | |
| 930 | 952 | __cfq_group_service_tree_add(st, cfqg); |
| 931 | 953 | |
| 932 | 954 | /* This group is being expired. Save the context */ |
| @@ -940,6 +962,9 @@ static void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg, · 7 unmodified lines | ||
| 940 | 962 | |
| 941 | 963 | cfq_log_cfqg(cfqd, cfqg, "served: vt=%llu min_vt=%llu", cfqg->vdisktime, |
| 942 | 964 | st->min_vdisktime); |
| 965 | + cfq_log_cfqq(cfqq->cfqd, cfqq, "sl_used=%u disp=%u charge=%u iops=%u" | |
| 966 | + " sect=%u", used_sl, cfqq->slice_dispatch, charge, | |
| 967 | + iops_mode(cfqd), cfqq->nr_sectors); | |
| 943 | 968 | cfq_blkiocg_update_timeslice_used(&cfqg->blkg, used_sl); |
| 944 | 969 | cfq_blkiocg_set_start_empty_time(&cfqg->blkg); |
| 945 | 970 | } |
| @@ -1587,6 +1612,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd, · 641 unmodified lines | ||
| 1587 | 1612 | cfqq->allocated_slice = 0; |
| 1588 | 1613 | cfqq->slice_end = 0; |
| 1589 | 1614 | cfqq->slice_dispatch = 0; |
| 1615 | + cfqq->nr_sectors = 0; | |
| 1590 | 1616 | |
| 1591 | 1617 | cfq_clear_cfqq_wait_request(cfqq); |
| 1592 | 1618 | cfq_clear_cfqq_must_dispatch(cfqq); |
| @@ -1839,6 +1865,9 @@ static bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq) · 246 unmodified lines | ||
| 1839 | 1865 | BUG_ON(!service_tree); |
| 1840 | 1866 | BUG_ON(!service_tree->count); |
| 1841 | 1867 | |
| 1868 | + if (!cfqd->cfq_slice_idle) | |
| 1869 | + return false; | |
| 1870 | + | |
| 1842 | 1871 | /* We never do for idle class queues. */ |
| 1843 | 1872 | if (prio == IDLE_WORKLOAD) |
| 1844 | 1873 | return false; |
| @@ -1863,7 +1892,7 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd) · 18 unmodified lines | ||
| 1863 | 1892 | { |
| 1864 | 1893 | struct cfq_queue *cfqq = cfqd->active_queue; |
| 1865 | 1894 | struct cfq_io_context *cic; |
| 1866 | − unsigned long sl; | |
| 1895 | + unsigned long sl, group_idle = 0; | |
| 1867 | 1896 | |
| 1868 | 1897 | /* |
| 1869 | 1898 | * SSD device without seek penalty, disable idling. But only do so |
| @@ -1879,8 +1908,13 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd) · 9 unmodified lines | ||
| 1879 | 1908 | /* |
| 1880 | 1909 | * idle is disabled, either manually or by past process history |
| 1881 | 1910 | */ |
| 1882 | − if (!cfqd->cfq_slice_idle || !cfq_should_idle(cfqd, cfqq)) | |
| 1883 | − return; | |
| 1911 | + if (!cfq_should_idle(cfqd, cfqq)) { | |
| 1912 | + /* no queue idling. Check for group idling */ | |
| 1913 | + if (cfqd->cfq_group_idle) | |
| 1914 | + group_idle = cfqd->cfq_group_idle; | |
| 1915 | + else | |
| 1916 | + return; | |
| 1917 | + } | |
| 1884 | 1918 | |
| 1885 | 1919 | /* |
| 1886 | 1920 | * still active requests from this queue, don't idle |
| @@ -1907,13 +1941,21 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd) · 20 unmodified lines | ||
| 1907 | 1941 | return; |
| 1908 | 1942 | } |
| 1909 | 1943 | |
| 1944 | + /* There are other queues in the group, don't do group idle */ | |
| 1945 | + if (group_idle && cfqq->cfqg->nr_cfqq > 1) | |
| 1946 | + return; | |
| 1947 | + | |
| 1910 | 1948 | cfq_mark_cfqq_wait_request(cfqq); |
| 1911 | 1949 | |
| 1912 | − sl = cfqd->cfq_slice_idle; | |
| 1950 | + if (group_idle) | |
| 1951 | + sl = cfqd->cfq_group_idle; | |
| 1952 | + else | |
| 1953 | + sl = cfqd->cfq_slice_idle; | |
| 1913 | 1954 | |
| 1914 | 1955 | mod_timer(&cfqd->idle_slice_timer, jiffies + sl); |
| 1915 | 1956 | cfq_blkiocg_update_set_idle_time_stats(&cfqq->cfqg->blkg); |
| 1916 | − cfq_log_cfqq(cfqd, cfqq, "arm_idle: %lu", sl); | |
| 1957 | + cfq_log_cfqq(cfqd, cfqq, "arm_idle: %lu group_idle: %d", sl, | |
| 1958 | + group_idle ? 1 : 0); | |
| 1917 | 1959 | } |
| 1918 | 1960 | |
| 1919 | 1961 | /* |
| @@ -1929,9 +1971,11 @@ static void cfq_dispatch_insert(struct request_queue *q, struct request *rq) · 9 unmodified lines | ||
| 1929 | 1971 | cfqq->next_rq = cfq_find_next_rq(cfqd, cfqq, rq); |
| 1930 | 1972 | cfq_remove_request(rq); |
| 1931 | 1973 | cfqq->dispatched++; |
| 1974 | + (RQ_CFQG(rq))->dispatched++; | |
| 1932 | 1975 | elv_dispatch_sort(q, rq); |
| 1933 | 1976 | |
| 1934 | 1977 | cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]++; |
| 1978 | + cfqq->nr_sectors += blk_rq_sectors(rq); | |
| 1935 | 1979 | cfq_blkiocg_update_dispatch_stats(&cfqq->cfqg->blkg, blk_rq_bytes(rq), |
| 1936 | 1980 | rq_data_dir(rq), rq_is_sync(rq)); |
| 1937 | 1981 | } |
| @@ -2198,7 +2242,7 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd) · 260 unmodified lines | ||
| 2198 | 2242 | cfqq = NULL; |
| 2199 | 2243 | goto keep_queue; |
| 2200 | 2244 | } else |
| 2201 | − goto expire; | |
| 2245 | + goto check_group_idle; | |
| 2202 | 2246 | } |
| 2203 | 2247 | |
| 2204 | 2248 | /* |
| @@ -2226,8 +2270,23 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd) · 21 unmodified lines | ||
| 2226 | 2270 | * flight or is idling for a new request, allow either of these |
| 2227 | 2271 | * conditions to happen (or time out) before selecting a new queue. |
| 2228 | 2272 | */ |
| 2229 | − if (timer_pending(&cfqd->idle_slice_timer) || | |
| 2230 | − (cfqq->dispatched && cfq_should_idle(cfqd, cfqq))) { | |
| 2273 | + if (timer_pending(&cfqd->idle_slice_timer)) { | |
| 2274 | + cfqq = NULL; | |
| 2275 | + goto keep_queue; | |
| 2276 | + } | |
| 2277 | + | |
| 2278 | + if (cfqq->dispatched && cfq_should_idle(cfqd, cfqq)) { | |
| 2279 | + cfqq = NULL; | |
| 2280 | + goto keep_queue; | |
| 2281 | + } | |
| 2282 | + | |
| 2283 | + /* | |
| 2284 | + * If group idle is enabled and there are requests dispatched from | |
| 2285 | + * this group, wait for requests to complete. | |
| 2286 | + */ | |
| 2287 | +check_group_idle: | |
| 2288 | + if (cfqd->cfq_group_idle && cfqq->cfqg->nr_cfqq == 1 | |
| 2289 | + && cfqq->cfqg->dispatched) { | |
| 2231 | 2290 | cfqq = NULL; |
| 2232 | 2291 | goto keep_queue; |
| 2233 | 2292 | } |
| @@ -3375,6 +3434,7 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq) · 1141 unmodified lines | ||
| 3375 | 3434 | WARN_ON(!cfqq->dispatched); |
| 3376 | 3435 | cfqd->rq_in_driver--; |
| 3377 | 3436 | cfqq->dispatched--; |
| 3437 | + (RQ_CFQG(rq))->dispatched--; | |
| 3378 | 3438 | cfq_blkiocg_update_completion_stats(&cfqq->cfqg->blkg, |
| 3379 | 3439 | rq_start_time_ns(rq), rq_io_start_time_ns(rq), |
| 3380 | 3440 | rq_data_dir(rq), rq_is_sync(rq)); |
| @@ -3404,7 +3464,10 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq) · 23 unmodified lines | ||
| 3404 | 3464 | * the queue. |
| 3405 | 3465 | */ |
| 3406 | 3466 | if (cfq_should_wait_busy(cfqd, cfqq)) { |
| 3407 | − cfqq->slice_end = jiffies + cfqd->cfq_slice_idle; | |
| 3467 | + unsigned long extend_sl = cfqd->cfq_slice_idle; | |
| 3468 | + if (!cfqd->cfq_slice_idle) | |
| 3469 | + extend_sl = cfqd->cfq_group_idle; | |
| 3470 | + cfqq->slice_end = jiffies + extend_sl; | |
| 3408 | 3471 | cfq_mark_cfqq_wait_busy(cfqq); |
| 3409 | 3472 | cfq_log_cfqq(cfqd, cfqq, "will busy wait"); |
| 3410 | 3473 | } |
| @@ -3850,6 +3913,7 @@ static void *cfq_init_queue(struct request_queue *q) · 439 unmodified lines | ||
| 3850 | 3913 | cfqd->cfq_slice[1] = cfq_slice_sync; |
| 3851 | 3914 | cfqd->cfq_slice_async_rq = cfq_slice_async_rq; |
| 3852 | 3915 | cfqd->cfq_slice_idle = cfq_slice_idle; |
| 3916 | + cfqd->cfq_group_idle = cfq_group_idle; | |
| 3853 | 3917 | cfqd->cfq_latency = 1; |
| 3854 | 3918 | cfqd->cfq_group_isolation = 0; |
| 3855 | 3919 | cfqd->hw_tag = -1; |
| @@ -3922,6 +3986,7 @@ SHOW_FUNCTION(cfq_fifo_expire_async_show, cfqd->cfq_fifo_expire[0], 1); · 66 unmodified lines | ||
| 3922 | 3986 | SHOW_FUNCTION(cfq_back_seek_max_show, cfqd->cfq_back_max, 0); |
| 3923 | 3987 | SHOW_FUNCTION(cfq_back_seek_penalty_show, cfqd->cfq_back_penalty, 0); |
| 3924 | 3988 | SHOW_FUNCTION(cfq_slice_idle_show, cfqd->cfq_slice_idle, 1); |
| 3989 | +SHOW_FUNCTION(cfq_group_idle_show, cfqd->cfq_group_idle, 1); | |
| 3925 | 3990 | SHOW_FUNCTION(cfq_slice_sync_show, cfqd->cfq_slice[1], 1); |
| 3926 | 3991 | SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1); |
| 3927 | 3992 | SHOW_FUNCTION(cfq_slice_async_rq_show, cfqd->cfq_slice_async_rq, 0); |
| @@ -3954,6 +4019,7 @@ STORE_FUNCTION(cfq_back_seek_max_store, &cfqd->cfq_back_max, 0, UINT_MAX, 0); · 26 unmodified lines | ||
| 3954 | 4019 | STORE_FUNCTION(cfq_back_seek_penalty_store, &cfqd->cfq_back_penalty, 1, |
| 3955 | 4020 | UINT_MAX, 0); |
| 3956 | 4021 | STORE_FUNCTION(cfq_slice_idle_store, &cfqd->cfq_slice_idle, 0, UINT_MAX, 1); |
| 4022 | +STORE_FUNCTION(cfq_group_idle_store, &cfqd->cfq_group_idle, 0, UINT_MAX, 1); | |
| 3957 | 4023 | STORE_FUNCTION(cfq_slice_sync_store, &cfqd->cfq_slice[1], 1, UINT_MAX, 1); |
| 3958 | 4024 | STORE_FUNCTION(cfq_slice_async_store, &cfqd->cfq_slice[0], 1, UINT_MAX, 1); |
| 3959 | 4025 | STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1, |
| @@ -3975,6 +4041,7 @@ static struct elv_fs_entry cfq_attrs[] = { · 15 unmodified lines | ||
| 3975 | 4041 | CFQ_ATTR(slice_async), |
| 3976 | 4042 | CFQ_ATTR(slice_async_rq), |
| 3977 | 4043 | CFQ_ATTR(slice_idle), |
| 4044 | + CFQ_ATTR(group_idle), | |
| 3978 | 4045 | CFQ_ATTR(low_latency), |
| 3979 | 4046 | CFQ_ATTR(group_isolation), |
| 3980 | 4047 | __ATTR_NULL |
| @@ -4028,6 +4095,12 @@ static int __init cfq_init(void) · 47 unmodified lines | ||
| 4028 | 4095 | if (!cfq_slice_idle) |
| 4029 | 4096 | cfq_slice_idle = 1; |
| 4030 | 4097 | |
| 4098 | +#ifdef CONFIG_CFQ_GROUP_IOSCHED | |
| 4099 | + if (!cfq_group_idle) | |
| 4100 | + cfq_group_idle = 1; | |
| 4101 | +#else | |
| 4102 | + cfq_group_idle = 0; | |
| 4103 | +#endif | |
| 4031 | 4104 | if (cfq_slab_setup()) |
| 4032 | 4105 | return -ENOMEM; |
| 4033 | 4106 | |
| @@ -1009,18 +1009,19 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) · 1008 unmodified lines | ||
| 1009 | 1009 | { |
| 1010 | 1010 | struct elevator_queue *old_elevator, *e; |
| 1011 | 1011 | void *data; |
| 1012 | + int err; | |
| 1012 | 1013 | |
| 1013 | 1014 | /* |
| 1014 | 1015 | * Allocate new elevator |
| 1015 | 1016 | */ |
| 1016 | 1017 | e = elevator_alloc(q, new_e); |
| 1017 | 1018 | if (!e) |
| 1018 | − return 0; | |
| 1019 | + return -ENOMEM; | |
| 1019 | 1020 | |
| 1020 | 1021 | data = elevator_init_queue(q, e); |
| 1021 | 1022 | if (!data) { |
| 1022 | 1023 | kobject_put(&e->kobj); |
| 1023 | − return 0; | |
| 1024 | + return -ENOMEM; | |
| 1024 | 1025 | } |
| 1025 | 1026 | |
| 1026 | 1027 | /* |
| @@ -1043,7 +1044,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) · 16 unmodified lines | ||
| 1043 | 1044 | |
| 1044 | 1045 | __elv_unregister_queue(old_elevator); |
| 1045 | 1046 | |
| 1046 | − if (elv_register_queue(q)) | |
| 1047 | + err = elv_register_queue(q); | |
| 1048 | + if (err) | |
| 1047 | 1049 | goto fail_register; |
| 1048 | 1050 | |
| 1049 | 1051 | /* |
| @@ -1056,7 +1058,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) · 6 unmodified lines | ||
| 1056 | 1058 | |
| 1057 | 1059 | blk_add_trace_msg(q, "elv switch: %s", e->elevator_type->elevator_name); |
| 1058 | 1060 | |
| 1059 | − return 1; | |
| 1061 | + return 0; | |
| 1060 | 1062 | |
| 1061 | 1063 | fail_register: |
| 1062 | 1064 | /* |
| @@ -1071,17 +1073,19 @@ fail_register: · 8 unmodified lines | ||
| 1071 | 1073 | queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q); |
| 1072 | 1074 | spin_unlock_irq(q->queue_lock); |
| 1073 | 1075 | |
| 1074 | − return 0; | |
| 1076 | + return err; | |
| 1075 | 1077 | } |
| 1076 | 1078 | |
| 1077 | −ssize_t elv_iosched_store(struct request_queue *q, const char *name, | |
| 1078 | − size_t count) | |
| 1079 | +/* | |
| 1080 | + * Switch this queue to the given IO scheduler. | |
| 1081 | + */ | |
| 1082 | +int elevator_change(struct request_queue *q, const char *name) | |
| 1079 | 1083 | { |
| 1080 | 1084 | char elevator_name[ELV_NAME_MAX]; |
| 1081 | 1085 | struct elevator_type *e; |
| 1082 | 1086 | |
| 1083 | 1087 | if (!q->elevator) |
| 1084 | − return count; | |
| 1088 | + return -ENXIO; | |
| 1085 | 1089 | |
| 1086 | 1090 | strlcpy(elevator_name, name, sizeof(elevator_name)); |
| 1087 | 1091 | e = elevator_get(strstrip(elevator_name)); |
| @@ -1092,13 +1096,27 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name, · 4 unmodified lines | ||
| 1092 | 1096 | |
| 1093 | 1097 | if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) { |
| 1094 | 1098 | elevator_put(e); |
| 1095 | − return count; | |
| 1099 | + return 0; | |
| 1096 | 1100 | } |
| 1097 | 1101 | |
| 1098 | − if (!elevator_switch(q, e)) | |
| 1099 | − printk(KERN_ERR "elevator: switch to %s failed\n", | |
| 1100 | − elevator_name); | |
| 1101 | − return count; | |
| 1102 | + return elevator_switch(q, e); | |
| 1103 | +} | |
| 1104 | +EXPORT_SYMBOL(elevator_change); | |
| 1105 | + | |
| 1106 | +ssize_t elv_iosched_store(struct request_queue *q, const char *name, | |
| 1107 | + size_t count) | |
| 1108 | +{ | |
| 1109 | + int ret; | |
| 1110 | + | |
| 1111 | + if (!q->elevator) | |
| 1112 | + return count; | |
| 1113 | + | |
| 1114 | + ret = elevator_change(q, name); | |
| 1115 | + if (!ret) | |
| 1116 | + return count; | |
| 1117 | + | |
| 1118 | + printk(KERN_ERR "elevator: switch to %s failed\n", name); | |
| 1119 | + return ret; | |
| 1102 | 1120 | } |
| 1103 | 1121 | |
| 1104 | 1122 | ssize_t elv_iosched_show(struct request_queue *q, char *name) |
| @@ -101,13 +101,13 @@ config CRYPTO_MANAGER2 · 100 unmodified lines | ||
| 101 | 101 | select CRYPTO_BLKCIPHER2 |
| 102 | 102 | select CRYPTO_PCOMP2 |
| 103 | 103 | |
| 104 | −config CRYPTO_MANAGER_TESTS | |
| 105 | − bool "Run algolithms' self-tests" | |
| 104 | +config CRYPTO_MANAGER_DISABLE_TESTS | |
| 105 | + bool "Disable run-time self tests" | |
| 106 | 106 | default y |
| 107 | 107 | depends on CRYPTO_MANAGER2 |
| 108 | 108 | help |
| 109 | − Run cryptomanager's tests for the new crypto algorithms being | |
| 110 | − registered. | |
| 109 | + Disable run-time self tests that normally take place at | |
| 110 | + algorithm registration. | |
| 111 | 111 | |
| 112 | 112 | config CRYPTO_GF128MUL |
| 113 | 113 | tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" |
| @@ -47,8 +47,11 @@ static int hash_walk_next(struct crypto_hash_walk *walk) · 46 unmodified lines | ||
| 47 | 47 | walk->data = crypto_kmap(walk->pg, 0); |
| 48 | 48 | walk->data += offset; |
| 49 | 49 | |
| 50 | − if (offset & alignmask) | |
| 51 | − nbytes = alignmask + 1 - (offset & alignmask); | |
| 50 | + if (offset & alignmask) { | |
| 51 | + unsigned int unaligned = alignmask + 1 - (offset & alignmask); | |
| 52 | + if (nbytes > unaligned) | |
| 53 | + nbytes = unaligned; | |
| 54 | + } | |
| 52 | 55 | |
| 53 | 56 | walk->entrylen -= nbytes; |
| 54 | 57 | return nbytes; |
| @@ -206,13 +206,16 @@ err: · 205 unmodified lines | ||
| 206 | 206 | return NOTIFY_OK; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | −#ifdef CONFIG_CRYPTO_MANAGER_TESTS | |
| 210 | 209 | static int cryptomgr_test(void *data) |
| 211 | 210 | { |
| 212 | 211 | struct crypto_test_param *param = data; |
| 213 | 212 | u32 type = param->type; |
| 214 | 213 | int err = 0; |
| 215 | 214 | |
| 215 | +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS | |
| 216 | + goto skiptest; | |
| 217 | +#endif | |
| 218 | + | |
| 216 | 219 | if (type & CRYPTO_ALG_TESTED) |
| 217 | 220 | goto skiptest; |
| 218 | 221 | |
| @@ -267,7 +270,6 @@ err_put_module: · 48 unmodified lines | ||
| 267 | 270 | err: |
| 268 | 271 | return NOTIFY_OK; |
| 269 | 272 | } |
| 270 | −#endif /* CONFIG_CRYPTO_MANAGER_TESTS */ | |
| 271 | 273 | |
| 272 | 274 | static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, |
| 273 | 275 | void *data) |
| @@ -275,10 +277,8 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, · 1 unmodified line | ||
| 275 | 277 | switch (msg) { |
| 276 | 278 | case CRYPTO_MSG_ALG_REQUEST: |
| 277 | 279 | return cryptomgr_schedule_probe(data); |
| 278 | −#ifdef CONFIG_CRYPTO_MANAGER_TESTS | |
| 279 | 280 | case CRYPTO_MSG_ALG_REGISTER: |
| 280 | 281 | return cryptomgr_schedule_test(data); |
| 281 | −#endif | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return NOTIFY_DONE; |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | #include "internal.h" |
| 25 | 25 | |
| 26 | −#ifndef CONFIG_CRYPTO_MANAGER_TESTS | |
| 26 | +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS | |
| 27 | 27 | |
| 28 | 28 | /* a perfect nop */ |
| 29 | 29 | int alg_test(const char *driver, const char *alg, u32 type, u32 mask) |
| @@ -2542,6 +2542,6 @@ non_fips_alg: · 2512 unmodified lines | ||
| 2542 | 2542 | return -EINVAL; |
| 2543 | 2543 | } |
| 2544 | 2544 | |
| 2545 | −#endif /* CONFIG_CRYPTO_MANAGER_TESTS */ | |
| 2545 | +#endif /* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */ | |
| 2546 | 2546 | |
| 2547 | 2547 | EXPORT_SYMBOL_GPL(alg_test); |
| @@ -33,7 +33,6 @@ · 32 unmodified lines | ||
| 33 | 33 | #include <linux/pm_runtime.h> |
| 34 | 34 | #include <linux/pci.h> |
| 35 | 35 | #include <linux/pci-acpi.h> |
| 36 | −#include <linux/pci-aspm.h> | |
| 37 | 36 | #include <linux/acpi.h> |
| 38 | 37 | #include <linux/slab.h> |
| 39 | 38 | #include <acpi/acpi_bus.h> |
| @@ -226,22 +225,31 @@ static acpi_status acpi_pci_run_osc(acpi_handle handle, · 186 unmodified lines | ||
| 226 | 225 | return status; |
| 227 | 226 | } |
| 228 | 227 | |
| 229 | −static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, u32 flags) | |
| 228 | +static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, | |
| 229 | + u32 support, | |
| 230 | + u32 *control) | |
| 230 | 231 | { |
| 231 | 232 | acpi_status status; |
| 232 | − u32 support_set, result, capbuf[3]; | |
| 233 | + u32 result, capbuf[3]; | |
| 234 | + | |
| 235 | + support &= OSC_PCI_SUPPORT_MASKS; | |
| 236 | + support |= root->osc_support_set; | |
| 233 | 237 | |
| 234 | − /* do _OSC query for all possible controls */ | |
| 235 | − support_set = root->osc_support_set | (flags & OSC_PCI_SUPPORT_MASKS); | |
| 236 | 238 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; |
| 237 | − capbuf[OSC_SUPPORT_TYPE] = support_set; | |
| 238 | − capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS; | |
| 239 | + capbuf[OSC_SUPPORT_TYPE] = support; | |
| 240 | + if (control) { | |
| 241 | + *control &= OSC_PCI_CONTROL_MASKS; | |
| 242 | + capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set; | |
| 243 | + } else { | |
| 244 | + /* Run _OSC query for all possible controls. */ | |
| 245 | + capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS; | |
| 246 | + } | |
| 239 | 247 | |
| 240 | 248 | status = acpi_pci_run_osc(root->device->handle, capbuf, &result); |
| 241 | 249 | if (ACPI_SUCCESS(status)) { |
| 242 | − root->osc_support_set = support_set; | |
| 243 | − root->osc_control_qry = result; | |
| 244 | − root->osc_queried = 1; | |
| 250 | + root->osc_support_set = support; | |
| 251 | + if (control) | |
| 252 | + *control = result; | |
| 245 | 253 | } |
| 246 | 254 | return status; |
| 247 | 255 | } |
| @@ -255,7 +263,7 @@ static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags) · 7 unmodified lines | ||
| 255 | 263 | if (ACPI_FAILURE(status)) |
| 256 | 264 | return status; |
| 257 | 265 | mutex_lock(&osc_lock); |
| 258 | − status = acpi_pci_query_osc(root, flags); | |
| 266 | + status = acpi_pci_query_osc(root, flags, NULL); | |
| 259 | 267 | mutex_unlock(&osc_lock); |
| 260 | 268 | return status; |
| 261 | 269 | } |
| @@ -365,55 +373,70 @@ out: · 103 unmodified lines | ||
| 365 | 373 | EXPORT_SYMBOL_GPL(acpi_get_pci_dev); |
| 366 | 374 | |
| 367 | 375 | /** |
| 368 | − * acpi_pci_osc_control_set - commit requested control to Firmware | |
| 369 | − * @handle: acpi_handle for the target ACPI object | |
| 370 | − * @flags: driver's requested control bits | |
| 376 | + * acpi_pci_osc_control_set - Request control of PCI root _OSC features. | |
| 377 | + * @handle: ACPI handle of a PCI root bridge (or PCIe Root Complex). | |
| 378 | + * @mask: Mask of _OSC bits to request control of, place to store control mask. | |
| 379 | + * @req: Mask of _OSC bits the control of is essential to the caller. | |
| 380 | + * | |
| 381 | + * Run _OSC query for @mask and if that is successful, compare the returned | |
| 382 | + * mask of control bits with @req. If all of the @req bits are set in the | |
| 383 | + * returned mask, run _OSC request for it. | |
| 371 | 384 | * |
| 372 | − * Attempt to take control from Firmware on requested control bits. | |
| 385 | + * The variable at the @mask address may be modified regardless of whether or | |
| 386 | + * not the function returns success. On success it will contain the mask of | |
| 387 | + * _OSC bits the BIOS has granted control of, but its contents are meaningless | |
| 388 | + * on failure. | |
| 373 | 389 | **/ |
| 374 | −acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags) | |
| 390 | +acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) | |
| 375 | 391 | { |
| 392 | + struct acpi_pci_root *root; | |
| 376 | 393 | acpi_status status; |
| 377 | − u32 control_req, result, capbuf[3]; | |
| 394 | + u32 ctrl, capbuf[3]; | |
| 378 | 395 | acpi_handle tmp; |
| 379 | − struct acpi_pci_root *root; | |
| 380 | 396 | |
| 381 | − status = acpi_get_handle(handle, "_OSC", &tmp); | |
| 382 | − if (ACPI_FAILURE(status)) | |
| 383 | − return status; | |
| 397 | + if (!mask) | |
| 398 | + return AE_BAD_PARAMETER; | |
| 384 | 399 | |
| 385 | − control_req = (flags & OSC_PCI_CONTROL_MASKS); | |
| 386 | − if (!control_req) | |
| 400 | + ctrl = *mask & OSC_PCI_CONTROL_MASKS; | |
| 401 | + if ((ctrl & req) != req) | |
| 387 | 402 | return AE_TYPE; |
| 388 | 403 | |
| 389 | 404 | root = acpi_pci_find_root(handle); |
| 390 | 405 | if (!root) |
| 391 | 406 | return AE_NOT_EXIST; |
| 392 | 407 | |
| 408 | + status = acpi_get_handle(handle, "_OSC", &tmp); | |
| 409 | + if (ACPI_FAILURE(status)) | |
| 410 | + return status; | |
| 411 | + | |
| 393 | 412 | mutex_lock(&osc_lock); |
| 413 | + | |
| 414 | + *mask = ctrl | root->osc_control_set; | |
| 394 | 415 | /* No need to evaluate _OSC if the control was already granted. */ |
| 395 | − if ((root->osc_control_set & control_req) == control_req) | |
| 416 | + if ((root->osc_control_set & ctrl) == ctrl) | |
| 396 | 417 | goto out; |
| 397 | 418 | |
| 398 | − /* Need to query controls first before requesting them */ | |
| 399 | − if (!root->osc_queried) { | |
| 400 | − status = acpi_pci_query_osc(root, root->osc_support_set); | |
| 419 | + /* Need to check the available controls bits before requesting them. */ | |
| 420 | + while (*mask) { | |
| 421 | + status = acpi_pci_query_osc(root, root->osc_support_set, mask); | |
| 401 | 422 | if (ACPI_FAILURE(status)) |
| 402 | 423 | goto out; |
| 424 | + if (ctrl == *mask) | |
| 425 | + break; | |
| 426 | + ctrl = *mask; | |
| 403 | 427 | } |
| 404 | − if ((root->osc_control_qry & control_req) != control_req) { | |
| 405 | − printk(KERN_DEBUG | |
| 406 | − "Firmware did not grant requested _OSC control\n"); | |
| 428 | + | |
| 429 | + if ((ctrl & req) != req) { | |
| 407 | 430 | status = AE_SUPPORT; |
| 408 | 431 | goto out; |
| 409 | 432 | } |
| 410 | 433 | |
| 411 | 434 | capbuf[OSC_QUERY_TYPE] = 0; |
| 412 | 435 | capbuf[OSC_SUPPORT_TYPE] = root->osc_support_set; |
| 413 | − capbuf[OSC_CONTROL_TYPE] = root->osc_control_set | control_req; | |
| 414 | − status = acpi_pci_run_osc(handle, capbuf, &result); | |
| 436 | + capbuf[OSC_CONTROL_TYPE] = ctrl; | |
| 437 | + status = acpi_pci_run_osc(handle, capbuf, mask); | |
| 415 | 438 | if (ACPI_SUCCESS(status)) |
| 416 | − root->osc_control_set = result; | |
| 439 | + root->osc_control_set = *mask; | |
| 417 | 440 | out: |
| 418 | 441 | mutex_unlock(&osc_lock); |
| 419 | 442 | return status; |
| @@ -544,14 +567,6 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) · 124 unmodified lines | ||
| 544 | 567 | if (flags != base_flags) |
| 545 | 568 | acpi_pci_osc_support(root, flags); |
| 546 | 569 | |
| 547 | − status = acpi_pci_osc_control_set(root->device->handle, | |
| 548 | − OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | |
| 549 | − | |
| 550 | − if (ACPI_FAILURE(status)) { | |
| 551 | − printk(KERN_INFO "Unable to assume PCIe control: Disabling ASPM\n"); | |
| 552 | − pcie_no_aspm(); | |
| 553 | − } | |
| 554 | − | |
| 555 | 570 | pci_acpi_add_bus_pm_notifier(device, root->bus); |
| 556 | 571 | if (device->wakeup.flags.run_wake) |
| 557 | 572 | device_set_run_wake(root->bus->bridge, true); |
| @@ -828,6 +828,7 @@ config PATA_SAMSUNG_CF · 827 unmodified lines | ||
| 828 | 828 | config PATA_WINBOND_VLB |
| 829 | 829 | tristate "Winbond W83759A VLB PATA support (Experimental)" |
| 830 | 830 | depends on ISA && EXPERIMENTAL |
| 831 | + select PATA_LEGACY | |
| 831 | 832 | help |
| 832 | 833 | Support for the Winbond W83759A controller on Vesa Local Bus |
| 833 | 834 | systems. |
| @@ -89,7 +89,6 @@ obj-$(CONFIG_PATA_QDI) += pata_qdi.o · 88 unmodified lines | ||
| 89 | 89 | obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o |
| 90 | 90 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o |
| 91 | 91 | obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o |
| 92 | −obj-$(CONFIG_PATA_WINBOND_VLB) += pata_winbond.o | |
| 93 | 92 | |
| 94 | 93 | obj-$(CONFIG_PATA_PXA) += pata_pxa.o |
| 95 | 94 | |
| @@ -60,6 +60,7 @@ enum board_ids { · 59 unmodified lines | ||
| 60 | 60 | board_ahci, |
| 61 | 61 | board_ahci_ign_iferr, |
| 62 | 62 | board_ahci_nosntf, |
| 63 | + board_ahci_yes_fbs, | |
| 63 | 64 | |
| 64 | 65 | /* board IDs for specific chipsets in alphabetical order */ |
| 65 | 66 | board_ahci_mcp65, |
| @@ -132,6 +133,14 @@ static const struct ata_port_info ahci_port_info[] = { · 66 unmodified lines | ||
| 132 | 133 | .udma_mask = ATA_UDMA6, |
| 133 | 134 | .port_ops = &ahci_ops, |
| 134 | 135 | }, |
| 136 | + [board_ahci_yes_fbs] = | |
| 137 | + { | |
| 138 | + AHCI_HFLAGS (AHCI_HFLAG_YES_FBS), | |
| 139 | + .flags = AHCI_FLAG_COMMON, | |
| 140 | + .pio_mask = ATA_PIO4, | |
| 141 | + .udma_mask = ATA_UDMA6, | |
| 142 | + .port_ops = &ahci_ops, | |
| 143 | + }, | |
| 135 | 144 | /* by chipsets */ |
| 136 | 145 | [board_ahci_mcp65] = |
| 137 | 146 | { |
| @@ -244,6 +253,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 106 unmodified lines | ||
| 244 | 253 | { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */ |
| 245 | 254 | { PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */ |
| 246 | 255 | { PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */ |
| 256 | + { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ | |
| 257 | + { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ | |
| 258 | + { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ | |
| 247 | 259 | |
| 248 | 260 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
| 249 | 261 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| @@ -362,6 +374,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 112 unmodified lines | ||
| 362 | 374 | /* Marvell */ |
| 363 | 375 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
| 364 | 376 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ |
| 377 | + { PCI_DEVICE(0x1b4b, 0x9123), | |
| 378 | + .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | |
| 365 | 379 | |
| 366 | 380 | /* Promise */ |
| 367 | 381 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ |
| @@ -209,6 +209,7 @@ enum { · 208 unmodified lines | ||
| 209 | 209 | link offline */ |
| 210 | 210 | AHCI_HFLAG_NO_SNTF = (1 << 12), /* no sntf */ |
| 211 | 211 | AHCI_HFLAG_NO_FPDMA_AA = (1 << 13), /* no FPDMA AA */ |
| 212 | + AHCI_HFLAG_YES_FBS = (1 << 14), /* force FBS cap on */ | |
| 212 | 213 | |
| 213 | 214 | /* ap->flags bits */ |
| 214 | 215 | |
| @@ -302,6 +302,10 @@ static const struct pci_device_id piix_pci_tbl[] = { · 301 unmodified lines | ||
| 302 | 302 | { 0x8086, 0x1c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 303 | 303 | /* SATA Controller IDE (CPT) */ |
| 304 | 304 | { 0x8086, 0x1c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 305 | + /* SATA Controller IDE (PBG) */ | |
| 306 | + { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | |
| 307 | + /* SATA Controller IDE (PBG) */ | |
| 308 | + { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | |
| 305 | 309 | { } /* terminate list */ |
| 306 | 310 | }; |
| 307 | 311 | |
| @@ -430,6 +430,12 @@ void ahci_save_initial_config(struct device *dev, · 429 unmodified lines | ||
| 430 | 430 | cap &= ~HOST_CAP_SNTF; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | + if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) { | |
| 434 | + dev_printk(KERN_INFO, dev, | |
| 435 | + "controller can do FBS, turning on CAP_FBS\n"); | |
| 436 | + cap |= HOST_CAP_FBS; | |
| 437 | + } | |
| 438 | + | |
| 433 | 439 | if (force_port_map && port_map != force_port_map) { |
| 434 | 440 | dev_printk(KERN_INFO, dev, "forcing port_map 0x%x -> 0x%x\n", |
| 435 | 441 | port_map, force_port_map); |
| @@ -1320,7 +1326,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, · 884 unmodified lines | ||
| 1320 | 1326 | /* issue the first D2H Register FIS */ |
| 1321 | 1327 | msecs = 0; |
| 1322 | 1328 | now = jiffies; |
| 1323 | − if (time_after(now, deadline)) | |
| 1329 | + if (time_after(deadline, now)) | |
| 1324 | 1330 | msecs = jiffies_to_msecs(deadline - now); |
| 1325 | 1331 | |
| 1326 | 1332 | tf.ctl |= ATA_SRST; |
| @@ -2036,9 +2042,15 @@ static int ahci_port_start(struct ata_port *ap) · 709 unmodified lines | ||
| 2036 | 2042 | u32 cmd = readl(port_mmio + PORT_CMD); |
| 2037 | 2043 | if (cmd & PORT_CMD_FBSCP) |
| 2038 | 2044 | pp->fbs_supported = true; |
| 2039 | − else | |
| 2045 | + else if (hpriv->flags & AHCI_HFLAG_YES_FBS) { | |
| 2046 | + dev_printk(KERN_INFO, dev, | |
| 2047 | + "port %d can do FBS, forcing FBSCP\n", | |
| 2048 | + ap->port_no); | |
| 2049 | + pp->fbs_supported = true; | |
| 2050 | + } else | |
| 2040 | 2051 | dev_printk(KERN_WARNING, dev, |
| 2041 | − "The port is not capable of FBS\n"); | |
| 2052 | + "port %d is not capable of FBS\n", | |
| 2053 | + ap->port_no); | |
| 2042 | 2054 | } |
| 2043 | 2055 | |
| 2044 | 2056 | if (pp->fbs_supported) { |
| @@ -5111,15 +5111,18 @@ void ata_qc_issue(struct ata_queued_cmd *qc) · 5110 unmodified lines | ||
| 5111 | 5111 | qc->flags |= ATA_QCFLAG_ACTIVE; |
| 5112 | 5112 | ap->qc_active |= 1 << qc->tag; |
| 5113 | 5113 | |
| 5114 | − /* We guarantee to LLDs that they will have at least one | |
| 5114 | + /* | |
| 5115 | + * We guarantee to LLDs that they will have at least one | |
| 5115 | 5116 | * non-zero sg if the command is a data command. |
| 5116 | 5117 | */ |
| 5117 | − BUG_ON(ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)); | |
| 5118 | + if (WARN_ON_ONCE(ata_is_data(prot) && | |
| 5119 | + (!qc->sg || !qc->n_elem || !qc->nbytes))) | |
| 5120 | + goto sys_err; | |
| 5118 | 5121 | |
| 5119 | 5122 | if (ata_is_dma(prot) || (ata_is_pio(prot) && |
| 5120 | 5123 | (ap->flags & ATA_FLAG_PIO_DMA))) |
| 5121 | 5124 | if (ata_sg_setup(qc)) |
| 5122 | − goto sg_err; | |
| 5125 | + goto sys_err; | |
| 5123 | 5126 | |
| 5124 | 5127 | /* if device is sleeping, schedule reset and abort the link */ |
| 5125 | 5128 | if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) { |
| @@ -5136,7 +5139,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc) · 10 unmodified lines | ||
| 5136 | 5139 | goto err; |
| 5137 | 5140 | return; |
| 5138 | 5141 | |
| 5139 | −sg_err: | |
| 5142 | +sys_err: | |
| 5140 | 5143 | qc->err_mask |= AC_ERR_SYSTEM; |
| 5141 | 5144 | err: |
| 5142 | 5145 | ata_qc_complete(qc); |
| @@ -5415,6 +5418,7 @@ static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, · 272 unmodified lines | ||
| 5415 | 5418 | */ |
| 5416 | 5419 | int ata_host_suspend(struct ata_host *host, pm_message_t mesg) |
| 5417 | 5420 | { |
| 5421 | + unsigned int ehi_flags = ATA_EHI_QUIET; | |
| 5418 | 5422 | int rc; |
| 5419 | 5423 | |
| 5420 | 5424 | /* |
| @@ -5423,7 +5427,18 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg) · 2 unmodified lines | ||
| 5423 | 5427 | */ |
| 5424 | 5428 | ata_lpm_enable(host); |
| 5425 | 5429 | |
| 5426 | − rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); | |
| 5430 | + /* | |
| 5431 | + * On some hardware, device fails to respond after spun down | |
| 5432 | + * for suspend. As the device won't be used before being | |
| 5433 | + * resumed, we don't need to touch the device. Ask EH to skip | |
| 5434 | + * the usual stuff and proceed directly to suspend. | |
| 5435 | + * | |
| 5436 | + * http://thread.gmane.org/gmane.linux.ide/46764 | |
| 5437 | + */ | |
| 5438 | + if (mesg.event == PM_EVENT_SUSPEND) | |
| 5439 | + ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY; | |
| 5440 | + | |
| 5441 | + rc = ata_host_request_pm(host, mesg, 0, ehi_flags, 1); | |
| 5427 | 5442 | if (rc == 0) |
| 5428 | 5443 | host->dev->power.power_state = mesg; |
| 5429 | 5444 | return rc; |
| @@ -3235,6 +3235,10 @@ static int ata_eh_skip_recovery(struct ata_link *link) · 3234 unmodified lines | ||
| 3235 | 3235 | if (link->flags & ATA_LFLAG_DISABLED) |
| 3236 | 3236 | return 1; |
| 3237 | 3237 | |
| 3238 | + /* skip if explicitly requested */ | |
| 3239 | + if (ehc->i.flags & ATA_EHI_NO_RECOVERY) | |
| 3240 | + return 1; | |
| 3241 | + | |
| 3238 | 3242 | /* thaw frozen port and recover failed devices */ |
| 3239 | 3243 | if ((ap->pflags & ATA_PFLAG_FROZEN) || ata_link_nr_enabled(link)) |
| 3240 | 3244 | return 0; |
| @@ -418,6 +418,7 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) · 417 unmodified lines | ||
| 418 | 418 | if (ioaddr->ctl_addr) |
| 419 | 419 | iowrite8(tf->ctl, ioaddr->ctl_addr); |
| 420 | 420 | ap->last_ctl = tf->ctl; |
| 421 | + ata_wait_idle(ap); | |
| 421 | 422 | } |
| 422 | 423 | |
| 423 | 424 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { |
| @@ -453,6 +454,8 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) · 29 unmodified lines | ||
| 453 | 454 | iowrite8(tf->device, ioaddr->device_addr); |
| 454 | 455 | VPRINTK("device 0x%X\n", tf->device); |
| 455 | 456 | } |
| 457 | + | |
| 458 | + ata_wait_idle(ap); | |
| 456 | 459 | } |
| 457 | 460 | EXPORT_SYMBOL_GPL(ata_sff_tf_load); |
| 458 | 461 | |
| @@ -1042,7 +1045,8 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) · 583 unmodified lines | ||
| 1042 | 1045 | int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
| 1043 | 1046 | u8 status, int in_wq) |
| 1044 | 1047 | { |
| 1045 | − struct ata_eh_info *ehi = &ap->link.eh_info; | |
| 1048 | + struct ata_link *link = qc->dev->link; | |
| 1049 | + struct ata_eh_info *ehi = &link->eh_info; | |
| 1046 | 1050 | unsigned long flags = 0; |
| 1047 | 1051 | int poll_next; |
| 1048 | 1052 | |
| @@ -1298,8 +1302,14 @@ fsm_start: · 249 unmodified lines | ||
| 1298 | 1302 | } |
| 1299 | 1303 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); |
| 1300 | 1304 | |
| 1301 | −void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay) | |
| 1305 | +void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay) | |
| 1302 | 1306 | { |
| 1307 | + struct ata_port *ap = link->ap; | |
| 1308 | + | |
| 1309 | + WARN_ON((ap->sff_pio_task_link != NULL) && | |
| 1310 | + (ap->sff_pio_task_link != link)); | |
| 1311 | + ap->sff_pio_task_link = link; | |
| 1312 | + | |
| 1303 | 1313 | /* may fail if ata_sff_flush_pio_task() in progress */ |
| 1304 | 1314 | queue_delayed_work(ata_sff_wq, &ap->sff_pio_task, |
| 1305 | 1315 | msecs_to_jiffies(delay)); |
| @@ -1321,14 +1331,18 @@ static void ata_sff_pio_task(struct work_struct *work) · 15 unmodified lines | ||
| 1321 | 1331 | { |
| 1322 | 1332 | struct ata_port *ap = |
| 1323 | 1333 | container_of(work, struct ata_port, sff_pio_task.work); |
| 1334 | + struct ata_link *link = ap->sff_pio_task_link; | |
| 1324 | 1335 | struct ata_queued_cmd *qc; |
| 1325 | 1336 | u8 status; |
| 1326 | 1337 | int poll_next; |
| 1327 | 1338 | |
| 1339 | + BUG_ON(ap->sff_pio_task_link == NULL); | |
| 1328 | 1340 | /* qc can be NULL if timeout occurred */ |
| 1329 | − qc = ata_qc_from_tag(ap, ap->link.active_tag); | |
| 1330 | − if (!qc) | |
| 1341 | + qc = ata_qc_from_tag(ap, link->active_tag); | |
| 1342 | + if (!qc) { | |
| 1343 | + ap->sff_pio_task_link = NULL; | |
| 1331 | 1344 | return; |
| 1345 | + } | |
| 1332 | 1346 | |
| 1333 | 1347 | fsm_start: |
| 1334 | 1348 | WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE); |
| @@ -1345,11 +1359,16 @@ fsm_start: · 10 unmodified lines | ||
| 1345 | 1359 | msleep(2); |
| 1346 | 1360 | status = ata_sff_busy_wait(ap, ATA_BUSY, 10); |
| 1347 | 1361 | if (status & ATA_BUSY) { |
| 1348 | − ata_sff_queue_pio_task(ap, ATA_SHORT_PAUSE); | |
| 1362 | + ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); | |
| 1349 | 1363 | return; |
| 1350 | 1364 | } |
| 1351 | 1365 | } |
| 1352 | 1366 | |
| 1367 | + /* | |
| 1368 | + * hsm_move() may trigger another command to be processed. | |
| 1369 | + * clean the link beforehand. | |
| 1370 | + */ | |
| 1371 | + ap->sff_pio_task_link = NULL; | |
| 1353 | 1372 | /* move the HSM */ |
| 1354 | 1373 | poll_next = ata_sff_hsm_move(ap, qc, status, 1); |
| 1355 | 1374 | |
| @@ -1376,6 +1395,7 @@ fsm_start: · 20 unmodified lines | ||
| 1376 | 1395 | unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) |
| 1377 | 1396 | { |
| 1378 | 1397 | struct ata_port *ap = qc->ap; |
| 1398 | + struct ata_link *link = qc->dev->link; | |
| 1379 | 1399 | |
| 1380 | 1400 | /* Use polling pio if the LLD doesn't handle |
| 1381 | 1401 | * interrupt driven pio and atapi CDB interrupt. |
| @@ -1396,7 +1416,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) · 14 unmodified lines | ||
| 1396 | 1416 | ap->hsm_task_state = HSM_ST_LAST; |
| 1397 | 1417 | |
| 1398 | 1418 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
| 1399 | − ata_sff_queue_pio_task(ap, 0); | |
| 1419 | + ata_sff_queue_pio_task(link, 0); | |
| 1400 | 1420 | |
| 1401 | 1421 | break; |
| 1402 | 1422 | |
| @@ -1409,7 +1429,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) · 6 unmodified lines | ||
| 1409 | 1429 | if (qc->tf.flags & ATA_TFLAG_WRITE) { |
| 1410 | 1430 | /* PIO data out protocol */ |
| 1411 | 1431 | ap->hsm_task_state = HSM_ST_FIRST; |
| 1412 | − ata_sff_queue_pio_task(ap, 0); | |
| 1432 | + ata_sff_queue_pio_task(link, 0); | |
| 1413 | 1433 | |
| 1414 | 1434 | /* always send first data block using the |
| 1415 | 1435 | * ata_sff_pio_task() codepath. |
| @@ -1419,7 +1439,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) · 3 unmodified lines | ||
| 1419 | 1439 | ap->hsm_task_state = HSM_ST; |
| 1420 | 1440 | |
| 1421 | 1441 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
| 1422 | − ata_sff_queue_pio_task(ap, 0); | |
| 1442 | + ata_sff_queue_pio_task(link, 0); | |
| 1423 | 1443 | |
| 1424 | 1444 | /* if polling, ata_sff_pio_task() handles the |
| 1425 | 1445 | * rest. otherwise, interrupt handler takes |
| @@ -1441,7 +1461,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) · 15 unmodified lines | ||
| 1441 | 1461 | /* send cdb by polling if no cdb interrupt */ |
| 1442 | 1462 | if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) || |
| 1443 | 1463 | (qc->tf.flags & ATA_TFLAG_POLLING)) |
| 1444 | − ata_sff_queue_pio_task(ap, 0); | |
| 1464 | + ata_sff_queue_pio_task(link, 0); | |
| 1445 | 1465 | break; |
| 1446 | 1466 | |
| 1447 | 1467 | default: |
| @@ -2734,10 +2754,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma_dumb_qc_prep); · 1286 unmodified lines | ||
| 2734 | 2754 | unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc) |
| 2735 | 2755 | { |
| 2736 | 2756 | struct ata_port *ap = qc->ap; |
| 2737 | − | |
| 2738 | − /* see ata_dma_blacklisted() */ | |
| 2739 | − BUG_ON((ap->flags & ATA_FLAG_PIO_POLLING) && | |
| 2740 | − qc->tf.protocol == ATAPI_PROT_DMA); | |
| 2757 | + struct ata_link *link = qc->dev->link; | |
| 2741 | 2758 | |
| 2742 | 2759 | /* defer PIO handling to sff_qc_issue */ |
| 2743 | 2760 | if (!ata_is_dma(qc->tf.protocol)) |
| @@ -2766,7 +2783,7 @@ unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc) · 22 unmodified lines | ||
| 2766 | 2783 | |
| 2767 | 2784 | /* send cdb by polling if no cdb interrupt */ |
| 2768 | 2785 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
| 2769 | − ata_sff_queue_pio_task(ap, 0); | |
| 2786 | + ata_sff_queue_pio_task(link, 0); | |
| 2770 | 2787 | break; |
| 2771 | 2788 | |
| 2772 | 2789 | default: |
| @@ -74,7 +74,8 @@ static int artop6260_pre_reset(struct ata_link *link, unsigned long deadline) · 73 unmodified lines | ||
| 74 | 74 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
| 75 | 75 | |
| 76 | 76 | /* Odd numbered device ids are the units with enable bits (the -R cards) */ |
| 77 | − if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) | |
| 77 | + if ((pdev->device & 1) && | |
| 78 | + !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) | |
| 78 | 79 | return -ENOENT; |
| 79 | 80 | |
| 80 | 81 | return ata_sff_prereset(link, deadline); |
| @@ -121,14 +121,8 @@ static void cmd64x_set_timing(struct ata_port *ap, struct ata_device *adev, u8 m · 120 unmodified lines | ||
| 121 | 121 | |
| 122 | 122 | if (pair) { |
| 123 | 123 | struct ata_timing tp; |
| 124 | − | |
| 125 | 124 | ata_timing_compute(pair, pair->pio_mode, &tp, T, 0); |
| 126 | 125 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); |
| 127 | − if (pair->dma_mode) { | |
| 128 | − ata_timing_compute(pair, pair->dma_mode, | |
| 129 | − &tp, T, 0); | |
| 130 | − ata_timing_merge(&tp, &t, &t, ATA_TIMING_SETUP); | |
| 131 | − } | |
| 132 | 126 | } |
| 133 | 127 | } |
| 134 | 128 | |
| @@ -44,6 +44,9 @@ · 43 unmodified lines | ||
| 44 | 44 | * Specific support is included for the ht6560a/ht6560b/opti82c611a/ |
| 45 | 45 | * opti82c465mv/promise 20230c/20630/qdi65x0/winbond83759A |
| 46 | 46 | * |
| 47 | + * Support for the Winbond 83759A when operating in advanced mode. | |
| 48 | + * Multichip mode is not currently supported. | |
| 49 | + * | |
| 47 | 50 | * Use the autospeed and pio_mask options with: |
| 48 | 51 | * Appian ADI/2 aka CLPD7220 or AIC25VL01. |
| 49 | 52 | * Use the jumpers, autospeed and set pio_mask to the mode on the jumpers with |
| @@ -135,12 +138,18 @@ static int ht6560b; /* HT 6560A on primary 1, second 2, both 3 */ · 85 unmodified lines | ||
| 135 | 138 | static int opti82c611a; /* Opti82c611A on primary 1, sec 2, both 3 */ |
| 136 | 139 | static int opti82c46x; /* Opti 82c465MV present(pri/sec autodetect) */ |
| 137 | 140 | static int qdi; /* Set to probe QDI controllers */ |
| 138 | −static int winbond; /* Set to probe Winbond controllers, | |
| 139 | − give I/O port if non standard */ | |
| 140 | 141 | static int autospeed; /* Chip present which snoops speed changes */ |
| 141 | 142 | static int pio_mask = ATA_PIO4; /* PIO range for autospeed devices */ |
| 142 | 143 | static int iordy_mask = 0xFFFFFFFF; /* Use iordy if available */ |
| 143 | 144 | |
| 145 | +#ifdef PATA_WINBOND_VLB_MODULE | |
| 146 | +static int winbond = 1; /* Set to probe Winbond controllers, | |
| 147 | + give I/O port if non standard */ | |
| 148 | +#else | |
| 149 | +static int winbond; /* Set to probe Winbond controllers, | |
| 150 | + give I/O port if non standard */ | |
| 151 | +#endif | |
| 152 | + | |
| 144 | 153 | /** |
| 145 | 154 | * legacy_probe_add - Add interface to probe list |
| 146 | 155 | * @port: Controller port |
| @@ -1297,6 +1306,7 @@ MODULE_AUTHOR("Alan Cox"); · 1150 unmodified lines | ||
| 1297 | 1306 | MODULE_DESCRIPTION("low-level driver for legacy ATA"); |
| 1298 | 1307 | MODULE_LICENSE("GPL"); |
| 1299 | 1308 | MODULE_VERSION(DRV_VERSION); |
| 1309 | +MODULE_ALIAS("pata_winbond"); | |
| 1300 | 1310 | |
| 1301 | 1311 | module_param(probe_all, int, 0); |
| 1302 | 1312 | module_param(autospeed, int, 0); |
| @@ -1305,6 +1315,7 @@ module_param(ht6560b, int, 0); · 2 unmodified lines | ||
| 1305 | 1315 | module_param(opti82c611a, int, 0); |
| 1306 | 1316 | module_param(opti82c46x, int, 0); |
| 1307 | 1317 | module_param(qdi, int, 0); |
| 1318 | +module_param(winbond, int, 0); | |
| 1308 | 1319 | module_param(pio_mask, int, 0); |
| 1309 | 1320 | module_param(iordy_mask, int, 0); |
| 1310 | 1321 | |
| @@ -417,6 +417,8 @@ static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) · 416 unmodified lines | ||
| 417 | 417 | tf->lbam, |
| 418 | 418 | tf->lbah); |
| 419 | 419 | } |
| 420 | + | |
| 421 | + ata_wait_idle(ap); | |
| 420 | 422 | } |
| 421 | 423 | |
| 422 | 424 | static int via_port_start(struct ata_port *ap) |
| @@ -1,282 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * pata_winbond.c - Winbond VLB ATA controllers | |
| 3 | − * (C) 2006 Red Hat | |
| 4 | − * | |
| 5 | − * Support for the Winbond 83759A when operating in advanced mode. | |
| 6 | − * Multichip mode is not currently supported. | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#include <linux/kernel.h> | |
| 10 | −#include <linux/module.h> | |
| 11 | −#include <linux/init.h> | |
| 12 | −#include <linux/blkdev.h> | |
| 13 | −#include <linux/delay.h> | |
| 14 | −#include <scsi/scsi_host.h> | |
| 15 | −#include <linux/libata.h> | |
| 16 | −#include <linux/platform_device.h> | |
| 17 | − | |
| 18 | −#define DRV_NAME "pata_winbond" | |
| 19 | −#define DRV_VERSION "0.0.3" | |
| 20 | − | |
| 21 | −#define NR_HOST 4 /* Two winbond controllers, two channels each */ | |
| 22 | − | |
| 23 | −struct winbond_data { | |
| 24 | − unsigned long config; | |
| 25 | − struct platform_device *platform_dev; | |
| 26 | −}; | |
| 27 | − | |
| 28 | −static struct ata_host *winbond_host[NR_HOST]; | |
| 29 | −static struct winbond_data winbond_data[NR_HOST]; | |
| 30 | −static int nr_winbond_host; | |
| 31 | − | |
| 32 | −#ifdef MODULE | |
| 33 | −static int probe_winbond = 1; | |
| 34 | −#else | |
| 35 | −static int probe_winbond; | |
| 36 | −#endif | |
| 37 | − | |
| 38 | −static DEFINE_SPINLOCK(winbond_lock); | |
| 39 | − | |
| 40 | −static void winbond_writecfg(unsigned long port, u8 reg, u8 val) | |
| 41 | −{ | |
| 42 | − unsigned long flags; | |
| 43 | − spin_lock_irqsave(&winbond_lock, flags); | |
| 44 | − outb(reg, port + 0x01); | |
| 45 | − outb(val, port + 0x02); | |
| 46 | − spin_unlock_irqrestore(&winbond_lock, flags); | |
| 47 | −} | |
| 48 | − | |
| 49 | −static u8 winbond_readcfg(unsigned long port, u8 reg) | |
| 50 | −{ | |
| 51 | − u8 val; | |
| 52 | − | |
| 53 | − unsigned long flags; | |
| 54 | − spin_lock_irqsave(&winbond_lock, flags); | |
| 55 | − outb(reg, port + 0x01); | |
| 56 | − val = inb(port + 0x02); | |
| 57 | − spin_unlock_irqrestore(&winbond_lock, flags); | |
| 58 | − | |
| 59 | − return val; | |
| 60 | −} | |
| 61 | − | |
| 62 | −static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |
| 63 | −{ | |
| 64 | − struct ata_timing t; | |
| 65 | − struct winbond_data *winbond = ap->host->private_data; | |
| 66 | − int active, recovery; | |
| 67 | − u8 reg; | |
| 68 | − int timing = 0x88 + (ap->port_no * 4) + (adev->devno * 2); | |
| 69 | − | |
| 70 | − reg = winbond_readcfg(winbond->config, 0x81); | |
| 71 | − | |
| 72 | − /* Get the timing data in cycles */ | |
| 73 | − if (reg & 0x40) /* Fast VLB bus, assume 50MHz */ | |
| 74 | − ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); | |
| 75 | − else | |
| 76 | − ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | |
| 77 | − | |
| 78 | − active = (clamp_val(t.active, 3, 17) - 1) & 0x0F; | |
| 79 | − recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F; | |
| 80 | − timing = (active << 4) | recovery; | |
| 81 | − winbond_writecfg(winbond->config, timing, reg); | |
| 82 | − | |
| 83 | − /* Load the setup timing */ | |
| 84 | − | |
| 85 | − reg = 0x35; | |
| 86 | − if (adev->class != ATA_DEV_ATA) | |
| 87 | − reg |= 0x08; /* FIFO off */ | |
| 88 | − if (!ata_pio_need_iordy(adev)) | |
| 89 | − reg |= 0x02; /* IORDY off */ | |
| 90 | − reg |= (clamp_val(t.setup, 0, 3) << 6); | |
| 91 | − winbond_writecfg(winbond->config, timing + 1, reg); | |
| 92 | −} | |
| 93 | − | |
| 94 | − | |
| 95 | −static unsigned int winbond_data_xfer(struct ata_device *dev, | |
| 96 | − unsigned char *buf, unsigned int buflen, int rw) | |
| 97 | −{ | |
| 98 | − struct ata_port *ap = dev->link->ap; | |
| 99 | − int slop = buflen & 3; | |
| 100 | − | |
| 101 | − if (ata_id_has_dword_io(dev->id)) { | |
| 102 | − if (rw == READ) | |
| 103 | − ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | |
| 104 | − else | |
| 105 | − iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | |
| 106 | − | |
| 107 | − if (unlikely(slop)) { | |
| 108 | − __le32 pad; | |
| 109 | − if (rw == READ) { | |
| 110 | − pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); | |
| 111 | − memcpy(buf + buflen - slop, &pad, slop); | |
| 112 | − } else { | |
| 113 | − memcpy(&pad, buf + buflen - slop, slop); | |
| 114 | − iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); | |
| 115 | − } | |
| 116 | − buflen += 4 - slop; | |
| 117 | − } | |
| 118 | − } else | |
| 119 | − buflen = ata_sff_data_xfer(dev, buf, buflen, rw); | |
| 120 | − | |
| 121 | − return buflen; | |
| 122 | −} | |
| 123 | − | |
| 124 | −static struct scsi_host_template winbond_sht = { | |
| 125 | − ATA_PIO_SHT(DRV_NAME), | |
| 126 | −}; | |
| 127 | − | |
| 128 | −static struct ata_port_operations winbond_port_ops = { | |
| 129 | − .inherits = &ata_sff_port_ops, | |
| 130 | − .sff_data_xfer = winbond_data_xfer, | |
| 131 | − .cable_detect = ata_cable_40wire, | |
| 132 | − .set_piomode = winbond_set_piomode, | |
| 133 | −}; | |
| 134 | − | |
| 135 | −/** | |
| 136 | − * winbond_init_one - attach a winbond interface | |
| 137 | − * @type: Type to display | |
| 138 | − * @io: I/O port start | |
| 139 | − * @irq: interrupt line | |
| 140 | − * @fast: True if on a > 33Mhz VLB | |
| 141 | − * | |
| 142 | − * Register a VLB bus IDE interface. Such interfaces are PIO and we | |
| 143 | − * assume do not support IRQ sharing. | |
| 144 | − */ | |
| 145 | − | |
| 146 | −static __init int winbond_init_one(unsigned long port) | |
| 147 | −{ | |
| 148 | − struct platform_device *pdev; | |
| 149 | − u8 reg; | |
| 150 | − int i, rc; | |
| 151 | − | |
| 152 | − reg = winbond_readcfg(port, 0x81); | |
| 153 | − reg |= 0x80; /* jumpered mode off */ | |
| 154 | − winbond_writecfg(port, 0x81, reg); | |
| 155 | − reg = winbond_readcfg(port, 0x83); | |
| 156 | − reg |= 0xF0; /* local control */ | |
| 157 | − winbond_writecfg(port, 0x83, reg); | |
| 158 | − reg = winbond_readcfg(port, 0x85); | |
| 159 | − reg |= 0xF0; /* programmable timing */ | |
| 160 | − winbond_writecfg(port, 0x85, reg); | |
| 161 | − | |
| 162 | − reg = winbond_readcfg(port, 0x81); | |
| 163 | − | |
| 164 | − if (!(reg & 0x03)) /* Disabled */ | |
| 165 | − return -ENODEV; | |
| 166 | − | |
| 167 | − for (i = 0; i < 2 ; i ++) { | |
| 168 | − unsigned long cmd_port = 0x1F0 - (0x80 * i); | |
| 169 | − unsigned long ctl_port = cmd_port + 0x206; | |
| 170 | − struct ata_host *host; | |
| 171 | − struct ata_port *ap; | |
| 172 | − void __iomem *cmd_addr, *ctl_addr; | |
| 173 | − | |
| 174 | − if (!(reg & (1 << i))) | |
| 175 | − continue; | |
| 176 | − | |
| 177 | − pdev = platform_device_register_simple(DRV_NAME, nr_winbond_host, NULL, 0); | |
| 178 | − if (IS_ERR(pdev)) | |
| 179 | − return PTR_ERR(pdev); | |
| 180 | − | |
| 181 | − rc = -ENOMEM; | |
| 182 | − host = ata_host_alloc(&pdev->dev, 1); | |
| 183 | − if (!host) | |
| 184 | − goto err_unregister; | |
| 185 | − ap = host->ports[0]; | |
| 186 | − | |
| 187 | − rc = -ENOMEM; | |
| 188 | − cmd_addr = devm_ioport_map(&pdev->dev, cmd_port, 8); | |
| 189 | − ctl_addr = devm_ioport_map(&pdev->dev, ctl_port, 1); | |
| 190 | − if (!cmd_addr || !ctl_addr) | |
| 191 | − goto err_unregister; | |
| 192 | − | |
| 193 | − ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", cmd_port, ctl_port); | |
| 194 | − | |
| 195 | − ap->ops = &winbond_port_ops; | |
| 196 | − ap->pio_mask = ATA_PIO4; | |
| 197 | − ap->flags |= ATA_FLAG_SLAVE_POSS; | |
| 198 | − ap->ioaddr.cmd_addr = cmd_addr; | |
| 199 | − ap->ioaddr.altstatus_addr = ctl_addr; | |
| 200 | − ap->ioaddr.ctl_addr = ctl_addr; | |
| 201 | − ata_sff_std_ports(&ap->ioaddr); | |
| 202 | − | |
| 203 | − /* hook in a private data structure per channel */ | |
| 204 | − host->private_data = &winbond_data[nr_winbond_host]; | |
| 205 | − winbond_data[nr_winbond_host].config = port; | |
| 206 | − winbond_data[nr_winbond_host].platform_dev = pdev; | |
| 207 | − | |
| 208 | − /* activate */ | |
| 209 | − rc = ata_host_activate(host, 14 + i, ata_sff_interrupt, 0, | |
| 210 | − &winbond_sht); | |
| 211 | − if (rc) | |
| 212 | − goto err_unregister; | |
| 213 | − | |
| 214 | − winbond_host[nr_winbond_host++] = dev_get_drvdata(&pdev->dev); | |
| 215 | − } | |
| 216 | − | |
| 217 | − return 0; | |
| 218 | − | |
| 219 | − err_unregister: | |
| 220 | − platform_device_unregister(pdev); | |
| 221 | − return rc; | |
| 222 | −} | |
| 223 | − | |
| 224 | −/** | |
| 225 | − * winbond_init - attach winbond interfaces | |
| 226 | − * | |
| 227 | − * Attach winbond IDE interfaces by scanning the ports it may occupy. | |
| 228 | − */ | |
| 229 | − | |
| 230 | −static __init int winbond_init(void) | |
| 231 | −{ | |
| 232 | − static const unsigned long config[2] = { 0x130, 0x1B0 }; | |
| 233 | − | |
| 234 | − int ct = 0; | |
| 235 | − int i; | |
| 236 | − | |
| 237 | − if (probe_winbond == 0) | |
| 238 | − return -ENODEV; | |
| 239 | − | |
| 240 | − /* | |
| 241 | − * Check both base addresses | |
| 242 | − */ | |
| 243 | − | |
| 244 | − for (i = 0; i < 2; i++) { | |
| 245 | − if (probe_winbond & (1<<i)) { | |
| 246 | − int ret = 0; | |
| 247 | − unsigned long port = config[i]; | |
| 248 | − | |
| 249 | − if (request_region(port, 2, "pata_winbond")) { | |
| 250 | − ret = winbond_init_one(port); | |
| 251 | − if (ret <= 0) | |
| 252 | − release_region(port, 2); | |
| 253 | − else ct+= ret; | |
| 254 | − } | |
| 255 | − } | |
| 256 | − } | |
| 257 | − if (ct != 0) | |
| 258 | − return 0; | |
| 259 | − return -ENODEV; | |
| 260 | −} | |
| 261 | − | |
| 262 | −static __exit void winbond_exit(void) | |
| 263 | −{ | |
| 264 | − int i; | |
| 265 | − | |
| 266 | − for (i = 0; i < nr_winbond_host; i++) { | |
| 267 | − ata_host_detach(winbond_host[i]); | |
| 268 | − release_region(winbond_data[i].config, 2); | |
| 269 | − platform_device_unregister(winbond_data[i].platform_dev); | |
| 270 | − } | |
| 271 | −} | |
| 272 | − | |
| 273 | −MODULE_AUTHOR("Alan Cox"); | |
| 274 | −MODULE_DESCRIPTION("low-level driver for Winbond VL ATA"); | |
| 275 | −MODULE_LICENSE("GPL"); | |
| 276 | −MODULE_VERSION(DRV_VERSION); | |
| 277 | − | |
| 278 | −module_init(winbond_init); | |
| 279 | −module_exit(winbond_exit); | |
| 280 | − | |
| 281 | −module_param(probe_winbond, int, 0); | |
| 282 | − | |
| @@ -1459,7 +1459,7 @@ static void sata_dwc_qc_prep_by_tag(struct ata_queued_cmd *qc, u8 tag) · 1458 unmodified lines | ||
| 1459 | 1459 | { |
| 1460 | 1460 | struct scatterlist *sg = qc->sg; |
| 1461 | 1461 | struct ata_port *ap = qc->ap; |
| 1462 | − u32 dma_chan; | |
| 1462 | + int dma_chan; | |
| 1463 | 1463 | struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); |
| 1464 | 1464 | struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); |
| 1465 | 1465 | int err; |
| @@ -1898,19 +1898,25 @@ static void mv_bmdma_start(struct ata_queued_cmd *qc) · 1897 unmodified lines | ||
| 1898 | 1898 | * LOCKING: |
| 1899 | 1899 | * Inherited from caller. |
| 1900 | 1900 | */ |
| 1901 | −static void mv_bmdma_stop(struct ata_queued_cmd *qc) | |
| 1901 | +static void mv_bmdma_stop_ap(struct ata_port *ap) | |
| 1902 | 1902 | { |
| 1903 | − struct ata_port *ap = qc->ap; | |
| 1904 | 1903 | void __iomem *port_mmio = mv_ap_base(ap); |
| 1905 | 1904 | u32 cmd; |
| 1906 | 1905 | |
| 1907 | 1906 | /* clear start/stop bit */ |
| 1908 | 1907 | cmd = readl(port_mmio + BMDMA_CMD); |
| 1909 | − cmd &= ~ATA_DMA_START; | |
| 1910 | − writelfl(cmd, port_mmio + BMDMA_CMD); | |
| 1908 | + if (cmd & ATA_DMA_START) { | |
| 1909 | + cmd &= ~ATA_DMA_START; | |
| 1910 | + writelfl(cmd, port_mmio + BMDMA_CMD); | |
| 1911 | + | |
| 1912 | + /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | |
| 1913 | + ata_sff_dma_pause(ap); | |
| 1914 | + } | |
| 1915 | +} | |
| 1911 | 1916 | |
| 1912 | − /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | |
| 1913 | − ata_sff_dma_pause(ap); | |
| 1917 | +static void mv_bmdma_stop(struct ata_queued_cmd *qc) | |
| 1918 | +{ | |
| 1919 | + mv_bmdma_stop_ap(qc->ap); | |
| 1914 | 1920 | } |
| 1915 | 1921 | |
| 1916 | 1922 | /** |
| @@ -1934,8 +1940,21 @@ static u8 mv_bmdma_status(struct ata_port *ap) · 17 unmodified lines | ||
| 1934 | 1940 | reg = readl(port_mmio + BMDMA_STATUS); |
| 1935 | 1941 | if (reg & ATA_DMA_ACTIVE) |
| 1936 | 1942 | status = ATA_DMA_ACTIVE; |
| 1937 | − else | |
| 1943 | + else if (reg & ATA_DMA_ERR) | |
| 1938 | 1944 | status = (reg & ATA_DMA_ERR) | ATA_DMA_INTR; |
| 1945 | + else { | |
| 1946 | + /* | |
| 1947 | + * Just because DMA_ACTIVE is 0 (DMA completed), | |
| 1948 | + * this does _not_ mean the device is "done". | |
| 1949 | + * So we should not yet be signalling ATA_DMA_INTR | |
| 1950 | + * in some cases. Eg. DSM/TRIM, and perhaps others. | |
| 1951 | + */ | |
| 1952 | + mv_bmdma_stop_ap(ap); | |
| 1953 | + if (ioread8(ap->ioaddr.altstatus_addr) & ATA_BUSY) | |
| 1954 | + status = 0; | |
| 1955 | + else | |
| 1956 | + status = ATA_DMA_INTR; | |
| 1957 | + } | |
| 1939 | 1958 | return status; |
| 1940 | 1959 | } |
| 1941 | 1960 | |
| @@ -1995,6 +2014,9 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) · 53 unmodified lines | ||
| 1995 | 2014 | |
| 1996 | 2015 | switch (tf->protocol) { |
| 1997 | 2016 | case ATA_PROT_DMA: |
| 2017 | + if (tf->command == ATA_CMD_DSM) | |
| 2018 | + return; | |
| 2019 | + /* fall-thru */ | |
| 1998 | 2020 | case ATA_PROT_NCQ: |
| 1999 | 2021 | break; /* continue below */ |
| 2000 | 2022 | case ATA_PROT_PIO: |
| @@ -2094,6 +2116,8 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc) · 93 unmodified lines | ||
| 2094 | 2116 | if ((tf->protocol != ATA_PROT_DMA) && |
| 2095 | 2117 | (tf->protocol != ATA_PROT_NCQ)) |
| 2096 | 2118 | return; |
| 2119 | + if (tf->command == ATA_CMD_DSM) | |
| 2120 | + return; /* use bmdma for this */ | |
| 2097 | 2121 | |
| 2098 | 2122 | /* Fill in Gen IIE command request block */ |
| 2099 | 2123 | if (!(tf->flags & ATA_TFLAG_WRITE)) |
| @@ -2260,7 +2284,7 @@ static unsigned int mv_qc_issue_fis(struct ata_queued_cmd *qc) · 160 unmodified lines | ||
| 2260 | 2284 | } |
| 2261 | 2285 | |
| 2262 | 2286 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
| 2263 | − ata_sff_queue_pio_task(ap, 0); | |
| 2287 | + ata_sff_queue_pio_task(link, 0); | |
| 2264 | 2288 | return 0; |
| 2265 | 2289 | } |
| 2266 | 2290 | |
| @@ -2289,6 +2313,12 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) · 22 unmodified lines | ||
| 2289 | 2313 | |
| 2290 | 2314 | switch (qc->tf.protocol) { |
| 2291 | 2315 | case ATA_PROT_DMA: |
| 2316 | + if (qc->tf.command == ATA_CMD_DSM) { | |
| 2317 | + if (!ap->ops->bmdma_setup) /* no bmdma on GEN_I */ | |
| 2318 | + return AC_ERR_OTHER; | |
| 2319 | + break; /* use bmdma for this */ | |
| 2320 | + } | |
| 2321 | + /* fall thru */ | |
| 2292 | 2322 | case ATA_PROT_NCQ: |
| 2293 | 2323 | mv_start_edma(ap, port_mmio, pp, qc->tf.protocol); |
| 2294 | 2324 | pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK; |
| @@ -59,6 +59,7 @@ void device_pm_init(struct device *dev) · 58 unmodified lines | ||
| 59 | 59 | { |
| 60 | 60 | dev->power.status = DPM_ON; |
| 61 | 61 | init_completion(&dev->power.completion); |
| 62 | + complete_all(&dev->power.completion); | |
| 62 | 63 | dev->power.wakeup_count = 0; |
| 63 | 64 | pm_runtime_init(dev); |
| 64 | 65 | } |
| @@ -297,6 +297,8 @@ static void enqueue_cmd_and_start_io(ctlr_info_t *h, · 296 unmodified lines | ||
| 297 | 297 | spin_lock_irqsave(&h->lock, flags); |
| 298 | 298 | addQ(&h->reqQ, c); |
| 299 | 299 | h->Qdepth++; |
| 300 | + if (h->Qdepth > h->maxQsinceinit) | |
| 301 | + h->maxQsinceinit = h->Qdepth; | |
| 300 | 302 | start_io(h); |
| 301 | 303 | spin_unlock_irqrestore(&h->lock, flags); |
| 302 | 304 | } |
| @@ -4519,6 +4521,12 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) · 4216 unmodified lines | ||
| 4519 | 4521 | misc_fw_support = readl(&cfgtable->misc_fw_support); |
| 4520 | 4522 | use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET; |
| 4521 | 4523 | |
| 4524 | + /* The doorbell reset seems to cause lockups on some Smart | |
| 4525 | + * Arrays (e.g. P410, P410i, maybe others). Until this is | |
| 4526 | + * fixed or at least isolated, avoid the doorbell reset. | |
| 4527 | + */ | |
| 4528 | + use_doorbell = 0; | |
| 4529 | + | |
| 4522 | 4530 | rc = cciss_controller_hard_reset(pdev, vaddr, use_doorbell); |
| 4523 | 4531 | if (rc) |
| 4524 | 4532 | goto unmap_cfgtable; |
| @@ -4712,6 +4720,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, · 187 unmodified lines | ||
| 4712 | 4720 | h->scatter_list = kmalloc(h->max_commands * |
| 4713 | 4721 | sizeof(struct scatterlist *), |
| 4714 | 4722 | GFP_KERNEL); |
| 4723 | + if (!h->scatter_list) | |
| 4724 | + goto clean4; | |
| 4725 | + | |
| 4715 | 4726 | for (k = 0; k < h->nr_cmds; k++) { |
| 4716 | 4727 | h->scatter_list[k] = kmalloc(sizeof(struct scatterlist) * |
| 4717 | 4728 | h->maxsgentries, |
| @@ -477,7 +477,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) · 476 unmodified lines | ||
| 477 | 477 | pos = ((loff_t) bio->bi_sector << 9) + lo->lo_offset; |
| 478 | 478 | |
| 479 | 479 | if (bio_rw(bio) == WRITE) { |
| 480 | − bool barrier = (bio->bi_rw & REQ_HARDBARRIER); | |
| 480 | + bool barrier = !!(bio->bi_rw & REQ_HARDBARRIER); | |
| 481 | 481 | struct file *file = lo->lo_backing_file; |
| 482 | 482 | |
| 483 | 483 | if (barrier) { |
| @@ -974,8 +974,7 @@ static int mg_probe(struct platform_device *plat_dev) · 973 unmodified lines | ||
| 974 | 974 | host->breq->queuedata = host; |
| 975 | 975 | |
| 976 | 976 | /* mflash is random device, thanx for the noop */ |
| 977 | − elevator_exit(host->breq->elevator); | |
| 978 | − err = elevator_init(host->breq, "noop"); | |
| 977 | + err = elevator_change(host->breq, "noop"); | |
| 979 | 978 | if (err) { |
| 980 | 979 | printk(KERN_ERR "%s:%d (elevator_init) fail\n", |
| 981 | 980 | __func__, __LINE__); |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <asm/smp.h> |
| 13 | 13 | #include "agp.h" |
| 14 | 14 | #include "intel-agp.h" |
| 15 | +#include <linux/intel-gtt.h> | |
| 15 | 16 | |
| 16 | 17 | #include "intel-gtt.c" |
| 17 | 18 | |
| @@ -815,11 +816,19 @@ static const struct intel_driver_description { · 797 unmodified lines | ||
| 815 | 816 | "HD Graphics", NULL, &intel_i965_driver }, |
| 816 | 817 | { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, |
| 817 | 818 | "HD Graphics", NULL, &intel_i965_driver }, |
| 818 | − { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG, | |
| 819 | + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG, | |
| 819 | 820 | "Sandybridge", NULL, &intel_gen6_driver }, |
| 820 | − { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG, | |
| 821 | + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG, | |
| 821 | 822 | "Sandybridge", NULL, &intel_gen6_driver }, |
| 822 | − { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_D0_IG, | |
| 823 | + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG, | |
| 824 | + "Sandybridge", NULL, &intel_gen6_driver }, | |
| 825 | + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG, | |
| 826 | + "Sandybridge", NULL, &intel_gen6_driver }, | |
| 827 | + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG, | |
| 828 | + "Sandybridge", NULL, &intel_gen6_driver }, | |
| 829 | + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG, | |
| 830 | + "Sandybridge", NULL, &intel_gen6_driver }, | |
| 831 | + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG, | |
| 823 | 832 | "Sandybridge", NULL, &intel_gen6_driver }, |
| 824 | 833 | { 0, 0, NULL, NULL, NULL } |
| 825 | 834 | }; |
| @@ -1044,6 +1053,7 @@ static struct pci_device_id agp_intel_pci_table[] = { · 218 unmodified lines | ||
| 1044 | 1053 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB), |
| 1045 | 1054 | ID(PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB), |
| 1046 | 1055 | ID(PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB), |
| 1056 | + ID(PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB), | |
| 1047 | 1057 | { } |
| 1048 | 1058 | }; |
| 1049 | 1059 | |
| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * Common Intel AGPGART and GTT definitions. |
| 3 | 3 | */ |
| 4 | +#ifndef _INTEL_AGP_H | |
| 5 | +#define _INTEL_AGP_H | |
| 4 | 6 | |
| 5 | 7 | /* Intel registers */ |
| 6 | 8 | #define INTEL_APSIZE 0xb4 |
| @@ -200,11 +202,16 @@ · 193 unmodified lines | ||
| 200 | 202 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB 0x0062 |
| 201 | 203 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB 0x006a |
| 202 | 204 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG 0x0046 |
| 203 | −#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB 0x0100 | |
| 204 | −#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG 0x0102 | |
| 205 | −#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB 0x0104 | |
| 206 | −#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG 0x0106 | |
| 207 | −#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_D0_IG 0x0126 | |
| 205 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB 0x0100 /* Desktop */ | |
| 206 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG 0x0102 | |
| 207 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG 0x0112 | |
| 208 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG 0x0122 | |
| 209 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB 0x0104 /* Mobile */ | |
| 210 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG 0x0106 | |
| 211 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG 0x0116 | |
| 212 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG 0x0126 | |
| 213 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB 0x0108 /* Server */ | |
| 214 | +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG 0x010A | |
| 208 | 215 | |
| 209 | 216 | /* cover 915 and 945 variants */ |
| 210 | 217 | #define IS_I915 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || \ |
| @@ -231,7 +238,8 @@ · 20 unmodified lines | ||
| 231 | 238 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB) |
| 232 | 239 | |
| 233 | 240 | #define IS_SNB (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || \ |
| 234 | − agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB) | |
| 241 | + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB || \ | |
| 242 | + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB) | |
| 235 | 243 | |
| 236 | 244 | #define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_EAGLELAKE_HB || \ |
| 237 | 245 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \ |
| @@ -244,3 +252,5 @@ · 6 unmodified lines | ||
| 244 | 252 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB || \ |
| 245 | 253 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB || \ |
| 246 | 254 | IS_SNB) |
| 255 | + | |
| 256 | +#endif | |
| @@ -49,6 +49,26 @@ static struct gatt_mask intel_i810_masks[] = · 48 unmodified lines | ||
| 49 | 49 | .type = INTEL_AGP_CACHED_MEMORY} |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | +#define INTEL_AGP_UNCACHED_MEMORY 0 | |
| 53 | +#define INTEL_AGP_CACHED_MEMORY_LLC 1 | |
| 54 | +#define INTEL_AGP_CACHED_MEMORY_LLC_GFDT 2 | |
| 55 | +#define INTEL_AGP_CACHED_MEMORY_LLC_MLC 3 | |
| 56 | +#define INTEL_AGP_CACHED_MEMORY_LLC_MLC_GFDT 4 | |
| 57 | + | |
| 58 | +static struct gatt_mask intel_gen6_masks[] = | |
| 59 | +{ | |
| 60 | + {.mask = I810_PTE_VALID | GEN6_PTE_UNCACHED, | |
| 61 | + .type = INTEL_AGP_UNCACHED_MEMORY }, | |
| 62 | + {.mask = I810_PTE_VALID | GEN6_PTE_LLC, | |
| 63 | + .type = INTEL_AGP_CACHED_MEMORY_LLC }, | |
| 64 | + {.mask = I810_PTE_VALID | GEN6_PTE_LLC | GEN6_PTE_GFDT, | |
| 65 | + .type = INTEL_AGP_CACHED_MEMORY_LLC_GFDT }, | |
| 66 | + {.mask = I810_PTE_VALID | GEN6_PTE_LLC_MLC, | |
| 67 | + .type = INTEL_AGP_CACHED_MEMORY_LLC_MLC }, | |
| 68 | + {.mask = I810_PTE_VALID | GEN6_PTE_LLC_MLC | GEN6_PTE_GFDT, | |
| 69 | + .type = INTEL_AGP_CACHED_MEMORY_LLC_MLC_GFDT }, | |
| 70 | +}; | |
| 71 | + | |
| 52 | 72 | static struct _intel_private { |
| 53 | 73 | struct pci_dev *pcidev; /* device one */ |
| 54 | 74 | u8 __iomem *registers; |
| @@ -178,13 +198,6 @@ static void intel_agp_insert_sg_entries(struct agp_memory *mem, · 123 unmodified lines | ||
| 178 | 198 | off_t pg_start, int mask_type) |
| 179 | 199 | { |
| 180 | 200 | int i, j; |
| 181 | − u32 cache_bits = 0; | |
| 182 | − | |
| 183 | − if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || | |
| 184 | − agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB) | |
| 185 | − { | |
| 186 | − cache_bits = GEN6_PTE_LLC_MLC; | |
| 187 | − } | |
| 188 | 201 | |
| 189 | 202 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { |
| 190 | 203 | writel(agp_bridge->driver->mask_memory(agp_bridge, |
| @@ -317,6 +330,23 @@ static int intel_i830_type_to_mask_type(struct agp_bridge_data *bridge, · 126 unmodified lines | ||
| 317 | 330 | return 0; |
| 318 | 331 | } |
| 319 | 332 | |
| 333 | +static int intel_gen6_type_to_mask_type(struct agp_bridge_data *bridge, | |
| 334 | + int type) | |
| 335 | +{ | |
| 336 | + unsigned int type_mask = type & ~AGP_USER_CACHED_MEMORY_GFDT; | |
| 337 | + unsigned int gfdt = type & AGP_USER_CACHED_MEMORY_GFDT; | |
| 338 | + | |
| 339 | + if (type_mask == AGP_USER_UNCACHED_MEMORY) | |
| 340 | + return INTEL_AGP_UNCACHED_MEMORY; | |
| 341 | + else if (type_mask == AGP_USER_CACHED_MEMORY_LLC_MLC) | |
| 342 | + return gfdt ? INTEL_AGP_CACHED_MEMORY_LLC_MLC_GFDT : | |
| 343 | + INTEL_AGP_CACHED_MEMORY_LLC_MLC; | |
| 344 | + else /* set 'normal'/'cached' to LLC by default */ | |
| 345 | + return gfdt ? INTEL_AGP_CACHED_MEMORY_LLC_GFDT : | |
| 346 | + INTEL_AGP_CACHED_MEMORY_LLC; | |
| 347 | +} | |
| 348 | + | |
| 349 | + | |
| 320 | 350 | static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start, |
| 321 | 351 | int type) |
| 322 | 352 | { |
| @@ -588,8 +618,7 @@ static void intel_i830_init_gtt_entries(void) · 265 unmodified lines | ||
| 588 | 618 | gtt_entries = 0; |
| 589 | 619 | break; |
| 590 | 620 | } |
| 591 | − } else if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || | |
| 592 | − agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB) { | |
| 621 | + } else if (IS_SNB) { | |
| 593 | 622 | /* |
| 594 | 623 | * SandyBridge has new memory control reg at 0x50.w |
| 595 | 624 | */ |
| @@ -1068,11 +1097,11 @@ static void intel_i9xx_setup_flush(void) · 472 unmodified lines | ||
| 1068 | 1097 | intel_i915_setup_chipset_flush(); |
| 1069 | 1098 | } |
| 1070 | 1099 | |
| 1071 | − if (intel_private.ifp_resource.start) { | |
| 1100 | + if (intel_private.ifp_resource.start) | |
| 1072 | 1101 | intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE); |
| 1073 | − if (!intel_private.i9xx_flush_page) | |
| 1074 | − dev_info(&intel_private.pcidev->dev, "can't ioremap flush page - no chipset flushing"); | |
| 1075 | − } | |
| 1102 | + if (!intel_private.i9xx_flush_page) | |
| 1103 | + dev_err(&intel_private.pcidev->dev, | |
| 1104 | + "can't ioremap flush page - no chipset flushing\n"); | |
| 1076 | 1105 | } |
| 1077 | 1106 | |
| 1078 | 1107 | static int intel_i9xx_configure(void) |
| @@ -1163,7 +1192,7 @@ static int intel_i915_insert_entries(struct agp_memory *mem, off_t pg_start, · 84 unmodified lines | ||
| 1163 | 1192 | |
| 1164 | 1193 | mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type); |
| 1165 | 1194 | |
| 1166 | − if (mask_type != 0 && mask_type != AGP_PHYS_MEMORY && | |
| 1195 | + if (!IS_SNB && mask_type != 0 && mask_type != AGP_PHYS_MEMORY && | |
| 1167 | 1196 | mask_type != INTEL_AGP_CACHED_MEMORY) |
| 1168 | 1197 | goto out_err; |
| 1169 | 1198 | |
| @@ -1333,8 +1362,8 @@ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge, · 163 unmodified lines | ||
| 1333 | 1362 | static unsigned long intel_gen6_mask_memory(struct agp_bridge_data *bridge, |
| 1334 | 1363 | dma_addr_t addr, int type) |
| 1335 | 1364 | { |
| 1336 | − /* Shift high bits down */ | |
| 1337 | − addr |= (addr >> 28) & 0xff; | |
| 1365 | + /* gen6 has bit11-4 for physical addr bit39-32 */ | |
| 1366 | + addr |= (addr >> 28) & 0xff0; | |
| 1338 | 1367 | |
| 1339 | 1368 | /* Type checking must be done elsewhere */ |
| 1340 | 1369 | return addr | bridge->driver->masks[type].mask; |
| @@ -1359,6 +1388,7 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) · 18 unmodified lines | ||
| 1359 | 1388 | break; |
| 1360 | 1389 | case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB: |
| 1361 | 1390 | case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB: |
| 1391 | + case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB: | |
| 1362 | 1392 | *gtt_offset = MB(2); |
| 1363 | 1393 | |
| 1364 | 1394 | pci_read_config_word(intel_private.pcidev, SNB_GMCH_CTRL, &snb_gmch_ctl); |
| @@ -1563,7 +1593,7 @@ static const struct agp_bridge_driver intel_gen6_driver = { · 198 unmodified lines | ||
| 1563 | 1593 | .fetch_size = intel_i9xx_fetch_size, |
| 1564 | 1594 | .cleanup = intel_i915_cleanup, |
| 1565 | 1595 | .mask_memory = intel_gen6_mask_memory, |
| 1566 | − .masks = intel_i810_masks, | |
| 1596 | + .masks = intel_gen6_masks, | |
| 1567 | 1597 | .agp_enable = intel_i810_agp_enable, |
| 1568 | 1598 | .cache_flush = global_cache_flush, |
| 1569 | 1599 | .create_gatt_table = intel_i965_create_gatt_table, |
| @@ -1576,7 +1606,7 @@ static const struct agp_bridge_driver intel_gen6_driver = { · 6 unmodified lines | ||
| 1576 | 1606 | .agp_alloc_pages = agp_generic_alloc_pages, |
| 1577 | 1607 | .agp_destroy_page = agp_generic_destroy_page, |
| 1578 | 1608 | .agp_destroy_pages = agp_generic_destroy_pages, |
| 1579 | − .agp_type_to_mask_type = intel_i830_type_to_mask_type, | |
| 1609 | + .agp_type_to_mask_type = intel_gen6_type_to_mask_type, | |
| 1580 | 1610 | .chipset_flush = intel_i915_chipset_flush, |
| 1581 | 1611 | #ifdef USE_PCI_DMA_API |
| 1582 | 1612 | .agp_map_page = intel_agp_map_page, |
| @@ -159,7 +159,7 @@ static void hangcheck_fire(unsigned long data) · 158 unmodified lines | ||
| 159 | 159 | if (hangcheck_dump_tasks) { |
| 160 | 160 | printk(KERN_CRIT "Hangcheck: Task state:\n"); |
| 161 | 161 | #ifdef CONFIG_MAGIC_SYSRQ |
| 162 | − handle_sysrq('t', NULL); | |
| 162 | + handle_sysrq('t'); | |
| 163 | 163 | #endif /* CONFIG_MAGIC_SYSRQ */ |
| 164 | 164 | } |
| 165 | 165 | if (hangcheck_reboot) { |
| @@ -651,7 +651,7 @@ int hvc_poll(struct hvc_struct *hp) · 650 unmodified lines | ||
| 651 | 651 | if (sysrq_pressed) |
| 652 | 652 | continue; |
| 653 | 653 | } else if (sysrq_pressed) { |
| 654 | − handle_sysrq(buf[i], tty); | |
| 654 | + handle_sysrq(buf[i]); | |
| 655 | 655 | sysrq_pressed = 0; |
| 656 | 656 | continue; |
| 657 | 657 | } |
| @@ -403,7 +403,7 @@ static void hvsi_insert_chars(struct hvsi_struct *hp, const char *buf, int len) · 402 unmodified lines | ||
| 403 | 403 | hp->sysrq = 1; |
| 404 | 404 | continue; |
| 405 | 405 | } else if (hp->sysrq) { |
| 406 | − handle_sysrq(c, hp->tty); | |
| 406 | + handle_sysrq(c); | |
| 407 | 407 | hp->sysrq = 0; |
| 408 | 408 | continue; |
| 409 | 409 | } |
| @@ -387,7 +387,7 @@ static int n2rng_init_control(struct n2rng *np) · 386 unmodified lines | ||
| 387 | 387 | |
| 388 | 388 | static int n2rng_data_read(struct hwrng *rng, u32 *data) |
| 389 | 389 | { |
| 390 | − struct n2rng *np = rng->priv; | |
| 390 | + struct n2rng *np = (struct n2rng *) rng->priv; | |
| 391 | 391 | unsigned long ra = __pa(&np->test_data); |
| 392 | 392 | int len; |
| 393 | 393 | |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/interrupt.h> |
| 19 | 19 | #include <linux/mm.h> |
| 20 | 20 | #include <linux/fs.h> |
| 21 | −#include <linux/tty.h> | |
| 22 | 21 | #include <linux/mount.h> |
| 23 | 22 | #include <linux/kdev_t.h> |
| 24 | 23 | #include <linux/major.h> |
| @@ -76,7 +75,7 @@ static int __init sysrq_always_enabled_setup(char *str) · 51 unmodified lines | ||
| 76 | 75 | __setup("sysrq_always_enabled", sysrq_always_enabled_setup); |
| 77 | 76 | |
| 78 | 77 | |
| 79 | −static void sysrq_handle_loglevel(int key, struct tty_struct *tty) | |
| 78 | +static void sysrq_handle_loglevel(int key) | |
| 80 | 79 | { |
| 81 | 80 | int i; |
| 82 | 81 | |
| @@ -93,7 +92,7 @@ static struct sysrq_key_op sysrq_loglevel_op = { · 10 unmodified lines | ||
| 93 | 92 | }; |
| 94 | 93 | |
| 95 | 94 | #ifdef CONFIG_VT |
| 96 | −static void sysrq_handle_SAK(int key, struct tty_struct *tty) | |
| 95 | +static void sysrq_handle_SAK(int key) | |
| 97 | 96 | { |
| 98 | 97 | struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work; |
| 99 | 98 | schedule_work(SAK_work); |
| @@ -109,7 +108,7 @@ static struct sysrq_key_op sysrq_SAK_op = { · 9 unmodified lines | ||
| 109 | 108 | #endif |
| 110 | 109 | |
| 111 | 110 | #ifdef CONFIG_VT |
| 112 | −static void sysrq_handle_unraw(int key, struct tty_struct *tty) | |
| 111 | +static void sysrq_handle_unraw(int key) | |
| 113 | 112 | { |
| 114 | 113 | struct kbd_struct *kbd = &kbd_table[fg_console]; |
| 115 | 114 | |
| @@ -126,7 +125,7 @@ static struct sysrq_key_op sysrq_unraw_op = { · 10 unmodified lines | ||
| 126 | 125 | #define sysrq_unraw_op (*(struct sysrq_key_op *)NULL) |
| 127 | 126 | #endif /* CONFIG_VT */ |
| 128 | 127 | |
| 129 | −static void sysrq_handle_crash(int key, struct tty_struct *tty) | |
| 128 | +static void sysrq_handle_crash(int key) | |
| 130 | 129 | { |
| 131 | 130 | char *killer = NULL; |
| 132 | 131 | |
| @@ -141,7 +140,7 @@ static struct sysrq_key_op sysrq_crash_op = { · 8 unmodified lines | ||
| 141 | 140 | .enable_mask = SYSRQ_ENABLE_DUMP, |
| 142 | 141 | }; |
| 143 | 142 | |
| 144 | −static void sysrq_handle_reboot(int key, struct tty_struct *tty) | |
| 143 | +static void sysrq_handle_reboot(int key) | |
| 145 | 144 | { |
| 146 | 145 | lockdep_off(); |
| 147 | 146 | local_irq_enable(); |
| @@ -154,7 +153,7 @@ static struct sysrq_key_op sysrq_reboot_op = { · 6 unmodified lines | ||
| 154 | 153 | .enable_mask = SYSRQ_ENABLE_BOOT, |
| 155 | 154 | }; |
| 156 | 155 | |
| 157 | −static void sysrq_handle_sync(int key, struct tty_struct *tty) | |
| 156 | +static void sysrq_handle_sync(int key) | |
| 158 | 157 | { |
| 159 | 158 | emergency_sync(); |
| 160 | 159 | } |
| @@ -165,7 +164,7 @@ static struct sysrq_key_op sysrq_sync_op = { · 4 unmodified lines | ||
| 165 | 164 | .enable_mask = SYSRQ_ENABLE_SYNC, |
| 166 | 165 | }; |
| 167 | 166 | |
| 168 | −static void sysrq_handle_show_timers(int key, struct tty_struct *tty) | |
| 167 | +static void sysrq_handle_show_timers(int key) | |
| 169 | 168 | { |
| 170 | 169 | sysrq_timer_list_show(); |
| 171 | 170 | } |
| @@ -176,7 +175,7 @@ static struct sysrq_key_op sysrq_show_timers_op = { · 4 unmodified lines | ||
| 176 | 175 | .action_msg = "Show clockevent devices & pending hrtimers (no others)", |
| 177 | 176 | }; |
| 178 | 177 | |
| 179 | −static void sysrq_handle_mountro(int key, struct tty_struct *tty) | |
| 178 | +static void sysrq_handle_mountro(int key) | |
| 180 | 179 | { |
| 181 | 180 | emergency_remount(); |
| 182 | 181 | } |
| @@ -188,7 +187,7 @@ static struct sysrq_key_op sysrq_mountro_op = { · 5 unmodified lines | ||
| 188 | 187 | }; |
| 189 | 188 | |
| 190 | 189 | #ifdef CONFIG_LOCKDEP |
| 191 | −static void sysrq_handle_showlocks(int key, struct tty_struct *tty) | |
| 190 | +static void sysrq_handle_showlocks(int key) | |
| 192 | 191 | { |
| 193 | 192 | debug_show_all_locks(); |
| 194 | 193 | } |
| @@ -226,7 +225,7 @@ static void sysrq_showregs_othercpus(struct work_struct *dummy) · 31 unmodified lines | ||
| 226 | 225 | |
| 227 | 226 | static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus); |
| 228 | 227 | |
| 229 | −static void sysrq_handle_showallcpus(int key, struct tty_struct *tty) | |
| 228 | +static void sysrq_handle_showallcpus(int key) | |
| 230 | 229 | { |
| 231 | 230 | /* |
| 232 | 231 | * Fall back to the workqueue based printing if the |
| @@ -252,7 +251,7 @@ static struct sysrq_key_op sysrq_showallcpus_op = { · 19 unmodified lines | ||
| 252 | 251 | }; |
| 253 | 252 | #endif |
| 254 | 253 | |
| 255 | −static void sysrq_handle_showregs(int key, struct tty_struct *tty) | |
| 254 | +static void sysrq_handle_showregs(int key) | |
| 256 | 255 | { |
| 257 | 256 | struct pt_regs *regs = get_irq_regs(); |
| 258 | 257 | if (regs) |
| @@ -266,7 +265,7 @@ static struct sysrq_key_op sysrq_showregs_op = { · 7 unmodified lines | ||
| 266 | 265 | .enable_mask = SYSRQ_ENABLE_DUMP, |
| 267 | 266 | }; |
| 268 | 267 | |
| 269 | −static void sysrq_handle_showstate(int key, struct tty_struct *tty) | |
| 268 | +static void sysrq_handle_showstate(int key) | |
| 270 | 269 | { |
| 271 | 270 | show_state(); |
| 272 | 271 | } |
| @@ -277,7 +276,7 @@ static struct sysrq_key_op sysrq_showstate_op = { · 4 unmodified lines | ||
| 277 | 276 | .enable_mask = SYSRQ_ENABLE_DUMP, |
| 278 | 277 | }; |
| 279 | 278 | |
| 280 | −static void sysrq_handle_showstate_blocked(int key, struct tty_struct *tty) | |
| 279 | +static void sysrq_handle_showstate_blocked(int key) | |
| 281 | 280 | { |
| 282 | 281 | show_state_filter(TASK_UNINTERRUPTIBLE); |
| 283 | 282 | } |
| @@ -291,7 +290,7 @@ static struct sysrq_key_op sysrq_showstate_blocked_op = { · 7 unmodified lines | ||
| 291 | 290 | #ifdef CONFIG_TRACING |
| 292 | 291 | #include <linux/ftrace.h> |
| 293 | 292 | |
| 294 | −static void sysrq_ftrace_dump(int key, struct tty_struct *tty) | |
| 293 | +static void sysrq_ftrace_dump(int key) | |
| 295 | 294 | { |
| 296 | 295 | ftrace_dump(DUMP_ALL); |
| 297 | 296 | } |
| @@ -305,7 +304,7 @@ static struct sysrq_key_op sysrq_ftrace_dump_op = { · 7 unmodified lines | ||
| 305 | 304 | #define sysrq_ftrace_dump_op (*(struct sysrq_key_op *)NULL) |
| 306 | 305 | #endif |
| 307 | 306 | |
| 308 | −static void sysrq_handle_showmem(int key, struct tty_struct *tty) | |
| 307 | +static void sysrq_handle_showmem(int key) | |
| 309 | 308 | { |
| 310 | 309 | show_mem(); |
| 311 | 310 | } |
| @@ -330,7 +329,7 @@ static void send_sig_all(int sig) · 18 unmodified lines | ||
| 330 | 329 | } |
| 331 | 330 | } |
| 332 | 331 | |
| 333 | −static void sysrq_handle_term(int key, struct tty_struct *tty) | |
| 332 | +static void sysrq_handle_term(int key) | |
| 334 | 333 | { |
| 335 | 334 | send_sig_all(SIGTERM); |
| 336 | 335 | console_loglevel = 8; |
| @@ -349,7 +348,7 @@ static void moom_callback(struct work_struct *ignored) · 12 unmodified lines | ||
| 349 | 348 | |
| 350 | 349 | static DECLARE_WORK(moom_work, moom_callback); |
| 351 | 350 | |
| 352 | −static void sysrq_handle_moom(int key, struct tty_struct *tty) | |
| 351 | +static void sysrq_handle_moom(int key) | |
| 353 | 352 | { |
| 354 | 353 | schedule_work(&moom_work); |
| 355 | 354 | } |
| @@ -361,7 +360,7 @@ static struct sysrq_key_op sysrq_moom_op = { · 5 unmodified lines | ||
| 361 | 360 | }; |
| 362 | 361 | |
| 363 | 362 | #ifdef CONFIG_BLOCK |
| 364 | −static void sysrq_handle_thaw(int key, struct tty_struct *tty) | |
| 363 | +static void sysrq_handle_thaw(int key) | |
| 365 | 364 | { |
| 366 | 365 | emergency_thaw_all(); |
| 367 | 366 | } |
| @@ -373,7 +372,7 @@ static struct sysrq_key_op sysrq_thaw_op = { · 5 unmodified lines | ||
| 373 | 372 | }; |
| 374 | 373 | #endif |
| 375 | 374 | |
| 376 | −static void sysrq_handle_kill(int key, struct tty_struct *tty) | |
| 375 | +static void sysrq_handle_kill(int key) | |
| 377 | 376 | { |
| 378 | 377 | send_sig_all(SIGKILL); |
| 379 | 378 | console_loglevel = 8; |
| @@ -385,7 +384,7 @@ static struct sysrq_key_op sysrq_kill_op = { · 5 unmodified lines | ||
| 385 | 384 | .enable_mask = SYSRQ_ENABLE_SIGNAL, |
| 386 | 385 | }; |
| 387 | 386 | |
| 388 | −static void sysrq_handle_unrt(int key, struct tty_struct *tty) | |
| 387 | +static void sysrq_handle_unrt(int key) | |
| 389 | 388 | { |
| 390 | 389 | normalize_rt_tasks(); |
| 391 | 390 | } |
| @@ -493,7 +492,7 @@ static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p) · 101 unmodified lines | ||
| 493 | 492 | sysrq_key_table[i] = op_p; |
| 494 | 493 | } |
| 495 | 494 | |
| 496 | −void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) | |
| 495 | +void __handle_sysrq(int key, bool check_mask) | |
| 497 | 496 | { |
| 498 | 497 | struct sysrq_key_op *op_p; |
| 499 | 498 | int orig_log_level; |
| @@ -520,7 +519,7 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) · 20 unmodified lines | ||
| 520 | 519 | if (!check_mask || sysrq_on_mask(op_p->enable_mask)) { |
| 521 | 520 | printk("%s\n", op_p->action_msg); |
| 522 | 521 | console_loglevel = orig_log_level; |
| 523 | − op_p->handler(key, tty); | |
| 522 | + op_p->handler(key); | |
| 524 | 523 | } else { |
| 525 | 524 | printk("This sysrq operation is disabled.\n"); |
| 526 | 525 | } |
| @@ -545,10 +544,10 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) · 18 unmodified lines | ||
| 545 | 544 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); |
| 546 | 545 | } |
| 547 | 546 | |
| 548 | −void handle_sysrq(int key, struct tty_struct *tty) | |
| 547 | +void handle_sysrq(int key) | |
| 549 | 548 | { |
| 550 | 549 | if (sysrq_on()) |
| 551 | − __handle_sysrq(key, tty, 1); | |
| 550 | + __handle_sysrq(key, true); | |
| 552 | 551 | } |
| 553 | 552 | EXPORT_SYMBOL(handle_sysrq); |
| 554 | 553 | |
| @@ -597,7 +596,7 @@ static bool sysrq_filter(struct input_handle *handle, unsigned int type, · 42 unmodified lines | ||
| 597 | 596 | |
| 598 | 597 | default: |
| 599 | 598 | if (sysrq_down && value && value != 2) |
| 600 | − __handle_sysrq(sysrq_xlate[code], NULL, 1); | |
| 599 | + __handle_sysrq(sysrq_xlate[code], true); | |
| 601 | 600 | break; |
| 602 | 601 | } |
| 603 | 602 | |
| @@ -765,7 +764,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, · 161 unmodified lines | ||
| 765 | 764 | |
| 766 | 765 | if (get_user(c, buf)) |
| 767 | 766 | return -EFAULT; |
| 768 | − __handle_sysrq(c, NULL, 0); | |
| 767 | + __handle_sysrq(c, false); | |
| 769 | 768 | } |
| 770 | 769 | |
| 771 | 770 | return count; |
| @@ -355,7 +355,7 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) · 354 unmodified lines | ||
| 355 | 355 | if (*stp == '\0') |
| 356 | 356 | stp = NULL; |
| 357 | 357 | |
| 358 | − if (tty_line >= 0 && tty_line <= p->num && p->ops && | |
| 358 | + if (tty_line >= 0 && tty_line < p->num && p->ops && | |
| 359 | 359 | p->ops->poll_init && !p->ops->poll_init(p, tty_line, stp)) { |
| 360 | 360 | res = tty_driver_kref_get(p); |
| 361 | 361 | *line = tty_line; |
| @@ -906,22 +906,16 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, · 905 unmodified lines | ||
| 906 | 906 | * bottom of buffer |
| 907 | 907 | */ |
| 908 | 908 | old_origin += (old_rows - new_rows) * old_row_size; |
| 909 | − end = vc->vc_scr_end; | |
| 910 | 909 | } else { |
| 911 | 910 | /* |
| 912 | 911 | * Cursor is in no man's land, copy 1/2 screenful |
| 913 | 912 | * from the top and bottom of cursor position |
| 914 | 913 | */ |
| 915 | 914 | old_origin += (vc->vc_y - new_rows/2) * old_row_size; |
| 916 | − end = old_origin + (old_row_size * new_rows); | |
| 917 | 915 | } |
| 918 | − } else | |
| 919 | − /* | |
| 920 | − * Cursor near the top, copy contents from the top of buffer | |
| 921 | − */ | |
| 922 | − end = (old_rows > new_rows) ? old_origin + | |
| 923 | − (old_row_size * new_rows) : | |
| 924 | − vc->vc_scr_end; | |
| 916 | + } | |
| 917 | + | |
| 918 | + end = old_origin + old_row_size * min(old_rows, new_rows); | |
| 925 | 919 | |
| 926 | 920 | update_attr(vc); |
| 927 | 921 | |
| @@ -3075,8 +3069,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, · 2147 unmodified lines | ||
| 3075 | 3069 | |
| 3076 | 3070 | old_was_color = vc->vc_can_do_color; |
| 3077 | 3071 | vc->vc_sw->con_deinit(vc); |
| 3078 | − if (!vc->vc_origin) | |
| 3079 | − vc->vc_origin = (unsigned long)vc->vc_screenbuf; | |
| 3072 | + vc->vc_origin = (unsigned long)vc->vc_screenbuf; | |
| 3080 | 3073 | visual_init(vc, i, 0); |
| 3081 | 3074 | set_origin(vc); |
| 3082 | 3075 | update_attr(vc); |
| @@ -533,11 +533,14 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, · 532 unmodified lines | ||
| 533 | 533 | case KIOCSOUND: |
| 534 | 534 | if (!perm) |
| 535 | 535 | goto eperm; |
| 536 | − /* FIXME: This is an old broken API but we need to keep it | |
| 537 | − supported and somehow separate the historic advertised | |
| 538 | − tick rate from any real one */ | |
| 536 | + /* | |
| 537 | + * The use of PIT_TICK_RATE is historic, it used to be | |
| 538 | + * the platform-dependent CLOCK_TICK_RATE between 2.6.12 | |
| 539 | + * and 2.6.36, which was a minor but unfortunate ABI | |
| 540 | + * change. | |
| 541 | + */ | |
| 539 | 542 | if (arg) |
| 540 | − arg = CLOCK_TICK_RATE / arg; | |
| 543 | + arg = PIT_TICK_RATE / arg; | |
| 541 | 544 | kd_mksound(arg, 0); |
| 542 | 545 | break; |
| 543 | 546 | |
| @@ -553,11 +556,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, · 9 unmodified lines | ||
| 553 | 556 | */ |
| 554 | 557 | ticks = HZ * ((arg >> 16) & 0xffff) / 1000; |
| 555 | 558 | count = ticks ? (arg & 0xffff) : 0; |
| 556 | − /* FIXME: This is an old broken API but we need to keep it | |
| 557 | − supported and somehow separate the historic advertised | |
| 558 | − tick rate from any real one */ | |
| 559 | 559 | if (count) |
| 560 | − count = CLOCK_TICK_RATE / count; | |
| 560 | + count = PIT_TICK_RATE / count; | |
| 561 | 561 | kd_mksound(count, ticks); |
| 562 | 562 | break; |
| 563 | 563 | } |
| @@ -2071,16 +2071,6 @@ static inline void __amd64_decode_bus_error(struct mem_ctl_info *mci, · 2070 unmodified lines | ||
| 2071 | 2071 | amd64_handle_ce(mci, info); |
| 2072 | 2072 | else if (ecc_type == 1) |
| 2073 | 2073 | amd64_handle_ue(mci, info); |
| 2074 | − | |
| 2075 | − /* | |
| 2076 | − * If main error is CE then overflow must be CE. If main error is UE | |
| 2077 | − * then overflow is unknown. We'll call the overflow a CE - if | |
| 2078 | − * panic_on_ue is set then we're already panic'ed and won't arrive | |
| 2079 | − * here. Else, then apparently someone doesn't think that UE's are | |
| 2080 | − * catastrophic. | |
| 2081 | − */ | |
| 2082 | − if (info->nbsh & K8_NBSH_OVERFLOW) | |
| 2083 | − edac_mc_handle_ce_no_info(mci, EDAC_MOD_STR " Error Overflow"); | |
| 2084 | 2074 | } |
| 2085 | 2075 | |
| 2086 | 2076 | void amd64_decode_bus_error(int node_id, struct err_regs *regs) |
| @@ -365,11 +365,10 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val, · 364 unmodified lines | ||
| 365 | 365 | |
| 366 | 366 | pr_emerg("MC%d_STATUS: ", m->bank); |
| 367 | 367 | |
| 368 | − pr_cont("%sorrected error, report: %s, MiscV: %svalid, " | |
| 368 | + pr_cont("%sorrected error, other errors lost: %s, " | |
| 369 | 369 | "CPU context corrupt: %s", |
| 370 | 370 | ((m->status & MCI_STATUS_UC) ? "Unc" : "C"), |
| 371 | − ((m->status & MCI_STATUS_EN) ? "yes" : "no"), | |
| 372 | − ((m->status & MCI_STATUS_MISCV) ? "" : "in"), | |
| 371 | + ((m->status & MCI_STATUS_OVER) ? "yes" : "no"), | |
| 373 | 372 | ((m->status & MCI_STATUS_PCC) ? "yes" : "no")); |
| 374 | 373 | |
| 375 | 374 | /* do the two bits[14:13] together */ |
| @@ -426,11 +425,15 @@ static struct notifier_block amd_mce_dec_nb = { · 50 unmodified lines | ||
| 426 | 425 | static int __init mce_amd_init(void) |
| 427 | 426 | { |
| 428 | 427 | /* |
| 429 | − * We can decode MCEs for Opteron and later CPUs: | |
| 428 | + * We can decode MCEs for K8, F10h and F11h CPUs: | |
| 430 | 429 | */ |
| 431 | − if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && | |
| 432 | − (boot_cpu_data.x86 >= 0xf)) | |
| 433 | − atomic_notifier_chain_register(&x86_mce_decoder_chain, &amd_mce_dec_nb); | |
| 430 | + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) | |
| 431 | + return 0; | |
| 432 | + | |
| 433 | + if (boot_cpu_data.x86 < 0xf || boot_cpu_data.x86 > 0x11) | |
| 434 | + return 0; | |
| 435 | + | |
| 436 | + atomic_notifier_chain_register(&x86_mce_decoder_chain, &amd_mce_dec_nb); | |
| 434 | 437 | |
| 435 | 438 | return 0; |
| 436 | 439 | } |
| @@ -81,6 +81,10 @@ static int close_transaction(struct fw_transaction *transaction, · 80 unmodified lines | ||
| 81 | 81 | spin_lock_irqsave(&card->lock, flags); |
| 82 | 82 | list_for_each_entry(t, &card->transaction_list, link) { |
| 83 | 83 | if (t == transaction) { |
| 84 | + if (!del_timer(&t->split_timeout_timer)) { | |
| 85 | + spin_unlock_irqrestore(&card->lock, flags); | |
| 86 | + goto timed_out; | |
| 87 | + } | |
| 84 | 88 | list_del_init(&t->link); |
| 85 | 89 | card->tlabel_mask &= ~(1ULL << t->tlabel); |
| 86 | 90 | break; |
| @@ -89,11 +93,11 @@ static int close_transaction(struct fw_transaction *transaction, · 2 unmodified lines | ||
| 89 | 93 | spin_unlock_irqrestore(&card->lock, flags); |
| 90 | 94 | |
| 91 | 95 | if (&t->link != &card->transaction_list) { |
| 92 | − del_timer_sync(&t->split_timeout_timer); | |
| 93 | 96 | t->callback(card, rcode, NULL, 0, t->callback_data); |
| 94 | 97 | return 0; |
| 95 | 98 | } |
| 96 | 99 | |
| 100 | + timed_out: | |
| 97 | 101 | return -ENOENT; |
| 98 | 102 | } |
| 99 | 103 | |
| @@ -921,6 +925,10 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) · 821 unmodified lines | ||
| 921 | 925 | spin_lock_irqsave(&card->lock, flags); |
| 922 | 926 | list_for_each_entry(t, &card->transaction_list, link) { |
| 923 | 927 | if (t->node_id == source && t->tlabel == tlabel) { |
| 928 | + if (!del_timer(&t->split_timeout_timer)) { | |
| 929 | + spin_unlock_irqrestore(&card->lock, flags); | |
| 930 | + goto timed_out; | |
| 931 | + } | |
| 924 | 932 | list_del_init(&t->link); |
| 925 | 933 | card->tlabel_mask &= ~(1ULL << t->tlabel); |
| 926 | 934 | break; |
| @@ -929,6 +937,7 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) · 2 unmodified lines | ||
| 929 | 937 | spin_unlock_irqrestore(&card->lock, flags); |
| 930 | 938 | |
| 931 | 939 | if (&t->link == &card->transaction_list) { |
| 940 | + timed_out: | |
| 932 | 941 | fw_notify("Unsolicited response (source %x, tlabel %x)\n", |
| 933 | 942 | source, tlabel); |
| 934 | 943 | return; |
| @@ -963,8 +972,6 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) · 28 unmodified lines | ||
| 963 | 972 | break; |
| 964 | 973 | } |
| 965 | 974 | |
| 966 | − del_timer_sync(&t->split_timeout_timer); | |
| 967 | − | |
| 968 | 975 | /* |
| 969 | 976 | * The response handler may be executed while the request handler |
| 970 | 977 | * is still pending. Cancel the request handler. |
| @@ -579,7 +579,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net, · 578 unmodified lines | ||
| 579 | 579 | if (!peer) { |
| 580 | 580 | fw_notify("No peer for ARP packet from %016llx\n", |
| 581 | 581 | (unsigned long long)peer_guid); |
| 582 | − goto failed_proto; | |
| 582 | + goto no_peer; | |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | /* |
| @@ -656,7 +656,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net, · 70 unmodified lines | ||
| 656 | 656 | |
| 657 | 657 | return 0; |
| 658 | 658 | |
| 659 | − failed_proto: | |
| 659 | + no_peer: | |
| 660 | 660 | net->stats.rx_errors++; |
| 661 | 661 | net->stats.rx_dropped++; |
| 662 | 662 | |
| @@ -664,7 +664,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net, · 1 unmodified line | ||
| 664 | 664 | if (netif_queue_stopped(net)) |
| 665 | 665 | netif_wake_queue(net); |
| 666 | 666 | |
| 667 | − return 0; | |
| 667 | + return -ENOENT; | |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, |
| @@ -701,7 +701,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, · 30 unmodified lines | ||
| 701 | 701 | fw_error("out of memory\n"); |
| 702 | 702 | net->stats.rx_dropped++; |
| 703 | 703 | |
| 704 | − return -1; | |
| 704 | + return -ENOMEM; | |
| 705 | 705 | } |
| 706 | 706 | skb_reserve(skb, (net->hard_header_len + 15) & ~15); |
| 707 | 707 | memcpy(skb_put(skb, len), buf, len); |
| @@ -726,8 +726,10 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, · 18 unmodified lines | ||
| 726 | 726 | spin_lock_irqsave(&dev->lock, flags); |
| 727 | 727 | |
| 728 | 728 | peer = fwnet_peer_find_by_node_id(dev, source_node_id, generation); |
| 729 | − if (!peer) | |
| 730 | − goto bad_proto; | |
| 729 | + if (!peer) { | |
| 730 | + retval = -ENOENT; | |
| 731 | + goto fail; | |
| 732 | + } | |
| 731 | 733 | |
| 732 | 734 | pd = fwnet_pd_find(peer, datagram_label); |
| 733 | 735 | if (pd == NULL) { |
| @@ -741,7 +743,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, · 7 unmodified lines | ||
| 741 | 743 | dg_size, buf, fg_off, len); |
| 742 | 744 | if (pd == NULL) { |
| 743 | 745 | retval = -ENOMEM; |
| 744 | − goto bad_proto; | |
| 746 | + goto fail; | |
| 745 | 747 | } |
| 746 | 748 | peer->pdg_size++; |
| 747 | 749 | } else { |
| @@ -755,9 +757,9 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, · 7 unmodified lines | ||
| 755 | 757 | pd = fwnet_pd_new(net, peer, datagram_label, |
| 756 | 758 | dg_size, buf, fg_off, len); |
| 757 | 759 | if (pd == NULL) { |
| 758 | − retval = -ENOMEM; | |
| 759 | 760 | peer->pdg_size--; |
| 760 | − goto bad_proto; | |
| 761 | + retval = -ENOMEM; | |
| 762 | + goto fail; | |
| 761 | 763 | } |
| 762 | 764 | } else { |
| 763 | 765 | if (!fwnet_pd_update(peer, pd, buf, fg_off, len)) { |
| @@ -768,7 +770,8 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, · 4 unmodified lines | ||
| 768 | 770 | */ |
| 769 | 771 | fwnet_pd_delete(pd); |
| 770 | 772 | peer->pdg_size--; |
| 771 | − goto bad_proto; | |
| 773 | + retval = -ENOMEM; | |
| 774 | + goto fail; | |
| 772 | 775 | } |
| 773 | 776 | } |
| 774 | 777 | } /* new datagram or add to existing one */ |
| @@ -794,14 +797,13 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, · 19 unmodified lines | ||
| 794 | 797 | spin_unlock_irqrestore(&dev->lock, flags); |
| 795 | 798 | |
| 796 | 799 | return 0; |
| 797 | − | |
| 798 | − bad_proto: | |
| 800 | + fail: | |
| 799 | 801 | spin_unlock_irqrestore(&dev->lock, flags); |
| 800 | 802 | |
| 801 | 803 | if (netif_queue_stopped(net)) |
| 802 | 804 | netif_wake_queue(net); |
| 803 | 805 | |
| 804 | − return 0; | |
| 806 | + return retval; | |
| 805 | 807 | } |
| 806 | 808 | |
| 807 | 809 | static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r, |
| @@ -694,7 +694,15 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) · 693 unmodified lines | ||
| 694 | 694 | log_ar_at_event('R', p.speed, p.header, evt); |
| 695 | 695 | |
| 696 | 696 | /* |
| 697 | − * The OHCI bus reset handler synthesizes a phy packet with | |
| 697 | + * Several controllers, notably from NEC and VIA, forget to | |
| 698 | + * write ack_complete status at PHY packet reception. | |
| 699 | + */ | |
| 700 | + if (evt == OHCI1394_evt_no_status && | |
| 701 | + (p.header[0] & 0xff) == (OHCI1394_phy_tcode << 4)) | |
| 702 | + p.ack = ACK_COMPLETE; | |
| 703 | + | |
| 704 | + /* | |
| 705 | + * The OHCI bus reset handler synthesizes a PHY packet with | |
| 698 | 706 | * the new generation number when a bus reset happens (see |
| 699 | 707 | * section 8.4.2.3). This helps us determine when a request |
| 700 | 708 | * was received and make sure we send the response in the same |
| @@ -450,7 +450,7 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, · 449 unmodified lines | ||
| 450 | 450 | |
| 451 | 451 | if (&orb->link != &lu->orb_list) { |
| 452 | 452 | orb->callback(orb, &status); |
| 453 | − kref_put(&orb->kref, free_orb); | |
| 453 | + kref_put(&orb->kref, free_orb); /* orb callback reference */ | |
| 454 | 454 | } else { |
| 455 | 455 | fw_error("status write for unknown orb\n"); |
| 456 | 456 | } |
| @@ -472,20 +472,28 @@ static void complete_transaction(struct fw_card *card, int rcode, · 15 unmodified lines | ||
| 472 | 472 | * So this callback only sets the rcode if it hasn't already |
| 473 | 473 | * been set and only does the cleanup if the transaction |
| 474 | 474 | * failed and we didn't already get a status write. |
| 475 | + * | |
| 476 | + * Here we treat RCODE_CANCELLED like RCODE_COMPLETE because some | |
| 477 | + * OXUF936QSE firmwares occasionally respond after Split_Timeout and | |
| 478 | + * complete the ORB just fine. Note, we also get RCODE_CANCELLED | |
| 479 | + * from sbp2_cancel_orbs() if fw_cancel_transaction() == 0. | |
| 475 | 480 | */ |
| 476 | 481 | spin_lock_irqsave(&card->lock, flags); |
| 477 | 482 | |
| 478 | 483 | if (orb->rcode == -1) |
| 479 | 484 | orb->rcode = rcode; |
| 480 | − if (orb->rcode != RCODE_COMPLETE) { | |
| 485 | + | |
| 486 | + if (orb->rcode != RCODE_COMPLETE && orb->rcode != RCODE_CANCELLED) { | |
| 481 | 487 | list_del(&orb->link); |
| 482 | 488 | spin_unlock_irqrestore(&card->lock, flags); |
| 489 | + | |
| 483 | 490 | orb->callback(orb, NULL); |
| 491 | + kref_put(&orb->kref, free_orb); /* orb callback reference */ | |
| 484 | 492 | } else { |
| 485 | 493 | spin_unlock_irqrestore(&card->lock, flags); |
| 486 | 494 | } |
| 487 | 495 | |
| 488 | − kref_put(&orb->kref, free_orb); | |
| 496 | + kref_put(&orb->kref, free_orb); /* transaction callback reference */ | |
| 489 | 497 | } |
| 490 | 498 | |
| 491 | 499 | static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, |
| @@ -501,9 +509,8 @@ static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, · 9 unmodified lines | ||
| 501 | 509 | list_add_tail(&orb->link, &lu->orb_list); |
| 502 | 510 | spin_unlock_irqrestore(&device->card->lock, flags); |
| 503 | 511 | |
| 504 | − /* Take a ref for the orb list and for the transaction callback. */ | |
| 505 | − kref_get(&orb->kref); | |
| 506 | − kref_get(&orb->kref); | |
| 512 | + kref_get(&orb->kref); /* transaction callback reference */ | |
| 513 | + kref_get(&orb->kref); /* orb callback reference */ | |
| 507 | 514 | |
| 508 | 515 | fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST, |
| 509 | 516 | node_id, generation, device->max_speed, offset, |
| @@ -525,11 +532,11 @@ static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu) · 15 unmodified lines | ||
| 525 | 532 | |
| 526 | 533 | list_for_each_entry_safe(orb, next, &list, link) { |
| 527 | 534 | retval = 0; |
| 528 | − if (fw_cancel_transaction(device->card, &orb->t) == 0) | |
| 529 | − continue; | |
| 535 | + fw_cancel_transaction(device->card, &orb->t); | |
| 530 | 536 | |
| 531 | 537 | orb->rcode = RCODE_CANCELLED; |
| 532 | 538 | orb->callback(orb, NULL); |
| 539 | + kref_put(&orb->kref, free_orb); /* orb callback reference */ | |
| 533 | 540 | } |
| 534 | 541 | |
| 535 | 542 | return retval; |
| @@ -459,17 +459,33 @@ static int sx150x_init_io(struct sx150x_chip *chip, u8 base, u16 cfg) · 458 unmodified lines | ||
| 459 | 459 | return err; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | −static int sx150x_init_hw(struct sx150x_chip *chip, | |
| 463 | − struct sx150x_platform_data *pdata) | |
| 462 | +static int sx150x_reset(struct sx150x_chip *chip) | |
| 464 | 463 | { |
| 465 | − int err = 0; | |
| 464 | + int err; | |
| 466 | 465 | |
| 467 | − err = i2c_smbus_write_word_data(chip->client, | |
| 466 | + err = i2c_smbus_write_byte_data(chip->client, | |
| 468 | 467 | chip->dev_cfg->reg_reset, |
| 469 | − 0x3412); | |
| 468 | + 0x12); | |
| 470 | 469 | if (err < 0) |
| 471 | 470 | return err; |
| 472 | 471 | |
| 472 | + err = i2c_smbus_write_byte_data(chip->client, | |
| 473 | + chip->dev_cfg->reg_reset, | |
| 474 | + 0x34); | |
| 475 | + return err; | |
| 476 | +} | |
| 477 | + | |
| 478 | +static int sx150x_init_hw(struct sx150x_chip *chip, | |
| 479 | + struct sx150x_platform_data *pdata) | |
| 480 | +{ | |
| 481 | + int err = 0; | |
| 482 | + | |
| 483 | + if (pdata->reset_during_probe) { | |
| 484 | + err = sx150x_reset(chip); | |
| 485 | + if (err < 0) | |
| 486 | + return err; | |
| 487 | + } | |
| 488 | + | |
| 473 | 489 | err = sx150x_i2c_write(chip->client, |
| 474 | 490 | chip->dev_cfg->reg_misc, |
| 475 | 491 | 0x01); |
| @@ -34,6 +34,9 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "drm_crtc_helper.h" |
| 35 | 35 | #include "drm_fb_helper.h" |
| 36 | 36 | |
| 37 | +static bool drm_kms_helper_poll = true; | |
| 38 | +module_param_named(poll, drm_kms_helper_poll, bool, 0600); | |
| 39 | + | |
| 37 | 40 | static void drm_mode_validate_flag(struct drm_connector *connector, |
| 38 | 41 | int flags) |
| 39 | 42 | { |
| @@ -99,8 +102,10 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, · 59 unmodified lines | ||
| 99 | 102 | connector->status = connector_status_disconnected; |
| 100 | 103 | if (connector->funcs->force) |
| 101 | 104 | connector->funcs->force(connector); |
| 102 | − } else | |
| 105 | + } else { | |
| 103 | 106 | connector->status = connector->funcs->detect(connector); |
| 107 | + drm_helper_hpd_irq_event(dev); | |
| 108 | + } | |
| 104 | 109 | |
| 105 | 110 | if (connector->status == connector_status_disconnected) { |
| 106 | 111 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", |
| @@ -110,11 +115,10 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, · 3 unmodified lines | ||
| 110 | 115 | } |
| 111 | 116 | |
| 112 | 117 | count = (*connector_funcs->get_modes)(connector); |
| 113 | − if (!count) { | |
| 118 | + if (count == 0 && connector->status == connector_status_connected) | |
| 114 | 119 | count = drm_add_modes_noedid(connector, 1024, 768); |
| 115 | − if (!count) | |
| 116 | − return 0; | |
| 117 | − } | |
| 120 | + if (count == 0) | |
| 121 | + goto prune; | |
| 118 | 122 | |
| 119 | 123 | drm_mode_connector_list_update(connector); |
| 120 | 124 | |
| @@ -840,6 +844,9 @@ static void output_poll_execute(struct work_struct *work) · 719 unmodified lines | ||
| 840 | 844 | enum drm_connector_status old_status, status; |
| 841 | 845 | bool repoll = false, changed = false; |
| 842 | 846 | |
| 847 | + if (!drm_kms_helper_poll) | |
| 848 | + return; | |
| 849 | + | |
| 843 | 850 | mutex_lock(&dev->mode_config.mutex); |
| 844 | 851 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 845 | 852 | |
| @@ -890,6 +897,9 @@ void drm_kms_helper_poll_enable(struct drm_device *dev) · 44 unmodified lines | ||
| 890 | 897 | bool poll = false; |
| 891 | 898 | struct drm_connector *connector; |
| 892 | 899 | |
| 900 | + if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) | |
| 901 | + return; | |
| 902 | + | |
| 893 | 903 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 894 | 904 | if (connector->polled) |
| 895 | 905 | poll = true; |
| @@ -919,8 +929,10 @@ void drm_helper_hpd_irq_event(struct drm_device *dev) · 23 unmodified lines | ||
| 919 | 929 | { |
| 920 | 930 | if (!dev->mode_config.poll_enabled) |
| 921 | 931 | return; |
| 932 | + | |
| 922 | 933 | /* kill timer and schedule immediate execution, this doesn't block */ |
| 923 | 934 | cancel_delayed_work(&dev->mode_config.output_poll_work); |
| 924 | − queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0); | |
| 935 | + if (drm_kms_helper_poll) | |
| 936 | + queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0); | |
| 925 | 937 | } |
| 926 | 938 | EXPORT_SYMBOL(drm_helper_hpd_irq_event); |
| @@ -370,7 +370,7 @@ static void drm_fb_helper_restore_work_fn(struct work_struct *ignored) · 369 unmodified lines | ||
| 370 | 370 | } |
| 371 | 371 | static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn); |
| 372 | 372 | |
| 373 | −static void drm_fb_helper_sysrq(int dummy1, struct tty_struct *dummy3) | |
| 373 | +static void drm_fb_helper_sysrq(int dummy1) | |
| 374 | 374 | { |
| 375 | 375 | schedule_work(&drm_fb_helper_restore_work); |
| 376 | 376 | } |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | /* from BKL pushdown: note that nothing else serializes idr_find() */ |
| 43 | 43 | DEFINE_MUTEX(drm_global_mutex); |
| 44 | +EXPORT_SYMBOL(drm_global_mutex); | |
| 44 | 45 | |
| 45 | 46 | static int drm_open_helper(struct inode *inode, struct file *filp, |
| 46 | 47 | struct drm_device * dev); |
| @@ -92,7 +92,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) · 91 unmodified lines | ||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /* Contention */ |
| 95 | + mutex_unlock(&drm_global_mutex); | |
| 95 | 96 | schedule(); |
| 97 | + mutex_lock(&drm_global_mutex); | |
| 96 | 98 | if (signal_pending(current)) { |
| 97 | 99 | ret = -EINTR; |
| 98 | 100 | break; |
| @@ -285,21 +285,21 @@ void drm_mm_put_block(struct drm_mm_node *cur) · 284 unmodified lines | ||
| 285 | 285 | |
| 286 | 286 | EXPORT_SYMBOL(drm_mm_put_block); |
| 287 | 287 | |
| 288 | −static int check_free_mm_node(struct drm_mm_node *entry, unsigned long size, | |
| 289 | − unsigned alignment) | |
| 288 | +static int check_free_hole(unsigned long start, unsigned long end, | |
| 289 | + unsigned long size, unsigned alignment) | |
| 290 | 290 | { |
| 291 | 291 | unsigned wasted = 0; |
| 292 | 292 | |
| 293 | − if (entry->size < size) | |
| 293 | + if (end - start < size) | |
| 294 | 294 | return 0; |
| 295 | 295 | |
| 296 | 296 | if (alignment) { |
| 297 | − register unsigned tmp = entry->start % alignment; | |
| 297 | + unsigned tmp = start % alignment; | |
| 298 | 298 | if (tmp) |
| 299 | 299 | wasted = alignment - tmp; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | − if (entry->size >= size + wasted) { | |
| 302 | + if (end >= start + size + wasted) { | |
| 303 | 303 | return 1; |
| 304 | 304 | } |
| 305 | 305 | |
| @@ -320,7 +320,8 @@ struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, · 14 unmodified lines | ||
| 320 | 320 | best_size = ~0UL; |
| 321 | 321 | |
| 322 | 322 | list_for_each_entry(entry, &mm->free_stack, free_stack) { |
| 323 | − if (!check_free_mm_node(entry, size, alignment)) | |
| 323 | + if (!check_free_hole(entry->start, entry->start + entry->size, | |
| 324 | + size, alignment)) | |
| 324 | 325 | continue; |
| 325 | 326 | |
| 326 | 327 | if (!best_match) |
| @@ -353,10 +354,12 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm, · 26 unmodified lines | ||
| 353 | 354 | best_size = ~0UL; |
| 354 | 355 | |
| 355 | 356 | list_for_each_entry(entry, &mm->free_stack, free_stack) { |
| 356 | − if (entry->start > end || (entry->start+entry->size) < start) | |
| 357 | − continue; | |
| 357 | + unsigned long adj_start = entry->start < start ? | |
| 358 | + start : entry->start; | |
| 359 | + unsigned long adj_end = entry->start + entry->size > end ? | |
| 360 | + end : entry->start + entry->size; | |
| 358 | 361 | |
| 359 | − if (!check_free_mm_node(entry, size, alignment)) | |
| 362 | + if (!check_free_hole(adj_start, adj_end, size, alignment)) | |
| 360 | 363 | continue; |
| 361 | 364 | |
| 362 | 365 | if (!best_match) |
| @@ -449,7 +452,8 @@ int drm_mm_scan_add_block(struct drm_mm_node *node) · 86 unmodified lines | ||
| 449 | 452 | node->free_stack.prev = prev_free; |
| 450 | 453 | node->free_stack.next = next_free; |
| 451 | 454 | |
| 452 | − if (check_free_mm_node(node, mm->scan_size, mm->scan_alignment)) { | |
| 455 | + if (check_free_hole(node->start, node->start + node->size, | |
| 456 | + mm->scan_size, mm->scan_alignment)) { | |
| 453 | 457 | mm->scan_hit_start = node->start; |
| 454 | 458 | mm->scan_hit_size = node->size; |
| 455 | 459 | |
| @@ -251,7 +251,10 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, · 250 unmodified lines | ||
| 251 | 251 | drm_mode->htotal = drm_mode->hdisplay + CVT_RB_H_BLANK; |
| 252 | 252 | /* Fill in HSync values */ |
| 253 | 253 | drm_mode->hsync_end = drm_mode->hdisplay + CVT_RB_H_BLANK / 2; |
| 254 | − drm_mode->hsync_start = drm_mode->hsync_end = CVT_RB_H_SYNC; | |
| 254 | + drm_mode->hsync_start = drm_mode->hsync_end - CVT_RB_H_SYNC; | |
| 255 | + /* Fill in VSync values */ | |
| 256 | + drm_mode->vsync_start = drm_mode->vdisplay + CVT_RB_VFPORCH; | |
| 257 | + drm_mode->vsync_end = drm_mode->vsync_start + vsync; | |
| 255 | 258 | } |
| 256 | 259 | /* 15/13. Find pixel clock frequency (kHz for xf86) */ |
| 257 | 260 | drm_mode->clock = drm_mode->htotal * HV_FACTOR * 1000 / hperiod; |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <linux/slab.h> |
| 32 | 32 | #include "drmP.h" |
| 33 | 33 | #include "drm.h" |
| 34 | +#include "intel_drv.h" | |
| 34 | 35 | #include "i915_drm.h" |
| 35 | 36 | #include "i915_drv.h" |
| 36 | 37 | |
| @@ -121,6 +122,54 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) · 84 unmodified lines | ||
| 121 | 122 | return 0; |
| 122 | 123 | } |
| 123 | 124 | |
| 125 | +static int i915_gem_pageflip_info(struct seq_file *m, void *data) | |
| 126 | +{ | |
| 127 | + struct drm_info_node *node = (struct drm_info_node *) m->private; | |
| 128 | + struct drm_device *dev = node->minor->dev; | |
| 129 | + unsigned long flags; | |
| 130 | + struct intel_crtc *crtc; | |
| 131 | + | |
| 132 | + list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) { | |
| 133 | + const char *pipe = crtc->pipe ? "B" : "A"; | |
| 134 | + const char *plane = crtc->plane ? "B" : "A"; | |
| 135 | + struct intel_unpin_work *work; | |
| 136 | + | |
| 137 | + spin_lock_irqsave(&dev->event_lock, flags); | |
| 138 | + work = crtc->unpin_work; | |
| 139 | + if (work == NULL) { | |
| 140 | + seq_printf(m, "No flip due on pipe %s (plane %s)\n", | |
| 141 | + pipe, plane); | |
| 142 | + } else { | |
| 143 | + if (!work->pending) { | |
| 144 | + seq_printf(m, "Flip queued on pipe %s (plane %s)\n", | |
| 145 | + pipe, plane); | |
| 146 | + } else { | |
| 147 | + seq_printf(m, "Flip pending (waiting for vsync) on pipe %s (plane %s)\n", | |
| 148 | + pipe, plane); | |
| 149 | + } | |
| 150 | + if (work->enable_stall_check) | |
| 151 | + seq_printf(m, "Stall check enabled, "); | |
| 152 | + else | |
| 153 | + seq_printf(m, "Stall check waiting for page flip ioctl, "); | |
| 154 | + seq_printf(m, "%d prepares\n", work->pending); | |
| 155 | + | |
| 156 | + if (work->old_fb_obj) { | |
| 157 | + struct drm_i915_gem_object *obj_priv = to_intel_bo(work->old_fb_obj); | |
| 158 | + if(obj_priv) | |
| 159 | + seq_printf(m, "Old framebuffer gtt_offset 0x%08x\n", obj_priv->gtt_offset ); | |
| 160 | + } | |
| 161 | + if (work->pending_flip_obj) { | |
| 162 | + struct drm_i915_gem_object *obj_priv = to_intel_bo(work->pending_flip_obj); | |
| 163 | + if(obj_priv) | |
| 164 | + seq_printf(m, "New framebuffer gtt_offset 0x%08x\n", obj_priv->gtt_offset ); | |
| 165 | + } | |
| 166 | + } | |
| 167 | + spin_unlock_irqrestore(&dev->event_lock, flags); | |
| 168 | + } | |
| 169 | + | |
| 170 | + return 0; | |
| 171 | +} | |
| 172 | + | |
| 124 | 173 | static int i915_gem_request_info(struct seq_file *m, void *data) |
| 125 | 174 | { |
| 126 | 175 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
| @@ -777,6 +826,7 @@ static struct drm_info_list i915_debugfs_list[] = { · 650 unmodified lines | ||
| 777 | 826 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, |
| 778 | 827 | {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST}, |
| 779 | 828 | {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST}, |
| 829 | + {"i915_gem_pageflip", i915_gem_pageflip_info, 0}, | |
| 780 | 830 | {"i915_gem_request", i915_gem_request_info, 0}, |
| 781 | 831 | {"i915_gem_seqno", i915_gem_seqno_info, 0}, |
| 782 | 832 | {"i915_gem_fence_regs", i915_gem_fence_regs_info, 0}, |
| @@ -620,8 +620,10 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, · 619 unmodified lines | ||
| 620 | 620 | ret = copy_from_user(cliprects, batch->cliprects, |
| 621 | 621 | batch->num_cliprects * |
| 622 | 622 | sizeof(struct drm_clip_rect)); |
| 623 | − if (ret != 0) | |
| 623 | + if (ret != 0) { | |
| 624 | + ret = -EFAULT; | |
| 624 | 625 | goto fail_free; |
| 626 | + } | |
| 625 | 627 | } |
| 626 | 628 | |
| 627 | 629 | mutex_lock(&dev->struct_mutex); |
| @@ -662,8 +664,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, · 34 unmodified lines | ||
| 662 | 664 | return -ENOMEM; |
| 663 | 665 | |
| 664 | 666 | ret = copy_from_user(batch_data, cmdbuf->buf, cmdbuf->sz); |
| 665 | − if (ret != 0) | |
| 667 | + if (ret != 0) { | |
| 668 | + ret = -EFAULT; | |
| 666 | 669 | goto fail_batch_free; |
| 670 | + } | |
| 667 | 671 | |
| 668 | 672 | if (cmdbuf->num_cliprects) { |
| 669 | 673 | cliprects = kcalloc(cmdbuf->num_cliprects, |
| @@ -676,8 +680,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, · 6 unmodified lines | ||
| 676 | 680 | ret = copy_from_user(cliprects, cmdbuf->cliprects, |
| 677 | 681 | cmdbuf->num_cliprects * |
| 678 | 682 | sizeof(struct drm_clip_rect)); |
| 679 | − if (ret != 0) | |
| 683 | + if (ret != 0) { | |
| 684 | + ret = -EFAULT; | |
| 680 | 685 | goto fail_clip_free; |
| 686 | + } | |
| 681 | 687 | } |
| 682 | 688 | |
| 683 | 689 | mutex_lock(&dev->struct_mutex); |
| @@ -885,7 +891,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev) · 201 unmodified lines | ||
| 885 | 891 | int reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915; |
| 886 | 892 | u32 temp_lo, temp_hi = 0; |
| 887 | 893 | u64 mchbar_addr; |
| 888 | − int ret = 0; | |
| 894 | + int ret; | |
| 889 | 895 | |
| 890 | 896 | if (IS_I965G(dev)) |
| 891 | 897 | pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi); |
| @@ -895,22 +901,23 @@ intel_alloc_mchbar_resource(struct drm_device *dev) · 3 unmodified lines | ||
| 895 | 901 | /* If ACPI doesn't have it, assume we need to allocate it ourselves */ |
| 896 | 902 | #ifdef CONFIG_PNP |
| 897 | 903 | if (mchbar_addr && |
| 898 | − pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) { | |
| 899 | − ret = 0; | |
| 900 | − goto out; | |
| 901 | − } | |
| 904 | + pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) | |
| 905 | + return 0; | |
| 902 | 906 | #endif |
| 903 | 907 | |
| 904 | 908 | /* Get some space for it */ |
| 905 | − ret = pci_bus_alloc_resource(dev_priv->bridge_dev->bus, &dev_priv->mch_res, | |
| 909 | + dev_priv->mch_res.name = "i915 MCHBAR"; | |
| 910 | + dev_priv->mch_res.flags = IORESOURCE_MEM; | |
| 911 | + ret = pci_bus_alloc_resource(dev_priv->bridge_dev->bus, | |
| 912 | + &dev_priv->mch_res, | |
| 906 | 913 | MCHBAR_SIZE, MCHBAR_SIZE, |
| 907 | 914 | PCIBIOS_MIN_MEM, |
| 908 | − 0, pcibios_align_resource, | |
| 915 | + 0, pcibios_align_resource, | |
| 909 | 916 | dev_priv->bridge_dev); |
| 910 | 917 | if (ret) { |
| 911 | 918 | DRM_DEBUG_DRIVER("failed bus alloc: %d\n", ret); |
| 912 | 919 | dev_priv->mch_res.start = 0; |
| 913 | − goto out; | |
| 920 | + return ret; | |
| 914 | 921 | } |
| 915 | 922 | |
| 916 | 923 | if (IS_I965G(dev)) |
| @@ -919,8 +926,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev) · 2 unmodified lines | ||
| 919 | 926 | |
| 920 | 927 | pci_write_config_dword(dev_priv->bridge_dev, reg, |
| 921 | 928 | lower_32_bits(dev_priv->mch_res.start)); |
| 922 | −out: | |
| 923 | − return ret; | |
| 929 | + return 0; | |
| 924 | 930 | } |
| 925 | 931 | |
| 926 | 932 | /* Setup MCHBAR if possible, return true if we should disable it again */ |
| @@ -2082,6 +2088,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 1155 unmodified lines | ||
| 2082 | 2088 | goto free_priv; |
| 2083 | 2089 | } |
| 2084 | 2090 | |
| 2091 | + /* overlay on gen2 is broken and can't address above 1G */ | |
| 2092 | + if (IS_GEN2(dev)) | |
| 2093 | + dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30)); | |
| 2094 | + | |
| 2085 | 2095 | dev_priv->regs = ioremap(base, size); |
| 2086 | 2096 | if (!dev_priv->regs) { |
| 2087 | 2097 | DRM_ERROR("failed to map registers\n"); |
| @@ -61,91 +61,86 @@ extern int intel_agp_enabled; · 60 unmodified lines | ||
| 61 | 61 | .driver_data = (unsigned long) info } |
| 62 | 62 | |
| 63 | 63 | static const struct intel_device_info intel_i830_info = { |
| 64 | − .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, | |
| 64 | + .gen = 2, .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, | |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | 67 | static const struct intel_device_info intel_845g_info = { |
| 68 | − .is_i8xx = 1, | |
| 68 | + .gen = 2, .is_i8xx = 1, | |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | 71 | static const struct intel_device_info intel_i85x_info = { |
| 72 | − .is_i8xx = 1, .is_i85x = 1, .is_mobile = 1, | |
| 72 | + .gen = 2, .is_i8xx = 1, .is_i85x = 1, .is_mobile = 1, | |
| 73 | 73 | .cursor_needs_physical = 1, |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | 76 | static const struct intel_device_info intel_i865g_info = { |
| 77 | − .is_i8xx = 1, | |
| 77 | + .gen = 2, .is_i8xx = 1, | |
| 78 | 78 | }; |
| 79 | 79 | |
| 80 | 80 | static const struct intel_device_info intel_i915g_info = { |
| 81 | − .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1, | |
| 81 | + .gen = 3, .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1, | |
| 82 | 82 | }; |
| 83 | 83 | static const struct intel_device_info intel_i915gm_info = { |
| 84 | − .is_i9xx = 1, .is_mobile = 1, | |
| 84 | + .gen = 3, .is_i9xx = 1, .is_mobile = 1, | |
| 85 | 85 | .cursor_needs_physical = 1, |
| 86 | 86 | }; |
| 87 | 87 | static const struct intel_device_info intel_i945g_info = { |
| 88 | − .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1, | |
| 88 | + .gen = 3, .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1, | |
| 89 | 89 | }; |
| 90 | 90 | static const struct intel_device_info intel_i945gm_info = { |
| 91 | − .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, | |
| 91 | + .gen = 3, .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, | |
| 92 | 92 | .has_hotplug = 1, .cursor_needs_physical = 1, |
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 95 | static const struct intel_device_info intel_i965g_info = { |
| 96 | − .is_broadwater = 1, .is_i965g = 1, .is_i9xx = 1, .has_hotplug = 1, | |
| 96 | + .gen = 4, .is_broadwater = 1, .is_i965g = 1, .is_i9xx = 1, | |
| 97 | + .has_hotplug = 1, | |
| 97 | 98 | }; |
| 98 | 99 | |
| 99 | 100 | static const struct intel_device_info intel_i965gm_info = { |
| 100 | − .is_crestline = 1, .is_i965g = 1, .is_i965gm = 1, .is_i9xx = 1, | |
| 101 | − .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1, | |
| 102 | − .has_hotplug = 1, | |
| 101 | + .gen = 4, .is_crestline = 1, .is_i965g = 1, .is_i965gm = 1, .is_i9xx = 1, | |
| 102 | + .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1, | |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | 105 | static const struct intel_device_info intel_g33_info = { |
| 106 | − .is_g33 = 1, .is_i9xx = 1, .need_gfx_hws = 1, | |
| 107 | − .has_hotplug = 1, | |
| 106 | + .gen = 3, .is_g33 = 1, .is_i9xx = 1, | |
| 107 | + .need_gfx_hws = 1, .has_hotplug = 1, | |
| 108 | 108 | }; |
| 109 | 109 | |
| 110 | 110 | static const struct intel_device_info intel_g45_info = { |
| 111 | − .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1, | |
| 112 | − .has_pipe_cxsr = 1, | |
| 113 | − .has_hotplug = 1, | |
| 111 | + .gen = 4, .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1, | |
| 112 | + .has_pipe_cxsr = 1, .has_hotplug = 1, | |
| 114 | 113 | }; |
| 115 | 114 | |
| 116 | 115 | static const struct intel_device_info intel_gm45_info = { |
| 117 | − .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, | |
| 116 | + .gen = 4, .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, | |
| 118 | 117 | .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, |
| 119 | − .has_pipe_cxsr = 1, | |
| 120 | − .has_hotplug = 1, | |
| 118 | + .has_pipe_cxsr = 1, .has_hotplug = 1, | |
| 121 | 119 | }; |
| 122 | 120 | |
| 123 | 121 | static const struct intel_device_info intel_pineview_info = { |
| 124 | − .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1, | |
| 125 | − .need_gfx_hws = 1, | |
| 126 | − .has_hotplug = 1, | |
| 122 | + .gen = 3, .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1, | |
| 123 | + .need_gfx_hws = 1, .has_hotplug = 1, | |
| 127 | 124 | }; |
| 128 | 125 | |
| 129 | 126 | static const struct intel_device_info intel_ironlake_d_info = { |
| 130 | − .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1, | |
| 131 | − .has_pipe_cxsr = 1, | |
| 132 | − .has_hotplug = 1, | |
| 127 | + .gen = 5, .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, | |
| 128 | + .need_gfx_hws = 1, .has_pipe_cxsr = 1, .has_hotplug = 1, | |
| 133 | 129 | }; |
| 134 | 130 | |
| 135 | 131 | static const struct intel_device_info intel_ironlake_m_info = { |
| 136 | − .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1, | |
| 137 | − .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, | |
| 138 | − .has_hotplug = 1, | |
| 132 | + .gen = 5, .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1, | |
| 133 | + .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1, | |
| 139 | 134 | }; |
| 140 | 135 | |
| 141 | 136 | static const struct intel_device_info intel_sandybridge_d_info = { |
| 142 | − .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1, | |
| 143 | − .has_hotplug = 1, .is_gen6 = 1, | |
| 137 | + .gen = 6, .is_i965g = 1, .is_i9xx = 1, | |
| 138 | + .need_gfx_hws = 1, .has_hotplug = 1, | |
| 144 | 139 | }; |
| 145 | 140 | |
| 146 | 141 | static const struct intel_device_info intel_sandybridge_m_info = { |
| 147 | − .is_i965g = 1, .is_mobile = 1, .is_i9xx = 1, .need_gfx_hws = 1, | |
| 148 | − .has_hotplug = 1, .is_gen6 = 1, | |
| 142 | + .gen = 6, .is_i965g = 1, .is_mobile = 1, .is_i9xx = 1, | |
| 143 | + .need_gfx_hws = 1, .has_hotplug = 1, | |
| 149 | 144 | }; |
| 150 | 145 | |
| 151 | 146 | static const struct pci_device_id pciidlist[] = { /* aka */ |
| @@ -180,8 +175,12 @@ static const struct pci_device_id pciidlist[] = { /* aka */ · 28 unmodified lines | ||
| 180 | 175 | INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info), |
| 181 | 176 | INTEL_VGA_DEVICE(0x0046, &intel_ironlake_m_info), |
| 182 | 177 | INTEL_VGA_DEVICE(0x0102, &intel_sandybridge_d_info), |
| 178 | + INTEL_VGA_DEVICE(0x0112, &intel_sandybridge_d_info), | |
| 179 | + INTEL_VGA_DEVICE(0x0122, &intel_sandybridge_d_info), | |
| 183 | 180 | INTEL_VGA_DEVICE(0x0106, &intel_sandybridge_m_info), |
| 181 | + INTEL_VGA_DEVICE(0x0116, &intel_sandybridge_m_info), | |
| 184 | 182 | INTEL_VGA_DEVICE(0x0126, &intel_sandybridge_m_info), |
| 183 | + INTEL_VGA_DEVICE(0x010A, &intel_sandybridge_d_info), | |
| 185 | 184 | {0, 0, 0} |
| 186 | 185 | }; |
| 187 | 186 | |
| @@ -191,6 +191,7 @@ struct drm_i915_display_funcs { · 190 unmodified lines | ||
| 191 | 191 | }; |
| 192 | 192 | |
| 193 | 193 | struct intel_device_info { |
| 194 | + u8 gen; | |
| 194 | 195 | u8 is_mobile : 1; |
| 195 | 196 | u8 is_i8xx : 1; |
| 196 | 197 | u8 is_i85x : 1; |
| @@ -206,7 +207,6 @@ struct intel_device_info { · 9 unmodified lines | ||
| 206 | 207 | u8 is_broadwater : 1; |
| 207 | 208 | u8 is_crestline : 1; |
| 208 | 209 | u8 is_ironlake : 1; |
| 209 | − u8 is_gen6 : 1; | |
| 210 | 210 | u8 has_fbc : 1; |
| 211 | 211 | u8 has_rc6 : 1; |
| 212 | 212 | u8 has_pipe_cxsr : 1; |
| @@ -1162,7 +1162,6 @@ extern void intel_overlay_print_error_state(struct seq_file *m, struct intel_ove · 949 unmodified lines | ||
| 1162 | 1162 | #define IS_845G(dev) ((dev)->pci_device == 0x2562) |
| 1163 | 1163 | #define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x) |
| 1164 | 1164 | #define IS_I865G(dev) ((dev)->pci_device == 0x2572) |
| 1165 | −#define IS_GEN2(dev) (INTEL_INFO(dev)->is_i8xx) | |
| 1166 | 1165 | #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g) |
| 1167 | 1166 | #define IS_I915GM(dev) ((dev)->pci_device == 0x2592) |
| 1168 | 1167 | #define IS_I945G(dev) ((dev)->pci_device == 0x2772) |
| @@ -1181,27 +1180,13 @@ extern void intel_overlay_print_error_state(struct seq_file *m, struct intel_ove · 12 unmodified lines | ||
| 1181 | 1180 | #define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) |
| 1182 | 1181 | #define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake) |
| 1183 | 1182 | #define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx) |
| 1184 | −#define IS_GEN6(dev) (INTEL_INFO(dev)->is_gen6) | |
| 1185 | 1183 | #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) |
| 1186 | 1184 | |
| 1187 | −#define IS_GEN3(dev) (IS_I915G(dev) || \ | |
| 1188 | − IS_I915GM(dev) || \ | |
| 1189 | − IS_I945G(dev) || \ | |
| 1190 | − IS_I945GM(dev) || \ | |
| 1191 | − IS_G33(dev) || \ | |
| 1192 | − IS_PINEVIEW(dev)) | |
| 1193 | −#define IS_GEN4(dev) ((dev)->pci_device == 0x2972 || \ | |
| 1194 | − (dev)->pci_device == 0x2982 || \ | |
| 1195 | − (dev)->pci_device == 0x2992 || \ | |
| 1196 | − (dev)->pci_device == 0x29A2 || \ | |
| 1197 | − (dev)->pci_device == 0x2A02 || \ | |
| 1198 | − (dev)->pci_device == 0x2A12 || \ | |
| 1199 | − (dev)->pci_device == 0x2E02 || \ | |
| 1200 | − (dev)->pci_device == 0x2E12 || \ | |
| 1201 | − (dev)->pci_device == 0x2E22 || \ | |
| 1202 | − (dev)->pci_device == 0x2E32 || \ | |
| 1203 | − (dev)->pci_device == 0x2A42 || \ | |
| 1204 | − (dev)->pci_device == 0x2E42) | |
| 1185 | +#define IS_GEN2(dev) (INTEL_INFO(dev)->gen == 2) | |
| 1186 | +#define IS_GEN3(dev) (INTEL_INFO(dev)->gen == 3) | |
| 1187 | +#define IS_GEN4(dev) (INTEL_INFO(dev)->gen == 4) | |
| 1188 | +#define IS_GEN5(dev) (INTEL_INFO(dev)->gen == 5) | |
| 1189 | +#define IS_GEN6(dev) (INTEL_INFO(dev)->gen == 6) | |
| 1205 | 1190 | |
| 1206 | 1191 | #define HAS_BSD(dev) (IS_IRONLAKE(dev) || IS_G4X(dev)) |
| 1207 | 1192 | #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws) |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include <linux/slab.h> |
| 35 | 35 | #include <linux/swap.h> |
| 36 | 36 | #include <linux/pci.h> |
| 37 | +#include <linux/intel-gtt.h> | |
| 37 | 38 | |
| 38 | 39 | static uint32_t i915_gem_get_gtt_alignment(struct drm_gem_object *obj); |
| 39 | 40 | static int i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj); |
| @@ -135,12 +136,15 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, · 95 unmodified lines | ||
| 135 | 136 | return -ENOMEM; |
| 136 | 137 | |
| 137 | 138 | ret = drm_gem_handle_create(file_priv, obj, &handle); |
| 138 | − drm_gem_object_unreference_unlocked(obj); | |
| 139 | − if (ret) | |
| 139 | + if (ret) { | |
| 140 | + drm_gem_object_unreference_unlocked(obj); | |
| 140 | 141 | return ret; |
| 142 | + } | |
| 141 | 143 | |
| 142 | − args->handle = handle; | |
| 144 | + /* Sink the floating reference from kref_init(handlecount) */ | |
| 145 | + drm_gem_object_handle_unreference_unlocked(obj); | |
| 143 | 146 | |
| 147 | + args->handle = handle; | |
| 144 | 148 | return 0; |
| 145 | 149 | } |
| 146 | 150 | |
| @@ -3585,6 +3589,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, · 3438 unmodified lines | ||
| 3585 | 3589 | if (ret != 0) { |
| 3586 | 3590 | DRM_ERROR("copy %d cliprects failed: %d\n", |
| 3587 | 3591 | args->num_cliprects, ret); |
| 3592 | + ret = -EFAULT; | |
| 3588 | 3593 | goto pre_mutex_err; |
| 3589 | 3594 | } |
| 3590 | 3595 | } |
| @@ -887,6 +887,49 @@ static void i915_handle_error(struct drm_device *dev, bool wedged) · 886 unmodified lines | ||
| 887 | 887 | queue_work(dev_priv->wq, &dev_priv->error_work); |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | +static void i915_pageflip_stall_check(struct drm_device *dev, int pipe) | |
| 891 | +{ | |
| 892 | + drm_i915_private_t *dev_priv = dev->dev_private; | |
| 893 | + struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; | |
| 894 | + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | |
| 895 | + struct drm_i915_gem_object *obj_priv; | |
| 896 | + struct intel_unpin_work *work; | |
| 897 | + unsigned long flags; | |
| 898 | + bool stall_detected; | |
| 899 | + | |
| 900 | + /* Ignore early vblank irqs */ | |
| 901 | + if (intel_crtc == NULL) | |
| 902 | + return; | |
| 903 | + | |
| 904 | + spin_lock_irqsave(&dev->event_lock, flags); | |
| 905 | + work = intel_crtc->unpin_work; | |
| 906 | + | |
| 907 | + if (work == NULL || work->pending || !work->enable_stall_check) { | |
| 908 | + /* Either the pending flip IRQ arrived, or we're too early. Don't check */ | |
| 909 | + spin_unlock_irqrestore(&dev->event_lock, flags); | |
| 910 | + return; | |
| 911 | + } | |
| 912 | + | |
| 913 | + /* Potential stall - if we see that the flip has happened, assume a missed interrupt */ | |
| 914 | + obj_priv = to_intel_bo(work->pending_flip_obj); | |
| 915 | + if(IS_I965G(dev)) { | |
| 916 | + int dspsurf = intel_crtc->plane == 0 ? DSPASURF : DSPBSURF; | |
| 917 | + stall_detected = I915_READ(dspsurf) == obj_priv->gtt_offset; | |
| 918 | + } else { | |
| 919 | + int dspaddr = intel_crtc->plane == 0 ? DSPAADDR : DSPBADDR; | |
| 920 | + stall_detected = I915_READ(dspaddr) == (obj_priv->gtt_offset + | |
| 921 | + crtc->y * crtc->fb->pitch + | |
| 922 | + crtc->x * crtc->fb->bits_per_pixel/8); | |
| 923 | + } | |
| 924 | + | |
| 925 | + spin_unlock_irqrestore(&dev->event_lock, flags); | |
| 926 | + | |
| 927 | + if (stall_detected) { | |
| 928 | + DRM_DEBUG_DRIVER("Pageflip stall detected\n"); | |
| 929 | + intel_prepare_page_flip(dev, intel_crtc->plane); | |
| 930 | + } | |
| 931 | +} | |
| 932 | + | |
| 890 | 933 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
| 891 | 934 | { |
| 892 | 935 | struct drm_device *dev = (struct drm_device *) arg; |
| @@ -1004,15 +1047,19 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) · 111 unmodified lines | ||
| 1004 | 1047 | if (pipea_stats & vblank_status) { |
| 1005 | 1048 | vblank++; |
| 1006 | 1049 | drm_handle_vblank(dev, 0); |
| 1007 | − if (!dev_priv->flip_pending_is_done) | |
| 1050 | + if (!dev_priv->flip_pending_is_done) { | |
| 1051 | + i915_pageflip_stall_check(dev, 0); | |
| 1008 | 1052 | intel_finish_page_flip(dev, 0); |
| 1053 | + } | |
| 1009 | 1054 | } |
| 1010 | 1055 | |
| 1011 | 1056 | if (pipeb_stats & vblank_status) { |
| 1012 | 1057 | vblank++; |
| 1013 | 1058 | drm_handle_vblank(dev, 1); |
| 1014 | − if (!dev_priv->flip_pending_is_done) | |
| 1059 | + if (!dev_priv->flip_pending_is_done) { | |
| 1060 | + i915_pageflip_stall_check(dev, 1); | |
| 1015 | 1061 | intel_finish_page_flip(dev, 1); |
| 1062 | + } | |
| 1016 | 1063 | } |
| 1017 | 1064 | |
| 1018 | 1065 | if ((pipea_stats & PIPE_LEGACY_BLC_EVENT_STATUS) || |
| @@ -1303,17 +1350,25 @@ void i915_hangcheck_elapsed(unsigned long data) · 284 unmodified lines | ||
| 1303 | 1350 | i915_seqno_passed(i915_get_gem_seqno(dev, |
| 1304 | 1351 | &dev_priv->render_ring), |
| 1305 | 1352 | i915_get_tail_request(dev)->seqno)) { |
| 1353 | + bool missed_wakeup = false; | |
| 1354 | + | |
| 1306 | 1355 | dev_priv->hangcheck_count = 0; |
| 1307 | 1356 | |
| 1308 | 1357 | /* Issue a wake-up to catch stuck h/w. */ |
| 1309 | − if (dev_priv->render_ring.waiting_gem_seqno | | |
| 1310 | − dev_priv->bsd_ring.waiting_gem_seqno) { | |
| 1311 | − DRM_ERROR("Hangcheck timer elapsed... GPU idle, missed IRQ.\n"); | |
| 1312 | − if (dev_priv->render_ring.waiting_gem_seqno) | |
| 1313 | − DRM_WAKEUP(&dev_priv->render_ring.irq_queue); | |
| 1314 | − if (dev_priv->bsd_ring.waiting_gem_seqno) | |
| 1315 | − DRM_WAKEUP(&dev_priv->bsd_ring.irq_queue); | |
| 1358 | + if (dev_priv->render_ring.waiting_gem_seqno && | |
| 1359 | + waitqueue_active(&dev_priv->render_ring.irq_queue)) { | |
| 1360 | + DRM_WAKEUP(&dev_priv->render_ring.irq_queue); | |
| 1361 | + missed_wakeup = true; | |
| 1316 | 1362 | } |
| 1363 | + | |
| 1364 | + if (dev_priv->bsd_ring.waiting_gem_seqno && | |
| 1365 | + waitqueue_active(&dev_priv->bsd_ring.irq_queue)) { | |
| 1366 | + DRM_WAKEUP(&dev_priv->bsd_ring.irq_queue); | |
| 1367 | + missed_wakeup = true; | |
| 1368 | + } | |
| 1369 | + | |
| 1370 | + if (missed_wakeup) | |
| 1371 | + DRM_ERROR("Hangcheck timer elapsed... GPU idle, missed IRQ.\n"); | |
| 1317 | 1372 | return; |
| 1318 | 1373 | } |
| 1319 | 1374 | |
| @@ -319,6 +319,7 @@ · 318 unmodified lines | ||
| 319 | 319 | |
| 320 | 320 | #define MI_MODE 0x0209c |
| 321 | 321 | # define VS_TIMER_DISPATCH (1 << 6) |
| 322 | +# define MI_FLUSH_ENABLE (1 << 11) | |
| 322 | 323 | |
| 323 | 324 | #define SCPD0 0x0209c /* 915+ only */ |
| 324 | 325 | #define IER 0x020a0 |
| @@ -2205,9 +2206,17 @@ · 1880 unmodified lines | ||
| 2205 | 2206 | #define WM1_LP_SR_EN (1<<31) |
| 2206 | 2207 | #define WM1_LP_LATENCY_SHIFT 24 |
| 2207 | 2208 | #define WM1_LP_LATENCY_MASK (0x7f<<24) |
| 2209 | +#define WM1_LP_FBC_LP1_MASK (0xf<<20) | |
| 2210 | +#define WM1_LP_FBC_LP1_SHIFT 20 | |
| 2208 | 2211 | #define WM1_LP_SR_MASK (0x1ff<<8) |
| 2209 | 2212 | #define WM1_LP_SR_SHIFT 8 |
| 2210 | 2213 | #define WM1_LP_CURSOR_MASK (0x3f) |
| 2214 | +#define WM2_LP_ILK 0x4510c | |
| 2215 | +#define WM2_LP_EN (1<<31) | |
| 2216 | +#define WM3_LP_ILK 0x45110 | |
| 2217 | +#define WM3_LP_EN (1<<31) | |
| 2218 | +#define WM1S_LP_ILK 0x45120 | |
| 2219 | +#define WM1S_LP_EN (1<<31) | |
| 2211 | 2220 | |
| 2212 | 2221 | /* Memory latency timer register */ |
| 2213 | 2222 | #define MLTR_ILK 0x11222 |
| @@ -990,6 +990,22 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) · 989 unmodified lines | ||
| 990 | 990 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 991 | 991 | int pipestat_reg = (pipe == 0 ? PIPEASTAT : PIPEBSTAT); |
| 992 | 992 | |
| 993 | + /* Clear existing vblank status. Note this will clear any other | |
| 994 | + * sticky status fields as well. | |
| 995 | + * | |
| 996 | + * This races with i915_driver_irq_handler() with the result | |
| 997 | + * that either function could miss a vblank event. Here it is not | |
| 998 | + * fatal, as we will either wait upon the next vblank interrupt or | |
| 999 | + * timeout. Generally speaking intel_wait_for_vblank() is only | |
| 1000 | + * called during modeset at which time the GPU should be idle and | |
| 1001 | + * should *not* be performing page flips and thus not waiting on | |
| 1002 | + * vblanks... | |
| 1003 | + * Currently, the result of us stealing a vblank from the irq | |
| 1004 | + * handler is that a single frame will be skipped during swapbuffers. | |
| 1005 | + */ | |
| 1006 | + I915_WRITE(pipestat_reg, | |
| 1007 | + I915_READ(pipestat_reg) | PIPE_VBLANK_INTERRUPT_STATUS); | |
| 1008 | + | |
| 993 | 1009 | /* Wait for vblank interrupt bit to set */ |
| 994 | 1010 | if (wait_for((I915_READ(pipestat_reg) & |
| 995 | 1011 | PIPE_VBLANK_INTERRUPT_STATUS), |
| @@ -1486,7 +1502,7 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, · 490 unmodified lines | ||
| 1486 | 1502 | dspcntr &= ~DISPPLANE_TILED; |
| 1487 | 1503 | } |
| 1488 | 1504 | |
| 1489 | − if (IS_IRONLAKE(dev)) | |
| 1505 | + if (HAS_PCH_SPLIT(dev)) | |
| 1490 | 1506 | /* must disable */ |
| 1491 | 1507 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; |
| 1492 | 1508 | |
| @@ -1495,20 +1511,19 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, · 2 unmodified lines | ||
| 1495 | 1511 | Start = obj_priv->gtt_offset; |
| 1496 | 1512 | Offset = y * fb->pitch + x * (fb->bits_per_pixel / 8); |
| 1497 | 1513 | |
| 1498 | − DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y); | |
| 1514 | + DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", | |
| 1515 | + Start, Offset, x, y, fb->pitch); | |
| 1499 | 1516 | I915_WRITE(dspstride, fb->pitch); |
| 1500 | 1517 | if (IS_I965G(dev)) { |
| 1501 | − I915_WRITE(dspbase, Offset); | |
| 1502 | − I915_READ(dspbase); | |
| 1503 | 1518 | I915_WRITE(dspsurf, Start); |
| 1504 | − I915_READ(dspsurf); | |
| 1505 | 1519 | I915_WRITE(dsptileoff, (y << 16) | x); |
| 1520 | + I915_WRITE(dspbase, Offset); | |
| 1506 | 1521 | } else { |
| 1507 | 1522 | I915_WRITE(dspbase, Start + Offset); |
| 1508 | − I915_READ(dspbase); | |
| 1509 | 1523 | } |
| 1524 | + POSTING_READ(dspbase); | |
| 1510 | 1525 | |
| 1511 | − if ((IS_I965G(dev) || plane == 0)) | |
| 1526 | + if (IS_I965G(dev) || plane == 0) | |
| 1512 | 1527 | intel_update_fbc(crtc, &crtc->mode); |
| 1513 | 1528 | |
| 1514 | 1529 | intel_wait_for_vblank(dev, intel_crtc->pipe); |
| @@ -1522,7 +1537,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, · 7 unmodified lines | ||
| 1522 | 1537 | struct drm_framebuffer *old_fb) |
| 1523 | 1538 | { |
| 1524 | 1539 | struct drm_device *dev = crtc->dev; |
| 1525 | − struct drm_i915_private *dev_priv = dev->dev_private; | |
| 1526 | 1540 | struct drm_i915_master_private *master_priv; |
| 1527 | 1541 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 1528 | 1542 | struct intel_framebuffer *intel_fb; |
| @@ -1530,13 +1544,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, · 1 unmodified line | ||
| 1530 | 1544 | struct drm_gem_object *obj; |
| 1531 | 1545 | int pipe = intel_crtc->pipe; |
| 1532 | 1546 | int plane = intel_crtc->plane; |
| 1533 | − unsigned long Start, Offset; | |
| 1534 | − int dspbase = (plane == 0 ? DSPAADDR : DSPBADDR); | |
| 1535 | − int dspsurf = (plane == 0 ? DSPASURF : DSPBSURF); | |
| 1536 | − int dspstride = (plane == 0) ? DSPASTRIDE : DSPBSTRIDE; | |
| 1537 | − int dsptileoff = (plane == 0 ? DSPATILEOFF : DSPBTILEOFF); | |
| 1538 | − int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; | |
| 1539 | − u32 dspcntr; | |
| 1540 | 1547 | int ret; |
| 1541 | 1548 | |
| 1542 | 1549 | /* no fb bound */ |
| @@ -1572,71 +1579,18 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, · 29 unmodified lines | ||
| 1572 | 1579 | return ret; |
| 1573 | 1580 | } |
| 1574 | 1581 | |
| 1575 | − dspcntr = I915_READ(dspcntr_reg); | |
| 1576 | − /* Mask out pixel format bits in case we change it */ | |
| 1577 | − dspcntr &= ~DISPPLANE_PIXFORMAT_MASK; | |
| 1578 | − switch (crtc->fb->bits_per_pixel) { | |
| 1579 | − case 8: | |
| 1580 | − dspcntr |= DISPPLANE_8BPP; | |
| 1581 | − break; | |
| 1582 | − case 16: | |
| 1583 | − if (crtc->fb->depth == 15) | |
| 1584 | − dspcntr |= DISPPLANE_15_16BPP; | |
| 1585 | − else | |
| 1586 | − dspcntr |= DISPPLANE_16BPP; | |
| 1587 | − break; | |
| 1588 | − case 24: | |
| 1589 | − case 32: | |
| 1590 | − if (crtc->fb->depth == 30) | |
| 1591 | − dspcntr |= DISPPLANE_32BPP_30BIT_NO_ALPHA; | |
| 1592 | − else | |
| 1593 | − dspcntr |= DISPPLANE_32BPP_NO_ALPHA; | |
| 1594 | − break; | |
| 1595 | − default: | |
| 1596 | − DRM_ERROR("Unknown color depth\n"); | |
| 1582 | + ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y); | |
| 1583 | + if (ret) { | |
| 1597 | 1584 | i915_gem_object_unpin(obj); |
| 1598 | 1585 | mutex_unlock(&dev->struct_mutex); |
| 1599 | − return -EINVAL; | |
| 1600 | − } | |
| 1601 | − if (IS_I965G(dev)) { | |
| 1602 | − if (obj_priv->tiling_mode != I915_TILING_NONE) | |
| 1603 | − dspcntr |= DISPPLANE_TILED; | |
| 1604 | − else | |
| 1605 | − dspcntr &= ~DISPPLANE_TILED; | |
| 1606 | − } | |
| 1607 | − | |
| 1608 | − if (HAS_PCH_SPLIT(dev)) | |
| 1609 | − /* must disable */ | |
| 1610 | − dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; | |
| 1611 | − | |
| 1612 | − I915_WRITE(dspcntr_reg, dspcntr); | |
| 1613 | − | |
| 1614 | − Start = obj_priv->gtt_offset; | |
| 1615 | − Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8); | |
| 1616 | − | |
| 1617 | − DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", | |
| 1618 | − Start, Offset, x, y, crtc->fb->pitch); | |
| 1619 | − I915_WRITE(dspstride, crtc->fb->pitch); | |
| 1620 | − if (IS_I965G(dev)) { | |
| 1621 | − I915_WRITE(dspsurf, Start); | |
| 1622 | − I915_WRITE(dsptileoff, (y << 16) | x); | |
| 1623 | − I915_WRITE(dspbase, Offset); | |
| 1624 | − } else { | |
| 1625 | − I915_WRITE(dspbase, Start + Offset); | |
| 1586 | + return ret; | |
| 1626 | 1587 | } |
| 1627 | − POSTING_READ(dspbase); | |
| 1628 | − | |
| 1629 | − if ((IS_I965G(dev) || plane == 0)) | |
| 1630 | − intel_update_fbc(crtc, &crtc->mode); | |
| 1631 | − | |
| 1632 | − intel_wait_for_vblank(dev, pipe); | |
| 1633 | 1588 | |
| 1634 | 1589 | if (old_fb) { |
| 1635 | 1590 | intel_fb = to_intel_framebuffer(old_fb); |
| 1636 | 1591 | obj_priv = to_intel_bo(intel_fb->obj); |
| 1637 | 1592 | i915_gem_object_unpin(intel_fb->obj); |
| 1638 | 1593 | } |
| 1639 | − intel_increase_pllclock(crtc, true); | |
| 1640 | 1594 | |
| 1641 | 1595 | mutex_unlock(&dev->struct_mutex); |
| 1642 | 1596 | |
| @@ -1911,9 +1865,6 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) · 268 unmodified lines | ||
| 1911 | 1865 | int fdi_tx_reg = (pipe == 0) ? FDI_TXA_CTL : FDI_TXB_CTL; |
| 1912 | 1866 | int fdi_rx_reg = (pipe == 0) ? FDI_RXA_CTL : FDI_RXB_CTL; |
| 1913 | 1867 | int transconf_reg = (pipe == 0) ? TRANSACONF : TRANSBCONF; |
| 1914 | − int pf_ctl_reg = (pipe == 0) ? PFA_CTL_1 : PFB_CTL_1; | |
| 1915 | − int pf_win_size = (pipe == 0) ? PFA_WIN_SZ : PFB_WIN_SZ; | |
| 1916 | − int pf_win_pos = (pipe == 0) ? PFA_WIN_POS : PFB_WIN_POS; | |
| 1917 | 1868 | int cpu_htot_reg = (pipe == 0) ? HTOTAL_A : HTOTAL_B; |
| 1918 | 1869 | int cpu_hblank_reg = (pipe == 0) ? HBLANK_A : HBLANK_B; |
| 1919 | 1870 | int cpu_hsync_reg = (pipe == 0) ? HSYNC_A : HSYNC_B; |
| @@ -1982,15 +1933,19 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) · 62 unmodified lines | ||
| 1982 | 1933 | } |
| 1983 | 1934 | |
| 1984 | 1935 | /* Enable panel fitting for LVDS */ |
| 1985 | − if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) | |
| 1986 | − || HAS_eDP || intel_pch_has_edp(crtc)) { | |
| 1987 | − if (dev_priv->pch_pf_size) { | |
| 1988 | − temp = I915_READ(pf_ctl_reg); | |
| 1989 | − I915_WRITE(pf_ctl_reg, temp | PF_ENABLE | PF_FILTER_MED_3x3); | |
| 1990 | − I915_WRITE(pf_win_pos, dev_priv->pch_pf_pos); | |
| 1991 | − I915_WRITE(pf_win_size, dev_priv->pch_pf_size); | |
| 1992 | − } else | |
| 1993 | − I915_WRITE(pf_ctl_reg, temp & ~PF_ENABLE); | |
| 1936 | + if (dev_priv->pch_pf_size && | |
| 1937 | + (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) | |
| 1938 | + || HAS_eDP || intel_pch_has_edp(crtc))) { | |
| 1939 | + /* Force use of hard-coded filter coefficients | |
| 1940 | + * as some pre-programmed values are broken, | |
| 1941 | + * e.g. x201. | |
| 1942 | + */ | |
| 1943 | + I915_WRITE(pipe ? PFB_CTL_1 : PFA_CTL_1, | |
| 1944 | + PF_ENABLE | PF_FILTER_MED_3x3); | |
| 1945 | + I915_WRITE(pipe ? PFB_WIN_POS : PFA_WIN_POS, | |
| 1946 | + dev_priv->pch_pf_pos); | |
| 1947 | + I915_WRITE(pipe ? PFB_WIN_SZ : PFA_WIN_SZ, | |
| 1948 | + dev_priv->pch_pf_size); | |
| 1994 | 1949 | } |
| 1995 | 1950 | |
| 1996 | 1951 | /* Enable CPU pipe */ |
| @@ -2115,7 +2070,7 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) · 118 unmodified lines | ||
| 2115 | 2070 | I915_WRITE(transconf_reg, temp | TRANS_ENABLE); |
| 2116 | 2071 | I915_READ(transconf_reg); |
| 2117 | 2072 | |
| 2118 | − if (wait_for(I915_READ(transconf_reg) & TRANS_STATE_ENABLE, 10, 0)) | |
| 2073 | + if (wait_for(I915_READ(transconf_reg) & TRANS_STATE_ENABLE, 100, 1)) | |
| 2119 | 2074 | DRM_ERROR("failed to enable transcoder\n"); |
| 2120 | 2075 | } |
| 2121 | 2076 | |
| @@ -2155,14 +2110,8 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) · 33 unmodified lines | ||
| 2155 | 2110 | udelay(100); |
| 2156 | 2111 | |
| 2157 | 2112 | /* Disable PF */ |
| 2158 | − temp = I915_READ(pf_ctl_reg); | |
| 2159 | − if ((temp & PF_ENABLE) != 0) { | |
| 2160 | − I915_WRITE(pf_ctl_reg, temp & ~PF_ENABLE); | |
| 2161 | − I915_READ(pf_ctl_reg); | |
| 2162 | − } | |
| 2163 | − I915_WRITE(pf_win_size, 0); | |
| 2164 | − POSTING_READ(pf_win_size); | |
| 2165 | − | |
| 2113 | + I915_WRITE(pipe ? PFB_CTL_1 : PFA_CTL_1, 0); | |
| 2114 | + I915_WRITE(pipe ? PFB_WIN_SZ : PFA_WIN_SZ, 0); | |
| 2166 | 2115 | |
| 2167 | 2116 | /* disable CPU FDI tx and PCH FDI rx */ |
| 2168 | 2117 | temp = I915_READ(fdi_tx_reg); |
| @@ -2421,6 +2370,9 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode) · 252 unmodified lines | ||
| 2421 | 2370 | int pipe = intel_crtc->pipe; |
| 2422 | 2371 | bool enabled; |
| 2423 | 2372 | |
| 2373 | + if (intel_crtc->dpms_mode == mode) | |
| 2374 | + return; | |
| 2375 | + | |
| 2424 | 2376 | intel_crtc->dpms_mode = mode; |
| 2425 | 2377 | intel_crtc->cursor_on = mode == DRM_MODE_DPMS_ON; |
| 2426 | 2378 | |
| @@ -2815,14 +2767,8 @@ static unsigned long intel_calculate_wm(unsigned long clock_in_khz, · 388 unmodified lines | ||
| 2815 | 2767 | /* Don't promote wm_size to unsigned... */ |
| 2816 | 2768 | if (wm_size > (long)wm->max_wm) |
| 2817 | 2769 | wm_size = wm->max_wm; |
| 2818 | − if (wm_size <= 0) { | |
| 2770 | + if (wm_size <= 0) | |
| 2819 | 2771 | wm_size = wm->default_wm; |
| 2820 | − DRM_ERROR("Insufficient FIFO for plane, expect flickering:" | |
| 2821 | − " entries required = %ld, available = %lu.\n", | |
| 2822 | − entries_required + wm->guard_size, | |
| 2823 | − wm->fifo_size); | |
| 2824 | − } | |
| 2825 | − | |
| 2826 | 2772 | return wm_size; |
| 2827 | 2773 | } |
| 2828 | 2774 | |
| @@ -3436,8 +3382,7 @@ static void ironlake_update_wm(struct drm_device *dev, int planea_clock, · 607 unmodified lines | ||
| 3436 | 3382 | reg_value = I915_READ(WM1_LP_ILK); |
| 3437 | 3383 | reg_value &= ~(WM1_LP_LATENCY_MASK | WM1_LP_SR_MASK | |
| 3438 | 3384 | WM1_LP_CURSOR_MASK); |
| 3439 | − reg_value |= WM1_LP_SR_EN | | |
| 3440 | − (ilk_sr_latency << WM1_LP_LATENCY_SHIFT) | | |
| 3385 | + reg_value |= (ilk_sr_latency << WM1_LP_LATENCY_SHIFT) | | |
| 3441 | 3386 | (sr_wm << WM1_LP_SR_SHIFT) | cursor_wm; |
| 3442 | 3387 | |
| 3443 | 3388 | I915_WRITE(WM1_LP_ILK, reg_value); |
| @@ -3554,10 +3499,9 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 110 unmodified lines | ||
| 3554 | 3499 | u32 dpll = 0, fp = 0, fp2 = 0, dspcntr, pipeconf; |
| 3555 | 3500 | bool ok, has_reduced_clock = false, is_sdvo = false, is_dvo = false; |
| 3556 | 3501 | bool is_crt = false, is_lvds = false, is_tv = false, is_dp = false; |
| 3557 | − bool is_edp = false; | |
| 3502 | + struct intel_encoder *has_edp_encoder = NULL; | |
| 3558 | 3503 | struct drm_mode_config *mode_config = &dev->mode_config; |
| 3559 | 3504 | struct drm_encoder *encoder; |
| 3560 | − struct intel_encoder *intel_encoder = NULL; | |
| 3561 | 3505 | const intel_limit_t *limit; |
| 3562 | 3506 | int ret; |
| 3563 | 3507 | struct fdi_m_n m_n = {0}; |
| @@ -3578,12 +3522,12 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 14 unmodified lines | ||
| 3578 | 3522 | drm_vblank_pre_modeset(dev, pipe); |
| 3579 | 3523 | |
| 3580 | 3524 | list_for_each_entry(encoder, &mode_config->encoder_list, head) { |
| 3525 | + struct intel_encoder *intel_encoder; | |
| 3581 | 3526 | |
| 3582 | − if (!encoder || encoder->crtc != crtc) | |
| 3527 | + if (encoder->crtc != crtc) | |
| 3583 | 3528 | continue; |
| 3584 | 3529 | |
| 3585 | 3530 | intel_encoder = enc_to_intel_encoder(encoder); |
| 3586 | − | |
| 3587 | 3531 | switch (intel_encoder->type) { |
| 3588 | 3532 | case INTEL_OUTPUT_LVDS: |
| 3589 | 3533 | is_lvds = true; |
| @@ -3607,7 +3551,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 17 unmodified lines | ||
| 3607 | 3551 | is_dp = true; |
| 3608 | 3552 | break; |
| 3609 | 3553 | case INTEL_OUTPUT_EDP: |
| 3610 | − is_edp = true; | |
| 3554 | + has_edp_encoder = intel_encoder; | |
| 3611 | 3555 | break; |
| 3612 | 3556 | } |
| 3613 | 3557 | |
| @@ -3685,10 +3629,10 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 71 unmodified lines | ||
| 3685 | 3629 | int lane = 0, link_bw, bpp; |
| 3686 | 3630 | /* eDP doesn't require FDI link, so just set DP M/N |
| 3687 | 3631 | according to current link config */ |
| 3688 | − if (is_edp) { | |
| 3632 | + if (has_edp_encoder) { | |
| 3689 | 3633 | target_clock = mode->clock; |
| 3690 | − intel_edp_link_config(intel_encoder, | |
| 3691 | − &lane, &link_bw); | |
| 3634 | + intel_edp_link_config(has_edp_encoder, | |
| 3635 | + &lane, &link_bw); | |
| 3692 | 3636 | } else { |
| 3693 | 3637 | /* DP over FDI requires target mode clock |
| 3694 | 3638 | instead of link clock */ |
| @@ -3709,7 +3653,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 14 unmodified lines | ||
| 3709 | 3653 | temp |= PIPE_8BPC; |
| 3710 | 3654 | else |
| 3711 | 3655 | temp |= PIPE_6BPC; |
| 3712 | − } else if (is_edp || (is_dp && intel_pch_has_edp(crtc))) { | |
| 3656 | + } else if (has_edp_encoder || (is_dp && intel_pch_has_edp(crtc))) { | |
| 3713 | 3657 | switch (dev_priv->edp_bpp/3) { |
| 3714 | 3658 | case 8: |
| 3715 | 3659 | temp |= PIPE_8BPC; |
| @@ -3782,7 +3726,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 66 unmodified lines | ||
| 3782 | 3726 | |
| 3783 | 3727 | udelay(200); |
| 3784 | 3728 | |
| 3785 | − if (is_edp) { | |
| 3729 | + if (has_edp_encoder) { | |
| 3786 | 3730 | if (dev_priv->lvds_use_ssc) { |
| 3787 | 3731 | temp |= DREF_SSC1_ENABLE; |
| 3788 | 3732 | I915_WRITE(PCH_DREF_CONTROL, temp); |
| @@ -3931,7 +3875,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 142 unmodified lines | ||
| 3931 | 3875 | dpll_reg = pch_dpll_reg; |
| 3932 | 3876 | } |
| 3933 | 3877 | |
| 3934 | − if (!is_edp) { | |
| 3878 | + if (!has_edp_encoder) { | |
| 3935 | 3879 | I915_WRITE(fp_reg, fp); |
| 3936 | 3880 | I915_WRITE(dpll_reg, dpll & ~DPLL_VCO_ENABLE); |
| 3937 | 3881 | I915_READ(dpll_reg); |
| @@ -4026,7 +3970,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 88 unmodified lines | ||
| 4026 | 3970 | } |
| 4027 | 3971 | } |
| 4028 | 3972 | |
| 4029 | − if (!is_edp) { | |
| 3973 | + if (!has_edp_encoder) { | |
| 4030 | 3974 | I915_WRITE(fp_reg, fp); |
| 4031 | 3975 | I915_WRITE(dpll_reg, dpll); |
| 4032 | 3976 | I915_READ(dpll_reg); |
| @@ -4105,7 +4049,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, · 72 unmodified lines | ||
| 4105 | 4049 | I915_WRITE(link_m1_reg, m_n.link_m); |
| 4106 | 4050 | I915_WRITE(link_n1_reg, m_n.link_n); |
| 4107 | 4051 | |
| 4108 | − if (is_edp) { | |
| 4052 | + if (has_edp_encoder) { | |
| 4109 | 4053 | ironlake_set_pll_edp(crtc, adjusted_mode->clock); |
| 4110 | 4054 | } else { |
| 4111 | 4055 | /* enable FDI RX PLL too */ |
| @@ -4911,15 +4855,6 @@ static void intel_crtc_destroy(struct drm_crtc *crtc) · 799 unmodified lines | ||
| 4911 | 4855 | kfree(intel_crtc); |
| 4912 | 4856 | } |
| 4913 | 4857 | |
| 4914 | −struct intel_unpin_work { | |
| 4915 | − struct work_struct work; | |
| 4916 | − struct drm_device *dev; | |
| 4917 | − struct drm_gem_object *old_fb_obj; | |
| 4918 | − struct drm_gem_object *pending_flip_obj; | |
| 4919 | − struct drm_pending_vblank_event *event; | |
| 4920 | − int pending; | |
| 4921 | −}; | |
| 4922 | − | |
| 4923 | 4858 | static void intel_unpin_work_fn(struct work_struct *__work) |
| 4924 | 4859 | { |
| 4925 | 4860 | struct intel_unpin_work *work = |
| @@ -5007,7 +4942,8 @@ void intel_prepare_page_flip(struct drm_device *dev, int plane) · 81 unmodified lines | ||
| 5007 | 4942 | |
| 5008 | 4943 | spin_lock_irqsave(&dev->event_lock, flags); |
| 5009 | 4944 | if (intel_crtc->unpin_work) { |
| 5010 | − intel_crtc->unpin_work->pending = 1; | |
| 4945 | + if ((++intel_crtc->unpin_work->pending) > 1) | |
| 4946 | + DRM_ERROR("Prepared flip multiple times\n"); | |
| 5011 | 4947 | } else { |
| 5012 | 4948 | DRM_DEBUG_DRIVER("preparing flip with no unpin work?\n"); |
| 5013 | 4949 | } |
| @@ -5026,9 +4962,9 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 12 unmodified lines | ||
| 5026 | 4962 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 5027 | 4963 | struct intel_unpin_work *work; |
| 5028 | 4964 | unsigned long flags, offset; |
| 5029 | − int pipesrc_reg = (intel_crtc->pipe == 0) ? PIPEASRC : PIPEBSRC; | |
| 5030 | − int ret, pipesrc; | |
| 5031 | − u32 flip_mask; | |
| 4965 | + int pipe = intel_crtc->pipe; | |
| 4966 | + u32 pf, pipesrc; | |
| 4967 | + int ret; | |
| 5032 | 4968 | |
| 5033 | 4969 | work = kzalloc(sizeof *work, GFP_KERNEL); |
| 5034 | 4970 | if (work == NULL) |
| @@ -5077,42 +5013,73 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 42 unmodified lines | ||
| 5077 | 5013 | atomic_inc(&obj_priv->pending_flip); |
| 5078 | 5014 | work->pending_flip_obj = obj; |
| 5079 | 5015 | |
| 5080 | − if (intel_crtc->plane) | |
| 5081 | − flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; | |
| 5082 | − else | |
| 5083 | − flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; | |
| 5084 | − | |
| 5085 | 5016 | if (IS_GEN3(dev) || IS_GEN2(dev)) { |
| 5017 | + u32 flip_mask; | |
| 5018 | + | |
| 5019 | + if (intel_crtc->plane) | |
| 5020 | + flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; | |
| 5021 | + else | |
| 5022 | + flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; | |
| 5023 | + | |
| 5086 | 5024 | BEGIN_LP_RING(2); |
| 5087 | 5025 | OUT_RING(MI_WAIT_FOR_EVENT | flip_mask); |
| 5088 | 5026 | OUT_RING(0); |
| 5089 | 5027 | ADVANCE_LP_RING(); |
| 5090 | 5028 | } |
| 5091 | 5029 | |
| 5030 | + work->enable_stall_check = true; | |
| 5031 | + | |
| 5092 | 5032 | /* Offset into the new buffer for cases of shared fbs between CRTCs */ |
| 5093 | − offset = obj_priv->gtt_offset; | |
| 5094 | − offset += (crtc->y * fb->pitch) + (crtc->x * (fb->bits_per_pixel) / 8); | |
| 5033 | + offset = crtc->y * fb->pitch + crtc->x * fb->bits_per_pixel/8; | |
| 5095 | 5034 | |
| 5096 | 5035 | BEGIN_LP_RING(4); |
| 5097 | − if (IS_I965G(dev)) { | |
| 5036 | + switch(INTEL_INFO(dev)->gen) { | |
| 5037 | + case 2: | |
| 5098 | 5038 | OUT_RING(MI_DISPLAY_FLIP | |
| 5099 | 5039 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
| 5100 | 5040 | OUT_RING(fb->pitch); |
| 5101 | − OUT_RING(offset | obj_priv->tiling_mode); | |
| 5102 | − pipesrc = I915_READ(pipesrc_reg); | |
| 5103 | − OUT_RING(pipesrc & 0x0fff0fff); | |
| 5104 | − } else if (IS_GEN3(dev)) { | |
| 5041 | + OUT_RING(obj_priv->gtt_offset + offset); | |
| 5042 | + OUT_RING(MI_NOOP); | |
| 5043 | + break; | |
| 5044 | + | |
| 5045 | + case 3: | |
| 5105 | 5046 | OUT_RING(MI_DISPLAY_FLIP_I915 | |
| 5106 | 5047 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
| 5107 | 5048 | OUT_RING(fb->pitch); |
| 5108 | − OUT_RING(offset); | |
| 5049 | + OUT_RING(obj_priv->gtt_offset + offset); | |
| 5109 | 5050 | OUT_RING(MI_NOOP); |
| 5110 | − } else { | |
| 5051 | + break; | |
| 5052 | + | |
| 5053 | + case 4: | |
| 5054 | + case 5: | |
| 5055 | + /* i965+ uses the linear or tiled offsets from the | |
| 5056 | + * Display Registers (which do not change across a page-flip) | |
| 5057 | + * so we need only reprogram the base address. | |
| 5058 | + */ | |
| 5111 | 5059 | OUT_RING(MI_DISPLAY_FLIP | |
| 5112 | 5060 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
| 5113 | 5061 | OUT_RING(fb->pitch); |
| 5114 | − OUT_RING(offset); | |
| 5115 | − OUT_RING(MI_NOOP); | |
| 5062 | + OUT_RING(obj_priv->gtt_offset | obj_priv->tiling_mode); | |
| 5063 | + | |
| 5064 | + /* XXX Enabling the panel-fitter across page-flip is so far | |
| 5065 | + * untested on non-native modes, so ignore it for now. | |
| 5066 | + * pf = I915_READ(pipe == 0 ? PFA_CTL_1 : PFB_CTL_1) & PF_ENABLE; | |
| 5067 | + */ | |
| 5068 | + pf = 0; | |
| 5069 | + pipesrc = I915_READ(pipe == 0 ? PIPEASRC : PIPEBSRC) & 0x0fff0fff; | |
| 5070 | + OUT_RING(pf | pipesrc); | |
| 5071 | + break; | |
| 5072 | + | |
| 5073 | + case 6: | |
| 5074 | + OUT_RING(MI_DISPLAY_FLIP | | |
| 5075 | + MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | |
| 5076 | + OUT_RING(fb->pitch | obj_priv->tiling_mode); | |
| 5077 | + OUT_RING(obj_priv->gtt_offset); | |
| 5078 | + | |
| 5079 | + pf = I915_READ(pipe == 0 ? PFA_CTL_1 : PFB_CTL_1) & PF_ENABLE; | |
| 5080 | + pipesrc = I915_READ(pipe == 0 ? PIPEASRC : PIPEBSRC) & 0x0fff0fff; | |
| 5081 | + OUT_RING(pf | pipesrc); | |
| 5082 | + break; | |
| 5116 | 5083 | } |
| 5117 | 5084 | ADVANCE_LP_RING(); |
| 5118 | 5085 | |
| @@ -5193,7 +5160,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) · 74 unmodified lines | ||
| 5193 | 5160 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; |
| 5194 | 5161 | |
| 5195 | 5162 | intel_crtc->cursor_addr = 0; |
| 5196 | − intel_crtc->dpms_mode = DRM_MODE_DPMS_OFF; | |
| 5163 | + intel_crtc->dpms_mode = -1; | |
| 5197 | 5164 | drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs); |
| 5198 | 5165 | |
| 5199 | 5166 | intel_crtc->busy = false; |
| @@ -5701,6 +5668,9 @@ void intel_init_clock_gating(struct drm_device *dev) · 501 unmodified lines | ||
| 5701 | 5668 | I915_WRITE(DISP_ARB_CTL, |
| 5702 | 5669 | (I915_READ(DISP_ARB_CTL) | |
| 5703 | 5670 | DISP_FBC_WM_DIS)); |
| 5671 | + I915_WRITE(WM3_LP_ILK, 0); | |
| 5672 | + I915_WRITE(WM2_LP_ILK, 0); | |
| 5673 | + I915_WRITE(WM1_LP_ILK, 0); | |
| 5704 | 5674 | } |
| 5705 | 5675 | /* |
| 5706 | 5676 | * Based on the document from hardware guys the following bits |
| @@ -5722,8 +5692,7 @@ void intel_init_clock_gating(struct drm_device *dev) · 15 unmodified lines | ||
| 5722 | 5692 | ILK_DPFC_DIS2 | |
| 5723 | 5693 | ILK_CLK_FBC); |
| 5724 | 5694 | } |
| 5725 | − if (IS_GEN6(dev)) | |
| 5726 | − return; | |
| 5695 | + return; | |
| 5727 | 5696 | } else if (IS_G4X(dev)) { |
| 5728 | 5697 | uint32_t dspclk_gate; |
| 5729 | 5698 | I915_WRITE(RENCLK_GATE_D1, 0); |
| @@ -5784,11 +5753,9 @@ void intel_init_clock_gating(struct drm_device *dev) · 54 unmodified lines | ||
| 5784 | 5753 | OUT_RING(MI_FLUSH); |
| 5785 | 5754 | ADVANCE_LP_RING(); |
| 5786 | 5755 | } |
| 5787 | − } else { | |
| 5756 | + } else | |
| 5788 | 5757 | DRM_DEBUG_KMS("Failed to allocate render context." |
| 5789 | − "Disable RC6\n"); | |
| 5790 | − return; | |
| 5791 | − } | |
| 5758 | + "Disable RC6\n"); | |
| 5792 | 5759 | } |
| 5793 | 5760 | |
| 5794 | 5761 | if (I915_HAS_RC6(dev) && drm_core_check_feature(dev, DRIVER_MODESET)) { |
| @@ -239,7 +239,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, · 238 unmodified lines | ||
| 239 | 239 | uint32_t ch_data = ch_ctl + 4; |
| 240 | 240 | int i; |
| 241 | 241 | int recv_bytes; |
| 242 | − uint32_t ctl; | |
| 243 | 242 | uint32_t status; |
| 244 | 243 | uint32_t aux_clock_divider; |
| 245 | 244 | int try, precharge; |
| @@ -263,41 +262,43 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, · 17 unmodified lines | ||
| 263 | 262 | else |
| 264 | 263 | precharge = 5; |
| 265 | 264 | |
| 265 | + if (I915_READ(ch_ctl) & DP_AUX_CH_CTL_SEND_BUSY) { | |
| 266 | + DRM_ERROR("dp_aux_ch not started status 0x%08x\n", | |
| 267 | + I915_READ(ch_ctl)); | |
| 268 | + return -EBUSY; | |
| 269 | + } | |
| 270 | + | |
| 266 | 271 | /* Must try at least 3 times according to DP spec */ |
| 267 | 272 | for (try = 0; try < 5; try++) { |
| 268 | 273 | /* Load the send data into the aux channel data registers */ |
| 269 | − for (i = 0; i < send_bytes; i += 4) { | |
| 270 | − uint32_t d = pack_aux(send + i, send_bytes - i); | |
| 271 | − | |
| 272 | − I915_WRITE(ch_data + i, d); | |
| 273 | − } | |
| 274 | − | |
| 275 | − ctl = (DP_AUX_CH_CTL_SEND_BUSY | | |
| 276 | − DP_AUX_CH_CTL_TIME_OUT_400us | | |
| 277 | − (send_bytes << DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT) | | |
| 278 | − (precharge << DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT) | | |
| 279 | − (aux_clock_divider << DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT) | | |
| 280 | − DP_AUX_CH_CTL_DONE | | |
| 281 | − DP_AUX_CH_CTL_TIME_OUT_ERROR | | |
| 282 | − DP_AUX_CH_CTL_RECEIVE_ERROR); | |
| 274 | + for (i = 0; i < send_bytes; i += 4) | |
| 275 | + I915_WRITE(ch_data + i, | |
| 276 | + pack_aux(send + i, send_bytes - i)); | |
| 283 | 277 | |
| 284 | 278 | /* Send the command and wait for it to complete */ |
| 285 | − I915_WRITE(ch_ctl, ctl); | |
| 286 | − (void) I915_READ(ch_ctl); | |
| 279 | + I915_WRITE(ch_ctl, | |
| 280 | + DP_AUX_CH_CTL_SEND_BUSY | | |
| 281 | + DP_AUX_CH_CTL_TIME_OUT_400us | | |
| 282 | + (send_bytes << DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT) | | |
| 283 | + (precharge << DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT) | | |
| 284 | + (aux_clock_divider << DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT) | | |
| 285 | + DP_AUX_CH_CTL_DONE | | |
| 286 | + DP_AUX_CH_CTL_TIME_OUT_ERROR | | |
| 287 | + DP_AUX_CH_CTL_RECEIVE_ERROR); | |
| 287 | 288 | for (;;) { |
| 288 | − udelay(100); | |
| 289 | 289 | status = I915_READ(ch_ctl); |
| 290 | 290 | if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0) |
| 291 | 291 | break; |
| 292 | + udelay(100); | |
| 292 | 293 | } |
| 293 | 294 | |
| 294 | 295 | /* Clear done status and any errors */ |
| 295 | − I915_WRITE(ch_ctl, (status | | |
| 296 | − DP_AUX_CH_CTL_DONE | | |
| 297 | − DP_AUX_CH_CTL_TIME_OUT_ERROR | | |
| 298 | − DP_AUX_CH_CTL_RECEIVE_ERROR)); | |
| 299 | − (void) I915_READ(ch_ctl); | |
| 300 | − if ((status & DP_AUX_CH_CTL_TIME_OUT_ERROR) == 0) | |
| 296 | + I915_WRITE(ch_ctl, | |
| 297 | + status | | |
| 298 | + DP_AUX_CH_CTL_DONE | | |
| 299 | + DP_AUX_CH_CTL_TIME_OUT_ERROR | | |
| 300 | + DP_AUX_CH_CTL_RECEIVE_ERROR); | |
| 301 | + if (status & DP_AUX_CH_CTL_DONE) | |
| 301 | 302 | break; |
| 302 | 303 | } |
| 303 | 304 | |
| @@ -324,15 +325,12 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, · 20 unmodified lines | ||
| 324 | 325 | /* Unload any bytes sent back from the other side */ |
| 325 | 326 | recv_bytes = ((status & DP_AUX_CH_CTL_MESSAGE_SIZE_MASK) >> |
| 326 | 327 | DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT); |
| 327 | − | |
| 328 | 328 | if (recv_bytes > recv_size) |
| 329 | 329 | recv_bytes = recv_size; |
| 330 | 330 | |
| 331 | − for (i = 0; i < recv_bytes; i += 4) { | |
| 332 | − uint32_t d = I915_READ(ch_data + i); | |
| 333 | − | |
| 334 | − unpack_aux(d, recv + i, recv_bytes - i); | |
| 335 | − } | |
| 331 | + for (i = 0; i < recv_bytes; i += 4) | |
| 332 | + unpack_aux(I915_READ(ch_data + i), | |
| 333 | + recv + i, recv_bytes - i); | |
| 336 | 334 | |
| 337 | 335 | return recv_bytes; |
| 338 | 336 | } |
| @@ -176,6 +176,16 @@ struct intel_crtc { · 175 unmodified lines | ||
| 176 | 176 | #define enc_to_intel_encoder(x) container_of(x, struct intel_encoder, enc) |
| 177 | 177 | #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) |
| 178 | 178 | |
| 179 | +struct intel_unpin_work { | |
| 180 | + struct work_struct work; | |
| 181 | + struct drm_device *dev; | |
| 182 | + struct drm_gem_object *old_fb_obj; | |
| 183 | + struct drm_gem_object *pending_flip_obj; | |
| 184 | + struct drm_pending_vblank_event *event; | |
| 185 | + int pending; | |
| 186 | + bool enable_stall_check; | |
| 187 | +}; | |
| 188 | + | |
| 179 | 189 | struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg, |
| 180 | 190 | const char *name); |
| 181 | 191 | void intel_i2c_destroy(struct i2c_adapter *adapter); |
| @@ -875,8 +875,6 @@ void intel_lvds_init(struct drm_device *dev) · 874 unmodified lines | ||
| 875 | 875 | |
| 876 | 876 | intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT); |
| 877 | 877 | intel_encoder->crtc_mask = (1 << 1); |
| 878 | − if (IS_I965G(dev)) | |
| 879 | − intel_encoder->crtc_mask |= (1 << 0); | |
| 880 | 878 | drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs); |
| 881 | 879 | drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs); |
| 882 | 880 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; |
| @@ -25,6 +25,8 @@ · 24 unmodified lines | ||
| 25 | 25 | * |
| 26 | 26 | * Derived from Xorg ddx, xf86-video-intel, src/i830_video.c |
| 27 | 27 | */ |
| 28 | + | |
| 29 | +#include <linux/seq_file.h> | |
| 28 | 30 | #include "drmP.h" |
| 29 | 31 | #include "drm.h" |
| 30 | 32 | #include "i915_drm.h" |
| @@ -220,9 +220,13 @@ static int init_render_ring(struct drm_device *dev, · 219 unmodified lines | ||
| 220 | 220 | { |
| 221 | 221 | drm_i915_private_t *dev_priv = dev->dev_private; |
| 222 | 222 | int ret = init_ring_common(dev, ring); |
| 223 | + int mode; | |
| 224 | + | |
| 223 | 225 | if (IS_I9XX(dev) && !IS_GEN3(dev)) { |
| 224 | − I915_WRITE(MI_MODE, | |
| 225 | − (VS_TIMER_DISPATCH) << 16 | VS_TIMER_DISPATCH); | |
| 226 | + mode = VS_TIMER_DISPATCH << 16 | VS_TIMER_DISPATCH; | |
| 227 | + if (IS_GEN6(dev)) | |
| 228 | + mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE; | |
| 229 | + I915_WRITE(MI_MODE, mode); | |
| 226 | 230 | } |
| 227 | 231 | return ret; |
| 228 | 232 | } |
| @@ -1061,8 +1061,9 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, · 1060 unmodified lines | ||
| 1061 | 1061 | if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode)) |
| 1062 | 1062 | return false; |
| 1063 | 1063 | |
| 1064 | − if (!intel_sdvo_set_input_timings_for_mode(intel_sdvo, mode, adjusted_mode)) | |
| 1065 | − return false; | |
| 1064 | + (void) intel_sdvo_set_input_timings_for_mode(intel_sdvo, | |
| 1065 | + mode, | |
| 1066 | + adjusted_mode); | |
| 1066 | 1067 | } else if (intel_sdvo->is_lvds) { |
| 1067 | 1068 | drm_mode_set_crtcinfo(intel_sdvo->sdvo_lvds_fixed_mode, 0); |
| 1068 | 1069 | |
| @@ -1070,8 +1071,9 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, · 1 unmodified line | ||
| 1070 | 1071 | intel_sdvo->sdvo_lvds_fixed_mode)) |
| 1071 | 1072 | return false; |
| 1072 | 1073 | |
| 1073 | − if (!intel_sdvo_set_input_timings_for_mode(intel_sdvo, mode, adjusted_mode)) | |
| 1074 | − return false; | |
| 1074 | + (void) intel_sdvo_set_input_timings_for_mode(intel_sdvo, | |
| 1075 | + mode, | |
| 1076 | + adjusted_mode); | |
| 1075 | 1077 | } |
| 1076 | 1078 | |
| 1077 | 1079 | /* Make the CRTC code factor in the SDVO pixel multiplier. The |
| @@ -1108,10 +1110,9 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, · 30 unmodified lines | ||
| 1108 | 1110 | in_out.in0 = intel_sdvo->attached_output; |
| 1109 | 1111 | in_out.in1 = 0; |
| 1110 | 1112 | |
| 1111 | − if (!intel_sdvo_set_value(intel_sdvo, | |
| 1112 | − SDVO_CMD_SET_IN_OUT_MAP, | |
| 1113 | − &in_out, sizeof(in_out))) | |
| 1114 | − return; | |
| 1113 | + intel_sdvo_set_value(intel_sdvo, | |
| 1114 | + SDVO_CMD_SET_IN_OUT_MAP, | |
| 1115 | + &in_out, sizeof(in_out)); | |
| 1115 | 1116 | |
| 1116 | 1117 | if (intel_sdvo->is_hdmi) { |
| 1117 | 1118 | if (!intel_sdvo_set_avi_infoframe(intel_sdvo, mode)) |
| @@ -1122,11 +1123,9 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, · 4 unmodified lines | ||
| 1122 | 1123 | |
| 1123 | 1124 | /* We have tried to get input timing in mode_fixup, and filled into |
| 1124 | 1125 | adjusted_mode */ |
| 1125 | − if (intel_sdvo->is_tv || intel_sdvo->is_lvds) { | |
| 1126 | − intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | |
| 1126 | + intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | |
| 1127 | + if (intel_sdvo->is_tv || intel_sdvo->is_lvds) | |
| 1127 | 1128 | input_dtd.part2.sdvo_flags = intel_sdvo->sdvo_flags; |
| 1128 | − } else | |
| 1129 | − intel_sdvo_get_dtd_from_mode(&input_dtd, mode); | |
| 1130 | 1129 | |
| 1131 | 1130 | /* If it's a TV, we already set the output timing in mode_fixup. |
| 1132 | 1131 | * Otherwise, the output timing is equal to the input timing. |
| @@ -1137,8 +1136,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, · 4 unmodified lines | ||
| 1137 | 1136 | intel_sdvo->attached_output)) |
| 1138 | 1137 | return; |
| 1139 | 1138 | |
| 1140 | − if (!intel_sdvo_set_output_timing(intel_sdvo, &input_dtd)) | |
| 1141 | − return; | |
| 1139 | + (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd); | |
| 1142 | 1140 | } |
| 1143 | 1141 | |
| 1144 | 1142 | /* Set the input timing to the screen. Assume always input 0. */ |
| @@ -1165,8 +1163,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, · 20 unmodified lines | ||
| 1165 | 1163 | intel_sdvo_set_input_timing(encoder, &input_dtd); |
| 1166 | 1164 | } |
| 1167 | 1165 | #else |
| 1168 | − if (!intel_sdvo_set_input_timing(intel_sdvo, &input_dtd)) | |
| 1169 | − return; | |
| 1166 | + (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); | |
| 1170 | 1167 | #endif |
| 1171 | 1168 | |
| 1172 | 1169 | sdvo_pixel_multiply = intel_sdvo_get_pixel_multiplier(mode); |
| @@ -1932,6 +1929,41 @@ static const struct drm_encoder_funcs intel_sdvo_enc_funcs = { · 759 unmodified lines | ||
| 1932 | 1929 | .destroy = intel_sdvo_enc_destroy, |
| 1933 | 1930 | }; |
| 1934 | 1931 | |
| 1932 | +static void | |
| 1933 | +intel_sdvo_guess_ddc_bus(struct intel_sdvo *sdvo) | |
| 1934 | +{ | |
| 1935 | + uint16_t mask = 0; | |
| 1936 | + unsigned int num_bits; | |
| 1937 | + | |
| 1938 | + /* Make a mask of outputs less than or equal to our own priority in the | |
| 1939 | + * list. | |
| 1940 | + */ | |
| 1941 | + switch (sdvo->controlled_output) { | |
| 1942 | + case SDVO_OUTPUT_LVDS1: | |
| 1943 | + mask |= SDVO_OUTPUT_LVDS1; | |
| 1944 | + case SDVO_OUTPUT_LVDS0: | |
| 1945 | + mask |= SDVO_OUTPUT_LVDS0; | |
| 1946 | + case SDVO_OUTPUT_TMDS1: | |
| 1947 | + mask |= SDVO_OUTPUT_TMDS1; | |
| 1948 | + case SDVO_OUTPUT_TMDS0: | |
| 1949 | + mask |= SDVO_OUTPUT_TMDS0; | |
| 1950 | + case SDVO_OUTPUT_RGB1: | |
| 1951 | + mask |= SDVO_OUTPUT_RGB1; | |
| 1952 | + case SDVO_OUTPUT_RGB0: | |
| 1953 | + mask |= SDVO_OUTPUT_RGB0; | |
| 1954 | + break; | |
| 1955 | + } | |
| 1956 | + | |
| 1957 | + /* Count bits to find what number we are in the priority list. */ | |
| 1958 | + mask &= sdvo->caps.output_flags; | |
| 1959 | + num_bits = hweight16(mask); | |
| 1960 | + /* If more than 3 outputs, default to DDC bus 3 for now. */ | |
| 1961 | + if (num_bits > 3) | |
| 1962 | + num_bits = 3; | |
| 1963 | + | |
| 1964 | + /* Corresponds to SDVO_CONTROL_BUS_DDCx */ | |
| 1965 | + sdvo->ddc_bus = 1 << num_bits; | |
| 1966 | +} | |
| 1935 | 1967 | |
| 1936 | 1968 | /** |
| 1937 | 1969 | * Choose the appropriate DDC bus for control bus switch command for this |
| @@ -1951,7 +1983,10 @@ intel_sdvo_select_ddc_bus(struct drm_i915_private *dev_priv, · 13 unmodified lines | ||
| 1951 | 1983 | else |
| 1952 | 1984 | mapping = &(dev_priv->sdvo_mappings[1]); |
| 1953 | 1985 | |
| 1954 | − sdvo->ddc_bus = 1 << ((mapping->ddc_pin & 0xf0) >> 4); | |
| 1986 | + if (mapping->initialized) | |
| 1987 | + sdvo->ddc_bus = 1 << ((mapping->ddc_pin & 0xf0) >> 4); | |
| 1988 | + else | |
| 1989 | + intel_sdvo_guess_ddc_bus(sdvo); | |
| 1955 | 1990 | } |
| 1956 | 1991 | |
| 1957 | 1992 | static bool |
| @@ -1231,7 +1231,6 @@ intel_tv_detect_type (struct intel_tv *intel_tv) · 1230 unmodified lines | ||
| 1231 | 1231 | struct drm_encoder *encoder = &intel_tv->base.enc; |
| 1232 | 1232 | struct drm_device *dev = encoder->dev; |
| 1233 | 1233 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1234 | − struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); | |
| 1235 | 1234 | unsigned long irqflags; |
| 1236 | 1235 | u32 tv_ctl, save_tv_ctl; |
| 1237 | 1236 | u32 tv_dac, save_tv_dac; |
| @@ -1268,11 +1267,15 @@ intel_tv_detect_type (struct intel_tv *intel_tv) · 30 unmodified lines | ||
| 1268 | 1267 | DAC_C_0_7_V); |
| 1269 | 1268 | I915_WRITE(TV_CTL, tv_ctl); |
| 1270 | 1269 | I915_WRITE(TV_DAC, tv_dac); |
| 1271 | − intel_wait_for_vblank(dev, intel_crtc->pipe); | |
| 1270 | + POSTING_READ(TV_DAC); | |
| 1271 | + msleep(20); | |
| 1272 | + | |
| 1272 | 1273 | tv_dac = I915_READ(TV_DAC); |
| 1273 | 1274 | I915_WRITE(TV_DAC, save_tv_dac); |
| 1274 | 1275 | I915_WRITE(TV_CTL, save_tv_ctl); |
| 1275 | − intel_wait_for_vblank(dev, intel_crtc->pipe); | |
| 1276 | + POSTING_READ(TV_CTL); | |
| 1277 | + msleep(20); | |
| 1278 | + | |
| 1276 | 1279 | /* |
| 1277 | 1280 | * A B C |
| 1278 | 1281 | * 0 1 1 Composite |
| @@ -3869,27 +3869,10 @@ static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_entr · 3868 unmodified lines | ||
| 3869 | 3869 | } |
| 3870 | 3870 | #ifdef __powerpc__ |
| 3871 | 3871 | /* Powerbook specific quirks */ |
| 3872 | − if ((dev->pci_device & 0xffff) == 0x0179 || | |
| 3873 | − (dev->pci_device & 0xffff) == 0x0189 || | |
| 3874 | − (dev->pci_device & 0xffff) == 0x0329) { | |
| 3875 | − if (script == LVDS_RESET) { | |
| 3876 | − nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72); | |
| 3877 | − | |
| 3878 | − } else if (script == LVDS_PANEL_ON) { | |
| 3879 | − bios_wr32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL, | |
| 3880 | − bios_rd32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL) | |
| 3881 | − | (1 << 31)); | |
| 3882 | − bios_wr32(bios, NV_PCRTC_GPIO_EXT, | |
| 3883 | − bios_rd32(bios, NV_PCRTC_GPIO_EXT) | 1); | |
| 3884 | − | |
| 3885 | − } else if (script == LVDS_PANEL_OFF) { | |
| 3886 | − bios_wr32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL, | |
| 3887 | − bios_rd32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL) | |
| 3888 | − & ~(1 << 31)); | |
| 3889 | − bios_wr32(bios, NV_PCRTC_GPIO_EXT, | |
| 3890 | − bios_rd32(bios, NV_PCRTC_GPIO_EXT) & ~3); | |
| 3891 | − } | |
| 3892 | − } | |
| 3872 | + if (script == LVDS_RESET && | |
| 3873 | + (dev->pci_device == 0x0179 || dev->pci_device == 0x0189 || | |
| 3874 | + dev->pci_device == 0x0329)) | |
| 3875 | + nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72); | |
| 3893 | 3876 | #endif |
| 3894 | 3877 | |
| 3895 | 3878 | return 0; |
| @@ -4381,11 +4364,8 @@ int nouveau_bios_parse_lvds_table(struct drm_device *dev, int pxclk, bool *dl, b · 485 unmodified lines | ||
| 4381 | 4364 | * |
| 4382 | 4365 | * For the moment, a quirk will do :) |
| 4383 | 4366 | */ |
| 4384 | − if ((dev->pdev->device == 0x01d7) && | |
| 4385 | − (dev->pdev->subsystem_vendor == 0x1028) && | |
| 4386 | − (dev->pdev->subsystem_device == 0x01c2)) { | |
| 4367 | + if (nv_match_device(dev, 0x01d7, 0x1028, 0x01c2)) | |
| 4387 | 4368 | bios->fp.duallink_transition_clk = 80000; |
| 4388 | − } | |
| 4389 | 4369 | |
| 4390 | 4370 | /* set dual_link flag for EDID case */ |
| 4391 | 4371 | if (pxclk && (chip_version < 0x25 || chip_version > 0x28)) |
| @@ -5814,9 +5794,7 @@ parse_dcb_gpio_table(struct nvbios *bios) · 1422 unmodified lines | ||
| 5814 | 5794 | */ |
| 5815 | 5795 | |
| 5816 | 5796 | /* Apple iMac G4 NV18 */ |
| 5817 | − if (dev->pdev->device == 0x0189 && | |
| 5818 | − dev->pdev->subsystem_vendor == 0x10de && | |
| 5819 | − dev->pdev->subsystem_device == 0x0010) { | |
| 5797 | + if (nv_match_device(dev, 0x0189, 0x10de, 0x0010)) { | |
| 5820 | 5798 | struct dcb_gpio_entry *gpio = new_gpio_entry(bios); |
| 5821 | 5799 | |
| 5822 | 5800 | gpio->tag = DCB_GPIO_TVDAC0; |
| @@ -5898,9 +5876,7 @@ apply_dcb_connector_quirks(struct nvbios *bios, int idx) · 75 unmodified lines | ||
| 5898 | 5876 | struct drm_device *dev = bios->dev; |
| 5899 | 5877 | |
| 5900 | 5878 | /* Gigabyte NX85T */ |
| 5901 | − if ((dev->pdev->device == 0x0421) && | |
| 5902 | − (dev->pdev->subsystem_vendor == 0x1458) && | |
| 5903 | − (dev->pdev->subsystem_device == 0x344c)) { | |
| 5879 | + if (nv_match_device(dev, 0x0421, 0x1458, 0x344c)) { | |
| 5904 | 5880 | if (cte->type == DCB_CONNECTOR_HDMI_1) |
| 5905 | 5881 | cte->type = DCB_CONNECTOR_DVI_I; |
| 5906 | 5882 | } |
| @@ -6153,7 +6129,7 @@ parse_dcb20_entry(struct drm_device *dev, struct dcb_table *dcb, · 246 unmodified lines | ||
| 6153 | 6129 | entry->tmdsconf.slave_addr = (conf & 0x00000070) >> 4; |
| 6154 | 6130 | |
| 6155 | 6131 | break; |
| 6156 | − case 0xe: | |
| 6132 | + case OUTPUT_EOL: | |
| 6157 | 6133 | /* weird g80 mobile type that "nv" treats as a terminator */ |
| 6158 | 6134 | dcb->entries--; |
| 6159 | 6135 | return false; |
| @@ -6190,22 +6166,14 @@ parse_dcb15_entry(struct drm_device *dev, struct dcb_table *dcb, · 30 unmodified lines | ||
| 6190 | 6166 | entry->type = OUTPUT_TV; |
| 6191 | 6167 | break; |
| 6192 | 6168 | case 2: |
| 6193 | − case 3: | |
| 6194 | − entry->type = OUTPUT_LVDS; | |
| 6195 | − break; | |
| 6196 | 6169 | case 4: |
| 6197 | − switch ((conn & 0x000000f0) >> 4) { | |
| 6198 | − case 0: | |
| 6199 | − entry->type = OUTPUT_TMDS; | |
| 6200 | − break; | |
| 6201 | − case 1: | |
| 6170 | + if (conn & 0x10) | |
| 6202 | 6171 | entry->type = OUTPUT_LVDS; |
| 6203 | − break; | |
| 6204 | − default: | |
| 6205 | − NV_ERROR(dev, "Unknown DCB subtype 4/%d\n", | |
| 6206 | − (conn & 0x000000f0) >> 4); | |
| 6207 | − return false; | |
| 6208 | − } | |
| 6172 | + else | |
| 6173 | + entry->type = OUTPUT_TMDS; | |
| 6174 | + break; | |
| 6175 | + case 3: | |
| 6176 | + entry->type = OUTPUT_LVDS; | |
| 6209 | 6177 | break; |
| 6210 | 6178 | default: |
| 6211 | 6179 | NV_ERROR(dev, "Unknown DCB type %d\n", conn & 0x0000000f); |
| @@ -6321,9 +6289,7 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) · 109 unmodified lines | ||
| 6321 | 6289 | * nasty problems until this is sorted (assuming it's not a |
| 6322 | 6290 | * VBIOS bug). |
| 6323 | 6291 | */ |
| 6324 | − if ((dev->pdev->device == 0x040d) && | |
| 6325 | − (dev->pdev->subsystem_vendor == 0x1028) && | |
| 6326 | − (dev->pdev->subsystem_device == 0x019b)) { | |
| 6292 | + if (nv_match_device(dev, 0x040d, 0x1028, 0x019b)) { | |
| 6327 | 6293 | if (*conn == 0x02026312 && *conf == 0x00000020) |
| 6328 | 6294 | return false; |
| 6329 | 6295 | } |
| @@ -95,6 +95,7 @@ enum dcb_type { · 94 unmodified lines | ||
| 95 | 95 | OUTPUT_TMDS = 2, |
| 96 | 96 | OUTPUT_LVDS = 3, |
| 97 | 97 | OUTPUT_DP = 6, |
| 98 | + OUTPUT_EOL = 14, /* DCB 4.0+, appears to be end-of-list */ | |
| 98 | 99 | OUTPUT_ANY = -1 |
| 99 | 100 | }; |
| 100 | 101 | |
| @@ -1389,6 +1389,15 @@ nv_two_reg_pll(struct drm_device *dev) · 1388 unmodified lines | ||
| 1389 | 1389 | return false; |
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | +static inline bool | |
| 1393 | +nv_match_device(struct drm_device *dev, unsigned device, | |
| 1394 | + unsigned sub_vendor, unsigned sub_device) | |
| 1395 | +{ | |
| 1396 | + return dev->pdev->device == device && | |
| 1397 | + dev->pdev->subsystem_vendor == sub_vendor && | |
| 1398 | + dev->pdev->subsystem_device == sub_device; | |
| 1399 | +} | |
| 1400 | + | |
| 1392 | 1401 | #define NV_SW 0x0000506e |
| 1393 | 1402 | #define NV_SW_DMA_SEMAPHORE 0x00000060 |
| 1394 | 1403 | #define NV_SW_SEMAPHORE_OFFSET 0x00000064 |
| @@ -64,16 +64,17 @@ nouveau_fence_update(struct nouveau_channel *chan) · 63 unmodified lines | ||
| 64 | 64 | struct nouveau_fence *fence; |
| 65 | 65 | uint32_t sequence; |
| 66 | 66 | |
| 67 | + spin_lock(&chan->fence.lock); | |
| 68 | + | |
| 67 | 69 | if (USE_REFCNT) |
| 68 | 70 | sequence = nvchan_rd32(chan, 0x48); |
| 69 | 71 | else |
| 70 | 72 | sequence = atomic_read(&chan->fence.last_sequence_irq); |
| 71 | 73 | |
| 72 | 74 | if (chan->fence.sequence_ack == sequence) |
| 73 | − return; | |
| 75 | + goto out; | |
| 74 | 76 | chan->fence.sequence_ack = sequence; |
| 75 | 77 | |
| 76 | − spin_lock(&chan->fence.lock); | |
| 77 | 78 | list_for_each_safe(entry, tmp, &chan->fence.pending) { |
| 78 | 79 | fence = list_entry(entry, struct nouveau_fence, entry); |
| 79 | 80 | |
| @@ -85,6 +86,7 @@ nouveau_fence_update(struct nouveau_channel *chan) · 5 unmodified lines | ||
| 85 | 86 | if (sequence == chan->fence.sequence_ack) |
| 86 | 87 | break; |
| 87 | 88 | } |
| 89 | +out: | |
| 88 | 90 | spin_unlock(&chan->fence.lock); |
| 89 | 91 | } |
| 90 | 92 | |
| @@ -245,7 +245,7 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence) · 244 unmodified lines | ||
| 245 | 245 | list_del(&nvbo->entry); |
| 246 | 246 | nvbo->reserved_by = NULL; |
| 247 | 247 | ttm_bo_unreserve(&nvbo->bo); |
| 248 | − drm_gem_object_unreference(nvbo->gem); | |
| 248 | + drm_gem_object_unreference_unlocked(nvbo->gem); | |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | |
| @@ -300,7 +300,7 @@ retry: · 48 unmodified lines | ||
| 300 | 300 | validate_fini(op, NULL); |
| 301 | 301 | if (ret == -EAGAIN) |
| 302 | 302 | ret = ttm_bo_wait_unreserved(&nvbo->bo, false); |
| 303 | − drm_gem_object_unreference(gem); | |
| 303 | + drm_gem_object_unreference_unlocked(gem); | |
| 304 | 304 | if (ret) { |
| 305 | 305 | NV_ERROR(dev, "fail reserve\n"); |
| 306 | 306 | return ret; |
| @@ -337,7 +337,9 @@ retry: · 30 unmodified lines | ||
| 337 | 337 | return -EINVAL; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | + mutex_unlock(&drm_global_mutex); | |
| 340 | 341 | ret = ttm_bo_wait_cpu(&nvbo->bo, false); |
| 342 | + mutex_lock(&drm_global_mutex); | |
| 341 | 343 | if (ret) { |
| 342 | 344 | NV_ERROR(dev, "fail wait_cpu\n"); |
| 343 | 345 | return ret; |
| @@ -614,8 +616,6 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, · 270 unmodified lines | ||
| 614 | 616 | return PTR_ERR(bo); |
| 615 | 617 | } |
| 616 | 618 | |
| 617 | − mutex_lock(&dev->struct_mutex); | |
| 618 | − | |
| 619 | 619 | /* Mark push buffers as being used on PFIFO, the validation code |
| 620 | 620 | * will then make sure that if the pushbuf bo moves, that they |
| 621 | 621 | * happen on the kernel channel, which will in turn cause a sync |
| @@ -663,7 +663,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, · 41 unmodified lines | ||
| 663 | 663 | push[i].length); |
| 664 | 664 | } |
| 665 | 665 | } else |
| 666 | − if (dev_priv->card_type >= NV_20) { | |
| 666 | + if (dev_priv->chipset >= 0x25) { | |
| 667 | 667 | ret = RING_SPACE(chan, req->nr_push * 2); |
| 668 | 668 | if (ret) { |
| 669 | 669 | NV_ERROR(dev, "cal_space: %d\n", ret); |
| @@ -729,7 +729,6 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, · 59 unmodified lines | ||
| 729 | 729 | out: |
| 730 | 730 | validate_fini(&op, fence); |
| 731 | 731 | nouveau_fence_unref((void**)&fence); |
| 732 | − mutex_unlock(&dev->struct_mutex); | |
| 733 | 732 | kfree(bo); |
| 734 | 733 | kfree(push); |
| 735 | 734 | |
| @@ -738,7 +737,7 @@ out_next: · 2 unmodified lines | ||
| 738 | 737 | req->suffix0 = 0x00000000; |
| 739 | 738 | req->suffix1 = 0x00000000; |
| 740 | 739 | } else |
| 741 | − if (dev_priv->card_type >= NV_20) { | |
| 740 | + if (dev_priv->chipset >= 0x25) { | |
| 742 | 741 | req->suffix0 = 0x00020000; |
| 743 | 742 | req->suffix1 = 0x00000000; |
| 744 | 743 | } else { |
| @@ -444,6 +444,7 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) · 443 unmodified lines | ||
| 444 | 444 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); |
| 445 | 445 | struct dcb_entry *dcbe = nv_encoder->dcb; |
| 446 | 446 | int head = nouveau_crtc(encoder->crtc)->index; |
| 447 | + struct drm_encoder *slave_encoder; | |
| 447 | 448 | |
| 448 | 449 | if (dcbe->type == OUTPUT_TMDS) |
| 449 | 450 | run_tmds_table(dev, dcbe, head, nv_encoder->mode.clock); |
| @@ -462,9 +463,10 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) · 12 unmodified lines | ||
| 462 | 463 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + nv04_dac_output_offset(encoder), 0x00100000); |
| 463 | 464 | |
| 464 | 465 | /* Init external transmitters */ |
| 465 | − if (get_tmds_slave(encoder)) | |
| 466 | − get_slave_funcs(get_tmds_slave(encoder))->mode_set( | |
| 467 | − encoder, &nv_encoder->mode, &nv_encoder->mode); | |
| 466 | + slave_encoder = get_tmds_slave(encoder); | |
| 467 | + if (slave_encoder) | |
| 468 | + get_slave_funcs(slave_encoder)->mode_set( | |
| 469 | + slave_encoder, &nv_encoder->mode, &nv_encoder->mode); | |
| 468 | 470 | |
| 469 | 471 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
| 470 | 472 | |
| @@ -473,6 +475,27 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) · 2 unmodified lines | ||
| 473 | 475 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
| 474 | 476 | } |
| 475 | 477 | |
| 478 | +static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) | |
| 479 | +{ | |
| 480 | +#ifdef __powerpc__ | |
| 481 | + struct drm_device *dev = encoder->dev; | |
| 482 | + | |
| 483 | + /* BIOS scripts usually take care of the backlight, thanks | |
| 484 | + * Apple for your consistency. | |
| 485 | + */ | |
| 486 | + if (dev->pci_device == 0x0179 || dev->pci_device == 0x0189 || | |
| 487 | + dev->pci_device == 0x0329) { | |
| 488 | + if (mode == DRM_MODE_DPMS_ON) { | |
| 489 | + nv_mask(dev, NV_PBUS_DEBUG_DUALHEAD_CTL, 0, 1 << 31); | |
| 490 | + nv_mask(dev, NV_PCRTC_GPIO_EXT, 3, 1); | |
| 491 | + } else { | |
| 492 | + nv_mask(dev, NV_PBUS_DEBUG_DUALHEAD_CTL, 1 << 31, 0); | |
| 493 | + nv_mask(dev, NV_PCRTC_GPIO_EXT, 3, 0); | |
| 494 | + } | |
| 495 | + } | |
| 496 | +#endif | |
| 497 | +} | |
| 498 | + | |
| 476 | 499 | static inline bool is_powersaving_dpms(int mode) |
| 477 | 500 | { |
| 478 | 501 | return (mode != DRM_MODE_DPMS_ON); |
| @@ -520,6 +543,7 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) · 41 unmodified lines | ||
| 520 | 543 | LVDS_PANEL_OFF, 0); |
| 521 | 544 | } |
| 522 | 545 | |
| 546 | + nv04_dfp_update_backlight(encoder, mode); | |
| 523 | 547 | nv04_dfp_update_fp_control(encoder, mode); |
| 524 | 548 | |
| 525 | 549 | if (mode == DRM_MODE_DPMS_ON) |
| @@ -543,6 +567,7 @@ static void nv04_tmds_dpms(struct drm_encoder *encoder, int mode) · 17 unmodified lines | ||
| 543 | 567 | NV_INFO(dev, "Setting dpms mode %d on tmds encoder (output %d)\n", |
| 544 | 568 | mode, nv_encoder->dcb->index); |
| 545 | 569 | |
| 570 | + nv04_dfp_update_backlight(encoder, mode); | |
| 546 | 571 | nv04_dfp_update_fp_control(encoder, mode); |
| 547 | 572 | } |
| 548 | 573 | |
| @@ -121,18 +121,14 @@ static bool · 120 unmodified lines | ||
| 121 | 121 | get_tv_detect_quirks(struct drm_device *dev, uint32_t *pin_mask) |
| 122 | 122 | { |
| 123 | 123 | /* Zotac FX5200 */ |
| 124 | − if (dev->pdev->device == 0x0322 && | |
| 125 | − dev->pdev->subsystem_vendor == 0x19da && | |
| 126 | − (dev->pdev->subsystem_device == 0x1035 || | |
| 127 | − dev->pdev->subsystem_device == 0x2035)) { | |
| 124 | + if (nv_match_device(dev, 0x0322, 0x19da, 0x1035) || | |
| 125 | + nv_match_device(dev, 0x0322, 0x19da, 0x2035)) { | |
| 128 | 126 | *pin_mask = 0xc; |
| 129 | 127 | return false; |
| 130 | 128 | } |
| 131 | 129 | |
| 132 | 130 | /* MSI nForce2 IGP */ |
| 133 | − if (dev->pdev->device == 0x01f0 && | |
| 134 | − dev->pdev->subsystem_vendor == 0x1462 && | |
| 135 | − dev->pdev->subsystem_device == 0x5710) { | |
| 131 | + if (nv_match_device(dev, 0x01f0, 0x1462, 0x5710)) { | |
| 136 | 132 | *pin_mask = 0xc; |
| 137 | 133 | return false; |
| 138 | 134 | } |
| @@ -139,6 +139,8 @@ nv50_instmem_init(struct drm_device *dev) · 138 unmodified lines | ||
| 139 | 139 | chan->file_priv = (struct drm_file *)-2; |
| 140 | 140 | dev_priv->fifos[0] = dev_priv->fifos[127] = chan; |
| 141 | 141 | |
| 142 | + INIT_LIST_HEAD(&chan->ramht_refs); | |
| 143 | + | |
| 142 | 144 | /* Channel's PRAMIN object + heap */ |
| 143 | 145 | ret = nouveau_gpuobj_new_fake(dev, 0, c_offset, c_size, 0, |
| 144 | 146 | NULL, &chan->ramin); |
| @@ -332,6 +332,11 @@ static void atombios_crtc_set_timing(struct drm_crtc *crtc, · 331 unmodified lines | ||
| 332 | 332 | args.usV_SyncWidth = |
| 333 | 333 | cpu_to_le16(mode->crtc_vsync_end - mode->crtc_vsync_start); |
| 334 | 334 | |
| 335 | + args.ucOverscanRight = radeon_crtc->h_border; | |
| 336 | + args.ucOverscanLeft = radeon_crtc->h_border; | |
| 337 | + args.ucOverscanBottom = radeon_crtc->v_border; | |
| 338 | + args.ucOverscanTop = radeon_crtc->v_border; | |
| 339 | + | |
| 335 | 340 | if (mode->flags & DRM_MODE_FLAG_NVSYNC) |
| 336 | 341 | misc |= ATOM_VSYNC_POLARITY; |
| 337 | 342 | if (mode->flags & DRM_MODE_FLAG_NHSYNC) |
| @@ -534,6 +539,20 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, · 196 unmodified lines | ||
| 534 | 539 | pll->algo = PLL_ALGO_LEGACY; |
| 535 | 540 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; |
| 536 | 541 | } |
| 542 | + /* There is some evidence (often anecdotal) that RV515 LVDS | |
| 543 | + * (on some boards at least) prefers the legacy algo. I'm not | |
| 544 | + * sure whether this should handled generically or on a | |
| 545 | + * case-by-case quirk basis. Both algos should work fine in the | |
| 546 | + * majority of cases. | |
| 547 | + */ | |
| 548 | + if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) && | |
| 549 | + (rdev->family == CHIP_RV515)) { | |
| 550 | + /* allow the user to overrride just in case */ | |
| 551 | + if (radeon_new_pll == 1) | |
| 552 | + pll->algo = PLL_ALGO_NEW; | |
| 553 | + else | |
| 554 | + pll->algo = PLL_ALGO_LEGACY; | |
| 555 | + } | |
| 537 | 556 | } else { |
| 538 | 557 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) |
| 539 | 558 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; |
| @@ -1056,11 +1075,11 @@ static int avivo_crtc_set_base(struct drm_crtc *crtc, int x, int y, · 516 unmodified lines | ||
| 1056 | 1075 | |
| 1057 | 1076 | if (rdev->family >= CHIP_RV770) { |
| 1058 | 1077 | if (radeon_crtc->crtc_id) { |
| 1059 | − WREG32(R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH, 0); | |
| 1060 | − WREG32(R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH, 0); | |
| 1078 | + WREG32(R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH, upper_32_bits(fb_location)); | |
| 1079 | + WREG32(R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH, upper_32_bits(fb_location)); | |
| 1061 | 1080 | } else { |
| 1062 | − WREG32(R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH, 0); | |
| 1063 | − WREG32(R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH, 0); | |
| 1081 | + WREG32(R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH, upper_32_bits(fb_location)); | |
| 1082 | + WREG32(R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH, upper_32_bits(fb_location)); | |
| 1064 | 1083 | } |
| 1065 | 1084 | } |
| 1066 | 1085 | WREG32(AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
| @@ -1197,8 +1216,18 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc, · 130 unmodified lines | ||
| 1197 | 1216 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
| 1198 | 1217 | struct drm_device *dev = crtc->dev; |
| 1199 | 1218 | struct radeon_device *rdev = dev->dev_private; |
| 1219 | + struct drm_encoder *encoder; | |
| 1220 | + bool is_tvcv = false; | |
| 1200 | 1221 | |
| 1201 | − /* TODO color tiling */ | |
| 1222 | + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | |
| 1223 | + /* find tv std */ | |
| 1224 | + if (encoder->crtc == crtc) { | |
| 1225 | + struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | |
| 1226 | + if (radeon_encoder->active_device & | |
| 1227 | + (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) | |
| 1228 | + is_tvcv = true; | |
| 1229 | + } | |
| 1230 | + } | |
| 1202 | 1231 | |
| 1203 | 1232 | atombios_disable_ss(crtc); |
| 1204 | 1233 | /* always set DCPLL */ |
| @@ -1207,9 +1236,14 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc, · 2 unmodified lines | ||
| 1207 | 1236 | atombios_crtc_set_pll(crtc, adjusted_mode); |
| 1208 | 1237 | atombios_enable_ss(crtc); |
| 1209 | 1238 | |
| 1210 | − if (ASIC_IS_AVIVO(rdev)) | |
| 1239 | + if (ASIC_IS_DCE4(rdev)) | |
| 1211 | 1240 | atombios_set_crtc_dtd_timing(crtc, adjusted_mode); |
| 1212 | − else { | |
| 1241 | + else if (ASIC_IS_AVIVO(rdev)) { | |
| 1242 | + if (is_tvcv) | |
| 1243 | + atombios_crtc_set_timing(crtc, adjusted_mode); | |
| 1244 | + else | |
| 1245 | + atombios_set_crtc_dtd_timing(crtc, adjusted_mode); | |
| 1246 | + } else { | |
| 1213 | 1247 | atombios_crtc_set_timing(crtc, adjusted_mode); |
| 1214 | 1248 | if (radeon_crtc->crtc_id == 0) |
| 1215 | 1249 | atombios_set_crtc_dtd_timing(crtc, adjusted_mode); |
| @@ -675,6 +675,43 @@ static int evergreen_cp_load_microcode(struct radeon_device *rdev) · 674 unmodified lines | ||
| 675 | 675 | return 0; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | +static int evergreen_cp_start(struct radeon_device *rdev) | |
| 679 | +{ | |
| 680 | + int r; | |
| 681 | + uint32_t cp_me; | |
| 682 | + | |
| 683 | + r = radeon_ring_lock(rdev, 7); | |
| 684 | + if (r) { | |
| 685 | + DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); | |
| 686 | + return r; | |
| 687 | + } | |
| 688 | + radeon_ring_write(rdev, PACKET3(PACKET3_ME_INITIALIZE, 5)); | |
| 689 | + radeon_ring_write(rdev, 0x1); | |
| 690 | + radeon_ring_write(rdev, 0x0); | |
| 691 | + radeon_ring_write(rdev, rdev->config.evergreen.max_hw_contexts - 1); | |
| 692 | + radeon_ring_write(rdev, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); | |
| 693 | + radeon_ring_write(rdev, 0); | |
| 694 | + radeon_ring_write(rdev, 0); | |
| 695 | + radeon_ring_unlock_commit(rdev); | |
| 696 | + | |
| 697 | + cp_me = 0xff; | |
| 698 | + WREG32(CP_ME_CNTL, cp_me); | |
| 699 | + | |
| 700 | + r = radeon_ring_lock(rdev, 4); | |
| 701 | + if (r) { | |
| 702 | + DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); | |
| 703 | + return r; | |
| 704 | + } | |
| 705 | + /* init some VGT regs */ | |
| 706 | + radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); | |
| 707 | + radeon_ring_write(rdev, (VGT_VERTEX_REUSE_BLOCK_CNTL - PACKET3_SET_CONTEXT_REG_START) >> 2); | |
| 708 | + radeon_ring_write(rdev, 0xe); | |
| 709 | + radeon_ring_write(rdev, 0x10); | |
| 710 | + radeon_ring_unlock_commit(rdev); | |
| 711 | + | |
| 712 | + return 0; | |
| 713 | +} | |
| 714 | + | |
| 678 | 715 | int evergreen_cp_resume(struct radeon_device *rdev) |
| 679 | 716 | { |
| 680 | 717 | u32 tmp; |
| @@ -719,7 +756,7 @@ int evergreen_cp_resume(struct radeon_device *rdev) · 38 unmodified lines | ||
| 719 | 756 | rdev->cp.rptr = RREG32(CP_RB_RPTR); |
| 720 | 757 | rdev->cp.wptr = RREG32(CP_RB_WPTR); |
| 721 | 758 | |
| 722 | − r600_cp_start(rdev); | |
| 759 | + evergreen_cp_start(rdev); | |
| 723 | 760 | rdev->cp.ready = true; |
| 724 | 761 | r = radeon_ring_test(rdev); |
| 725 | 762 | if (r) { |
| @@ -2054,11 +2091,6 @@ int evergreen_resume(struct radeon_device *rdev) · 1328 unmodified lines | ||
| 2054 | 2091 | */ |
| 2055 | 2092 | /* post card */ |
| 2056 | 2093 | atom_asic_init(rdev->mode_info.atom_context); |
| 2057 | − /* Initialize clocks */ | |
| 2058 | − r = radeon_clocks_init(rdev); | |
| 2059 | − if (r) { | |
| 2060 | − return r; | |
| 2061 | − } | |
| 2062 | 2094 | |
| 2063 | 2095 | r = evergreen_startup(rdev); |
| 2064 | 2096 | if (r) { |
| @@ -2164,9 +2196,6 @@ int evergreen_init(struct radeon_device *rdev) · 99 unmodified lines | ||
| 2164 | 2196 | radeon_surface_init(rdev); |
| 2165 | 2197 | /* Initialize clocks */ |
| 2166 | 2198 | radeon_get_clock_info(rdev->ddev); |
| 2167 | − r = radeon_clocks_init(rdev); | |
| 2168 | − if (r) | |
| 2169 | − return r; | |
| 2170 | 2199 | /* Fence driver */ |
| 2171 | 2200 | r = radeon_fence_driver_init(rdev); |
| 2172 | 2201 | if (r) |
| @@ -2236,7 +2265,6 @@ void evergreen_fini(struct radeon_device *rdev) · 63 unmodified lines | ||
| 2236 | 2265 | evergreen_pcie_gart_fini(rdev); |
| 2237 | 2266 | radeon_gem_fini(rdev); |
| 2238 | 2267 | radeon_fence_driver_fini(rdev); |
| 2239 | − radeon_clocks_fini(rdev); | |
| 2240 | 2268 | radeon_agp_fini(rdev); |
| 2241 | 2269 | radeon_bo_fini(rdev); |
| 2242 | 2270 | radeon_atombios_fini(rdev); |
| @@ -2119,10 +2119,7 @@ int r600_cp_start(struct radeon_device *rdev) · 2118 unmodified lines | ||
| 2119 | 2119 | } |
| 2120 | 2120 | radeon_ring_write(rdev, PACKET3(PACKET3_ME_INITIALIZE, 5)); |
| 2121 | 2121 | radeon_ring_write(rdev, 0x1); |
| 2122 | − if (rdev->family >= CHIP_CEDAR) { | |
| 2123 | − radeon_ring_write(rdev, 0x0); | |
| 2124 | − radeon_ring_write(rdev, rdev->config.evergreen.max_hw_contexts - 1); | |
| 2125 | − } else if (rdev->family >= CHIP_RV770) { | |
| 2122 | + if (rdev->family >= CHIP_RV770) { | |
| 2126 | 2123 | radeon_ring_write(rdev, 0x0); |
| 2127 | 2124 | radeon_ring_write(rdev, rdev->config.rv770.max_hw_contexts - 1); |
| 2128 | 2125 | } else { |
| @@ -2489,11 +2486,6 @@ int r600_resume(struct radeon_device *rdev) · 360 unmodified lines | ||
| 2489 | 2486 | */ |
| 2490 | 2487 | /* post card */ |
| 2491 | 2488 | atom_asic_init(rdev->mode_info.atom_context); |
| 2492 | − /* Initialize clocks */ | |
| 2493 | − r = radeon_clocks_init(rdev); | |
| 2494 | − if (r) { | |
| 2495 | − return r; | |
| 2496 | − } | |
| 2497 | 2489 | |
| 2498 | 2490 | r = r600_startup(rdev); |
| 2499 | 2491 | if (r) { |
| @@ -2586,9 +2578,6 @@ int r600_init(struct radeon_device *rdev) · 86 unmodified lines | ||
| 2586 | 2578 | radeon_surface_init(rdev); |
| 2587 | 2579 | /* Initialize clocks */ |
| 2588 | 2580 | radeon_get_clock_info(rdev->ddev); |
| 2589 | − r = radeon_clocks_init(rdev); | |
| 2590 | − if (r) | |
| 2591 | − return r; | |
| 2592 | 2581 | /* Fence driver */ |
| 2593 | 2582 | r = radeon_fence_driver_init(rdev); |
| 2594 | 2583 | if (r) |
| @@ -2663,7 +2652,6 @@ void r600_fini(struct radeon_device *rdev) · 68 unmodified lines | ||
| 2663 | 2652 | radeon_agp_fini(rdev); |
| 2664 | 2653 | radeon_gem_fini(rdev); |
| 2665 | 2654 | radeon_fence_driver_fini(rdev); |
| 2666 | − radeon_clocks_fini(rdev); | |
| 2667 | 2655 | radeon_bo_fini(rdev); |
| 2668 | 2656 | radeon_atombios_fini(rdev); |
| 2669 | 2657 | kfree(rdev->bios); |
| @@ -3541,7 +3529,7 @@ void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) · 871 unmodified lines | ||
| 3541 | 3529 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL |
| 3542 | 3530 | */ |
| 3543 | 3531 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { |
| 3544 | − void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; | |
| 3532 | + void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | |
| 3545 | 3533 | u32 tmp; |
| 3546 | 3534 | |
| 3547 | 3535 | WREG32(HDP_DEBUG1, 0); |
| @@ -1013,6 +1013,11 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data, · 1012 unmodified lines | ||
| 1013 | 1013 | int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data, |
| 1014 | 1014 | struct drm_file *filp); |
| 1015 | 1015 | |
| 1016 | +/* VRAM scratch page for HDP bug */ | |
| 1017 | +struct r700_vram_scratch { | |
| 1018 | + struct radeon_bo *robj; | |
| 1019 | + volatile uint32_t *ptr; | |
| 1020 | +}; | |
| 1016 | 1021 | |
| 1017 | 1022 | /* |
| 1018 | 1023 | * Core structure, functions and helpers. |
| @@ -1079,6 +1084,7 @@ struct radeon_device { · 60 unmodified lines | ||
| 1079 | 1084 | const struct firmware *pfp_fw; /* r6/700 PFP firmware */ |
| 1080 | 1085 | const struct firmware *rlc_fw; /* r6/700 RLC firmware */ |
| 1081 | 1086 | struct r600_blit r600_blit; |
| 1087 | + struct r700_vram_scratch vram_scratch; | |
| 1082 | 1088 | int msi_enabled; /* msi enabled */ |
| 1083 | 1089 | struct r600_ih ih; /* r6/700 interrupt ring */ |
| 1084 | 1090 | struct workqueue_struct *wq; |
| @@ -1333,8 +1339,6 @@ extern bool radeon_card_posted(struct radeon_device *rdev); · 248 unmodified lines | ||
| 1333 | 1339 | extern void radeon_update_bandwidth_info(struct radeon_device *rdev); |
| 1334 | 1340 | extern void radeon_update_display_priority(struct radeon_device *rdev); |
| 1335 | 1341 | extern bool radeon_boot_test_post_card(struct radeon_device *rdev); |
| 1336 | −extern int radeon_clocks_init(struct radeon_device *rdev); | |
| 1337 | −extern void radeon_clocks_fini(struct radeon_device *rdev); | |
| 1338 | 1342 | extern void radeon_scratch_init(struct radeon_device *rdev); |
| 1339 | 1343 | extern void radeon_surface_init(struct radeon_device *rdev); |
| 1340 | 1344 | extern int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data); |
| @@ -858,21 +858,3 @@ int radeon_asic_init(struct radeon_device *rdev) · 857 unmodified lines | ||
| 858 | 858 | return 0; |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | −/* | |
| 862 | − * Wrapper around modesetting bits. Move to radeon_clocks.c? | |
| 863 | − */ | |
| 864 | −int radeon_clocks_init(struct radeon_device *rdev) | |
| 865 | −{ | |
| 866 | − int r; | |
| 867 | − | |
| 868 | − r = radeon_static_clocks_init(rdev->ddev); | |
| 869 | − if (r) { | |
| 870 | − return r; | |
| 871 | − } | |
| 872 | − DRM_INFO("Clocks initialized !\n"); | |
| 873 | − return 0; | |
| 874 | −} | |
| 875 | − | |
| 876 | −void radeon_clocks_fini(struct radeon_device *rdev) | |
| 877 | −{ | |
| 878 | −} | |
| @@ -85,6 +85,19 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev · 84 unmodified lines | ||
| 85 | 85 | for (i = 0; i < num_indices; i++) { |
| 86 | 86 | gpio = &i2c_info->asGPIO_Info[i]; |
| 87 | 87 | |
| 88 | + /* some evergreen boards have bad data for this entry */ | |
| 89 | + if (ASIC_IS_DCE4(rdev)) { | |
| 90 | + if ((i == 7) && | |
| 91 | + (gpio->usClkMaskRegisterIndex == 0x1936) && | |
| 92 | + (gpio->sucI2cId.ucAccess == 0)) { | |
| 93 | + gpio->sucI2cId.ucAccess = 0x97; | |
| 94 | + gpio->ucDataMaskShift = 8; | |
| 95 | + gpio->ucDataEnShift = 8; | |
| 96 | + gpio->ucDataY_Shift = 8; | |
| 97 | + gpio->ucDataA_Shift = 8; | |
| 98 | + } | |
| 99 | + } | |
| 100 | + | |
| 88 | 101 | if (gpio->sucI2cId.ucAccess == id) { |
| 89 | 102 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
| 90 | 103 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
| @@ -147,6 +160,20 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) · 56 unmodified lines | ||
| 147 | 160 | for (i = 0; i < num_indices; i++) { |
| 148 | 161 | gpio = &i2c_info->asGPIO_Info[i]; |
| 149 | 162 | i2c.valid = false; |
| 163 | + | |
| 164 | + /* some evergreen boards have bad data for this entry */ | |
| 165 | + if (ASIC_IS_DCE4(rdev)) { | |
| 166 | + if ((i == 7) && | |
| 167 | + (gpio->usClkMaskRegisterIndex == 0x1936) && | |
| 168 | + (gpio->sucI2cId.ucAccess == 0)) { | |
| 169 | + gpio->sucI2cId.ucAccess = 0x97; | |
| 170 | + gpio->ucDataMaskShift = 8; | |
| 171 | + gpio->ucDataEnShift = 8; | |
| 172 | + gpio->ucDataY_Shift = 8; | |
| 173 | + gpio->ucDataA_Shift = 8; | |
| 174 | + } | |
| 175 | + } | |
| 176 | + | |
| 150 | 177 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
| 151 | 178 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
| 152 | 179 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; |
| @@ -327,6 +327,14 @@ void radeon_get_clock_info(struct drm_device *dev) · 326 unmodified lines | ||
| 327 | 327 | mpll->max_feedback_div = 0xff; |
| 328 | 328 | mpll->best_vco = 0; |
| 329 | 329 | |
| 330 | + if (!rdev->clock.default_sclk) | |
| 331 | + rdev->clock.default_sclk = radeon_get_engine_clock(rdev); | |
| 332 | + if ((!rdev->clock.default_mclk) && rdev->asic->get_memory_clock) | |
| 333 | + rdev->clock.default_mclk = radeon_get_memory_clock(rdev); | |
| 334 | + | |
| 335 | + rdev->pm.current_sclk = rdev->clock.default_sclk; | |
| 336 | + rdev->pm.current_mclk = rdev->clock.default_mclk; | |
| 337 | + | |
| 330 | 338 | } |
| 331 | 339 | |
| 332 | 340 | /* 10 khz */ |
| @@ -897,53 +905,3 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) · 564 unmodified lines | ||
| 897 | 905 | } |
| 898 | 906 | } |
| 899 | 907 | |
| 900 | −static void radeon_apply_clock_quirks(struct radeon_device *rdev) | |
| 901 | −{ | |
| 902 | − uint32_t tmp; | |
| 903 | − | |
| 904 | − /* XXX make sure engine is idle */ | |
| 905 | − | |
| 906 | − if (rdev->family < CHIP_RS600) { | |
| 907 | − tmp = RREG32_PLL(RADEON_SCLK_CNTL); | |
| 908 | − if (ASIC_IS_R300(rdev) || ASIC_IS_RV100(rdev)) | |
| 909 | − tmp |= RADEON_SCLK_FORCE_CP | RADEON_SCLK_FORCE_VIP; | |
| 910 | − if ((rdev->family == CHIP_RV250) | |
| 911 | − || (rdev->family == CHIP_RV280)) | |
| 912 | − tmp |= | |
| 913 | − RADEON_SCLK_FORCE_DISP1 | RADEON_SCLK_FORCE_DISP2; | |
| 914 | − if ((rdev->family == CHIP_RV350) | |
| 915 | − || (rdev->family == CHIP_RV380)) | |
| 916 | − tmp |= R300_SCLK_FORCE_VAP; | |
| 917 | − if (rdev->family == CHIP_R420) | |
| 918 | − tmp |= R300_SCLK_FORCE_PX | R300_SCLK_FORCE_TX; | |
| 919 | − WREG32_PLL(RADEON_SCLK_CNTL, tmp); | |
| 920 | − } else if (rdev->family < CHIP_R600) { | |
| 921 | − tmp = RREG32_PLL(AVIVO_CP_DYN_CNTL); | |
| 922 | − tmp |= AVIVO_CP_FORCEON; | |
| 923 | − WREG32_PLL(AVIVO_CP_DYN_CNTL, tmp); | |
| 924 | − | |
| 925 | − tmp = RREG32_PLL(AVIVO_E2_DYN_CNTL); | |
| 926 | − tmp |= AVIVO_E2_FORCEON; | |
| 927 | − WREG32_PLL(AVIVO_E2_DYN_CNTL, tmp); | |
| 928 | − | |
| 929 | − tmp = RREG32_PLL(AVIVO_IDCT_DYN_CNTL); | |
| 930 | − tmp |= AVIVO_IDCT_FORCEON; | |
| 931 | − WREG32_PLL(AVIVO_IDCT_DYN_CNTL, tmp); | |
| 932 | − } | |
| 933 | −} | |
| 934 | − | |
| 935 | −int radeon_static_clocks_init(struct drm_device *dev) | |
| 936 | −{ | |
| 937 | − struct radeon_device *rdev = dev->dev_private; | |
| 938 | − | |
| 939 | − /* XXX make sure engine is idle */ | |
| 940 | − | |
| 941 | − if (radeon_dynclks != -1) { | |
| 942 | − if (radeon_dynclks) { | |
| 943 | − if (rdev->asic->set_clock_gating) | |
| 944 | − radeon_set_clock_gating(rdev, 1); | |
| 945 | − } | |
| 946 | − } | |
| 947 | − radeon_apply_clock_quirks(rdev); | |
| 948 | − return 0; | |
| 949 | −} | |
| @@ -999,6 +999,7 @@ static enum drm_connector_status radeon_dp_detect(struct drm_connector *connecto · 998 unmodified lines | ||
| 999 | 999 | } |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | + radeon_connector_update_scratch_regs(connector, ret); | |
| 1002 | 1003 | return ret; |
| 1003 | 1004 | } |
| 1004 | 1005 | |
| @@ -1050,10 +1051,16 @@ radeon_add_atom_connector(struct drm_device *dev, · 45 unmodified lines | ||
| 1050 | 1051 | uint32_t subpixel_order = SubPixelNone; |
| 1051 | 1052 | bool shared_ddc = false; |
| 1052 | 1053 | |
| 1053 | − /* fixme - tv/cv/din */ | |
| 1054 | 1054 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) |
| 1055 | 1055 | return; |
| 1056 | 1056 | |
| 1057 | + /* if the user selected tv=0 don't try and add the connector */ | |
| 1058 | + if (((connector_type == DRM_MODE_CONNECTOR_SVIDEO) || | |
| 1059 | + (connector_type == DRM_MODE_CONNECTOR_Composite) || | |
| 1060 | + (connector_type == DRM_MODE_CONNECTOR_9PinDIN)) && | |
| 1061 | + (radeon_tv == 0)) | |
| 1062 | + return; | |
| 1063 | + | |
| 1057 | 1064 | /* see if we already added it */ |
| 1058 | 1065 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1059 | 1066 | radeon_connector = to_radeon_connector(connector); |
| @@ -1208,19 +1215,17 @@ radeon_add_atom_connector(struct drm_device *dev, · 148 unmodified lines | ||
| 1208 | 1215 | case DRM_MODE_CONNECTOR_SVIDEO: |
| 1209 | 1216 | case DRM_MODE_CONNECTOR_Composite: |
| 1210 | 1217 | case DRM_MODE_CONNECTOR_9PinDIN: |
| 1211 | − if (radeon_tv == 1) { | |
| 1212 | − drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); | |
| 1213 | − drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); | |
| 1214 | − radeon_connector->dac_load_detect = true; | |
| 1215 | − drm_connector_attach_property(&radeon_connector->base, | |
| 1216 | − rdev->mode_info.load_detect_property, | |
| 1217 | − 1); | |
| 1218 | − drm_connector_attach_property(&radeon_connector->base, | |
| 1219 | − rdev->mode_info.tv_std_property, | |
| 1220 | − radeon_atombios_get_tv_info(rdev)); | |
| 1221 | − /* no HPD on analog connectors */ | |
| 1222 | − radeon_connector->hpd.hpd = RADEON_HPD_NONE; | |
| 1223 | − } | |
| 1218 | + drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); | |
| 1219 | + drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); | |
| 1220 | + radeon_connector->dac_load_detect = true; | |
| 1221 | + drm_connector_attach_property(&radeon_connector->base, | |
| 1222 | + rdev->mode_info.load_detect_property, | |
| 1223 | + 1); | |
| 1224 | + drm_connector_attach_property(&radeon_connector->base, | |
| 1225 | + rdev->mode_info.tv_std_property, | |
| 1226 | + radeon_atombios_get_tv_info(rdev)); | |
| 1227 | + /* no HPD on analog connectors */ | |
| 1228 | + radeon_connector->hpd.hpd = RADEON_HPD_NONE; | |
| 1224 | 1229 | break; |
| 1225 | 1230 | case DRM_MODE_CONNECTOR_LVDS: |
| 1226 | 1231 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
| @@ -1271,10 +1276,16 @@ radeon_add_legacy_connector(struct drm_device *dev, · 44 unmodified lines | ||
| 1271 | 1276 | struct radeon_connector *radeon_connector; |
| 1272 | 1277 | uint32_t subpixel_order = SubPixelNone; |
| 1273 | 1278 | |
| 1274 | − /* fixme - tv/cv/din */ | |
| 1275 | 1279 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) |
| 1276 | 1280 | return; |
| 1277 | 1281 | |
| 1282 | + /* if the user selected tv=0 don't try and add the connector */ | |
| 1283 | + if (((connector_type == DRM_MODE_CONNECTOR_SVIDEO) || | |
| 1284 | + (connector_type == DRM_MODE_CONNECTOR_Composite) || | |
| 1285 | + (connector_type == DRM_MODE_CONNECTOR_9PinDIN)) && | |
| 1286 | + (radeon_tv == 0)) | |
| 1287 | + return; | |
| 1288 | + | |
| 1278 | 1289 | /* see if we already added it */ |
| 1279 | 1290 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1280 | 1291 | radeon_connector = to_radeon_connector(connector); |
| @@ -1346,26 +1357,24 @@ radeon_add_legacy_connector(struct drm_device *dev, · 65 unmodified lines | ||
| 1346 | 1357 | case DRM_MODE_CONNECTOR_SVIDEO: |
| 1347 | 1358 | case DRM_MODE_CONNECTOR_Composite: |
| 1348 | 1359 | case DRM_MODE_CONNECTOR_9PinDIN: |
| 1349 | − if (radeon_tv == 1) { | |
| 1350 | − drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); | |
| 1351 | − drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); | |
| 1352 | − radeon_connector->dac_load_detect = true; | |
| 1353 | − /* RS400,RC410,RS480 chipset seems to report a lot | |
| 1354 | − * of false positive on load detect, we haven't yet | |
| 1355 | − * found a way to make load detect reliable on those | |
| 1356 | − * chipset, thus just disable it for TV. | |
| 1357 | − */ | |
| 1358 | − if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) | |
| 1359 | − radeon_connector->dac_load_detect = false; | |
| 1360 | − drm_connector_attach_property(&radeon_connector->base, | |
| 1361 | − rdev->mode_info.load_detect_property, | |
| 1362 | − radeon_connector->dac_load_detect); | |
| 1363 | − drm_connector_attach_property(&radeon_connector->base, | |
| 1364 | − rdev->mode_info.tv_std_property, | |
| 1365 | − radeon_combios_get_tv_info(rdev)); | |
| 1366 | − /* no HPD on analog connectors */ | |
| 1367 | − radeon_connector->hpd.hpd = RADEON_HPD_NONE; | |
| 1368 | − } | |
| 1360 | + drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); | |
| 1361 | + drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); | |
| 1362 | + radeon_connector->dac_load_detect = true; | |
| 1363 | + /* RS400,RC410,RS480 chipset seems to report a lot | |
| 1364 | + * of false positive on load detect, we haven't yet | |
| 1365 | + * found a way to make load detect reliable on those | |
| 1366 | + * chipset, thus just disable it for TV. | |
| 1367 | + */ | |
| 1368 | + if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) | |
| 1369 | + radeon_connector->dac_load_detect = false; | |
| 1370 | + drm_connector_attach_property(&radeon_connector->base, | |
| 1371 | + rdev->mode_info.load_detect_property, | |
| 1372 | + radeon_connector->dac_load_detect); | |
| 1373 | + drm_connector_attach_property(&radeon_connector->base, | |
| 1374 | + rdev->mode_info.tv_std_property, | |
| 1375 | + radeon_combios_get_tv_info(rdev)); | |
| 1376 | + /* no HPD on analog connectors */ | |
| 1377 | + radeon_connector->hpd.hpd = RADEON_HPD_NONE; | |
| 1369 | 1378 | break; |
| 1370 | 1379 | case DRM_MODE_CONNECTOR_LVDS: |
| 1371 | 1380 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
| @@ -293,30 +293,20 @@ bool radeon_card_posted(struct radeon_device *rdev) · 292 unmodified lines | ||
| 293 | 293 | void radeon_update_bandwidth_info(struct radeon_device *rdev) |
| 294 | 294 | { |
| 295 | 295 | fixed20_12 a; |
| 296 | − u32 sclk, mclk; | |
| 296 | + u32 sclk = rdev->pm.current_sclk; | |
| 297 | + u32 mclk = rdev->pm.current_mclk; | |
| 297 | 298 | |
| 298 | − if (rdev->flags & RADEON_IS_IGP) { | |
| 299 | − sclk = radeon_get_engine_clock(rdev); | |
| 300 | − mclk = rdev->clock.default_mclk; | |
| 301 | − | |
| 302 | − a.full = dfixed_const(100); | |
| 303 | − rdev->pm.sclk.full = dfixed_const(sclk); | |
| 304 | − rdev->pm.sclk.full = dfixed_div(rdev->pm.sclk, a); | |
| 305 | − rdev->pm.mclk.full = dfixed_const(mclk); | |
| 306 | − rdev->pm.mclk.full = dfixed_div(rdev->pm.mclk, a); | |
| 299 | + /* sclk/mclk in Mhz */ | |
| 300 | + a.full = dfixed_const(100); | |
| 301 | + rdev->pm.sclk.full = dfixed_const(sclk); | |
| 302 | + rdev->pm.sclk.full = dfixed_div(rdev->pm.sclk, a); | |
| 303 | + rdev->pm.mclk.full = dfixed_const(mclk); | |
| 304 | + rdev->pm.mclk.full = dfixed_div(rdev->pm.mclk, a); | |
| 307 | 305 | |
| 306 | + if (rdev->flags & RADEON_IS_IGP) { | |
| 308 | 307 | a.full = dfixed_const(16); |
| 309 | 308 | /* core_bandwidth = sclk(Mhz) * 16 */ |
| 310 | 309 | rdev->pm.core_bandwidth.full = dfixed_div(rdev->pm.sclk, a); |
| 311 | − } else { | |
| 312 | − sclk = radeon_get_engine_clock(rdev); | |
| 313 | − mclk = radeon_get_memory_clock(rdev); | |
| 314 | − | |
| 315 | − a.full = dfixed_const(100); | |
| 316 | − rdev->pm.sclk.full = dfixed_const(sclk); | |
| 317 | − rdev->pm.sclk.full = dfixed_div(rdev->pm.sclk, a); | |
| 318 | − rdev->pm.mclk.full = dfixed_const(mclk); | |
| 319 | − rdev->pm.mclk.full = dfixed_div(rdev->pm.mclk, a); | |
| 320 | 310 | } |
| 321 | 311 | } |
| 322 | 312 | |
| @@ -213,7 +213,7 @@ static void post_xfer(struct i2c_adapter *i2c_adap) · 212 unmodified lines | ||
| 213 | 213 | |
| 214 | 214 | static u32 radeon_get_i2c_prescale(struct radeon_device *rdev) |
| 215 | 215 | { |
| 216 | − u32 sclk = radeon_get_engine_clock(rdev); | |
| 216 | + u32 sclk = rdev->pm.current_sclk; | |
| 217 | 217 | u32 prescale = 0; |
| 218 | 218 | u32 nm; |
| 219 | 219 | u8 n, m, loop; |
| @@ -600,7 +600,6 @@ extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct d · 599 unmodified lines | ||
| 600 | 600 | void radeon_enc_destroy(struct drm_encoder *encoder); |
| 601 | 601 | void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj); |
| 602 | 602 | void radeon_combios_asic_init(struct drm_device *dev); |
| 603 | −extern int radeon_static_clocks_init(struct drm_device *dev); | |
| 604 | 603 | bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, |
| 605 | 604 | struct drm_display_mode *mode, |
| 606 | 605 | struct drm_display_mode *adjusted_mode); |
| @@ -637,8 +637,6 @@ void radeon_pm_fini(struct radeon_device *rdev) · 636 unmodified lines | ||
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | radeon_hwmon_fini(rdev); |
| 640 | − if (rdev->pm.i2c_bus) | |
| 641 | − radeon_i2c_destroy(rdev->pm.i2c_bus); | |
| 642 | 640 | } |
| 643 | 641 | |
| 644 | 642 | void radeon_pm_compute_clocks(struct radeon_device *rdev) |
| @@ -905,6 +905,54 @@ static void rv770_gpu_init(struct radeon_device *rdev) · 904 unmodified lines | ||
| 905 | 905 | |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | +static int rv770_vram_scratch_init(struct radeon_device *rdev) | |
| 909 | +{ | |
| 910 | + int r; | |
| 911 | + u64 gpu_addr; | |
| 912 | + | |
| 913 | + if (rdev->vram_scratch.robj == NULL) { | |
| 914 | + r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, | |
| 915 | + true, RADEON_GEM_DOMAIN_VRAM, | |
| 916 | + &rdev->vram_scratch.robj); | |
| 917 | + if (r) { | |
| 918 | + return r; | |
| 919 | + } | |
| 920 | + } | |
| 921 | + | |
| 922 | + r = radeon_bo_reserve(rdev->vram_scratch.robj, false); | |
| 923 | + if (unlikely(r != 0)) | |
| 924 | + return r; | |
| 925 | + r = radeon_bo_pin(rdev->vram_scratch.robj, | |
| 926 | + RADEON_GEM_DOMAIN_VRAM, &gpu_addr); | |
| 927 | + if (r) { | |
| 928 | + radeon_bo_unreserve(rdev->vram_scratch.robj); | |
| 929 | + return r; | |
| 930 | + } | |
| 931 | + r = radeon_bo_kmap(rdev->vram_scratch.robj, | |
| 932 | + (void **)&rdev->vram_scratch.ptr); | |
| 933 | + if (r) | |
| 934 | + radeon_bo_unpin(rdev->vram_scratch.robj); | |
| 935 | + radeon_bo_unreserve(rdev->vram_scratch.robj); | |
| 936 | + | |
| 937 | + return r; | |
| 938 | +} | |
| 939 | + | |
| 940 | +static void rv770_vram_scratch_fini(struct radeon_device *rdev) | |
| 941 | +{ | |
| 942 | + int r; | |
| 943 | + | |
| 944 | + if (rdev->vram_scratch.robj == NULL) { | |
| 945 | + return; | |
| 946 | + } | |
| 947 | + r = radeon_bo_reserve(rdev->vram_scratch.robj, false); | |
| 948 | + if (likely(r == 0)) { | |
| 949 | + radeon_bo_kunmap(rdev->vram_scratch.robj); | |
| 950 | + radeon_bo_unpin(rdev->vram_scratch.robj); | |
| 951 | + radeon_bo_unreserve(rdev->vram_scratch.robj); | |
| 952 | + } | |
| 953 | + radeon_bo_unref(&rdev->vram_scratch.robj); | |
| 954 | +} | |
| 955 | + | |
| 908 | 956 | int rv770_mc_init(struct radeon_device *rdev) |
| 909 | 957 | { |
| 910 | 958 | u32 tmp; |
| @@ -970,6 +1018,9 @@ static int rv770_startup(struct radeon_device *rdev) · 59 unmodified lines | ||
| 970 | 1018 | if (r) |
| 971 | 1019 | return r; |
| 972 | 1020 | } |
| 1021 | + r = rv770_vram_scratch_init(rdev); | |
| 1022 | + if (r) | |
| 1023 | + return r; | |
| 973 | 1024 | rv770_gpu_init(rdev); |
| 974 | 1025 | r = r600_blit_init(rdev); |
| 975 | 1026 | if (r) { |
| @@ -1023,11 +1074,6 @@ int rv770_resume(struct radeon_device *rdev) · 47 unmodified lines | ||
| 1023 | 1074 | */ |
| 1024 | 1075 | /* post card */ |
| 1025 | 1076 | atom_asic_init(rdev->mode_info.atom_context); |
| 1026 | − /* Initialize clocks */ | |
| 1027 | − r = radeon_clocks_init(rdev); | |
| 1028 | − if (r) { | |
| 1029 | − return r; | |
| 1030 | − } | |
| 1031 | 1077 | |
| 1032 | 1078 | r = rv770_startup(rdev); |
| 1033 | 1079 | if (r) { |
| @@ -1118,9 +1164,6 @@ int rv770_init(struct radeon_device *rdev) · 84 unmodified lines | ||
| 1118 | 1164 | radeon_surface_init(rdev); |
| 1119 | 1165 | /* Initialize clocks */ |
| 1120 | 1166 | radeon_get_clock_info(rdev->ddev); |
| 1121 | − r = radeon_clocks_init(rdev); | |
| 1122 | − if (r) | |
| 1123 | − return r; | |
| 1124 | 1167 | /* Fence driver */ |
| 1125 | 1168 | r = radeon_fence_driver_init(rdev); |
| 1126 | 1169 | if (r) |
| @@ -1195,9 +1238,9 @@ void rv770_fini(struct radeon_device *rdev) · 68 unmodified lines | ||
| 1195 | 1238 | r600_irq_fini(rdev); |
| 1196 | 1239 | radeon_irq_kms_fini(rdev); |
| 1197 | 1240 | rv770_pcie_gart_fini(rdev); |
| 1241 | + rv770_vram_scratch_fini(rdev); | |
| 1198 | 1242 | radeon_gem_fini(rdev); |
| 1199 | 1243 | radeon_fence_driver_fini(rdev); |
| 1200 | − radeon_clocks_fini(rdev); | |
| 1201 | 1244 | radeon_agp_fini(rdev); |
| 1202 | 1245 | radeon_bo_fini(rdev); |
| 1203 | 1246 | radeon_atombios_fini(rdev); |
| @@ -160,30 +160,12 @@ static const struct attribute_group ads7871_group = { · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | static int __devinit ads7871_probe(struct spi_device *spi) |
| 162 | 162 | { |
| 163 | − int status, ret, err = 0; | |
| 163 | + int ret, err; | |
| 164 | 164 | uint8_t val; |
| 165 | 165 | struct ads7871_data *pdata; |
| 166 | 166 | |
| 167 | 167 | dev_dbg(&spi->dev, "probe\n"); |
| 168 | 168 | |
| 169 | − pdata = kzalloc(sizeof(struct ads7871_data), GFP_KERNEL); | |
| 170 | − if (!pdata) { | |
| 171 | − err = -ENOMEM; | |
| 172 | − goto exit; | |
| 173 | − } | |
| 174 | − | |
| 175 | − status = sysfs_create_group(&spi->dev.kobj, &ads7871_group); | |
| 176 | − if (status < 0) | |
| 177 | − goto error_free; | |
| 178 | − | |
| 179 | − pdata->hwmon_dev = hwmon_device_register(&spi->dev); | |
| 180 | − if (IS_ERR(pdata->hwmon_dev)) { | |
| 181 | − err = PTR_ERR(pdata->hwmon_dev); | |
| 182 | − goto error_remove; | |
| 183 | − } | |
| 184 | − | |
| 185 | − spi_set_drvdata(spi, pdata); | |
| 186 | − | |
| 187 | 169 | /* Configure the SPI bus */ |
| 188 | 170 | spi->mode = (SPI_MODE_0); |
| 189 | 171 | spi->bits_per_word = 8; |
| @@ -201,6 +183,24 @@ static int __devinit ads7871_probe(struct spi_device *spi) · 11 unmodified lines | ||
| 201 | 183 | we need to make sure we really have a chip*/ |
| 202 | 184 | if (val != ret) { |
| 203 | 185 | err = -ENODEV; |
| 186 | + goto exit; | |
| 187 | + } | |
| 188 | + | |
| 189 | + pdata = kzalloc(sizeof(struct ads7871_data), GFP_KERNEL); | |
| 190 | + if (!pdata) { | |
| 191 | + err = -ENOMEM; | |
| 192 | + goto exit; | |
| 193 | + } | |
| 194 | + | |
| 195 | + err = sysfs_create_group(&spi->dev.kobj, &ads7871_group); | |
| 196 | + if (err < 0) | |
| 197 | + goto error_free; | |
| 198 | + | |
| 199 | + spi_set_drvdata(spi, pdata); | |
| 200 | + | |
| 201 | + pdata->hwmon_dev = hwmon_device_register(&spi->dev); | |
| 202 | + if (IS_ERR(pdata->hwmon_dev)) { | |
| 203 | + err = PTR_ERR(pdata->hwmon_dev); | |
| 204 | 204 | goto error_remove; |
| 205 | 205 | } |
| 206 | 206 | |
| @@ -518,7 +518,6 @@ static struct notifier_block coretemp_cpu_notifier __refdata = { · 517 unmodified lines | ||
| 518 | 518 | static int __init coretemp_init(void) |
| 519 | 519 | { |
| 520 | 520 | int i, err = -ENODEV; |
| 521 | − struct pdev_entry *p, *n; | |
| 522 | 521 | |
| 523 | 522 | /* quick check if we run Intel */ |
| 524 | 523 | if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) |
| @@ -221,6 +221,8 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { · 220 unmodified lines | ||
| 221 | 221 | AXIS_DMI_MATCH("HPB442x", "HP ProBook 442", xy_rotated_left), |
| 222 | 222 | AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted), |
| 223 | 223 | AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap), |
| 224 | + AXIS_DMI_MATCH("HPB532x", "HP ProBook 532", y_inverted), | |
| 225 | + AXIS_DMI_MATCH("Mini5102", "HP Mini 5102", xy_rotated_left_usd), | |
| 224 | 226 | { NULL, } |
| 225 | 227 | /* Laptop models without axis info (yet): |
| 226 | 228 | * "NC6910" "HP Compaq 6910" |
| @@ -143,6 +143,37 @@ static const struct pci_device_id k8temp_ids[] = { · 142 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | MODULE_DEVICE_TABLE(pci, k8temp_ids); |
| 145 | 145 | |
| 146 | +static int __devinit is_rev_g_desktop(u8 model) | |
| 147 | +{ | |
| 148 | + u32 brandidx; | |
| 149 | + | |
| 150 | + if (model < 0x69) | |
| 151 | + return 0; | |
| 152 | + | |
| 153 | + if (model == 0xc1 || model == 0x6c || model == 0x7c) | |
| 154 | + return 0; | |
| 155 | + | |
| 156 | + /* | |
| 157 | + * Differentiate between AM2 and ASB1. | |
| 158 | + * See "Constructing the processor Name String" in "Revision | |
| 159 | + * Guide for AMD NPT Family 0Fh Processors" (33610). | |
| 160 | + */ | |
| 161 | + brandidx = cpuid_ebx(0x80000001); | |
| 162 | + brandidx = (brandidx >> 9) & 0x1f; | |
| 163 | + | |
| 164 | + /* Single core */ | |
| 165 | + if ((model == 0x6f || model == 0x7f) && | |
| 166 | + (brandidx == 0x7 || brandidx == 0x9 || brandidx == 0xc)) | |
| 167 | + return 0; | |
| 168 | + | |
| 169 | + /* Dual core */ | |
| 170 | + if (model == 0x6b && | |
| 171 | + (brandidx == 0xb || brandidx == 0xc)) | |
| 172 | + return 0; | |
| 173 | + | |
| 174 | + return 1; | |
| 175 | +} | |
| 176 | + | |
| 146 | 177 | static int __devinit k8temp_probe(struct pci_dev *pdev, |
| 147 | 178 | const struct pci_device_id *id) |
| 148 | 179 | { |
| @@ -179,9 +210,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, · 30 unmodified lines | ||
| 179 | 210 | "wrong - check erratum #141\n"); |
| 180 | 211 | } |
| 181 | 212 | |
| 182 | − if ((model >= 0x69) && | |
| 183 | − !(model == 0xc1 || model == 0x6c || model == 0x7c || | |
| 184 | − model == 0x6b || model == 0x6f || model == 0x7f)) { | |
| 213 | + if (is_rev_g_desktop(model)) { | |
| 185 | 214 | /* |
| 186 | 215 | * RevG desktop CPUs (i.e. no socket S1G1 or |
| 187 | 216 | * ASB1 parts) need additional offset, |
| @@ -1106,7 +1106,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso) · 1105 unmodified lines | ||
| 1106 | 1106 | if (recv->block_irq_interval * 4 > iso->buf_packets) |
| 1107 | 1107 | recv->block_irq_interval = iso->buf_packets / 4; |
| 1108 | 1108 | if (recv->block_irq_interval < 1) |
| 1109 | − recv->block_irq_interval = 1; | |
| 1109 | + recv->block_irq_interval = 1; | |
| 1110 | 1110 | |
| 1111 | 1111 | /* choose a buffer stride */ |
| 1112 | 1112 | /* must be a power of 2, and <= PAGE_SIZE */ |
| @@ -53,7 +53,7 @@ · 52 unmodified lines | ||
| 53 | 53 | #define T3_MAX_PBL_SIZE 256 |
| 54 | 54 | #define T3_MAX_RQ_SIZE 1024 |
| 55 | 55 | #define T3_MAX_QP_DEPTH (T3_MAX_RQ_SIZE-1) |
| 56 | −#define T3_MAX_CQ_DEPTH 262144 | |
| 56 | +#define T3_MAX_CQ_DEPTH 65536 | |
| 57 | 57 | #define T3_MAX_NUM_STAG (1<<15) |
| 58 | 58 | #define T3_MAX_MR_SIZE 0x100000000ULL |
| 59 | 59 | #define T3_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */ |
| @@ -502,7 +502,9 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, · 501 unmodified lines | ||
| 502 | 502 | static void nes_retrans_expired(struct nes_cm_node *cm_node) |
| 503 | 503 | { |
| 504 | 504 | struct iw_cm_id *cm_id = cm_node->cm_id; |
| 505 | − switch (cm_node->state) { | |
| 505 | + enum nes_cm_node_state state = cm_node->state; | |
| 506 | + cm_node->state = NES_CM_STATE_CLOSED; | |
| 507 | + switch (state) { | |
| 506 | 508 | case NES_CM_STATE_SYN_RCVD: |
| 507 | 509 | case NES_CM_STATE_CLOSING: |
| 508 | 510 | rem_ref_cm_node(cm_node->cm_core, cm_node); |
| @@ -511,7 +513,6 @@ static void nes_retrans_expired(struct nes_cm_node *cm_node) · 2 unmodified lines | ||
| 511 | 513 | case NES_CM_STATE_FIN_WAIT1: |
| 512 | 514 | if (cm_node->cm_id) |
| 513 | 515 | cm_id->rem_ref(cm_id); |
| 514 | − cm_node->state = NES_CM_STATE_CLOSED; | |
| 515 | 516 | send_reset(cm_node, NULL); |
| 516 | 517 | break; |
| 517 | 518 | default: |
| @@ -1439,9 +1440,6 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, · 921 unmodified lines | ||
| 1439 | 1440 | break; |
| 1440 | 1441 | case NES_CM_STATE_MPAREQ_RCVD: |
| 1441 | 1442 | passive_state = atomic_add_return(1, &cm_node->passive_state); |
| 1442 | − if (passive_state == NES_SEND_RESET_EVENT) | |
| 1443 | − create_event(cm_node, NES_CM_EVENT_RESET); | |
| 1444 | − cm_node->state = NES_CM_STATE_CLOSED; | |
| 1445 | 1443 | dev_kfree_skb_any(skb); |
| 1446 | 1444 | break; |
| 1447 | 1445 | case NES_CM_STATE_ESTABLISHED: |
| @@ -1456,6 +1454,7 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, · 8 unmodified lines | ||
| 1456 | 1454 | case NES_CM_STATE_CLOSED: |
| 1457 | 1455 | drop_packet(skb); |
| 1458 | 1456 | break; |
| 1457 | + case NES_CM_STATE_FIN_WAIT2: | |
| 1459 | 1458 | case NES_CM_STATE_FIN_WAIT1: |
| 1460 | 1459 | case NES_CM_STATE_LAST_ACK: |
| 1461 | 1460 | cm_node->cm_id->rem_ref(cm_node->cm_id); |
| @@ -2777,6 +2776,12 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) · 1315 unmodified lines | ||
| 2777 | 2776 | return -EINVAL; |
| 2778 | 2777 | } |
| 2779 | 2778 | |
| 2779 | + passive_state = atomic_add_return(1, &cm_node->passive_state); | |
| 2780 | + if (passive_state == NES_SEND_RESET_EVENT) { | |
| 2781 | + rem_ref_cm_node(cm_node->cm_core, cm_node); | |
| 2782 | + return -ECONNRESET; | |
| 2783 | + } | |
| 2784 | + | |
| 2780 | 2785 | /* associate the node with the QP */ |
| 2781 | 2786 | nesqp->cm_node = (void *)cm_node; |
| 2782 | 2787 | cm_node->nesqp = nesqp; |
| @@ -2979,9 +2984,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) · 196 unmodified lines | ||
| 2979 | 2984 | printk(KERN_ERR "%s[%u] OFA CM event_handler returned, " |
| 2980 | 2985 | "ret=%d\n", __func__, __LINE__, ret); |
| 2981 | 2986 | |
| 2982 | − passive_state = atomic_add_return(1, &cm_node->passive_state); | |
| 2983 | − if (passive_state == NES_SEND_RESET_EVENT) | |
| 2984 | − create_event(cm_node, NES_CM_EVENT_RESET); | |
| 2985 | 2987 | return 0; |
| 2986 | 2988 | } |
| 2987 | 2989 | |
| @@ -3468,6 +3468,19 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, · 3467 unmodified lines | ||
| 3468 | 3468 | return; /* Ignore it, wait for close complete */ |
| 3469 | 3469 | |
| 3470 | 3470 | if (atomic_inc_return(&nesqp->close_timer_started) == 1) { |
| 3471 | + if ((tcp_state == NES_AEQE_TCP_STATE_CLOSE_WAIT) && | |
| 3472 | + (nesqp->ibqp_state == IB_QPS_RTS) && | |
| 3473 | + ((nesadapter->eeprom_version >> 16) != NES_A0)) { | |
| 3474 | + spin_lock_irqsave(&nesqp->lock, flags); | |
| 3475 | + nesqp->hw_iwarp_state = iwarp_state; | |
| 3476 | + nesqp->hw_tcp_state = tcp_state; | |
| 3477 | + nesqp->last_aeq = async_event_id; | |
| 3478 | + next_iwarp_state = NES_CQP_QP_IWARP_STATE_CLOSING; | |
| 3479 | + nesqp->hw_iwarp_state = NES_AEQE_IWARP_STATE_CLOSING; | |
| 3480 | + spin_unlock_irqrestore(&nesqp->lock, flags); | |
| 3481 | + nes_hw_modify_qp(nesdev, nesqp, next_iwarp_state, 0, 0); | |
| 3482 | + nes_cm_disconn(nesqp); | |
| 3483 | + } | |
| 3471 | 3484 | nesqp->cm_id->add_ref(nesqp->cm_id); |
| 3472 | 3485 | schedule_nes_timer(nesqp->cm_node, (struct sk_buff *)nesqp, |
| 3473 | 3486 | NES_TIMER_TYPE_CLOSE, 1, 0); |
| @@ -3477,7 +3490,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, · 3 unmodified lines | ||
| 3477 | 3490 | nesqp->hwqp.qp_id, atomic_read(&nesqp->refcount), |
| 3478 | 3491 | async_event_id, nesqp->last_aeq, tcp_state); |
| 3479 | 3492 | } |
| 3480 | − | |
| 3481 | 3493 | break; |
| 3482 | 3494 | case NES_AEQE_AEID_LLP_CLOSE_COMPLETE: |
| 3483 | 3495 | if (nesqp->term_flags) { |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #define NES_PHY_TYPE_KR 9 |
| 46 | 46 | |
| 47 | 47 | #define NES_MULTICAST_PF_MAX 8 |
| 48 | +#define NES_A0 3 | |
| 48 | 49 | |
| 49 | 50 | enum pci_regs { |
| 50 | 51 | NES_INT_STAT = 0x0000, |
| @@ -1446,14 +1446,14 @@ static int nes_netdev_set_pauseparam(struct net_device *netdev, · 1445 unmodified lines | ||
| 1446 | 1446 | NES_IDX_MAC_TX_CONFIG + (nesdev->mac_index*0x200)); |
| 1447 | 1447 | u32temp |= NES_IDX_MAC_TX_CONFIG_ENABLE_PAUSE; |
| 1448 | 1448 | nes_write_indexed(nesdev, |
| 1449 | − NES_IDX_MAC_TX_CONFIG_ENABLE_PAUSE + (nesdev->mac_index*0x200), u32temp); | |
| 1449 | + NES_IDX_MAC_TX_CONFIG + (nesdev->mac_index*0x200), u32temp); | |
| 1450 | 1450 | nesdev->disable_tx_flow_control = 0; |
| 1451 | 1451 | } else if ((et_pauseparam->tx_pause == 0) && (nesdev->disable_tx_flow_control == 0)) { |
| 1452 | 1452 | u32temp = nes_read_indexed(nesdev, |
| 1453 | 1453 | NES_IDX_MAC_TX_CONFIG + (nesdev->mac_index*0x200)); |
| 1454 | 1454 | u32temp &= ~NES_IDX_MAC_TX_CONFIG_ENABLE_PAUSE; |
| 1455 | 1455 | nes_write_indexed(nesdev, |
| 1456 | − NES_IDX_MAC_TX_CONFIG_ENABLE_PAUSE + (nesdev->mac_index*0x200), u32temp); | |
| 1456 | + NES_IDX_MAC_TX_CONFIG + (nesdev->mac_index*0x200), u32temp); | |
| 1457 | 1457 | nesdev->disable_tx_flow_control = 1; |
| 1458 | 1458 | } |
| 1459 | 1459 | if ((et_pauseparam->rx_pause == 1) && (nesdev->disable_rx_flow_control == 1)) { |
| @@ -1599,11 +1599,14 @@ EXPORT_SYMBOL(input_free_device); · 1598 unmodified lines | ||
| 1599 | 1599 | * @dev: input device supporting MT events and finger tracking |
| 1600 | 1600 | * @num_slots: number of slots used by the device |
| 1601 | 1601 | * |
| 1602 | − * This function allocates all necessary memory for MT slot handling | |
| 1603 | − * in the input device, and adds ABS_MT_SLOT to the device capabilities. | |
| 1602 | + * This function allocates all necessary memory for MT slot handling in the | |
| 1603 | + * input device, and adds ABS_MT_SLOT to the device capabilities. All slots | |
| 1604 | + * are initially marked as unused iby setting ABS_MT_TRACKING_ID to -1. | |
| 1604 | 1605 | */ |
| 1605 | 1606 | int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots) |
| 1606 | 1607 | { |
| 1608 | + int i; | |
| 1609 | + | |
| 1607 | 1610 | if (!num_slots) |
| 1608 | 1611 | return 0; |
| 1609 | 1612 | |
| @@ -1614,6 +1617,10 @@ int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots) · 4 unmodified lines | ||
| 1614 | 1617 | dev->mtsize = num_slots; |
| 1615 | 1618 | input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0); |
| 1616 | 1619 | |
| 1620 | + /* Mark slots as 'unused' */ | |
| 1621 | + for (i = 0; i < num_slots; i++) | |
| 1622 | + dev->mt[i].abs[ABS_MT_TRACKING_ID - ABS_MT_FIRST] = -1; | |
| 1623 | + | |
| 1617 | 1624 | return 0; |
| 1618 | 1625 | } |
| 1619 | 1626 | EXPORT_SYMBOL(input_mt_create_slots); |
| @@ -232,13 +232,13 @@ static void hil_dev_handle_ptr_events(struct hil_dev *ptr) · 231 unmodified lines | ||
| 232 | 232 | if (absdev) { |
| 233 | 233 | val = lo + (hi << 8); |
| 234 | 234 | #ifdef TABLET_AUTOADJUST |
| 235 | − if (val < input_abs_min(dev, ABS_X + i)) | |
| 235 | + if (val < input_abs_get_min(dev, ABS_X + i)) | |
| 236 | 236 | input_abs_set_min(dev, ABS_X + i, val); |
| 237 | − if (val > input_abs_max(dev, ABS_X + i)) | |
| 237 | + if (val > input_abs_get_max(dev, ABS_X + i)) | |
| 238 | 238 | input_abs_set_max(dev, ABS_X + i, val); |
| 239 | 239 | #endif |
| 240 | 240 | if (i % 3) |
| 241 | − val = input_abs_max(dev, ABS_X + i) - val; | |
| 241 | + val = input_abs_get_max(dev, ABS_X + i) - val; | |
| 242 | 242 | input_report_abs(dev, ABS_X + i, val); |
| 243 | 243 | } else { |
| 244 | 244 | val = (int) (((int8_t) lo) | ((int8_t) hi << 8)); |
| @@ -388,11 +388,11 @@ static void hil_dev_pointer_setup(struct hil_dev *ptr) · 143 unmodified lines | ||
| 388 | 388 | |
| 389 | 389 | #ifdef TABLET_AUTOADJUST |
| 390 | 390 | for (i = 0; i < ABS_MAX; i++) { |
| 391 | − int diff = input_abs_max(input_dev, ABS_X + i) / 10; | |
| 391 | + int diff = input_abs_get_max(input_dev, ABS_X + i) / 10; | |
| 392 | 392 | input_abs_set_min(input_dev, ABS_X + i, |
| 393 | − input_abs_min(input_dev, ABS_X + i) + diff) | |
| 393 | + input_abs_get_min(input_dev, ABS_X + i) + diff); | |
| 394 | 394 | input_abs_set_max(input_dev, ABS_X + i, |
| 395 | − input_abs_max(input_dev, ABS_X + i) - diff) | |
| 395 | + input_abs_get_max(input_dev, ABS_X + i) - diff); | |
| 396 | 396 | } |
| 397 | 397 | #endif |
| 398 | 398 | |
| @@ -567,8 +567,6 @@ static int __devexit pxa27x_keypad_remove(struct platform_device *pdev) · 566 unmodified lines | ||
| 567 | 567 | clk_put(keypad->clk); |
| 568 | 568 | |
| 569 | 569 | input_unregister_device(keypad->input_dev); |
| 570 | − input_free_device(keypad->input_dev); | |
| 571 | − | |
| 572 | 570 | iounmap(keypad->mmio_base); |
| 573 | 571 | |
| 574 | 572 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| @@ -811,6 +811,8 @@ static struct miscdevice uinput_misc = { · 810 unmodified lines | ||
| 811 | 811 | .minor = UINPUT_MINOR, |
| 812 | 812 | .name = UINPUT_NAME, |
| 813 | 813 | }; |
| 814 | +MODULE_ALIAS_MISCDEV(UINPUT_MINOR); | |
| 815 | +MODULE_ALIAS("devname:" UINPUT_NAME); | |
| 814 | 816 | |
| 815 | 817 | static int __init uinput_init(void) |
| 816 | 818 | { |
| @@ -337,10 +337,14 @@ static void report_finger_data(struct input_dev *input, · 336 unmodified lines | ||
| 337 | 337 | const struct bcm5974_config *cfg, |
| 338 | 338 | const struct tp_finger *f) |
| 339 | 339 | { |
| 340 | − input_report_abs(input, ABS_MT_TOUCH_MAJOR, raw2int(f->force_major)); | |
| 341 | − input_report_abs(input, ABS_MT_TOUCH_MINOR, raw2int(f->force_minor)); | |
| 342 | − input_report_abs(input, ABS_MT_WIDTH_MAJOR, raw2int(f->size_major)); | |
| 343 | − input_report_abs(input, ABS_MT_WIDTH_MINOR, raw2int(f->size_minor)); | |
| 340 | + input_report_abs(input, ABS_MT_TOUCH_MAJOR, | |
| 341 | + raw2int(f->force_major) << 1); | |
| 342 | + input_report_abs(input, ABS_MT_TOUCH_MINOR, | |
| 343 | + raw2int(f->force_minor) << 1); | |
| 344 | + input_report_abs(input, ABS_MT_WIDTH_MAJOR, | |
| 345 | + raw2int(f->size_major) << 1); | |
| 346 | + input_report_abs(input, ABS_MT_WIDTH_MINOR, | |
| 347 | + raw2int(f->size_minor) << 1); | |
| 344 | 348 | input_report_abs(input, ABS_MT_ORIENTATION, |
| 345 | 349 | MAX_FINGER_ORIENTATION - raw2int(f->orientation)); |
| 346 | 350 | input_report_abs(input, ABS_MT_POSITION_X, raw2int(f->abs_x)); |
| @@ -138,8 +138,8 @@ static void mousedev_touchpad_event(struct input_dev *dev, · 137 unmodified lines | ||
| 138 | 138 | |
| 139 | 139 | fx(0) = value; |
| 140 | 140 | if (mousedev->touch && mousedev->pkt_count >= 2) { |
| 141 | − size = input_abs_get_min(dev, ABS_X) - | |
| 142 | − input_abs_get_max(dev, ABS_X); | |
| 141 | + size = input_abs_get_max(dev, ABS_X) - | |
| 142 | + input_abs_get_min(dev, ABS_X); | |
| 143 | 143 | if (size == 0) |
| 144 | 144 | size = 256 * 2; |
| 145 | 145 | |
| @@ -155,8 +155,8 @@ static void mousedev_touchpad_event(struct input_dev *dev, · 9 unmodified lines | ||
| 155 | 155 | fy(0) = value; |
| 156 | 156 | if (mousedev->touch && mousedev->pkt_count >= 2) { |
| 157 | 157 | /* use X size for ABS_Y to keep the same scale */ |
| 158 | − size = input_abs_get_min(dev, ABS_X) - | |
| 159 | − input_abs_get_max(dev, ABS_X); | |
| 158 | + size = input_abs_get_max(dev, ABS_X) - | |
| 159 | + input_abs_get_min(dev, ABS_X); | |
| 160 | 160 | if (size == 0) |
| 161 | 161 | size = 256 * 2; |
| 162 | 162 | |
| @@ -1485,8 +1485,8 @@ static int __init i8042_init(void) · 1484 unmodified lines | ||
| 1485 | 1485 | |
| 1486 | 1486 | static void __exit i8042_exit(void) |
| 1487 | 1487 | { |
| 1488 | − platform_driver_unregister(&i8042_driver); | |
| 1489 | 1488 | platform_device_unregister(i8042_platform_device); |
| 1489 | + platform_driver_unregister(&i8042_driver); | |
| 1490 | 1490 | i8042_platform_exit(); |
| 1491 | 1491 | |
| 1492 | 1492 | panic_blink = NULL; |
| @@ -243,10 +243,10 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) · 242 unmodified lines | ||
| 243 | 243 | if (features->type == WACOM_G4 || |
| 244 | 244 | features->type == WACOM_MO) { |
| 245 | 245 | input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); |
| 246 | − rw = (signed)(data[7] & 0x04) - (data[7] & 0x03); | |
| 246 | + rw = (data[7] & 0x04) - (data[7] & 0x03); | |
| 247 | 247 | } else { |
| 248 | 248 | input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); |
| 249 | − rw = -(signed)data[6]; | |
| 249 | + rw = -(signed char)data[6]; | |
| 250 | 250 | } |
| 251 | 251 | input_report_rel(input, REL_WHEEL, rw); |
| 252 | 252 | } |
| @@ -1,4 +0,0 @@ | ||
| 1 | −mktables | |
| 2 | −raid6altivec*.c | |
| 3 | −raid6int*.c | |
| 4 | −raid6tables.c | |
| @@ -1542,8 +1542,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) · 1541 unmodified lines | ||
| 1542 | 1542 | atomic_read(&bitmap->mddev->recovery_active) == 0); |
| 1543 | 1543 | |
| 1544 | 1544 | bitmap->mddev->curr_resync_completed = bitmap->mddev->curr_resync; |
| 1545 | − if (bitmap->mddev->persistent) | |
| 1546 | − set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags); | |
| 1545 | + set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags); | |
| 1547 | 1546 | sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1); |
| 1548 | 1547 | s = 0; |
| 1549 | 1548 | while (s < sector && s < bitmap->mddev->resync_max_sectors) { |
| @@ -2167,9 +2167,9 @@ repeat: · 2166 unmodified lines | ||
| 2167 | 2167 | rdev->recovery_offset = mddev->curr_resync_completed; |
| 2168 | 2168 | |
| 2169 | 2169 | } |
| 2170 | − if (mddev->external || !mddev->persistent) { | |
| 2171 | − clear_bit(MD_CHANGE_DEVS, &mddev->flags); | |
| 2170 | + if (!mddev->persistent) { | |
| 2172 | 2171 | clear_bit(MD_CHANGE_CLEAN, &mddev->flags); |
| 2172 | + clear_bit(MD_CHANGE_DEVS, &mddev->flags); | |
| 2173 | 2173 | wake_up(&mddev->sb_wait); |
| 2174 | 2174 | return; |
| 2175 | 2175 | } |
| @@ -2178,7 +2178,6 @@ repeat: · 2 unmodified lines | ||
| 2178 | 2178 | |
| 2179 | 2179 | mddev->utime = get_seconds(); |
| 2180 | 2180 | |
| 2181 | − set_bit(MD_CHANGE_PENDING, &mddev->flags); | |
| 2182 | 2181 | if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags)) |
| 2183 | 2182 | force_change = 1; |
| 2184 | 2183 | if (test_and_clear_bit(MD_CHANGE_CLEAN, &mddev->flags)) |
| @@ -3371,7 +3370,7 @@ array_state_show(mddev_t *mddev, char *page) · 1186 unmodified lines | ||
| 3371 | 3370 | case 0: |
| 3372 | 3371 | if (mddev->in_sync) |
| 3373 | 3372 | st = clean; |
| 3374 | − else if (test_bit(MD_CHANGE_CLEAN, &mddev->flags)) | |
| 3373 | + else if (test_bit(MD_CHANGE_PENDING, &mddev->flags)) | |
| 3375 | 3374 | st = write_pending; |
| 3376 | 3375 | else if (mddev->safemode) |
| 3377 | 3376 | st = active_idle; |
| @@ -3452,9 +3451,7 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) · 74 unmodified lines | ||
| 3452 | 3451 | mddev->in_sync = 1; |
| 3453 | 3452 | if (mddev->safemode == 1) |
| 3454 | 3453 | mddev->safemode = 0; |
| 3455 | − if (mddev->persistent) | |
| 3456 | − set_bit(MD_CHANGE_CLEAN, | |
| 3457 | − &mddev->flags); | |
| 3454 | + set_bit(MD_CHANGE_CLEAN, &mddev->flags); | |
| 3458 | 3455 | } |
| 3459 | 3456 | err = 0; |
| 3460 | 3457 | } else |
| @@ -3466,8 +3463,7 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) · 5 unmodified lines | ||
| 3466 | 3463 | case active: |
| 3467 | 3464 | if (mddev->pers) { |
| 3468 | 3465 | restart_array(mddev); |
| 3469 | − if (mddev->external) | |
| 3470 | − clear_bit(MD_CHANGE_CLEAN, &mddev->flags); | |
| 3466 | + clear_bit(MD_CHANGE_PENDING, &mddev->flags); | |
| 3471 | 3467 | wake_up(&mddev->sb_wait); |
| 3472 | 3468 | err = 0; |
| 3473 | 3469 | } else { |
| @@ -6572,6 +6568,7 @@ void md_write_start(mddev_t *mddev, struct bio *bi) · 3098 unmodified lines | ||
| 6572 | 6568 | if (mddev->in_sync) { |
| 6573 | 6569 | mddev->in_sync = 0; |
| 6574 | 6570 | set_bit(MD_CHANGE_CLEAN, &mddev->flags); |
| 6571 | + set_bit(MD_CHANGE_PENDING, &mddev->flags); | |
| 6575 | 6572 | md_wakeup_thread(mddev->thread); |
| 6576 | 6573 | did_change = 1; |
| 6577 | 6574 | } |
| @@ -6580,7 +6577,6 @@ void md_write_start(mddev_t *mddev, struct bio *bi) · 2 unmodified lines | ||
| 6580 | 6577 | if (did_change) |
| 6581 | 6578 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
| 6582 | 6579 | wait_event(mddev->sb_wait, |
| 6583 | − !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && | |
| 6584 | 6580 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); |
| 6585 | 6581 | } |
| 6586 | 6582 | |
| @@ -6616,6 +6612,7 @@ int md_allow_write(mddev_t *mddev) · 29 unmodified lines | ||
| 6616 | 6612 | if (mddev->in_sync) { |
| 6617 | 6613 | mddev->in_sync = 0; |
| 6618 | 6614 | set_bit(MD_CHANGE_CLEAN, &mddev->flags); |
| 6615 | + set_bit(MD_CHANGE_PENDING, &mddev->flags); | |
| 6619 | 6616 | if (mddev->safemode_delay && |
| 6620 | 6617 | mddev->safemode == 0) |
| 6621 | 6618 | mddev->safemode = 1; |
| @@ -6625,7 +6622,7 @@ int md_allow_write(mddev_t *mddev) · 3 unmodified lines | ||
| 6625 | 6622 | } else |
| 6626 | 6623 | spin_unlock_irq(&mddev->write_lock); |
| 6627 | 6624 | |
| 6628 | − if (test_bit(MD_CHANGE_CLEAN, &mddev->flags)) | |
| 6625 | + if (test_bit(MD_CHANGE_PENDING, &mddev->flags)) | |
| 6629 | 6626 | return -EAGAIN; |
| 6630 | 6627 | else |
| 6631 | 6628 | return 0; |
| @@ -6823,8 +6820,7 @@ void md_do_sync(mddev_t *mddev) · 191 unmodified lines | ||
| 6823 | 6820 | atomic_read(&mddev->recovery_active) == 0); |
| 6824 | 6821 | mddev->curr_resync_completed = |
| 6825 | 6822 | mddev->curr_resync; |
| 6826 | − if (mddev->persistent) | |
| 6827 | − set_bit(MD_CHANGE_CLEAN, &mddev->flags); | |
| 6823 | + set_bit(MD_CHANGE_CLEAN, &mddev->flags); | |
| 6828 | 6824 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); |
| 6829 | 6825 | } |
| 6830 | 6826 | |
| @@ -7103,8 +7099,7 @@ void md_check_recovery(mddev_t *mddev) · 272 unmodified lines | ||
| 7103 | 7099 | mddev->recovery_cp == MaxSector) { |
| 7104 | 7100 | mddev->in_sync = 1; |
| 7105 | 7101 | did_change = 1; |
| 7106 | − if (mddev->persistent) | |
| 7107 | − set_bit(MD_CHANGE_CLEAN, &mddev->flags); | |
| 7102 | + set_bit(MD_CHANGE_CLEAN, &mddev->flags); | |
| 7108 | 7103 | } |
| 7109 | 7104 | if (mddev->safemode == 1) |
| 7110 | 7105 | mddev->safemode = 0; |
| @@ -140,7 +140,7 @@ struct mddev_s · 139 unmodified lines | ||
| 140 | 140 | unsigned long flags; |
| 141 | 141 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ |
| 142 | 142 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ |
| 143 | −#define MD_CHANGE_PENDING 2 /* superblock update in progress */ | |
| 143 | +#define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ | |
| 144 | 144 | |
| 145 | 145 | int suspended; |
| 146 | 146 | atomic_t active_io; |
| @@ -362,9 +362,8 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, · 361 unmodified lines | ||
| 362 | 362 | goto err; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | − err = mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid); | |
| 366 | − | |
| 367 | − if (!err) { | |
| 365 | + if (ocr & R4_MEMORY_PRESENT | |
| 366 | + && mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid) == 0) { | |
| 368 | 367 | card->type = MMC_TYPE_SD_COMBO; |
| 369 | 368 | |
| 370 | 369 | if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO || |
| @@ -66,6 +66,7 @@ · 65 unmodified lines | ||
| 66 | 66 | #include <linux/clk.h> |
| 67 | 67 | #include <linux/atmel_pdc.h> |
| 68 | 68 | #include <linux/gfp.h> |
| 69 | +#include <linux/highmem.h> | |
| 69 | 70 | |
| 70 | 71 | #include <linux/mmc/host.h> |
| 71 | 72 | |
| @@ -148,11 +148,12 @@ static int imxmci_start_clock(struct imxmci_host *host) · 147 unmodified lines | ||
| 148 | 148 | |
| 149 | 149 | while (delay--) { |
| 150 | 150 | reg = readw(host->base + MMC_REG_STATUS); |
| 151 | − if (reg & STATUS_CARD_BUS_CLK_RUN) | |
| 151 | + if (reg & STATUS_CARD_BUS_CLK_RUN) { | |
| 152 | 152 | /* Check twice before cut */ |
| 153 | 153 | reg = readw(host->base + MMC_REG_STATUS); |
| 154 | 154 | if (reg & STATUS_CARD_BUS_CLK_RUN) |
| 155 | 155 | return 0; |
| 156 | + } | |
| 156 | 157 | |
| 157 | 158 | if (test_bit(IMXMCI_PEND_STARTED_b, &host->pending_events)) |
| 158 | 159 | return 0; |
| @@ -2305,7 +2305,6 @@ static int omap_hsmmc_suspend(struct device *dev) · 2304 unmodified lines | ||
| 2305 | 2305 | int ret = 0; |
| 2306 | 2306 | struct platform_device *pdev = to_platform_device(dev); |
| 2307 | 2307 | struct omap_hsmmc_host *host = platform_get_drvdata(pdev); |
| 2308 | − pm_message_t state = PMSG_SUSPEND; /* unused by MMC core */ | |
| 2309 | 2308 | |
| 2310 | 2309 | if (host && host->suspended) |
| 2311 | 2310 | return 0; |
| @@ -2324,8 +2323,8 @@ static int omap_hsmmc_suspend(struct device *dev) · 12 unmodified lines | ||
| 2324 | 2323 | } |
| 2325 | 2324 | } |
| 2326 | 2325 | cancel_work_sync(&host->mmc_carddetect_work); |
| 2327 | − mmc_host_enable(host->mmc); | |
| 2328 | 2326 | ret = mmc_suspend_host(host->mmc); |
| 2327 | + mmc_host_enable(host->mmc); | |
| 2329 | 2328 | if (ret == 0) { |
| 2330 | 2329 | omap_hsmmc_disable_irq(host); |
| 2331 | 2330 | OMAP_HSMMC_WRITE(host->base, HCTL, |
| @@ -1600,7 +1600,7 @@ static int __devinit s3cmci_probe(struct platform_device *pdev) · 1599 unmodified lines | ||
| 1600 | 1600 | host->pio_active = XFER_NONE; |
| 1601 | 1601 | |
| 1602 | 1602 | #ifdef CONFIG_MMC_S3C_PIODMA |
| 1603 | − host->dodma = host->pdata->dma; | |
| 1603 | + host->dodma = host->pdata->use_dma; | |
| 1604 | 1604 | #endif |
| 1605 | 1605 | |
| 1606 | 1606 | host->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| @@ -164,6 +164,7 @@ tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd) · 163 unmodified lines | ||
| 164 | 164 | static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) |
| 165 | 165 | { |
| 166 | 166 | struct mmc_data *data = host->data; |
| 167 | + void *sg_virt; | |
| 167 | 168 | unsigned short *buf; |
| 168 | 169 | unsigned int count; |
| 169 | 170 | unsigned long flags; |
| @@ -173,8 +174,8 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) · 3 unmodified lines | ||
| 173 | 174 | return; |
| 174 | 175 | } |
| 175 | 176 | |
| 176 | − buf = (unsigned short *)(tmio_mmc_kmap_atomic(host, &flags) + | |
| 177 | − host->sg_off); | |
| 177 | + sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags); | |
| 178 | + buf = (unsigned short *)(sg_virt + host->sg_off); | |
| 178 | 179 | |
| 179 | 180 | count = host->sg_ptr->length - host->sg_off; |
| 180 | 181 | if (count > data->blksz) |
| @@ -191,7 +192,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) · 10 unmodified lines | ||
| 191 | 192 | |
| 192 | 193 | host->sg_off += count; |
| 193 | 194 | |
| 194 | − tmio_mmc_kunmap_atomic(host, &flags); | |
| 195 | + tmio_mmc_kunmap_atomic(sg_virt, &flags); | |
| 195 | 196 | |
| 196 | 197 | if (host->sg_off == host->sg_ptr->length) |
| 197 | 198 | tmio_mmc_next_sg(host); |
| @@ -82,10 +82,7 @@ · 81 unmodified lines | ||
| 82 | 82 | |
| 83 | 83 | #define ack_mmc_irqs(host, i) \ |
| 84 | 84 | do { \ |
| 85 | − u32 mask;\ | |
| 86 | − mask = sd_ctrl_read32((host), CTL_STATUS); \ | |
| 87 | − mask &= ~((i) & TMIO_MASK_IRQ); \ | |
| 88 | − sd_ctrl_write32((host), CTL_STATUS, mask); \ | |
| 85 | + sd_ctrl_write32((host), CTL_STATUS, ~(i)); \ | |
| 89 | 86 | } while (0) |
| 90 | 87 | |
| 91 | 88 | |
| @@ -177,19 +174,17 @@ static inline int tmio_mmc_next_sg(struct tmio_mmc_host *host) · 85 unmodified lines | ||
| 177 | 174 | return --host->sg_len; |
| 178 | 175 | } |
| 179 | 176 | |
| 180 | −static inline char *tmio_mmc_kmap_atomic(struct tmio_mmc_host *host, | |
| 177 | +static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg, | |
| 181 | 178 | unsigned long *flags) |
| 182 | 179 | { |
| 183 | − struct scatterlist *sg = host->sg_ptr; | |
| 184 | − | |
| 185 | 180 | local_irq_save(*flags); |
| 186 | 181 | return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset; |
| 187 | 182 | } |
| 188 | 183 | |
| 189 | −static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host, | |
| 184 | +static inline void tmio_mmc_kunmap_atomic(void *virt, | |
| 190 | 185 | unsigned long *flags) |
| 191 | 186 | { |
| 192 | − kunmap_atomic(sg_page(host->sg_ptr), KM_BIO_SRC_IRQ); | |
| 187 | + kunmap_atomic(virt, KM_BIO_SRC_IRQ); | |
| 193 | 188 | local_irq_restore(*flags); |
| 194 | 189 | } |
| 195 | 190 | |
| @@ -6,7 +6,7 @@ config MTD_UBI_DEBUG · 5 unmodified lines | ||
| 6 | 6 | depends on SYSFS |
| 7 | 7 | depends on MTD_UBI |
| 8 | 8 | select DEBUG_FS |
| 9 | − select KALLSYMS_ALL | |
| 9 | + select KALLSYMS_ALL if KALLSYMS && DEBUG_KERNEL | |
| 10 | 10 | help |
| 11 | 11 | This option enables UBI debugging. |
| 12 | 12 | |
| @@ -798,18 +798,18 @@ static int rename_volumes(struct ubi_device *ubi, · 797 unmodified lines | ||
| 798 | 798 | goto out_free; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | − re = kzalloc(sizeof(struct ubi_rename_entry), GFP_KERNEL); | |
| 802 | − if (!re) { | |
| 801 | + re1 = kzalloc(sizeof(struct ubi_rename_entry), GFP_KERNEL); | |
| 802 | + if (!re1) { | |
| 803 | 803 | err = -ENOMEM; |
| 804 | 804 | ubi_close_volume(desc); |
| 805 | 805 | goto out_free; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | − re->remove = 1; | |
| 809 | − re->desc = desc; | |
| 810 | − list_add(&re->list, &rename_list); | |
| 808 | + re1->remove = 1; | |
| 809 | + re1->desc = desc; | |
| 810 | + list_add(&re1->list, &rename_list); | |
| 811 | 811 | dbg_msg("will remove volume %d, name \"%s\"", |
| 812 | − re->desc->vol->vol_id, re->desc->vol->name); | |
| 812 | + re1->desc->vol->vol_id, re1->desc->vol->name); | |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | mutex_lock(&ubi->device_mutex); |
| @@ -843,7 +843,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, · 842 unmodified lines | ||
| 843 | 843 | case UBI_COMPAT_DELETE: |
| 844 | 844 | ubi_msg("\"delete\" compatible internal volume %d:%d" |
| 845 | 845 | " found, will remove it", vol_id, lnum); |
| 846 | − err = add_to_list(si, pnum, ec, &si->corr); | |
| 846 | + err = add_to_list(si, pnum, ec, &si->erase); | |
| 847 | 847 | if (err) |
| 848 | 848 | return err; |
| 849 | 849 | return 0; |
| @@ -1212,7 +1212,8 @@ int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum) · 1211 unmodified lines | ||
| 1212 | 1212 | retry: |
| 1213 | 1213 | spin_lock(&ubi->wl_lock); |
| 1214 | 1214 | e = ubi->lookuptbl[pnum]; |
| 1215 | − if (e == ubi->move_from || in_wl_tree(e, &ubi->scrub)) { | |
| 1215 | + if (e == ubi->move_from || in_wl_tree(e, &ubi->scrub) || | |
| 1216 | + in_wl_tree(e, &ubi->erroneous)) { | |
| 1216 | 1217 | spin_unlock(&ubi->wl_lock); |
| 1217 | 1218 | return 0; |
| 1218 | 1219 | } |
| @@ -633,7 +633,8 @@ struct vortex_private { · 632 unmodified lines | ||
| 633 | 633 | open:1, |
| 634 | 634 | medialock:1, |
| 635 | 635 | must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ |
| 636 | − large_frames:1; /* accept large frames */ | |
| 636 | + large_frames:1, /* accept large frames */ | |
| 637 | + handling_irq:1; /* private in_irq indicator */ | |
| 637 | 638 | int drv_flags; |
| 638 | 639 | u16 status_enable; |
| 639 | 640 | u16 intr_enable; |
| @@ -646,7 +647,7 @@ struct vortex_private { · 6 unmodified lines | ||
| 646 | 647 | u16 io_size; /* Size of PCI region (for release_region) */ |
| 647 | 648 | |
| 648 | 649 | /* Serialises access to hardware other than MII and variables below. |
| 649 | − * The lock hierarchy is rtnl_lock > lock > mii_lock > window_lock. */ | |
| 650 | + * The lock hierarchy is rtnl_lock > {lock, mii_lock} > window_lock. */ | |
| 650 | 651 | spinlock_t lock; |
| 651 | 652 | |
| 652 | 653 | spinlock_t mii_lock; /* Serialises access to MII */ |
| @@ -1993,10 +1994,9 @@ vortex_error(struct net_device *dev, int status) · 1340 unmodified lines | ||
| 1993 | 1994 | } |
| 1994 | 1995 | } |
| 1995 | 1996 | |
| 1996 | − if (status & RxEarly) { /* Rx early is unused. */ | |
| 1997 | − vortex_rx(dev); | |
| 1997 | + if (status & RxEarly) /* Rx early is unused. */ | |
| 1998 | 1998 | iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD); |
| 1999 | − } | |
| 1999 | + | |
| 2000 | 2000 | if (status & StatsFull) { /* Empty statistics. */ |
| 2001 | 2001 | static int DoneDidThat; |
| 2002 | 2002 | if (vortex_debug > 4) |
| @@ -2133,6 +2133,15 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) · 130 unmodified lines | ||
| 2133 | 2133 | dev->name, vp->cur_tx); |
| 2134 | 2134 | } |
| 2135 | 2135 | |
| 2136 | + /* | |
| 2137 | + * We can't allow a recursion from our interrupt handler back into the | |
| 2138 | + * tx routine, as they take the same spin lock, and that causes | |
| 2139 | + * deadlock. Just return NETDEV_TX_BUSY and let the stack try again in | |
| 2140 | + * a bit | |
| 2141 | + */ | |
| 2142 | + if (vp->handling_irq) | |
| 2143 | + return NETDEV_TX_BUSY; | |
| 2144 | + | |
| 2136 | 2145 | if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { |
| 2137 | 2146 | if (vortex_debug > 0) |
| 2138 | 2147 | pr_warning("%s: BUG! Tx Ring full, refusing to send buffer.\n", |
| @@ -2288,7 +2297,12 @@ vortex_interrupt(int irq, void *dev_id) · 149 unmodified lines | ||
| 2288 | 2297 | if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) { |
| 2289 | 2298 | if (status == 0xffff) |
| 2290 | 2299 | break; |
| 2300 | + if (status & RxEarly) | |
| 2301 | + vortex_rx(dev); | |
| 2302 | + spin_unlock(&vp->window_lock); | |
| 2291 | 2303 | vortex_error(dev, status); |
| 2304 | + spin_lock(&vp->window_lock); | |
| 2305 | + window_set(vp, 7); | |
| 2292 | 2306 | } |
| 2293 | 2307 | |
| 2294 | 2308 | if (--work_done < 0) { |
| @@ -2335,11 +2349,13 @@ boomerang_interrupt(int irq, void *dev_id) · 40 unmodified lines | ||
| 2335 | 2349 | |
| 2336 | 2350 | ioaddr = vp->ioaddr; |
| 2337 | 2351 | |
| 2352 | + | |
| 2338 | 2353 | /* |
| 2339 | 2354 | * It seems dopey to put the spinlock this early, but we could race against vortex_tx_timeout |
| 2340 | 2355 | * and boomerang_start_xmit |
| 2341 | 2356 | */ |
| 2342 | 2357 | spin_lock(&vp->lock); |
| 2358 | + vp->handling_irq = 1; | |
| 2343 | 2359 | |
| 2344 | 2360 | status = ioread16(ioaddr + EL3_STATUS); |
| 2345 | 2361 | |
| @@ -2447,6 +2463,7 @@ boomerang_interrupt(int irq, void *dev_id) · 101 unmodified lines | ||
| 2447 | 2463 | pr_debug("%s: exiting interrupt, status %4.4x.\n", |
| 2448 | 2464 | dev->name, status); |
| 2449 | 2465 | handler_exit: |
| 2466 | + vp->handling_irq = 0; | |
| 2450 | 2467 | spin_unlock(&vp->lock); |
| 2451 | 2468 | return IRQ_HANDLED; |
| 2452 | 2469 | } |
| @@ -2971,7 +2988,6 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · 518 unmodified lines | ||
| 2971 | 2988 | { |
| 2972 | 2989 | int err; |
| 2973 | 2990 | struct vortex_private *vp = netdev_priv(dev); |
| 2974 | − unsigned long flags; | |
| 2975 | 2991 | pci_power_t state = 0; |
| 2976 | 2992 | |
| 2977 | 2993 | if(VORTEX_PCI(vp)) |
| @@ -2981,9 +2997,7 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · 3 unmodified lines | ||
| 2981 | 2997 | |
| 2982 | 2998 | if(state != 0) |
| 2983 | 2999 | pci_set_power_state(VORTEX_PCI(vp), PCI_D0); |
| 2984 | − spin_lock_irqsave(&vp->lock, flags); | |
| 2985 | 3000 | err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL); |
| 2986 | − spin_unlock_irqrestore(&vp->lock, flags); | |
| 2987 | 3001 | if(state != 0) |
| 2988 | 3002 | pci_set_power_state(VORTEX_PCI(vp), state); |
| 2989 | 3003 | |
| @@ -848,6 +848,15 @@ static int b44_poll(struct napi_struct *napi, int budget) · 847 unmodified lines | ||
| 848 | 848 | b44_tx(bp); |
| 849 | 849 | /* spin_unlock(&bp->tx_lock); */ |
| 850 | 850 | } |
| 851 | + if (bp->istat & ISTAT_RFO) { /* fast recovery, in ~20msec */ | |
| 852 | + bp->istat &= ~ISTAT_RFO; | |
| 853 | + b44_disable_ints(bp); | |
| 854 | + ssb_device_enable(bp->sdev, 0); /* resets ISTAT_RFO */ | |
| 855 | + b44_init_rings(bp); | |
| 856 | + b44_init_hw(bp, B44_FULL_RESET_SKIP_PHY); | |
| 857 | + netif_wake_queue(bp->dev); | |
| 858 | + } | |
| 859 | + | |
| 851 | 860 | spin_unlock_irqrestore(&bp->lock, flags); |
| 852 | 861 | |
| 853 | 862 | work_done = 0; |
| @@ -181,6 +181,7 @@ struct be_drvr_stats { · 180 unmodified lines | ||
| 181 | 181 | u64 be_rx_bytes_prev; |
| 182 | 182 | u64 be_rx_pkts; |
| 183 | 183 | u32 be_rx_rate; |
| 184 | + u32 be_rx_mcast_pkt; | |
| 184 | 185 | /* number of non ether type II frames dropped where |
| 185 | 186 | * frame len > length field of Mac Hdr */ |
| 186 | 187 | u32 be_802_3_dropped_frames; |
| @@ -140,10 +140,8 @@ int be_process_mcc(struct be_adapter *adapter, int *status) · 139 unmodified lines | ||
| 140 | 140 | while ((compl = be_mcc_compl_get(adapter))) { |
| 141 | 141 | if (compl->flags & CQE_FLAGS_ASYNC_MASK) { |
| 142 | 142 | /* Interpret flags as an async trailer */ |
| 143 | − BUG_ON(!is_link_state_evt(compl->flags)); | |
| 144 | − | |
| 145 | − /* Interpret compl as a async link evt */ | |
| 146 | − be_async_link_state_process(adapter, | |
| 143 | + if (is_link_state_evt(compl->flags)) | |
| 144 | + be_async_link_state_process(adapter, | |
| 147 | 145 | (struct be_async_event_link_state *) compl); |
| 148 | 146 | } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { |
| 149 | 147 | *status = be_mcc_compl_process(adapter, compl); |
| @@ -207,7 +205,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) · 57 unmodified lines | ||
| 207 | 205 | |
| 208 | 206 | if (msecs > 4000) { |
| 209 | 207 | dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); |
| 210 | − be_dump_ue(adapter); | |
| 208 | + be_detect_dump_ue(adapter); | |
| 211 | 209 | return -1; |
| 212 | 210 | } |
| 213 | 211 | |
| @@ -992,5 +992,5 @@ extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, · 991 unmodified lines | ||
| 992 | 992 | extern int be_cmd_get_phy_info(struct be_adapter *adapter, |
| 993 | 993 | struct be_dma_mem *cmd); |
| 994 | 994 | extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); |
| 995 | −extern void be_dump_ue(struct be_adapter *adapter); | |
| 995 | +extern void be_detect_dump_ue(struct be_adapter *adapter); | |
| 996 | 996 | |
| @@ -60,6 +60,7 @@ static const struct be_ethtool_stat et_stats[] = { · 59 unmodified lines | ||
| 60 | 60 | {DRVSTAT_INFO(be_rx_events)}, |
| 61 | 61 | {DRVSTAT_INFO(be_tx_compl)}, |
| 62 | 62 | {DRVSTAT_INFO(be_rx_compl)}, |
| 63 | + {DRVSTAT_INFO(be_rx_mcast_pkt)}, | |
| 63 | 64 | {DRVSTAT_INFO(be_ethrx_post_fail)}, |
| 64 | 65 | {DRVSTAT_INFO(be_802_3_dropped_frames)}, |
| 65 | 66 | {DRVSTAT_INFO(be_802_3_malformed_frames)}, |
| @@ -167,8 +167,11 @@ · 166 unmodified lines | ||
| 167 | 167 | #define FLASH_FCoE_BIOS_START_g3 (13631488) |
| 168 | 168 | #define FLASH_REDBOOT_START_g3 (262144) |
| 169 | 169 | |
| 170 | − | |
| 171 | − | |
| 170 | +/************* Rx Packet Type Encoding **************/ | |
| 171 | +#define BE_UNICAST_PACKET 0 | |
| 172 | +#define BE_MULTICAST_PACKET 1 | |
| 173 | +#define BE_BROADCAST_PACKET 2 | |
| 174 | +#define BE_RSVD_PACKET 3 | |
| 172 | 175 | |
| 173 | 176 | /* |
| 174 | 177 | * BE descriptors: host memory data structures whose formats |
| @@ -247,6 +247,7 @@ void netdev_stats_update(struct be_adapter *adapter) · 246 unmodified lines | ||
| 247 | 247 | dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts; |
| 248 | 248 | dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes; |
| 249 | 249 | dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes; |
| 250 | + dev_stats->multicast = drvr_stats(adapter)->be_rx_mcast_pkt; | |
| 250 | 251 | |
| 251 | 252 | /* bad pkts received */ |
| 252 | 253 | dev_stats->rx_errors = port_stats->rx_crc_errors + |
| @@ -294,7 +295,6 @@ void netdev_stats_update(struct be_adapter *adapter) · 41 unmodified lines | ||
| 294 | 295 | /* no space available in linux */ |
| 295 | 296 | dev_stats->tx_dropped = 0; |
| 296 | 297 | |
| 297 | − dev_stats->multicast = port_stats->rx_multicast_frames; | |
| 298 | 298 | dev_stats->collisions = 0; |
| 299 | 299 | |
| 300 | 300 | /* detailed tx_errors */ |
| @@ -848,7 +848,7 @@ static void be_rx_rate_update(struct be_adapter *adapter) · 547 unmodified lines | ||
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | static void be_rx_stats_update(struct be_adapter *adapter, |
| 851 | − u32 pktsize, u16 numfrags) | |
| 851 | + u32 pktsize, u16 numfrags, u8 pkt_type) | |
| 852 | 852 | { |
| 853 | 853 | struct be_drvr_stats *stats = drvr_stats(adapter); |
| 854 | 854 | |
| @@ -856,6 +856,9 @@ static void be_rx_stats_update(struct be_adapter *adapter, · 1 unmodified line | ||
| 856 | 856 | stats->be_rx_frags += numfrags; |
| 857 | 857 | stats->be_rx_bytes += pktsize; |
| 858 | 858 | stats->be_rx_pkts++; |
| 859 | + | |
| 860 | + if (pkt_type == BE_MULTICAST_PACKET) | |
| 861 | + stats->be_rx_mcast_pkt++; | |
| 859 | 862 | } |
| 860 | 863 | |
| 861 | 864 | static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) |
| @@ -925,9 +928,11 @@ static void skb_fill_rx_data(struct be_adapter *adapter, · 63 unmodified lines | ||
| 925 | 928 | u16 rxq_idx, i, j; |
| 926 | 929 | u32 pktsize, hdr_len, curr_frag_len, size; |
| 927 | 930 | u8 *start; |
| 931 | + u8 pkt_type; | |
| 928 | 932 | |
| 929 | 933 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); |
| 930 | 934 | pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); |
| 935 | + pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp); | |
| 931 | 936 | |
| 932 | 937 | page_info = get_rx_page_info(adapter, rxq_idx); |
| 933 | 938 | |
| @@ -993,7 +998,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter, · 59 unmodified lines | ||
| 993 | 998 | BUG_ON(j > MAX_SKB_FRAGS); |
| 994 | 999 | |
| 995 | 1000 | done: |
| 996 | − be_rx_stats_update(adapter, pktsize, num_rcvd); | |
| 1001 | + be_rx_stats_update(adapter, pktsize, num_rcvd, pkt_type); | |
| 997 | 1002 | } |
| 998 | 1003 | |
| 999 | 1004 | /* Process the RX completion indicated by rxcp when GRO is disabled */ |
| @@ -1060,6 +1065,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, · 60 unmodified lines | ||
| 1060 | 1065 | u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; |
| 1061 | 1066 | u16 i, rxq_idx = 0, vid, j; |
| 1062 | 1067 | u8 vtm; |
| 1068 | + u8 pkt_type; | |
| 1063 | 1069 | |
| 1064 | 1070 | num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); |
| 1065 | 1071 | /* Is it a flush compl that has no data */ |
| @@ -1070,6 +1076,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, · 4 unmodified lines | ||
| 1070 | 1076 | vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); |
| 1071 | 1077 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); |
| 1072 | 1078 | vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); |
| 1079 | + pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp); | |
| 1073 | 1080 | |
| 1074 | 1081 | /* vlanf could be wrongly set in some cards. |
| 1075 | 1082 | * ignore if vtm is not set */ |
| @@ -1125,7 +1132,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, · 49 unmodified lines | ||
| 1125 | 1132 | vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid); |
| 1126 | 1133 | } |
| 1127 | 1134 | |
| 1128 | − be_rx_stats_update(adapter, pkt_size, num_rcvd); | |
| 1135 | + be_rx_stats_update(adapter, pkt_size, num_rcvd, pkt_type); | |
| 1129 | 1136 | } |
| 1130 | 1137 | |
| 1131 | 1138 | static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter) |
| @@ -1743,26 +1750,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget) · 611 unmodified lines | ||
| 1743 | 1750 | return 1; |
| 1744 | 1751 | } |
| 1745 | 1752 | |
| 1746 | −static inline bool be_detect_ue(struct be_adapter *adapter) | |
| 1747 | −{ | |
| 1748 | − u32 online0 = 0, online1 = 0; | |
| 1749 | − | |
| 1750 | − pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0); | |
| 1751 | − | |
| 1752 | − pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1); | |
| 1753 | − | |
| 1754 | − if (!online0 || !online1) { | |
| 1755 | − adapter->ue_detected = true; | |
| 1756 | − dev_err(&adapter->pdev->dev, | |
| 1757 | − "UE Detected!! online0=%d online1=%d\n", | |
| 1758 | − online0, online1); | |
| 1759 | − return true; | |
| 1760 | − } | |
| 1761 | − | |
| 1762 | − return false; | |
| 1763 | −} | |
| 1764 | − | |
| 1765 | −void be_dump_ue(struct be_adapter *adapter) | |
| 1753 | +void be_detect_dump_ue(struct be_adapter *adapter) | |
| 1766 | 1754 | { |
| 1767 | 1755 | u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; |
| 1768 | 1756 | u32 i; |
| @@ -1779,6 +1767,11 @@ void be_dump_ue(struct be_adapter *adapter) · 10 unmodified lines | ||
| 1779 | 1767 | ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); |
| 1780 | 1768 | ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); |
| 1781 | 1769 | |
| 1770 | + if (ue_status_lo || ue_status_hi) { | |
| 1771 | + adapter->ue_detected = true; | |
| 1772 | + dev_err(&adapter->pdev->dev, "UE Detected!!\n"); | |
| 1773 | + } | |
| 1774 | + | |
| 1782 | 1775 | if (ue_status_lo) { |
| 1783 | 1776 | for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { |
| 1784 | 1777 | if (ue_status_lo & 1) |
| @@ -1814,10 +1807,8 @@ static void be_worker(struct work_struct *work) · 29 unmodified lines | ||
| 1814 | 1807 | adapter->rx_post_starved = false; |
| 1815 | 1808 | be_post_rx_frags(adapter); |
| 1816 | 1809 | } |
| 1817 | − if (!adapter->ue_detected) { | |
| 1818 | − if (be_detect_ue(adapter)) | |
| 1819 | − be_dump_ue(adapter); | |
| 1820 | − } | |
| 1810 | + if (!adapter->ue_detected) | |
| 1811 | + be_detect_dump_ue(adapter); | |
| 1821 | 1812 | |
| 1822 | 1813 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); |
| 1823 | 1814 | } |
| @@ -2797,9 +2797,15 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 2796 unmodified lines | ||
| 2797 | 2797 | * so it can wait |
| 2798 | 2798 | */ |
| 2799 | 2799 | bond_for_each_slave(bond, slave, i) { |
| 2800 | + unsigned long trans_start = dev_trans_start(slave->dev); | |
| 2801 | + | |
| 2800 | 2802 | if (slave->link != BOND_LINK_UP) { |
| 2801 | − if (time_before_eq(jiffies, dev_trans_start(slave->dev) + delta_in_ticks) && | |
| 2802 | − time_before_eq(jiffies, slave->dev->last_rx + delta_in_ticks)) { | |
| 2803 | + if (time_in_range(jiffies, | |
| 2804 | + trans_start - delta_in_ticks, | |
| 2805 | + trans_start + delta_in_ticks) && | |
| 2806 | + time_in_range(jiffies, | |
| 2807 | + slave->dev->last_rx - delta_in_ticks, | |
| 2808 | + slave->dev->last_rx + delta_in_ticks)) { | |
| 2803 | 2809 | |
| 2804 | 2810 | slave->link = BOND_LINK_UP; |
| 2805 | 2811 | slave->state = BOND_STATE_ACTIVE; |
| @@ -2827,8 +2833,12 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 21 unmodified lines | ||
| 2827 | 2833 | * when the source ip is 0, so don't take the link down |
| 2828 | 2834 | * if we don't know our ip yet |
| 2829 | 2835 | */ |
| 2830 | − if (time_after_eq(jiffies, dev_trans_start(slave->dev) + 2*delta_in_ticks) || | |
| 2831 | − (time_after_eq(jiffies, slave->dev->last_rx + 2*delta_in_ticks))) { | |
| 2836 | + if (!time_in_range(jiffies, | |
| 2837 | + trans_start - delta_in_ticks, | |
| 2838 | + trans_start + 2 * delta_in_ticks) || | |
| 2839 | + !time_in_range(jiffies, | |
| 2840 | + slave->dev->last_rx - delta_in_ticks, | |
| 2841 | + slave->dev->last_rx + 2 * delta_in_ticks)) { | |
| 2832 | 2842 | |
| 2833 | 2843 | slave->link = BOND_LINK_DOWN; |
| 2834 | 2844 | slave->state = BOND_STATE_BACKUP; |
| @@ -2883,13 +2893,16 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 48 unmodified lines | ||
| 2883 | 2893 | { |
| 2884 | 2894 | struct slave *slave; |
| 2885 | 2895 | int i, commit = 0; |
| 2896 | + unsigned long trans_start; | |
| 2886 | 2897 | |
| 2887 | 2898 | bond_for_each_slave(bond, slave, i) { |
| 2888 | 2899 | slave->new_link = BOND_LINK_NOCHANGE; |
| 2889 | 2900 | |
| 2890 | 2901 | if (slave->link != BOND_LINK_UP) { |
| 2891 | − if (time_before_eq(jiffies, slave_last_rx(bond, slave) + | |
| 2892 | − delta_in_ticks)) { | |
| 2902 | + if (time_in_range(jiffies, | |
| 2903 | + slave_last_rx(bond, slave) - delta_in_ticks, | |
| 2904 | + slave_last_rx(bond, slave) + delta_in_ticks)) { | |
| 2905 | + | |
| 2893 | 2906 | slave->new_link = BOND_LINK_UP; |
| 2894 | 2907 | commit++; |
| 2895 | 2908 | } |
| @@ -2902,8 +2915,9 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 6 unmodified lines | ||
| 2902 | 2915 | * active. This avoids bouncing, as the last receive |
| 2903 | 2916 | * times need a full ARP monitor cycle to be updated. |
| 2904 | 2917 | */ |
| 2905 | − if (!time_after_eq(jiffies, slave->jiffies + | |
| 2906 | − 2 * delta_in_ticks)) | |
| 2918 | + if (time_in_range(jiffies, | |
| 2919 | + slave->jiffies - delta_in_ticks, | |
| 2920 | + slave->jiffies + 2 * delta_in_ticks)) | |
| 2907 | 2921 | continue; |
| 2908 | 2922 | |
| 2909 | 2923 | /* |
| @@ -2921,8 +2935,10 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 11 unmodified lines | ||
| 2921 | 2935 | */ |
| 2922 | 2936 | if (slave->state == BOND_STATE_BACKUP && |
| 2923 | 2937 | !bond->current_arp_slave && |
| 2924 | − time_after(jiffies, slave_last_rx(bond, slave) + | |
| 2925 | − 3 * delta_in_ticks)) { | |
| 2938 | + !time_in_range(jiffies, | |
| 2939 | + slave_last_rx(bond, slave) - delta_in_ticks, | |
| 2940 | + slave_last_rx(bond, slave) + 3 * delta_in_ticks)) { | |
| 2941 | + | |
| 2926 | 2942 | slave->new_link = BOND_LINK_DOWN; |
| 2927 | 2943 | commit++; |
| 2928 | 2944 | } |
| @@ -2933,11 +2949,15 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 4 unmodified lines | ||
| 2933 | 2949 | * - (more than 2*delta since receive AND |
| 2934 | 2950 | * the bond has an IP address) |
| 2935 | 2951 | */ |
| 2952 | + trans_start = dev_trans_start(slave->dev); | |
| 2936 | 2953 | if ((slave->state == BOND_STATE_ACTIVE) && |
| 2937 | − (time_after_eq(jiffies, dev_trans_start(slave->dev) + | |
| 2938 | − 2 * delta_in_ticks) || | |
| 2939 | − (time_after_eq(jiffies, slave_last_rx(bond, slave) | |
| 2940 | − + 2 * delta_in_ticks)))) { | |
| 2954 | + (!time_in_range(jiffies, | |
| 2955 | + trans_start - delta_in_ticks, | |
| 2956 | + trans_start + 2 * delta_in_ticks) || | |
| 2957 | + !time_in_range(jiffies, | |
| 2958 | + slave_last_rx(bond, slave) - delta_in_ticks, | |
| 2959 | + slave_last_rx(bond, slave) + 2 * delta_in_ticks))) { | |
| 2960 | + | |
| 2941 | 2961 | slave->new_link = BOND_LINK_DOWN; |
| 2942 | 2962 | commit++; |
| 2943 | 2963 | } |
| @@ -2956,6 +2976,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) · 12 unmodified lines | ||
| 2956 | 2976 | { |
| 2957 | 2977 | struct slave *slave; |
| 2958 | 2978 | int i; |
| 2979 | + unsigned long trans_start; | |
| 2959 | 2980 | |
| 2960 | 2981 | bond_for_each_slave(bond, slave, i) { |
| 2961 | 2982 | switch (slave->new_link) { |
| @@ -2963,10 +2984,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) · 1 unmodified line | ||
| 2963 | 2984 | continue; |
| 2964 | 2985 | |
| 2965 | 2986 | case BOND_LINK_UP: |
| 2987 | + trans_start = dev_trans_start(slave->dev); | |
| 2966 | 2988 | if ((!bond->curr_active_slave && |
| 2967 | − time_before_eq(jiffies, | |
| 2968 | − dev_trans_start(slave->dev) + | |
| 2969 | − delta_in_ticks)) || | |
| 2989 | + time_in_range(jiffies, | |
| 2990 | + trans_start - delta_in_ticks, | |
| 2991 | + trans_start + delta_in_ticks)) || | |
| 2970 | 2992 | bond->curr_active_slave != slave) { |
| 2971 | 2993 | slave->link = BOND_LINK_UP; |
| 2972 | 2994 | bond->current_arp_slave = NULL; |
| @@ -15,7 +15,7 @@ config CAIF_TTY · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | config CAIF_SPI_SLAVE |
| 17 | 17 | tristate "CAIF SPI transport driver for slave interface" |
| 18 | − depends on CAIF | |
| 18 | + depends on CAIF && HAS_DMA | |
| 19 | 19 | default n |
| 20 | 20 | ---help--- |
| 21 | 21 | The CAIF Link layer SPI Protocol driver for Slave SPI interface. |
| @@ -238,7 +238,7 @@ void emac_dbg_dump_all(void) · 237 unmodified lines | ||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | #if defined(CONFIG_MAGIC_SYSRQ) |
| 241 | −static void emac_sysrq_handler(int key, struct tty_struct *tty) | |
| 241 | +static void emac_sysrq_handler(int key) | |
| 242 | 242 | { |
| 243 | 243 | emac_dbg_dump_all(); |
| 244 | 244 | } |
| @@ -503,30 +503,33 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) · 502 unmodified lines | ||
| 503 | 503 | ks8851_wrreg16(ks, KS_RXQCR, |
| 504 | 504 | ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE); |
| 505 | 505 | |
| 506 | − if (rxlen > 0) { | |
| 507 | − skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8); | |
| 508 | − if (!skb) { | |
| 509 | − /* todo - dump frame and move on */ | |
| 510 | − } | |
| 506 | + if (rxlen > 4) { | |
| 507 | + unsigned int rxalign; | |
| 508 | + | |
| 509 | + rxlen -= 4; | |
| 510 | + rxalign = ALIGN(rxlen, 4); | |
| 511 | + skb = netdev_alloc_skb_ip_align(ks->netdev, rxalign); | |
| 512 | + if (skb) { | |
| 511 | 513 | |
| 512 | − /* two bytes to ensure ip is aligned, and four bytes | |
| 513 | − * for the status header and 4 bytes of garbage */ | |
| 514 | − skb_reserve(skb, 2 + 4 + 4); | |
| 514 | + /* 4 bytes of status header + 4 bytes of | |
| 515 | + * garbage: we put them before ethernet | |
| 516 | + * header, so that they are copied, | |
| 517 | + * but ignored. | |
| 518 | + */ | |
| 515 | 519 | |
| 516 | − rxpkt = skb_put(skb, rxlen - 4) - 8; | |
| 520 | + rxpkt = skb_put(skb, rxlen) - 8; | |
| 517 | 521 | |
| 518 | − /* align the packet length to 4 bytes, and add 4 bytes | |
| 519 | − * as we're getting the rx status header as well */ | |
| 520 | − ks8851_rdfifo(ks, rxpkt, ALIGN(rxlen, 4) + 8); | |
| 522 | + ks8851_rdfifo(ks, rxpkt, rxalign + 8); | |
| 521 | 523 | |
| 522 | − if (netif_msg_pktdata(ks)) | |
| 523 | − ks8851_dbg_dumpkkt(ks, rxpkt); | |
| 524 | + if (netif_msg_pktdata(ks)) | |
| 525 | + ks8851_dbg_dumpkkt(ks, rxpkt); | |
| 524 | 526 | |
| 525 | − skb->protocol = eth_type_trans(skb, ks->netdev); | |
| 526 | − netif_rx(skb); | |
| 527 | + skb->protocol = eth_type_trans(skb, ks->netdev); | |
| 528 | + netif_rx(skb); | |
| 527 | 529 | |
| 528 | − ks->netdev->stats.rx_packets++; | |
| 529 | − ks->netdev->stats.rx_bytes += rxlen - 4; | |
| 530 | + ks->netdev->stats.rx_packets++; | |
| 531 | + ks->netdev->stats.rx_bytes += rxlen; | |
| 532 | + } | |
| 530 | 533 | } |
| 531 | 534 | |
| 532 | 535 | ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | #include <linux/of_device.h> |
| 39 | 39 | #include <linux/of_mdio.h> |
| 40 | 40 | #include <linux/of_platform.h> |
| 41 | +#include <linux/of_address.h> | |
| 41 | 42 | #include <linux/skbuff.h> |
| 42 | 43 | #include <linux/spinlock.h> |
| 43 | 44 | #include <linux/tcp.h> /* needed for sizeof(tcphdr) */ |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <linux/phy.h> |
| 11 | 11 | #include <linux/of.h> |
| 12 | 12 | #include <linux/of_device.h> |
| 13 | +#include <linux/of_address.h> | |
| 13 | 14 | #include <linux/slab.h> |
| 14 | 15 | #include <linux/of_mdio.h> |
| 15 | 16 | |
| @@ -2131,9 +2131,16 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) · 2130 unmodified lines | ||
| 2131 | 2131 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 2132 | 2132 | static void netxen_nic_poll_controller(struct net_device *netdev) |
| 2133 | 2133 | { |
| 2134 | + int ring; | |
| 2135 | + struct nx_host_sds_ring *sds_ring; | |
| 2134 | 2136 | struct netxen_adapter *adapter = netdev_priv(netdev); |
| 2137 | + struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; | |
| 2138 | + | |
| 2135 | 2139 | disable_irq(adapter->irq); |
| 2136 | − netxen_intr(adapter->irq, adapter); | |
| 2140 | + for (ring = 0; ring < adapter->max_sds_rings; ring++) { | |
| 2141 | + sds_ring = &recv_ctx->sds_rings[ring]; | |
| 2142 | + netxen_intr(adapter->irq, sds_ring); | |
| 2143 | + } | |
| 2137 | 2144 | enable_irq(adapter->irq); |
| 2138 | 2145 | } |
| 2139 | 2146 | #endif |
| @@ -7269,32 +7269,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np, · 7268 unmodified lines | ||
| 7269 | 7269 | struct niu_parent *parent = np->parent; |
| 7270 | 7270 | struct niu_tcam_entry *tp; |
| 7271 | 7271 | int i, idx, cnt; |
| 7272 | − u16 n_entries; | |
| 7273 | 7272 | unsigned long flags; |
| 7274 | − | |
| 7273 | + int ret = 0; | |
| 7275 | 7274 | |
| 7276 | 7275 | /* put the tcam size here */ |
| 7277 | 7276 | nfc->data = tcam_get_size(np); |
| 7278 | 7277 | |
| 7279 | 7278 | niu_lock_parent(np, flags); |
| 7280 | − n_entries = nfc->rule_cnt; | |
| 7281 | 7279 | for (cnt = 0, i = 0; i < nfc->data; i++) { |
| 7282 | 7280 | idx = tcam_get_index(np, i); |
| 7283 | 7281 | tp = &parent->tcam[idx]; |
| 7284 | 7282 | if (!tp->valid) |
| 7285 | 7283 | continue; |
| 7284 | + if (cnt == nfc->rule_cnt) { | |
| 7285 | + ret = -EMSGSIZE; | |
| 7286 | + break; | |
| 7287 | + } | |
| 7286 | 7288 | rule_locs[cnt] = i; |
| 7287 | 7289 | cnt++; |
| 7288 | 7290 | } |
| 7289 | 7291 | niu_unlock_parent(np, flags); |
| 7290 | 7292 | |
| 7291 | − if (n_entries != cnt) { | |
| 7292 | − /* print warning, this should not happen */ | |
| 7293 | − netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n", | |
| 7294 | − np->parent->index, __func__, n_entries, cnt); | |
| 7295 | − } | |
| 7296 | − | |
| 7297 | − return 0; | |
| 7293 | + return ret; | |
| 7298 | 7294 | } |
| 7299 | 7295 | |
| 7300 | 7296 | static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, |
| @@ -1637,6 +1637,7 @@ static struct pcmcia_device_id pcnet_ids[] = { · 1636 unmodified lines | ||
| 1637 | 1637 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), |
| 1638 | 1638 | PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), |
| 1639 | 1639 | PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), |
| 1640 | + PCMCIA_DEVICE_PROD_ID12("KENTRONICS", "KEP-230", 0xaf8144c9, 0x868f6616), | |
| 1640 | 1641 | PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), |
| 1641 | 1642 | PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), |
| 1642 | 1643 | PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), |
| @@ -466,6 +466,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 465 unmodified lines | ||
| 466 | 466 | |
| 467 | 467 | phydev->interface = interface; |
| 468 | 468 | |
| 469 | + phydev->state = PHY_READY; | |
| 470 | + | |
| 469 | 471 | /* Do initial configuration here, now that |
| 470 | 472 | * we have certain key parameters |
| 471 | 473 | * (dev_flags and interface) */ |
| @@ -654,15 +654,15 @@ static void eth_port_start(struct net_device *dev) · 653 unmodified lines | ||
| 654 | 654 | /* Assignment of Tx CTRP of given queue */ |
| 655 | 655 | tx_curr_desc = pep->tx_curr_desc_q; |
| 656 | 656 | wrl(pep, ETH_C_TX_DESC_1, |
| 657 | − (u32) ((struct tx_desc *)pep->tx_desc_dma + tx_curr_desc)); | |
| 657 | + (u32) (pep->tx_desc_dma + tx_curr_desc * sizeof(struct tx_desc))); | |
| 658 | 658 | |
| 659 | 659 | /* Assignment of Rx CRDP of given queue */ |
| 660 | 660 | rx_curr_desc = pep->rx_curr_desc_q; |
| 661 | 661 | wrl(pep, ETH_C_RX_DESC_0, |
| 662 | − (u32) ((struct rx_desc *)pep->rx_desc_dma + rx_curr_desc)); | |
| 662 | + (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc))); | |
| 663 | 663 | |
| 664 | 664 | wrl(pep, ETH_F_RX_DESC_0, |
| 665 | − (u32) ((struct rx_desc *)pep->rx_desc_dma + rx_curr_desc)); | |
| 665 | + (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc))); | |
| 666 | 666 | |
| 667 | 667 | /* Clear all interrupts */ |
| 668 | 668 | wrl(pep, INT_CAUSE, 0); |
| @@ -1350,7 +1350,7 @@ static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, · 681 unmodified lines | ||
| 1350 | 1350 | { |
| 1351 | 1351 | struct pxa168_eth_private *pep = netdev_priv(dev); |
| 1352 | 1352 | if (pep->phy != NULL) |
| 1353 | − return phy_mii_ioctl(pep->phy, if_mii(ifr), cmd); | |
| 1353 | + return phy_mii_ioctl(pep->phy, ifr, cmd); | |
| 1354 | 1354 | |
| 1355 | 1355 | return -EOPNOTSUPP; |
| 1356 | 1356 | } |
| @@ -1414,10 +1414,8 @@ static int ethernet_phy_setup(struct net_device *dev) · 57 unmodified lines | ||
| 1414 | 1414 | { |
| 1415 | 1415 | struct pxa168_eth_private *pep = netdev_priv(dev); |
| 1416 | 1416 | |
| 1417 | − if (pep->pd != NULL) { | |
| 1418 | − if (pep->pd->init) | |
| 1419 | − pep->pd->init(); | |
| 1420 | − } | |
| 1417 | + if (pep->pd->init) | |
| 1418 | + pep->pd->init(); | |
| 1421 | 1419 | pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f); |
| 1422 | 1420 | if (pep->phy != NULL) |
| 1423 | 1421 | phy_init(pep, pep->pd->speed, pep->pd->duplex); |
| @@ -1499,7 +1497,7 @@ static int pxa168_eth_probe(struct platform_device *pdev) · 75 unmodified lines | ||
| 1499 | 1497 | dev = alloc_etherdev(sizeof(struct pxa168_eth_private)); |
| 1500 | 1498 | if (!dev) { |
| 1501 | 1499 | err = -ENOMEM; |
| 1502 | − goto out; | |
| 1500 | + goto err_clk; | |
| 1503 | 1501 | } |
| 1504 | 1502 | |
| 1505 | 1503 | platform_set_drvdata(pdev, dev); |
| @@ -1509,12 +1507,12 @@ static int pxa168_eth_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 1509 | 1507 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1510 | 1508 | if (res == NULL) { |
| 1511 | 1509 | err = -ENODEV; |
| 1512 | − goto out; | |
| 1510 | + goto err_netdev; | |
| 1513 | 1511 | } |
| 1514 | 1512 | pep->base = ioremap(res->start, res->end - res->start + 1); |
| 1515 | 1513 | if (pep->base == NULL) { |
| 1516 | 1514 | err = -ENOMEM; |
| 1517 | − goto out; | |
| 1515 | + goto err_netdev; | |
| 1518 | 1516 | } |
| 1519 | 1517 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
| 1520 | 1518 | BUG_ON(!res); |
| @@ -1551,7 +1549,7 @@ static int pxa168_eth_probe(struct platform_device *pdev) · 30 unmodified lines | ||
| 1551 | 1549 | pep->smi_bus = mdiobus_alloc(); |
| 1552 | 1550 | if (pep->smi_bus == NULL) { |
| 1553 | 1551 | err = -ENOMEM; |
| 1554 | − goto out; | |
| 1552 | + goto err_base; | |
| 1555 | 1553 | } |
| 1556 | 1554 | pep->smi_bus->priv = pep; |
| 1557 | 1555 | pep->smi_bus->name = "pxa168_eth smi"; |
| @@ -1560,31 +1558,31 @@ static int pxa168_eth_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 1560 | 1558 | snprintf(pep->smi_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id); |
| 1561 | 1559 | pep->smi_bus->parent = &pdev->dev; |
| 1562 | 1560 | pep->smi_bus->phy_mask = 0xffffffff; |
| 1563 | − if (mdiobus_register(pep->smi_bus) < 0) { | |
| 1564 | − err = -ENOMEM; | |
| 1565 | − goto out; | |
| 1566 | − } | |
| 1561 | + err = mdiobus_register(pep->smi_bus); | |
| 1562 | + if (err) | |
| 1563 | + goto err_free_mdio; | |
| 1564 | + | |
| 1567 | 1565 | pxa168_init_hw(pep); |
| 1568 | 1566 | err = ethernet_phy_setup(dev); |
| 1569 | 1567 | if (err) |
| 1570 | − goto out; | |
| 1568 | + goto err_mdiobus; | |
| 1571 | 1569 | SET_NETDEV_DEV(dev, &pdev->dev); |
| 1572 | 1570 | err = register_netdev(dev); |
| 1573 | 1571 | if (err) |
| 1574 | − goto out; | |
| 1572 | + goto err_mdiobus; | |
| 1575 | 1573 | return 0; |
| 1576 | −out: | |
| 1577 | − if (pep->clk) { | |
| 1578 | − clk_disable(pep->clk); | |
| 1579 | − clk_put(pep->clk); | |
| 1580 | − pep->clk = NULL; | |
| 1581 | − } | |
| 1582 | − if (pep->base) { | |
| 1583 | − iounmap(pep->base); | |
| 1584 | − pep->base = NULL; | |
| 1585 | − } | |
| 1586 | − if (dev) | |
| 1587 | − free_netdev(dev); | |
| 1574 | + | |
| 1575 | +err_mdiobus: | |
| 1576 | + mdiobus_unregister(pep->smi_bus); | |
| 1577 | +err_free_mdio: | |
| 1578 | + mdiobus_free(pep->smi_bus); | |
| 1579 | +err_base: | |
| 1580 | + iounmap(pep->base); | |
| 1581 | +err_netdev: | |
| 1582 | + free_netdev(dev); | |
| 1583 | +err_clk: | |
| 1584 | + clk_disable(clk); | |
| 1585 | + clk_put(clk); | |
| 1588 | 1586 | return err; |
| 1589 | 1587 | } |
| 1590 | 1588 | |
| @@ -1608,6 +1606,8 @@ static int pxa168_eth_remove(struct platform_device *pdev) · 17 unmodified lines | ||
| 1608 | 1606 | |
| 1609 | 1607 | iounmap(pep->base); |
| 1610 | 1608 | pep->base = NULL; |
| 1609 | + mdiobus_unregister(pep->smi_bus); | |
| 1610 | + mdiobus_free(pep->smi_bus); | |
| 1611 | 1611 | unregister_netdev(dev); |
| 1612 | 1612 | flush_scheduled_work(); |
| 1613 | 1613 | free_netdev(dev); |
| @@ -2188,9 +2188,16 @@ static int qlcnic_rx_poll(struct napi_struct *napi, int budget) · 2187 unmodified lines | ||
| 2188 | 2188 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 2189 | 2189 | static void qlcnic_poll_controller(struct net_device *netdev) |
| 2190 | 2190 | { |
| 2191 | + int ring; | |
| 2192 | + struct qlcnic_host_sds_ring *sds_ring; | |
| 2191 | 2193 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
| 2194 | + struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | |
| 2195 | + | |
| 2192 | 2196 | disable_irq(adapter->irq); |
| 2193 | − qlcnic_intr(adapter->irq, adapter); | |
| 2197 | + for (ring = 0; ring < adapter->max_sds_rings; ring++) { | |
| 2198 | + sds_ring = &recv_ctx->sds_rings[ring]; | |
| 2199 | + qlcnic_intr(adapter->irq, sds_ring); | |
| 2200 | + } | |
| 2194 | 2201 | enable_irq(adapter->irq); |
| 2195 | 2202 | } |
| 2196 | 2203 | #endif |
| @@ -3919,12 +3919,12 @@ static int ql_adapter_down(struct ql_adapter *qdev) · 3918 unmodified lines | ||
| 3919 | 3919 | for (i = 0; i < qdev->rss_ring_count; i++) |
| 3920 | 3920 | netif_napi_del(&qdev->rx_ring[i].napi); |
| 3921 | 3921 | |
| 3922 | − ql_free_rx_buffers(qdev); | |
| 3923 | − | |
| 3924 | 3922 | status = ql_adapter_reset(qdev); |
| 3925 | 3923 | if (status) |
| 3926 | 3924 | netif_err(qdev, ifdown, qdev->ndev, "reset(func #%d) FAILED!\n", |
| 3927 | 3925 | qdev->func); |
| 3926 | + ql_free_rx_buffers(qdev); | |
| 3927 | + | |
| 3928 | 3928 | return status; |
| 3929 | 3929 | } |
| 3930 | 3930 | |
| @@ -1865,15 +1865,15 @@ static int stmmac_resume(struct platform_device *pdev) · 1864 unmodified lines | ||
| 1865 | 1865 | if (!netif_running(dev)) |
| 1866 | 1866 | return 0; |
| 1867 | 1867 | |
| 1868 | − spin_lock(&priv->lock); | |
| 1869 | − | |
| 1870 | 1868 | if (priv->shutdown) { |
| 1871 | 1869 | /* Re-open the interface and re-init the MAC/DMA |
| 1872 | − and the rings. */ | |
| 1870 | + and the rings (i.e. on hibernation stage) */ | |
| 1873 | 1871 | stmmac_open(dev); |
| 1874 | − goto out_resume; | |
| 1872 | + return 0; | |
| 1875 | 1873 | } |
| 1876 | 1874 | |
| 1875 | + spin_lock(&priv->lock); | |
| 1876 | + | |
| 1877 | 1877 | /* Power Down bit, into the PM register, is cleared |
| 1878 | 1878 | * automatically as soon as a magic packet or a Wake-up frame |
| 1879 | 1879 | * is received. Anyway, it's better to manually clear |
| @@ -1901,7 +1901,6 @@ static int stmmac_resume(struct platform_device *pdev) · 21 unmodified lines | ||
| 1901 | 1901 | |
| 1902 | 1902 | netif_start_queue(dev); |
| 1903 | 1903 | |
| 1904 | −out_resume: | |
| 1905 | 1904 | spin_unlock(&priv->lock); |
| 1906 | 1905 | return 0; |
| 1907 | 1906 | } |
| @@ -429,10 +429,6 @@ static const struct net_device_ops ipheth_netdev_ops = { · 428 unmodified lines | ||
| 429 | 429 | .ndo_get_stats = &ipheth_stats, |
| 430 | 430 | }; |
| 431 | 431 | |
| 432 | −static struct device_type ipheth_type = { | |
| 433 | − .name = "wwan", | |
| 434 | −}; | |
| 435 | − | |
| 436 | 432 | static int ipheth_probe(struct usb_interface *intf, |
| 437 | 433 | const struct usb_device_id *id) |
| 438 | 434 | { |
| @@ -450,7 +446,7 @@ static int ipheth_probe(struct usb_interface *intf, · 11 unmodified lines | ||
| 450 | 446 | |
| 451 | 447 | netdev->netdev_ops = &ipheth_netdev_ops; |
| 452 | 448 | netdev->watchdog_timeo = IPHETH_TX_TIMEOUT; |
| 453 | − strcpy(netdev->name, "wwan%d"); | |
| 449 | + strcpy(netdev->name, "eth%d"); | |
| 454 | 450 | |
| 455 | 451 | dev = netdev_priv(netdev); |
| 456 | 452 | dev->udev = udev; |
| @@ -500,7 +496,6 @@ static int ipheth_probe(struct usb_interface *intf, · 43 unmodified lines | ||
| 500 | 496 | |
| 501 | 497 | SET_NETDEV_DEV(netdev, &intf->dev); |
| 502 | 498 | SET_ETHTOOL_OPS(netdev, &ops); |
| 503 | − SET_NETDEV_DEVTYPE(netdev, &ipheth_type); | |
| 504 | 499 | |
| 505 | 500 | retval = register_netdev(netdev); |
| 506 | 501 | if (retval) { |
| @@ -2824,7 +2824,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi · 2823 unmodified lines | ||
| 2824 | 2824 | netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT); |
| 2825 | 2825 | |
| 2826 | 2826 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | |
| 2827 | − NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM | NETIF_F_SG; | |
| 2827 | + NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM; | |
| 2828 | 2828 | |
| 2829 | 2829 | ret = register_netdev(dev); |
| 2830 | 2830 | if (ret < 0) |
| @@ -1327,6 +1327,10 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, · 1326 unmodified lines | ||
| 1327 | 1327 | PCI_DMA_TODEVICE); |
| 1328 | 1328 | |
| 1329 | 1329 | rate = ieee80211_get_tx_rate(sc->hw, info); |
| 1330 | + if (!rate) { | |
| 1331 | + ret = -EINVAL; | |
| 1332 | + goto err_unmap; | |
| 1333 | + } | |
| 1330 | 1334 | |
| 1331 | 1335 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) |
| 1332 | 1336 | flags |= AR5K_TXDESC_NOACK; |
| @@ -797,7 +797,7 @@ static bool ar9300_uncompress_block(struct ath_hw *ah, · 796 unmodified lines | ||
| 797 | 797 | length = block[it+1]; |
| 798 | 798 | length &= 0xff; |
| 799 | 799 | |
| 800 | − if (length > 0 && spot >= 0 && spot+length < mdataSize) { | |
| 800 | + if (length > 0 && spot >= 0 && spot+length <= mdataSize) { | |
| 801 | 801 | ath_print(common, ATH_DBG_EEPROM, |
| 802 | 802 | "Restore at %d: spot=%d " |
| 803 | 803 | "offset=%d length=%d\n", |
| @@ -62,7 +62,7 @@ · 61 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | #define SD_NO_CTL 0xE0 |
| 64 | 64 | #define NO_CTL 0xff |
| 65 | −#define CTL_MODE_M 7 | |
| 65 | +#define CTL_MODE_M 0xf | |
| 66 | 66 | #define CTL_11A 0 |
| 67 | 67 | #define CTL_11B 1 |
| 68 | 68 | #define CTL_11G 2 |
| @@ -31,7 +31,6 @@ enum ctl_group { · 30 unmodified lines | ||
| 31 | 31 | #define NO_CTL 0xff |
| 32 | 32 | #define SD_NO_CTL 0xE0 |
| 33 | 33 | #define NO_CTL 0xff |
| 34 | −#define CTL_MODE_M 7 | |
| 35 | 34 | #define CTL_11A 0 |
| 36 | 35 | #define CTL_11B 1 |
| 37 | 36 | #define CTL_11G 2 |
| @@ -128,7 +128,7 @@ struct if_sdio_card { · 127 unmodified lines | ||
| 128 | 128 | bool helper_allocated; |
| 129 | 129 | bool firmware_allocated; |
| 130 | 130 | |
| 131 | − u8 buffer[65536]; | |
| 131 | + u8 buffer[65536] __attribute__((aligned(4))); | |
| 132 | 132 | |
| 133 | 133 | spinlock_t lock; |
| 134 | 134 | struct if_sdio_packet *packets; |
| @@ -446,7 +446,7 @@ static void p54_rx_frame_sent(struct p54_common *priv, struct sk_buff *skb) · 445 unmodified lines | ||
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && |
| 449 | − (!payload->status)) | |
| 449 | + !(payload->status & P54_TX_FAILED)) | |
| 450 | 450 | info->flags |= IEEE80211_TX_STAT_ACK; |
| 451 | 451 | if (payload->status & P54_TX_PSM_CANCELLED) |
| 452 | 452 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
| @@ -338,9 +338,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) · 337 unmodified lines | ||
| 338 | 338 | acpi_handle chandle, handle; |
| 339 | 339 | struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 340 | 340 | |
| 341 | − flags &= (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | | |
| 342 | − OSC_SHPC_NATIVE_HP_CONTROL | | |
| 343 | − OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | |
| 341 | + flags &= OSC_SHPC_NATIVE_HP_CONTROL; | |
| 344 | 342 | if (!flags) { |
| 345 | 343 | err("Invalid flags %u specified!\n", flags); |
| 346 | 344 | return -EINVAL; |
| @@ -360,7 +358,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) · 13 unmodified lines | ||
| 360 | 358 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); |
| 361 | 359 | dbg("Trying to get hotplug control for %s\n", |
| 362 | 360 | (char *)string.pointer); |
| 363 | − status = acpi_pci_osc_control_set(handle, flags); | |
| 361 | + status = acpi_pci_osc_control_set(handle, &flags, flags); | |
| 364 | 362 | if (ACPI_SUCCESS(status)) |
| 365 | 363 | goto got_one; |
| 366 | 364 | if (status == AE_SUPPORT) |
| @@ -176,19 +176,11 @@ static inline void pciehp_firmware_init(void) · 175 unmodified lines | ||
| 176 | 176 | { |
| 177 | 177 | pciehp_acpi_slot_detection_init(); |
| 178 | 178 | } |
| 179 | − | |
| 180 | −static inline int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) | |
| 181 | −{ | |
| 182 | − int retval; | |
| 183 | − u32 flags = (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | | |
| 184 | − OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | |
| 185 | − retval = acpi_get_hp_hw_control_from_firmware(dev, flags); | |
| 186 | − if (retval) | |
| 187 | − return retval; | |
| 188 | − return pciehp_acpi_slot_detection_check(dev); | |
| 189 | −} | |
| 190 | 179 | #else |
| 191 | 180 | #define pciehp_firmware_init() do {} while (0) |
| 192 | −#define pciehp_get_hp_hw_control_from_firmware(dev) 0 | |
| 181 | +static inline int pciehp_acpi_slot_detection_check(struct pci_dev *dev) | |
| 182 | +{ | |
| 183 | + return 0; | |
| 184 | +} | |
| 193 | 185 | #endif /* CONFIG_ACPI */ |
| 194 | 186 | #endif /* _PCIEHP_H */ |
| @@ -85,9 +85,7 @@ static int __init dummy_probe(struct pcie_device *dev) · 84 unmodified lines | ||
| 85 | 85 | acpi_handle handle; |
| 86 | 86 | struct dummy_slot *slot, *tmp; |
| 87 | 87 | struct pci_dev *pdev = dev->port; |
| 88 | − /* Note: pciehp_detect_mode != PCIEHP_DETECT_ACPI here */ | |
| 89 | − if (pciehp_get_hp_hw_control_from_firmware(pdev)) | |
| 90 | − return -ENODEV; | |
| 88 | + | |
| 91 | 89 | pos = pci_pcie_cap(pdev); |
| 92 | 90 | if (!pos) |
| 93 | 91 | return -ENODEV; |
| @@ -59,7 +59,7 @@ module_param(pciehp_force, bool, 0644); · 58 unmodified lines | ||
| 59 | 59 | MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not"); |
| 60 | 60 | MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); |
| 61 | 61 | MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); |
| 62 | −MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing"); | |
| 62 | +MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if OSHP is missing"); | |
| 63 | 63 | |
| 64 | 64 | #define PCIE_MODULE_NAME "pciehp" |
| 65 | 65 | |
| @@ -235,7 +235,7 @@ static int pciehp_probe(struct pcie_device *dev) · 169 unmodified lines | ||
| 235 | 235 | dev_info(&dev->device, |
| 236 | 236 | "Bypassing BIOS check for pciehp use on %s\n", |
| 237 | 237 | pci_name(dev->port)); |
| 238 | − else if (pciehp_get_hp_hw_control_from_firmware(dev->port)) | |
| 238 | + else if (pciehp_acpi_slot_detection_check(dev->port)) | |
| 239 | 239 | goto err_out_none; |
| 240 | 240 | |
| 241 | 241 | ctrl = pcie_init(dev); |
| @@ -140,8 +140,10 @@ static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } · 139 unmodified lines | ||
| 140 | 140 | |
| 141 | 141 | #ifdef CONFIG_PCIEAER |
| 142 | 142 | void pci_no_aer(void); |
| 143 | +bool pci_aer_available(void); | |
| 143 | 144 | #else |
| 144 | 145 | static inline void pci_no_aer(void) { } |
| 146 | +static inline bool pci_aer_available(void) { return false; } | |
| 145 | 147 | #endif |
| 146 | 148 | |
| 147 | 149 | static inline int pci_no_d1d2(struct pci_dev *dev) |
| @@ -6,10 +6,11 @@ · 5 unmodified lines | ||
| 6 | 6 | obj-$(CONFIG_PCIEASPM) += aspm.o |
| 7 | 7 | |
| 8 | 8 | pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o |
| 9 | +pcieportdrv-$(CONFIG_ACPI) += portdrv_acpi.o | |
| 9 | 10 | |
| 10 | 11 | obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o |
| 11 | 12 | |
| 12 | 13 | # Build PCI Express AER if needed |
| 13 | 14 | obj-$(CONFIG_PCIEAER) += aer/ |
| 14 | 15 | |
| 15 | −obj-$(CONFIG_PCIE_PME) += pme/ | |
| 16 | +obj-$(CONFIG_PCIE_PME) += pme.o | |
| @@ -72,6 +72,11 @@ void pci_no_aer(void) · 71 unmodified lines | ||
| 72 | 72 | pcie_aer_disable = 1; /* has priority over 'forceload' */ |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | +bool pci_aer_available(void) | |
| 76 | +{ | |
| 77 | + return !pcie_aer_disable && pci_msi_enabled(); | |
| 78 | +} | |
| 79 | + | |
| 75 | 80 | static int set_device_error_reporting(struct pci_dev *dev, void *data) |
| 76 | 81 | { |
| 77 | 82 | bool enable = *((bool *)data); |
| @@ -411,9 +416,7 @@ static void aer_error_resume(struct pci_dev *dev) · 333 unmodified lines | ||
| 411 | 416 | */ |
| 412 | 417 | static int __init aer_service_init(void) |
| 413 | 418 | { |
| 414 | − if (pcie_aer_disable) | |
| 415 | − return -ENXIO; | |
| 416 | − if (!pci_msi_enabled()) | |
| 419 | + if (!pci_aer_available()) | |
| 417 | 420 | return -ENXIO; |
| 418 | 421 | return pcie_port_service_register(&aerdriver); |
| 419 | 422 | } |
| @@ -19,42 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <acpi/apei.h> |
| 20 | 20 | #include "aerdrv.h" |
| 21 | 21 | |
| 22 | −/** | |
| 23 | − * aer_osc_setup - run ACPI _OSC method | |
| 24 | − * @pciedev: pcie_device which AER is being enabled on | |
| 25 | − * | |
| 26 | − * @return: Zero on success. Nonzero otherwise. | |
| 27 | − * | |
| 28 | − * Invoked when PCIe bus loads AER service driver. To avoid conflict with | |
| 29 | − * BIOS AER support requires BIOS to yield AER control to OS native driver. | |
| 30 | − **/ | |
| 31 | −int aer_osc_setup(struct pcie_device *pciedev) | |
| 32 | −{ | |
| 33 | − acpi_status status = AE_NOT_FOUND; | |
| 34 | − struct pci_dev *pdev = pciedev->port; | |
| 35 | − acpi_handle handle = NULL; | |
| 36 | − | |
| 37 | − if (acpi_pci_disabled) | |
| 38 | − return -1; | |
| 39 | − | |
| 40 | − handle = acpi_find_root_bridge_handle(pdev); | |
| 41 | − if (handle) { | |
| 42 | − status = acpi_pci_osc_control_set(handle, | |
| 43 | − OSC_PCI_EXPRESS_AER_CONTROL | | |
| 44 | − OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | |
| 45 | − } | |
| 46 | − | |
| 47 | − if (ACPI_FAILURE(status)) { | |
| 48 | − dev_printk(KERN_DEBUG, &pciedev->device, "AER service couldn't " | |
| 49 | − "init device: %s\n", | |
| 50 | − (status == AE_SUPPORT || status == AE_NOT_FOUND) ? | |
| 51 | − "no _OSC support" : "_OSC failed"); | |
| 52 | − return -1; | |
| 53 | − } | |
| 54 | − | |
| 55 | − return 0; | |
| 56 | −} | |
| 57 | − | |
| 58 | 22 | #ifdef CONFIG_ACPI_APEI |
| 59 | 23 | static inline int hest_match_pci(struct acpi_hest_aer_common *p, |
| 60 | 24 | struct pci_dev *pci) |
| @@ -772,22 +772,10 @@ void aer_isr(struct work_struct *work) · 771 unmodified lines | ||
| 772 | 772 | */ |
| 773 | 773 | int aer_init(struct pcie_device *dev) |
| 774 | 774 | { |
| 775 | − if (pcie_aer_get_firmware_first(dev->port)) { | |
| 776 | − dev_printk(KERN_DEBUG, &dev->device, | |
| 777 | − "PCIe errors handled by platform firmware.\n"); | |
| 778 | − goto out; | |
| 779 | − } | |
| 780 | − | |
| 781 | − if (aer_osc_setup(dev)) | |
| 782 | − goto out; | |
| 783 | − | |
| 784 | − return 0; | |
| 785 | −out: | |
| 786 | 775 | if (forceload) { |
| 787 | 776 | dev_printk(KERN_DEBUG, &dev->device, |
| 788 | 777 | "aerdrv forceload requested.\n"); |
| 789 | 778 | pcie_aer_force_firmware_first(dev->port, 0); |
| 790 | − return 0; | |
| 791 | 779 | } |
| 792 | − return -ENXIO; | |
| 780 | + return 0; | |
| 793 | 781 | } |
| @@ -23,37 +23,12 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/pci-acpi.h> |
| 24 | 24 | #include <linux/pm_runtime.h> |
| 25 | 25 | |
| 26 | −#include "../../pci.h" | |
| 27 | −#include "pcie_pme.h" | |
| 26 | +#include "../pci.h" | |
| 27 | +#include "portdrv.h" | |
| 28 | 28 | |
| 29 | 29 | #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ |
| 30 | 30 | #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ |
| 31 | 31 | |
| 32 | −/* | |
| 33 | − * If set, this switch will prevent the PCIe root port PME service driver from | |
| 34 | − * being registered. Consequently, the interrupt-based PCIe PME signaling will | |
| 35 | − * not be used by any PCIe root ports in that case. | |
| 36 | − */ | |
| 37 | −static bool pcie_pme_disabled = true; | |
| 38 | − | |
| 39 | −/* | |
| 40 | − * The PCI Express Base Specification 2.0, Section 6.1.8, states the following: | |
| 41 | − * "In order to maintain compatibility with non-PCI Express-aware system | |
| 42 | − * software, system power management logic must be configured by firmware to use | |
| 43 | − * the legacy mechanism of signaling PME by default. PCI Express-aware system | |
| 44 | − * software must notify the firmware prior to enabling native, interrupt-based | |
| 45 | − * PME signaling." However, if the platform doesn't provide us with a suitable | |
| 46 | − * notification mechanism or the notification fails, it is not clear whether or | |
| 47 | − * not we are supposed to use the interrupt-based PCIe PME signaling. The | |
| 48 | − * switch below can be used to indicate the desired behaviour. When set, it | |
| 49 | − * will make the kernel use the interrupt-based PCIe PME signaling regardless of | |
| 50 | − * the platform notification status, although the kernel will attempt to notify | |
| 51 | − * the platform anyway. When unset, it will prevent the kernel from using the | |
| 52 | − * the interrupt-based PCIe PME signaling if the platform notification fails, | |
| 53 | − * which is the default. | |
| 54 | − */ | |
| 55 | −static bool pcie_pme_force_enable; | |
| 56 | − | |
| 57 | 32 | /* |
| 58 | 33 | * If this switch is set, MSI will not be used for PCIe PME signaling. This |
| 59 | 34 | * causes the PCIe port driver to use INTx interrupts only, but it turns out |
| @@ -64,38 +39,13 @@ bool pcie_pme_msi_disabled; · 4 unmodified lines | ||
| 64 | 39 | |
| 65 | 40 | static int __init pcie_pme_setup(char *str) |
| 66 | 41 | { |
| 67 | − if (!strncmp(str, "auto", 4)) | |
| 68 | − pcie_pme_disabled = false; | |
| 69 | − else if (!strncmp(str, "force", 5)) | |
| 70 | − pcie_pme_force_enable = true; | |
| 71 | − | |
| 72 | − str = strchr(str, ','); | |
| 73 | − if (str) { | |
| 74 | − str++; | |
| 75 | − str += strspn(str, " \t"); | |
| 76 | − if (*str && !strcmp(str, "nomsi")) | |
| 77 | − pcie_pme_msi_disabled = true; | |
| 78 | − } | |
| 42 | + if (!strncmp(str, "nomsi", 5)) | |
| 43 | + pcie_pme_msi_disabled = true; | |
| 79 | 44 | |
| 80 | 45 | return 1; |
| 81 | 46 | } |
| 82 | 47 | __setup("pcie_pme=", pcie_pme_setup); |
| 83 | 48 | |
| 84 | −/** | |
| 85 | − * pcie_pme_platform_setup - Ensure that the kernel controls the PCIe PME. | |
| 86 | − * @srv: PCIe PME root port service to use for carrying out the check. | |
| 87 | − * | |
| 88 | − * Notify the platform that the native PCIe PME is going to be used and return | |
| 89 | − * 'true' if the control of the PCIe PME registers has been acquired from the | |
| 90 | − * platform. | |
| 91 | − */ | |
| 92 | −static bool pcie_pme_platform_setup(struct pcie_device *srv) | |
| 93 | −{ | |
| 94 | − if (!pcie_pme_platform_notify(srv)) | |
| 95 | − return true; | |
| 96 | − return pcie_pme_force_enable; | |
| 97 | −} | |
| 98 | − | |
| 99 | 49 | struct pcie_pme_service_data { |
| 100 | 50 | spinlock_t lock; |
| 101 | 51 | struct pcie_device *srv; |
| @@ -108,7 +58,7 @@ struct pcie_pme_service_data { · 6 unmodified lines | ||
| 108 | 58 | * @dev: PCIe root port or event collector. |
| 109 | 59 | * @enable: Enable or disable the interrupt. |
| 110 | 60 | */ |
| 111 | −static void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable) | |
| 61 | +void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable) | |
| 112 | 62 | { |
| 113 | 63 | int rtctl_pos; |
| 114 | 64 | u16 rtctl; |
| @@ -417,9 +367,6 @@ static int pcie_pme_probe(struct pcie_device *srv) · 302 unmodified lines | ||
| 417 | 367 | struct pcie_pme_service_data *data; |
| 418 | 368 | int ret; |
| 419 | 369 | |
| 420 | − if (!pcie_pme_platform_setup(srv)) | |
| 421 | − return -EACCES; | |
| 422 | − | |
| 423 | 370 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 424 | 371 | if (!data) |
| 425 | 372 | return -ENOMEM; |
| @@ -509,8 +456,7 @@ static struct pcie_port_service_driver pcie_pme_driver = { · 83 unmodified lines | ||
| 509 | 456 | */ |
| 510 | 457 | static int __init pcie_pme_service_init(void) |
| 511 | 458 | { |
| 512 | − return pcie_pme_disabled ? | |
| 513 | − -ENODEV : pcie_port_service_register(&pcie_pme_driver); | |
| 459 | + return pcie_port_service_register(&pcie_pme_driver); | |
| 514 | 460 | } |
| 515 | 461 | |
| 516 | 462 | module_init(pcie_pme_service_init); |
| @@ -1,8 +0,0 @@ | ||
| 1 | −# | |
| 2 | −# Makefile for PCI-Express Root Port PME signaling driver | |
| 3 | −# | |
| 4 | − | |
| 5 | −obj-$(CONFIG_PCIE_PME) += pmedriver.o | |
| 6 | − | |
| 7 | −pmedriver-objs := pcie_pme.o | |
| 8 | −pmedriver-$(CONFIG_ACPI) += pcie_pme_acpi.o | |
| @@ -1,28 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * drivers/pci/pcie/pme/pcie_pme.h | |
| 3 | − * | |
| 4 | − * PCI Express Root Port PME signaling support | |
| 5 | − * | |
| 6 | − * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#ifndef _PCIE_PME_H_ | |
| 10 | −#define _PCIE_PME_H_ | |
| 11 | − | |
| 12 | −struct pcie_device; | |
| 13 | − | |
| 14 | −#ifdef CONFIG_ACPI | |
| 15 | −extern int pcie_pme_acpi_setup(struct pcie_device *srv); | |
| 16 | − | |
| 17 | −static inline int pcie_pme_platform_notify(struct pcie_device *srv) | |
| 18 | −{ | |
| 19 | − return pcie_pme_acpi_setup(srv); | |
| 20 | −} | |
| 21 | −#else /* !CONFIG_ACPI */ | |
| 22 | −static inline int pcie_pme_platform_notify(struct pcie_device *srv) | |
| 23 | −{ | |
| 24 | − return 0; | |
| 25 | −} | |
| 26 | −#endif /* !CONFIG_ACPI */ | |
| 27 | − | |
| 28 | −#endif | |
| @@ -1,54 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * PCIe Native PME support, ACPI-related part | |
| 3 | − * | |
| 4 | − * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | |
| 5 | − * | |
| 6 | − * This file is subject to the terms and conditions of the GNU General Public | |
| 7 | − * License V2. See the file "COPYING" in the main directory of this archive | |
| 8 | − * for more details. | |
| 9 | − */ | |
| 10 | − | |
| 11 | −#include <linux/pci.h> | |
| 12 | −#include <linux/kernel.h> | |
| 13 | −#include <linux/errno.h> | |
| 14 | −#include <linux/acpi.h> | |
| 15 | −#include <linux/pci-acpi.h> | |
| 16 | −#include <linux/pcieport_if.h> | |
| 17 | − | |
| 18 | −/** | |
| 19 | − * pcie_pme_acpi_setup - Request the ACPI BIOS to release control over PCIe PME. | |
| 20 | − * @srv - PCIe PME service for a root port or event collector. | |
| 21 | − * | |
| 22 | − * Invoked when the PCIe bus type loads PCIe PME service driver. To avoid | |
| 23 | − * conflict with the BIOS PCIe support requires the BIOS to yield PCIe PME | |
| 24 | − * control to the kernel. | |
| 25 | − */ | |
| 26 | −int pcie_pme_acpi_setup(struct pcie_device *srv) | |
| 27 | −{ | |
| 28 | − acpi_status status = AE_NOT_FOUND; | |
| 29 | − struct pci_dev *port = srv->port; | |
| 30 | − acpi_handle handle; | |
| 31 | − int error = 0; | |
| 32 | − | |
| 33 | − if (acpi_pci_disabled) | |
| 34 | − return -ENOSYS; | |
| 35 | − | |
| 36 | − dev_info(&port->dev, "Requesting control of PCIe PME from ACPI BIOS\n"); | |
| 37 | − | |
| 38 | − handle = acpi_find_root_bridge_handle(port); | |
| 39 | − if (!handle) | |
| 40 | − return -EINVAL; | |
| 41 | − | |
| 42 | − status = acpi_pci_osc_control_set(handle, | |
| 43 | − OSC_PCI_EXPRESS_PME_CONTROL | | |
| 44 | − OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | |
| 45 | − if (ACPI_FAILURE(status)) { | |
| 46 | − dev_info(&port->dev, | |
| 47 | − "Failed to receive control of PCIe PME service: %s\n", | |
| 48 | − (status == AE_SUPPORT || status == AE_NOT_FOUND) ? | |
| 49 | − "no _OSC support" : "ACPI _OSC failed"); | |
| 50 | − error = -ENODEV; | |
| 51 | − } | |
| 52 | − | |
| 53 | − return error; | |
| 54 | −} | |
| @@ -20,6 +20,9 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #define get_descriptor_id(type, service) (((type - 4) << 4) | service) |
| 22 | 22 | |
| 23 | +extern bool pcie_ports_disabled; | |
| 24 | +extern bool pcie_ports_auto; | |
| 25 | + | |
| 23 | 26 | extern struct bus_type pcie_port_bus_type; |
| 24 | 27 | extern int pcie_port_device_register(struct pci_dev *dev); |
| 25 | 28 | #ifdef CONFIG_PM |
| @@ -30,6 +33,8 @@ extern void pcie_port_device_remove(struct pci_dev *dev); · 4 unmodified lines | ||
| 30 | 33 | extern int __must_check pcie_port_bus_register(void); |
| 31 | 34 | extern void pcie_port_bus_unregister(void); |
| 32 | 35 | |
| 36 | +struct pci_dev; | |
| 37 | + | |
| 33 | 38 | #ifdef CONFIG_PCIE_PME |
| 34 | 39 | extern bool pcie_pme_msi_disabled; |
| 35 | 40 | |
| @@ -42,9 +47,26 @@ static inline bool pcie_pme_no_msi(void) · 6 unmodified lines | ||
| 42 | 47 | { |
| 43 | 48 | return pcie_pme_msi_disabled; |
| 44 | 49 | } |
| 50 | + | |
| 51 | +extern void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable); | |
| 45 | 52 | #else /* !CONFIG_PCIE_PME */ |
| 46 | 53 | static inline void pcie_pme_disable_msi(void) {} |
| 47 | 54 | static inline bool pcie_pme_no_msi(void) { return false; } |
| 55 | +static inline void pcie_pme_interrupt_enable(struct pci_dev *dev, bool en) {} | |
| 48 | 56 | #endif /* !CONFIG_PCIE_PME */ |
| 49 | 57 | |
| 58 | +#ifdef CONFIG_ACPI | |
| 59 | +extern int pcie_port_acpi_setup(struct pci_dev *port, int *mask); | |
| 60 | + | |
| 61 | +static inline int pcie_port_platform_notify(struct pci_dev *port, int *mask) | |
| 62 | +{ | |
| 63 | + return pcie_port_acpi_setup(port, mask); | |
| 64 | +} | |
| 65 | +#else /* !CONFIG_ACPI */ | |
| 66 | +static inline int pcie_port_platform_notify(struct pci_dev *port, int *mask) | |
| 67 | +{ | |
| 68 | + return 0; | |
| 69 | +} | |
| 70 | +#endif /* !CONFIG_ACPI */ | |
| 71 | + | |
| 50 | 72 | #endif /* _PORTDRV_H_ */ |
| @@ -0,0 +1,77 @@ | ||
| 1 | +/* | |
| 2 | + * PCIe Port Native Services Support, ACPI-Related Part | |
| 3 | + * | |
| 4 | + * Copyright (C) 2010 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | |
| 5 | + * | |
| 6 | + * This file is subject to the terms and conditions of the GNU General Public | |
| 7 | + * License V2. See the file "COPYING" in the main directory of this archive | |
| 8 | + * for more details. | |
| 9 | + */ | |
| 10 | + | |
| 11 | +#include <linux/pci.h> | |
| 12 | +#include <linux/kernel.h> | |
| 13 | +#include <linux/errno.h> | |
| 14 | +#include <linux/acpi.h> | |
| 15 | +#include <linux/pci-acpi.h> | |
| 16 | +#include <linux/pcieport_if.h> | |
| 17 | + | |
| 18 | +#include "aer/aerdrv.h" | |
| 19 | +#include "../pci.h" | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * pcie_port_acpi_setup - Request the BIOS to release control of PCIe services. | |
| 23 | + * @port: PCIe Port service for a root port or event collector. | |
| 24 | + * @srv_mask: Bit mask of services that can be enabled for @port. | |
| 25 | + * | |
| 26 | + * Invoked when @port is identified as a PCIe port device. To avoid conflicts | |
| 27 | + * with the BIOS PCIe port native services support requires the BIOS to yield | |
| 28 | + * control of these services to the kernel. The mask of services that the BIOS | |
| 29 | + * allows to be enabled for @port is written to @srv_mask. | |
| 30 | + * | |
| 31 | + * NOTE: It turns out that we cannot do that for individual port services | |
| 32 | + * separately, because that would make some systems work incorrectly. | |
| 33 | + */ | |
| 34 | +int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask) | |
| 35 | +{ | |
| 36 | + acpi_status status; | |
| 37 | + acpi_handle handle; | |
| 38 | + u32 flags; | |
| 39 | + | |
| 40 | + if (acpi_pci_disabled) | |
| 41 | + return 0; | |
| 42 | + | |
| 43 | + handle = acpi_find_root_bridge_handle(port); | |
| 44 | + if (!handle) | |
| 45 | + return -EINVAL; | |
| 46 | + | |
| 47 | + flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | |
| 48 | + | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | |
| 49 | + | OSC_PCI_EXPRESS_PME_CONTROL; | |
| 50 | + | |
| 51 | + if (pci_aer_available()) { | |
| 52 | + if (pcie_aer_get_firmware_first(port)) | |
| 53 | + dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n"); | |
| 54 | + else | |
| 55 | + flags |= OSC_PCI_EXPRESS_AER_CONTROL; | |
| 56 | + } | |
| 57 | + | |
| 58 | + status = acpi_pci_osc_control_set(handle, &flags, | |
| 59 | + OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | |
| 60 | + if (ACPI_FAILURE(status)) { | |
| 61 | + dev_dbg(&port->dev, "ACPI _OSC request failed (code %d)\n", | |
| 62 | + status); | |
| 63 | + return -ENODEV; | |
| 64 | + } | |
| 65 | + | |
| 66 | + dev_info(&port->dev, "ACPI _OSC control granted for 0x%02x\n", flags); | |
| 67 | + | |
| 68 | + *srv_mask = PCIE_PORT_SERVICE_VC; | |
| 69 | + if (flags & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL) | |
| 70 | + *srv_mask |= PCIE_PORT_SERVICE_HP; | |
| 71 | + if (flags & OSC_PCI_EXPRESS_PME_CONTROL) | |
| 72 | + *srv_mask |= PCIE_PORT_SERVICE_PME; | |
| 73 | + if (flags & OSC_PCI_EXPRESS_AER_CONTROL) | |
| 74 | + *srv_mask |= PCIE_PORT_SERVICE_AER; | |
| 75 | + | |
| 76 | + return 0; | |
| 77 | +} | |
| @@ -14,6 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/string.h> |
| 15 | 15 | #include <linux/slab.h> |
| 16 | 16 | #include <linux/pcieport_if.h> |
| 17 | +#include <linux/aer.h> | |
| 18 | +#include <linux/pci-aspm.h> | |
| 17 | 19 | |
| 18 | 20 | #include "../pci.h" |
| 19 | 21 | #include "portdrv.h" |
| @@ -236,24 +238,64 @@ static int get_port_device_capability(struct pci_dev *dev) · 216 unmodified lines | ||
| 236 | 238 | int services = 0, pos; |
| 237 | 239 | u16 reg16; |
| 238 | 240 | u32 reg32; |
| 241 | + int cap_mask; | |
| 242 | + int err; | |
| 243 | + | |
| 244 | + err = pcie_port_platform_notify(dev, &cap_mask); | |
| 245 | + if (pcie_ports_auto) { | |
| 246 | + if (err) { | |
| 247 | + pcie_no_aspm(); | |
| 248 | + return 0; | |
| 249 | + } | |
| 250 | + } else { | |
| 251 | + cap_mask = PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP | |
| 252 | + | PCIE_PORT_SERVICE_VC; | |
| 253 | + if (pci_aer_available()) | |
| 254 | + cap_mask |= PCIE_PORT_SERVICE_AER; | |
| 255 | + } | |
| 239 | 256 | |
| 240 | 257 | pos = pci_pcie_cap(dev); |
| 241 | 258 | pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16); |
| 242 | 259 | /* Hot-Plug Capable */ |
| 243 | − if (reg16 & PCI_EXP_FLAGS_SLOT) { | |
| 260 | + if ((cap_mask & PCIE_PORT_SERVICE_HP) && (reg16 & PCI_EXP_FLAGS_SLOT)) { | |
| 244 | 261 | pci_read_config_dword(dev, pos + PCI_EXP_SLTCAP, ®32); |
| 245 | − if (reg32 & PCI_EXP_SLTCAP_HPC) | |
| 262 | + if (reg32 & PCI_EXP_SLTCAP_HPC) { | |
| 246 | 263 | services |= PCIE_PORT_SERVICE_HP; |
| 264 | + /* | |
| 265 | + * Disable hot-plug interrupts in case they have been | |
| 266 | + * enabled by the BIOS and the hot-plug service driver | |
| 267 | + * is not loaded. | |
| 268 | + */ | |
| 269 | + pos += PCI_EXP_SLTCTL; | |
| 270 | + pci_read_config_word(dev, pos, ®16); | |
| 271 | + reg16 &= ~(PCI_EXP_SLTCTL_CCIE | PCI_EXP_SLTCTL_HPIE); | |
| 272 | + pci_write_config_word(dev, pos, reg16); | |
| 273 | + } | |
| 247 | 274 | } |
| 248 | 275 | /* AER capable */ |
| 249 | − if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR)) | |
| 276 | + if ((cap_mask & PCIE_PORT_SERVICE_AER) | |
| 277 | + && pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR)) { | |
| 250 | 278 | services |= PCIE_PORT_SERVICE_AER; |
| 279 | + /* | |
| 280 | + * Disable AER on this port in case it's been enabled by the | |
| 281 | + * BIOS (the AER service driver will enable it when necessary). | |
| 282 | + */ | |
| 283 | + pci_disable_pcie_error_reporting(dev); | |
| 284 | + } | |
| 251 | 285 | /* VC support */ |
| 252 | 286 | if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_VC)) |
| 253 | 287 | services |= PCIE_PORT_SERVICE_VC; |
| 254 | 288 | /* Root ports are capable of generating PME too */ |
| 255 | − if (dev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) | |
| 289 | + if ((cap_mask & PCIE_PORT_SERVICE_PME) | |
| 290 | + && dev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) { | |
| 256 | 291 | services |= PCIE_PORT_SERVICE_PME; |
| 292 | + /* | |
| 293 | + * Disable PME interrupt on this port in case it's been enabled | |
| 294 | + * by the BIOS (the PME service driver will enable it when | |
| 295 | + * necessary). | |
| 296 | + */ | |
| 297 | + pcie_pme_interrupt_enable(dev, false); | |
| 298 | + } | |
| 257 | 299 | |
| 258 | 300 | return services; |
| 259 | 301 | } |
| @@ -494,6 +536,9 @@ static void pcie_port_shutdown_service(struct device *dev) {} · 234 unmodified lines | ||
| 494 | 536 | */ |
| 495 | 537 | int pcie_port_service_register(struct pcie_port_service_driver *new) |
| 496 | 538 | { |
| 539 | + if (pcie_ports_disabled) | |
| 540 | + return -ENODEV; | |
| 541 | + | |
| 497 | 542 | new->driver.name = (char *)new->name; |
| 498 | 543 | new->driver.bus = &pcie_port_bus_type; |
| 499 | 544 | new->driver.probe = pcie_port_probe_service; |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/pcieport_if.h> |
| 16 | 16 | #include <linux/aer.h> |
| 17 | 17 | #include <linux/dmi.h> |
| 18 | +#include <linux/pci-aspm.h> | |
| 18 | 19 | |
| 19 | 20 | #include "portdrv.h" |
| 20 | 21 | #include "aer/aerdrv.h" |
| @@ -29,6 +30,31 @@ MODULE_AUTHOR(DRIVER_AUTHOR); · 8 unmodified lines | ||
| 29 | 30 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 30 | 31 | MODULE_LICENSE("GPL"); |
| 31 | 32 | |
| 33 | +/* If this switch is set, PCIe port native services should not be enabled. */ | |
| 34 | +bool pcie_ports_disabled; | |
| 35 | + | |
| 36 | +/* | |
| 37 | + * If this switch is set, ACPI _OSC will be used to determine whether or not to | |
| 38 | + * enable PCIe port native services. | |
| 39 | + */ | |
| 40 | +bool pcie_ports_auto = true; | |
| 41 | + | |
| 42 | +static int __init pcie_port_setup(char *str) | |
| 43 | +{ | |
| 44 | + if (!strncmp(str, "compat", 6)) { | |
| 45 | + pcie_ports_disabled = true; | |
| 46 | + } else if (!strncmp(str, "native", 6)) { | |
| 47 | + pcie_ports_disabled = false; | |
| 48 | + pcie_ports_auto = false; | |
| 49 | + } else if (!strncmp(str, "auto", 4)) { | |
| 50 | + pcie_ports_disabled = false; | |
| 51 | + pcie_ports_auto = true; | |
| 52 | + } | |
| 53 | + | |
| 54 | + return 1; | |
| 55 | +} | |
| 56 | +__setup("pcie_ports=", pcie_port_setup); | |
| 57 | + | |
| 32 | 58 | /* global data */ |
| 33 | 59 | |
| 34 | 60 | static int pcie_portdrv_restore_config(struct pci_dev *dev) |
| @@ -301,6 +327,11 @@ static int __init pcie_portdrv_init(void) · 266 unmodified lines | ||
| 301 | 327 | { |
| 302 | 328 | int retval; |
| 303 | 329 | |
| 330 | + if (pcie_ports_disabled) { | |
| 331 | + pcie_no_aspm(); | |
| 332 | + return -EACCES; | |
| 333 | + } | |
| 334 | + | |
| 304 | 335 | dmi_check_system(pcie_portdrv_dmi_table); |
| 305 | 336 | |
| 306 | 337 | retval = pcie_port_bus_register(); |
| @@ -315,11 +346,4 @@ static int __init pcie_portdrv_init(void) · 8 unmodified lines | ||
| 315 | 346 | return retval; |
| 316 | 347 | } |
| 317 | 348 | |
| 318 | −static void __exit pcie_portdrv_exit(void) | |
| 319 | −{ | |
| 320 | − pci_unregister_driver(&pcie_portdriver); | |
| 321 | − pcie_port_bus_unregister(); | |
| 322 | −} | |
| 323 | − | |
| 324 | 349 | module_init(pcie_portdrv_init); |
| 325 | −module_exit(pcie_portdrv_exit); | |
| @@ -49,7 +49,7 @@ static ssize_t address_read_file(struct pci_slot *slot, char *buf) · 48 unmodified lines | ||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /* these strings match up with the values in pci_bus_speed */ |
| 52 | −static char *pci_bus_speed_strings[] = { | |
| 52 | +static const char *pci_bus_speed_strings[] = { | |
| 53 | 53 | "33 MHz PCI", /* 0x00 */ |
| 54 | 54 | "66 MHz PCI", /* 0x01 */ |
| 55 | 55 | "66 MHz PCI-X", /* 0x02 */ |
| @@ -426,7 +426,7 @@ static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state) · 425 unmodified lines | ||
| 426 | 426 | enable_irq_wake(IRQ_RTC); |
| 427 | 427 | bfin_rtc_sync_pending(&pdev->dev); |
| 428 | 428 | } else |
| 429 | − bfin_rtc_int_clear(-1); | |
| 429 | + bfin_rtc_int_clear(0); | |
| 430 | 430 | |
| 431 | 431 | return 0; |
| 432 | 432 | } |
| @@ -435,8 +435,17 @@ static int bfin_rtc_resume(struct platform_device *pdev) · 2 unmodified lines | ||
| 435 | 435 | { |
| 436 | 436 | if (device_may_wakeup(&pdev->dev)) |
| 437 | 437 | disable_irq_wake(IRQ_RTC); |
| 438 | − else | |
| 439 | − bfin_write_RTC_ISTAT(-1); | |
| 438 | + | |
| 439 | + /* | |
| 440 | + * Since only some of the RTC bits are maintained externally in the | |
| 441 | + * Vbat domain, we need to wait for the RTC MMRs to be synced into | |
| 442 | + * the core after waking up. This happens every RTC 1HZ. Once that | |
| 443 | + * has happened, we can go ahead and re-enable the important write | |
| 444 | + * complete interrupt event. | |
| 445 | + */ | |
| 446 | + while (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_SEC)) | |
| 447 | + continue; | |
| 448 | + bfin_rtc_int_set(RTC_ISTAT_WRITE_COMPLETE); | |
| 440 | 449 | |
| 441 | 450 | return 0; |
| 442 | 451 | } |
| @@ -364,7 +364,7 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t) · 363 unmodified lines | ||
| 364 | 364 | t->time.tm_isdst = -1; |
| 365 | 365 | t->enabled = !!(reg[M41T80_REG_ALARM_MON] & M41T80_ALMON_AFE); |
| 366 | 366 | t->pending = !!(reg[M41T80_REG_FLAGS] & M41T80_FLAGS_AF); |
| 367 | − return rtc_valid_tm(t); | |
| 367 | + return 0; | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | static struct rtc_class_ops m41t80_rtc_ops = { |
| @@ -403,7 +403,7 @@ static int pl031_probe(struct amba_device *adev, struct amba_id *id) · 402 unmodified lines | ||
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | if (request_irq(adev->irq[0], pl031_interrupt, |
| 406 | − IRQF_DISABLED | IRQF_SHARED, "rtc-pl031", ldata)) { | |
| 406 | + IRQF_DISABLED, "rtc-pl031", ldata)) { | |
| 407 | 407 | ret = -EIO; |
| 408 | 408 | goto out_no_irq; |
| 409 | 409 | } |
| @@ -16,12 +16,11 @@ · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | #ifdef CONFIG_MAGIC_SYSRQ |
| 18 | 18 | static int ctrlchar_sysrq_key; |
| 19 | −static struct tty_struct *sysrq_tty; | |
| 20 | 19 | |
| 21 | 20 | static void |
| 22 | 21 | ctrlchar_handle_sysrq(struct work_struct *work) |
| 23 | 22 | { |
| 24 | − handle_sysrq(ctrlchar_sysrq_key, sysrq_tty); | |
| 23 | + handle_sysrq(ctrlchar_sysrq_key); | |
| 25 | 24 | } |
| 26 | 25 | |
| 27 | 26 | static DECLARE_WORK(ctrlchar_work, ctrlchar_handle_sysrq); |
| @@ -54,7 +53,6 @@ ctrlchar_handle(const unsigned char *buf, int len, struct tty_struct *tty) · 26 unmodified lines | ||
| 54 | 53 | /* racy */ |
| 55 | 54 | if (len == 3 && buf[1] == '-') { |
| 56 | 55 | ctrlchar_sysrq_key = buf[2]; |
| 57 | − sysrq_tty = tty; | |
| 58 | 56 | schedule_work(&ctrlchar_work); |
| 59 | 57 | return CTRLCHAR_SYSRQ; |
| 60 | 58 | } |
| @@ -305,7 +305,7 @@ kbd_keycode(struct kbd_data *kbd, unsigned int keycode) · 304 unmodified lines | ||
| 305 | 305 | if (kbd->sysrq) { |
| 306 | 306 | if (kbd->sysrq == K(KT_LATIN, '-')) { |
| 307 | 307 | kbd->sysrq = 0; |
| 308 | − handle_sysrq(value, kbd->tty); | |
| 308 | + handle_sysrq(value); | |
| 309 | 309 | return; |
| 310 | 310 | } |
| 311 | 311 | if (value == '-') { |
| @@ -217,8 +217,7 @@ tapeblock_setup_device(struct tape_device * device) · 216 unmodified lines | ||
| 217 | 217 | if (!blkdat->request_queue) |
| 218 | 218 | return -ENOMEM; |
| 219 | 219 | |
| 220 | − elevator_exit(blkdat->request_queue->elevator); | |
| 221 | − rc = elevator_init(blkdat->request_queue, "noop"); | |
| 220 | + rc = elevator_change(blkdat->request_queue, "noop"); | |
| 222 | 221 | if (rc) |
| 223 | 222 | goto cleanup_queue; |
| 224 | 223 | |
| @@ -300,8 +300,7 @@ int beiscsi_get_host_param(struct Scsi_Host *shost, · 299 unmodified lines | ||
| 300 | 300 | enum iscsi_host_param param, char *buf) |
| 301 | 301 | { |
| 302 | 302 | struct beiscsi_hba *phba = (struct beiscsi_hba *)iscsi_host_priv(shost); |
| 303 | − int len = 0; | |
| 304 | − int status; | |
| 303 | + int status = 0; | |
| 305 | 304 | |
| 306 | 305 | SE_DEBUG(DBG_LVL_8, "In beiscsi_get_host_param, param= %d\n", param); |
| 307 | 306 | switch (param) { |
| @@ -315,7 +314,7 @@ int beiscsi_get_host_param(struct Scsi_Host *shost, · 7 unmodified lines | ||
| 315 | 314 | default: |
| 316 | 315 | return iscsi_host_get_param(shost, param, buf); |
| 317 | 316 | } |
| 318 | − return len; | |
| 317 | + return status; | |
| 319 | 318 | } |
| 320 | 319 | |
| 321 | 320 | int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba) |
| @@ -368,7 +368,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba, · 367 unmodified lines | ||
| 368 | 368 | memset(req, 0, sizeof(*req)); |
| 369 | 369 | wrb->tag0 |= tag; |
| 370 | 370 | |
| 371 | − be_wrb_hdr_prepare(wrb, sizeof(*req), true, 1); | |
| 371 | + be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1); | |
| 372 | 372 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, |
| 373 | 373 | OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD, |
| 374 | 374 | sizeof(*req)); |
| @@ -1404,13 +1404,13 @@ void scsi_print_sense(char *name, struct scsi_cmnd *cmd) · 1403 unmodified lines | ||
| 1404 | 1404 | { |
| 1405 | 1405 | struct scsi_sense_hdr sshdr; |
| 1406 | 1406 | |
| 1407 | − scmd_printk(KERN_INFO, cmd, ""); | |
| 1407 | + scmd_printk(KERN_INFO, cmd, " "); | |
| 1408 | 1408 | scsi_decode_sense_buffer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, |
| 1409 | 1409 | &sshdr); |
| 1410 | 1410 | scsi_show_sense_hdr(&sshdr); |
| 1411 | 1411 | scsi_decode_sense_extras(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, |
| 1412 | 1412 | &sshdr); |
| 1413 | − scmd_printk(KERN_INFO, cmd, ""); | |
| 1413 | + scmd_printk(KERN_INFO, cmd, " "); | |
| 1414 | 1414 | scsi_show_extd_sense(sshdr.asc, sshdr.ascq); |
| 1415 | 1415 | } |
| 1416 | 1416 | EXPORT_SYMBOL(scsi_print_sense); |
| @@ -1453,7 +1453,7 @@ EXPORT_SYMBOL(scsi_show_result); · 36 unmodified lines | ||
| 1453 | 1453 | |
| 1454 | 1454 | void scsi_print_result(struct scsi_cmnd *cmd) |
| 1455 | 1455 | { |
| 1456 | − scmd_printk(KERN_INFO, cmd, ""); | |
| 1456 | + scmd_printk(KERN_INFO, cmd, " "); | |
| 1457 | 1457 | scsi_show_result(cmd->result); |
| 1458 | 1458 | } |
| 1459 | 1459 | EXPORT_SYMBOL(scsi_print_result); |
| @@ -3231,6 +3231,12 @@ static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) · 3230 unmodified lines | ||
| 3231 | 3231 | misc_fw_support = readl(&cfgtable->misc_fw_support); |
| 3232 | 3232 | use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET; |
| 3233 | 3233 | |
| 3234 | + /* The doorbell reset seems to cause lockups on some Smart | |
| 3235 | + * Arrays (e.g. P410, P410i, maybe others). Until this is | |
| 3236 | + * fixed or at least isolated, avoid the doorbell reset. | |
| 3237 | + */ | |
| 3238 | + use_doorbell = 0; | |
| 3239 | + | |
| 3234 | 3240 | rc = hpsa_controller_hard_reset(pdev, vaddr, use_doorbell); |
| 3235 | 3241 | if (rc) |
| 3236 | 3242 | goto unmap_cfgtable; |
| @@ -865,7 +865,7 @@ void osd_req_read(struct osd_request *or, · 864 unmodified lines | ||
| 865 | 865 | { |
| 866 | 866 | _osd_req_encode_common(or, OSD_ACT_READ, obj, offset, len); |
| 867 | 867 | WARN_ON(or->in.bio || or->in.total_bytes); |
| 868 | − WARN_ON(1 == (bio->bi_rw & REQ_WRITE)); | |
| 868 | + WARN_ON(bio->bi_rw & REQ_WRITE); | |
| 869 | 869 | or->in.bio = bio; |
| 870 | 870 | or->in.total_bytes = len; |
| 871 | 871 | } |
| @@ -1838,26 +1838,33 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) · 1837 unmodified lines | ||
| 1838 | 1838 | |
| 1839 | 1839 | qla24xx_disable_vp(vha); |
| 1840 | 1840 | |
| 1841 | + vha->flags.delete_progress = 1; | |
| 1842 | + | |
| 1841 | 1843 | fc_remove_host(vha->host); |
| 1842 | 1844 | |
| 1843 | 1845 | scsi_remove_host(vha->host); |
| 1844 | 1846 | |
| 1845 | − qla2x00_free_fcports(vha); | |
| 1847 | + if (vha->timer_active) { | |
| 1848 | + qla2x00_vp_stop_timer(vha); | |
| 1849 | + DEBUG15(printk(KERN_INFO "scsi(%ld): timer for the vport[%d]" | |
| 1850 | + " = %p has stopped\n", vha->host_no, vha->vp_idx, vha)); | |
| 1851 | + } | |
| 1846 | 1852 | |
| 1847 | 1853 | qla24xx_deallocate_vp_id(vha); |
| 1848 | 1854 | |
| 1855 | + /* No pending activities shall be there on the vha now */ | |
| 1856 | + DEBUG(msleep(random32()%10)); /* Just to see if something falls on | |
| 1857 | + * the net we have placed below */ | |
| 1858 | + | |
| 1859 | + BUG_ON(atomic_read(&vha->vref_count)); | |
| 1860 | + | |
| 1861 | + qla2x00_free_fcports(vha); | |
| 1862 | + | |
| 1849 | 1863 | mutex_lock(&ha->vport_lock); |
| 1850 | 1864 | ha->cur_vport_count--; |
| 1851 | 1865 | clear_bit(vha->vp_idx, ha->vp_idx_map); |
| 1852 | 1866 | mutex_unlock(&ha->vport_lock); |
| 1853 | 1867 | |
| 1854 | − if (vha->timer_active) { | |
| 1855 | − qla2x00_vp_stop_timer(vha); | |
| 1856 | − DEBUG15(printk ("scsi(%ld): timer for the vport[%d] = %p " | |
| 1857 | − "has stopped\n", | |
| 1858 | − vha->host_no, vha->vp_idx, vha)); | |
| 1859 | − } | |
| 1860 | − | |
| 1861 | 1868 | if (vha->req->id && !ha->flags.cpu_affinity_enabled) { |
| 1862 | 1869 | if (qla25xx_delete_req_que(vha, vha->req) != QLA_SUCCESS) |
| 1863 | 1870 | qla_printk(KERN_WARNING, ha, |
| @@ -29,8 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | /* #define QL_DEBUG_LEVEL_17 */ /* Output EEH trace messages */ |
| 30 | 30 | /* #define QL_DEBUG_LEVEL_18 */ /* Output T10 CRC trace messages */ |
| 31 | 31 | |
| 32 | −/* #define QL_PRINTK_BUF */ /* Captures printk to buffer */ | |
| 33 | − | |
| 34 | 32 | /* |
| 35 | 33 | * Macros use for debugging the driver. |
| 36 | 34 | */ |
| @@ -2641,6 +2641,7 @@ struct qla_hw_data { · 2640 unmodified lines | ||
| 2641 | 2641 | #define MBX_UPDATE_FLASH_ACTIVE 3 |
| 2642 | 2642 | |
| 2643 | 2643 | struct mutex vport_lock; /* Virtual port synchronization */ |
| 2644 | + spinlock_t vport_slock; /* order is hardware_lock, then vport_slock */ | |
| 2644 | 2645 | struct completion mbx_cmd_comp; /* Serialize mbx access */ |
| 2645 | 2646 | struct completion mbx_intr_comp; /* Used for completion notification */ |
| 2646 | 2647 | struct completion dcbx_comp; /* For set port config notification */ |
| @@ -2828,6 +2829,7 @@ typedef struct scsi_qla_host { · 181 unmodified lines | ||
| 2828 | 2829 | uint32_t management_server_logged_in :1; |
| 2829 | 2830 | uint32_t process_response_queue :1; |
| 2830 | 2831 | uint32_t difdix_supported:1; |
| 2832 | + uint32_t delete_progress:1; | |
| 2831 | 2833 | } flags; |
| 2832 | 2834 | |
| 2833 | 2835 | atomic_t loop_state; |
| @@ -2922,6 +2924,8 @@ typedef struct scsi_qla_host { · 88 unmodified lines | ||
| 2922 | 2924 | struct req_que *req; |
| 2923 | 2925 | int fw_heartbeat_counter; |
| 2924 | 2926 | int seconds_since_last_heartbeat; |
| 2927 | + | |
| 2928 | + atomic_t vref_count; | |
| 2925 | 2929 | } scsi_qla_host_t; |
| 2926 | 2930 | |
| 2927 | 2931 | /* |
| @@ -2932,6 +2936,22 @@ typedef struct scsi_qla_host { · 4 unmodified lines | ||
| 2932 | 2936 | test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \ |
| 2933 | 2937 | atomic_read(&ha->loop_state) == LOOP_DOWN) |
| 2934 | 2938 | |
| 2939 | +#define QLA_VHA_MARK_BUSY(__vha, __bail) do { \ | |
| 2940 | + atomic_inc(&__vha->vref_count); \ | |
| 2941 | + mb(); \ | |
| 2942 | + if (__vha->flags.delete_progress) { \ | |
| 2943 | + atomic_dec(&__vha->vref_count); \ | |
| 2944 | + __bail = 1; \ | |
| 2945 | + } else { \ | |
| 2946 | + __bail = 0; \ | |
| 2947 | + } \ | |
| 2948 | +} while (0) | |
| 2949 | + | |
| 2950 | +#define QLA_VHA_MARK_NOT_BUSY(__vha) do { \ | |
| 2951 | + atomic_dec(&__vha->vref_count); \ | |
| 2952 | +} while (0) | |
| 2953 | + | |
| 2954 | + | |
| 2935 | 2955 | #define qla_printk(level, ha, format, arg...) \ |
| 2936 | 2956 | dev_printk(level , &((ha)->pdev->dev) , format , ## arg) |
| 2937 | 2957 | |
| @@ -69,21 +69,29 @@ qla2x00_ctx_sp_free(srb_t *sp) · 68 unmodified lines | ||
| 69 | 69 | { |
| 70 | 70 | struct srb_ctx *ctx = sp->ctx; |
| 71 | 71 | struct srb_iocb *iocb = ctx->u.iocb_cmd; |
| 72 | + struct scsi_qla_host *vha = sp->fcport->vha; | |
| 72 | 73 | |
| 73 | 74 | del_timer_sync(&iocb->timer); |
| 74 | 75 | kfree(iocb); |
| 75 | 76 | kfree(ctx); |
| 76 | 77 | mempool_free(sp, sp->fcport->vha->hw->srb_mempool); |
| 78 | + | |
| 79 | + QLA_VHA_MARK_NOT_BUSY(vha); | |
| 77 | 80 | } |
| 78 | 81 | |
| 79 | 82 | inline srb_t * |
| 80 | 83 | qla2x00_get_ctx_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size, |
| 81 | 84 | unsigned long tmo) |
| 82 | 85 | { |
| 83 | − srb_t *sp; | |
| 86 | + srb_t *sp = NULL; | |
| 84 | 87 | struct qla_hw_data *ha = vha->hw; |
| 85 | 88 | struct srb_ctx *ctx; |
| 86 | 89 | struct srb_iocb *iocb; |
| 90 | + uint8_t bail; | |
| 91 | + | |
| 92 | + QLA_VHA_MARK_BUSY(vha, bail); | |
| 93 | + if (bail) | |
| 94 | + return NULL; | |
| 87 | 95 | |
| 88 | 96 | sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL); |
| 89 | 97 | if (!sp) |
| @@ -116,6 +124,8 @@ qla2x00_get_ctx_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size, · 26 unmodified lines | ||
| 116 | 124 | iocb->timer.function = qla2x00_ctx_sp_timeout; |
| 117 | 125 | add_timer(&iocb->timer); |
| 118 | 126 | done: |
| 127 | + if (!sp) | |
| 128 | + QLA_VHA_MARK_NOT_BUSY(vha); | |
| 119 | 129 | return sp; |
| 120 | 130 | } |
| 121 | 131 | |
| @@ -1777,11 +1787,15 @@ qla2x00_init_rings(scsi_qla_host_t *vha) · 1655 unmodified lines | ||
| 1777 | 1787 | qla2x00_init_response_q_entries(rsp); |
| 1778 | 1788 | } |
| 1779 | 1789 | |
| 1790 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 1780 | 1791 | /* Clear RSCN queue. */ |
| 1781 | 1792 | list_for_each_entry(vp, &ha->vp_list, list) { |
| 1782 | 1793 | vp->rscn_in_ptr = 0; |
| 1783 | 1794 | vp->rscn_out_ptr = 0; |
| 1784 | 1795 | } |
| 1796 | + | |
| 1797 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 1798 | + | |
| 1785 | 1799 | ha->isp_ops->config_rings(vha); |
| 1786 | 1800 | |
| 1787 | 1801 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| @@ -3218,12 +3232,17 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha, · 1430 unmodified lines | ||
| 3218 | 3232 | /* Bypass virtual ports of the same host. */ |
| 3219 | 3233 | found = 0; |
| 3220 | 3234 | if (ha->num_vhosts) { |
| 3235 | + unsigned long flags; | |
| 3236 | + | |
| 3237 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 3221 | 3238 | list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { |
| 3222 | 3239 | if (new_fcport->d_id.b24 == vp->d_id.b24) { |
| 3223 | 3240 | found = 1; |
| 3224 | 3241 | break; |
| 3225 | 3242 | } |
| 3226 | 3243 | } |
| 3244 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 3245 | + | |
| 3227 | 3246 | if (found) |
| 3228 | 3247 | continue; |
| 3229 | 3248 | } |
| @@ -3343,6 +3362,7 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *vha, fc_port_t *dev) · 113 unmodified lines | ||
| 3343 | 3362 | struct qla_hw_data *ha = vha->hw; |
| 3344 | 3363 | struct scsi_qla_host *vp; |
| 3345 | 3364 | struct scsi_qla_host *tvp; |
| 3365 | + unsigned long flags = 0; | |
| 3346 | 3366 | |
| 3347 | 3367 | rval = QLA_SUCCESS; |
| 3348 | 3368 | |
| @@ -3367,6 +3387,8 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *vha, fc_port_t *dev) · 18 unmodified lines | ||
| 3367 | 3387 | /* Check for loop ID being already in use. */ |
| 3368 | 3388 | found = 0; |
| 3369 | 3389 | fcport = NULL; |
| 3390 | + | |
| 3391 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 3370 | 3392 | list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { |
| 3371 | 3393 | list_for_each_entry(fcport, &vp->vp_fcports, list) { |
| 3372 | 3394 | if (fcport->loop_id == dev->loop_id && |
| @@ -3379,6 +3401,7 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *vha, fc_port_t *dev) · 6 unmodified lines | ||
| 3379 | 3401 | if (found) |
| 3380 | 3402 | break; |
| 3381 | 3403 | } |
| 3404 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 3382 | 3405 | |
| 3383 | 3406 | /* If not in use then it is free to use. */ |
| 3384 | 3407 | if (!found) { |
| @@ -3791,14 +3814,27 @@ void · 406 unmodified lines | ||
| 3791 | 3814 | qla2x00_update_fcports(scsi_qla_host_t *base_vha) |
| 3792 | 3815 | { |
| 3793 | 3816 | fc_port_t *fcport; |
| 3794 | − struct scsi_qla_host *tvp, *vha; | |
| 3817 | + struct scsi_qla_host *vha; | |
| 3818 | + struct qla_hw_data *ha = base_vha->hw; | |
| 3819 | + unsigned long flags; | |
| 3795 | 3820 | |
| 3821 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 3796 | 3822 | /* Go with deferred removal of rport references. */ |
| 3797 | − list_for_each_entry_safe(vha, tvp, &base_vha->hw->vp_list, list) | |
| 3798 | − list_for_each_entry(fcport, &vha->vp_fcports, list) | |
| 3823 | + list_for_each_entry(vha, &base_vha->hw->vp_list, list) { | |
| 3824 | + atomic_inc(&vha->vref_count); | |
| 3825 | + list_for_each_entry(fcport, &vha->vp_fcports, list) { | |
| 3799 | 3826 | if (fcport && fcport->drport && |
| 3800 | − atomic_read(&fcport->state) != FCS_UNCONFIGURED) | |
| 3827 | + atomic_read(&fcport->state) != FCS_UNCONFIGURED) { | |
| 3828 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 3829 | + | |
| 3801 | 3830 | qla2x00_rport_del(fcport); |
| 3831 | + | |
| 3832 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 3833 | + } | |
| 3834 | + } | |
| 3835 | + atomic_dec(&vha->vref_count); | |
| 3836 | + } | |
| 3837 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 3802 | 3838 | } |
| 3803 | 3839 | |
| 3804 | 3840 | void |
| @@ -3806,7 +3842,7 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) · 1 unmodified line | ||
| 3806 | 3842 | { |
| 3807 | 3843 | struct qla_hw_data *ha = vha->hw; |
| 3808 | 3844 | struct scsi_qla_host *vp, *base_vha = pci_get_drvdata(ha->pdev); |
| 3809 | − struct scsi_qla_host *tvp; | |
| 3845 | + unsigned long flags; | |
| 3810 | 3846 | |
| 3811 | 3847 | vha->flags.online = 0; |
| 3812 | 3848 | ha->flags.chip_reset_done = 0; |
| @@ -3824,8 +3860,18 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) · 11 unmodified lines | ||
| 3824 | 3860 | if (atomic_read(&vha->loop_state) != LOOP_DOWN) { |
| 3825 | 3861 | atomic_set(&vha->loop_state, LOOP_DOWN); |
| 3826 | 3862 | qla2x00_mark_all_devices_lost(vha, 0); |
| 3827 | − list_for_each_entry_safe(vp, tvp, &base_vha->hw->vp_list, list) | |
| 3863 | + | |
| 3864 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 3865 | + list_for_each_entry(vp, &base_vha->hw->vp_list, list) { | |
| 3866 | + atomic_inc(&vp->vref_count); | |
| 3867 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 3868 | + | |
| 3828 | 3869 | qla2x00_mark_all_devices_lost(vp, 0); |
| 3870 | + | |
| 3871 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 3872 | + atomic_dec(&vp->vref_count); | |
| 3873 | + } | |
| 3874 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 3829 | 3875 | } else { |
| 3830 | 3876 | if (!atomic_read(&vha->loop_down_timer)) |
| 3831 | 3877 | atomic_set(&vha->loop_down_timer, |
| @@ -3862,8 +3908,8 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) · 30 unmodified lines | ||
| 3862 | 3908 | uint8_t status = 0; |
| 3863 | 3909 | struct qla_hw_data *ha = vha->hw; |
| 3864 | 3910 | struct scsi_qla_host *vp; |
| 3865 | − struct scsi_qla_host *tvp; | |
| 3866 | 3911 | struct req_que *req = ha->req_q_map[0]; |
| 3912 | + unsigned long flags; | |
| 3867 | 3913 | |
| 3868 | 3914 | if (vha->flags.online) { |
| 3869 | 3915 | qla2x00_abort_isp_cleanup(vha); |
| @@ -3970,10 +4016,21 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) · 100 unmodified lines | ||
| 3970 | 4016 | DEBUG(printk(KERN_INFO |
| 3971 | 4017 | "qla2x00_abort_isp(%ld): succeeded.\n", |
| 3972 | 4018 | vha->host_no)); |
| 3973 | − list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { | |
| 3974 | − if (vp->vp_idx) | |
| 4019 | + | |
| 4020 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 4021 | + list_for_each_entry(vp, &ha->vp_list, list) { | |
| 4022 | + if (vp->vp_idx) { | |
| 4023 | + atomic_inc(&vp->vref_count); | |
| 4024 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 4025 | + | |
| 3975 | 4026 | qla2x00_vp_abort_isp(vp); |
| 4027 | + | |
| 4028 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 4029 | + atomic_dec(&vp->vref_count); | |
| 4030 | + } | |
| 3976 | 4031 | } |
| 4032 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 4033 | + | |
| 3977 | 4034 | } else { |
| 3978 | 4035 | qla_printk(KERN_INFO, ha, |
| 3979 | 4036 | "qla2x00_abort_isp: **** FAILED ****\n"); |
| @@ -5185,7 +5242,7 @@ qla82xx_restart_isp(scsi_qla_host_t *vha) · 1205 unmodified lines | ||
| 5185 | 5242 | struct req_que *req = ha->req_q_map[0]; |
| 5186 | 5243 | struct rsp_que *rsp = ha->rsp_q_map[0]; |
| 5187 | 5244 | struct scsi_qla_host *vp; |
| 5188 | − struct scsi_qla_host *tvp; | |
| 5245 | + unsigned long flags; | |
| 5189 | 5246 | |
| 5190 | 5247 | status = qla2x00_init_rings(vha); |
| 5191 | 5248 | if (!status) { |
| @@ -5272,10 +5329,21 @@ qla82xx_restart_isp(scsi_qla_host_t *vha) · 80 unmodified lines | ||
| 5272 | 5329 | DEBUG(printk(KERN_INFO |
| 5273 | 5330 | "qla82xx_restart_isp(%ld): succeeded.\n", |
| 5274 | 5331 | vha->host_no)); |
| 5275 | − list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { | |
| 5276 | − if (vp->vp_idx) | |
| 5332 | + | |
| 5333 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 5334 | + list_for_each_entry(vp, &ha->vp_list, list) { | |
| 5335 | + if (vp->vp_idx) { | |
| 5336 | + atomic_inc(&vp->vref_count); | |
| 5337 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 5338 | + | |
| 5277 | 5339 | qla2x00_vp_abort_isp(vp); |
| 5340 | + | |
| 5341 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 5342 | + atomic_dec(&vp->vref_count); | |
| 5343 | + } | |
| 5278 | 5344 | } |
| 5345 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 5346 | + | |
| 5279 | 5347 | } else { |
| 5280 | 5348 | qla_printk(KERN_INFO, ha, |
| 5281 | 5349 | "qla82xx_restart_isp: **** FAILED ****\n"); |
| @@ -1706,19 +1706,20 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) · 1705 unmodified lines | ||
| 1706 | 1706 | cp->result = DID_ERROR << 16; |
| 1707 | 1707 | break; |
| 1708 | 1708 | } |
| 1709 | − } else if (!lscsi_status) { | |
| 1709 | + } else { | |
| 1710 | 1710 | DEBUG2(qla_printk(KERN_INFO, ha, |
| 1711 | 1711 | "scsi(%ld:%d:%d) Dropped frame(s) detected (0x%x " |
| 1712 | 1712 | "of 0x%x bytes).\n", vha->host_no, cp->device->id, |
| 1713 | 1713 | cp->device->lun, resid, scsi_bufflen(cp))); |
| 1714 | 1714 | |
| 1715 | − cp->result = DID_ERROR << 16; | |
| 1716 | − break; | |
| 1715 | + cp->result = DID_ERROR << 16 | lscsi_status; | |
| 1716 | + goto check_scsi_status; | |
| 1717 | 1717 | } |
| 1718 | 1718 | |
| 1719 | 1719 | cp->result = DID_OK << 16 | lscsi_status; |
| 1720 | 1720 | logit = 0; |
| 1721 | 1721 | |
| 1722 | +check_scsi_status: | |
| 1722 | 1723 | /* |
| 1723 | 1724 | * Check to see if SCSI Status is non zero. If so report SCSI |
| 1724 | 1725 | * Status. |
| @@ -2913,7 +2913,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 2912 unmodified lines | ||
| 2913 | 2913 | uint16_t stat = le16_to_cpu(rptid_entry->vp_idx); |
| 2914 | 2914 | struct qla_hw_data *ha = vha->hw; |
| 2915 | 2915 | scsi_qla_host_t *vp; |
| 2916 | − scsi_qla_host_t *tvp; | |
| 2916 | + unsigned long flags; | |
| 2917 | 2917 | |
| 2918 | 2918 | if (rptid_entry->entry_status != 0) |
| 2919 | 2919 | return; |
| @@ -2945,9 +2945,12 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 25 unmodified lines | ||
| 2945 | 2945 | return; |
| 2946 | 2946 | } |
| 2947 | 2947 | |
| 2948 | − list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) | |
| 2948 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 2949 | + list_for_each_entry(vp, &ha->vp_list, list) | |
| 2949 | 2950 | if (vp_idx == vp->vp_idx) |
| 2950 | 2951 | break; |
| 2952 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 2953 | + | |
| 2951 | 2954 | if (!vp) |
| 2952 | 2955 | return; |
| 2953 | 2956 | |
| @@ -30,6 +30,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) · 29 unmodified lines | ||
| 30 | 30 | { |
| 31 | 31 | uint32_t vp_id; |
| 32 | 32 | struct qla_hw_data *ha = vha->hw; |
| 33 | + unsigned long flags; | |
| 33 | 34 | |
| 34 | 35 | /* Find an empty slot and assign an vp_id */ |
| 35 | 36 | mutex_lock(&ha->vport_lock); |
| @@ -44,7 +45,11 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) · 8 unmodified lines | ||
| 44 | 45 | set_bit(vp_id, ha->vp_idx_map); |
| 45 | 46 | ha->num_vhosts++; |
| 46 | 47 | vha->vp_idx = vp_id; |
| 48 | + | |
| 49 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 47 | 50 | list_add_tail(&vha->list, &ha->vp_list); |
| 51 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 52 | + | |
| 48 | 53 | mutex_unlock(&ha->vport_lock); |
| 49 | 54 | return vp_id; |
| 50 | 55 | } |
| @@ -54,12 +59,31 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · 3 unmodified lines | ||
| 54 | 59 | { |
| 55 | 60 | uint16_t vp_id; |
| 56 | 61 | struct qla_hw_data *ha = vha->hw; |
| 62 | + unsigned long flags = 0; | |
| 57 | 63 | |
| 58 | 64 | mutex_lock(&ha->vport_lock); |
| 65 | + /* | |
| 66 | + * Wait for all pending activities to finish before removing vport from | |
| 67 | + * the list. | |
| 68 | + * Lock needs to be held for safe removal from the list (it | |
| 69 | + * ensures no active vp_list traversal while the vport is removed | |
| 70 | + * from the queue) | |
| 71 | + */ | |
| 72 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 73 | + while (atomic_read(&vha->vref_count)) { | |
| 74 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 75 | + | |
| 76 | + msleep(500); | |
| 77 | + | |
| 78 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 79 | + } | |
| 80 | + list_del(&vha->list); | |
| 81 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 82 | + | |
| 59 | 83 | vp_id = vha->vp_idx; |
| 60 | 84 | ha->num_vhosts--; |
| 61 | 85 | clear_bit(vp_id, ha->vp_idx_map); |
| 62 | − list_del(&vha->list); | |
| 86 | + | |
| 63 | 87 | mutex_unlock(&ha->vport_lock); |
| 64 | 88 | } |
| 65 | 89 | |
| @@ -68,12 +92,17 @@ qla24xx_find_vhost_by_name(struct qla_hw_data *ha, uint8_t *port_name) · 2 unmodified lines | ||
| 68 | 92 | { |
| 69 | 93 | scsi_qla_host_t *vha; |
| 70 | 94 | struct scsi_qla_host *tvha; |
| 95 | + unsigned long flags; | |
| 71 | 96 | |
| 97 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 72 | 98 | /* Locate matching device in database. */ |
| 73 | 99 | list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) { |
| 74 | − if (!memcmp(port_name, vha->port_name, WWN_SIZE)) | |
| 100 | + if (!memcmp(port_name, vha->port_name, WWN_SIZE)) { | |
| 101 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 75 | 102 | return vha; |
| 103 | + } | |
| 76 | 104 | } |
| 105 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 77 | 106 | return NULL; |
| 78 | 107 | } |
| 79 | 108 | |
| @@ -93,6 +122,12 @@ qla24xx_find_vhost_by_name(struct qla_hw_data *ha, uint8_t *port_name) · 13 unmodified lines | ||
| 93 | 122 | static void |
| 94 | 123 | qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha) |
| 95 | 124 | { |
| 125 | + /* | |
| 126 | + * !!! NOTE !!! | |
| 127 | + * This function, if called in contexts other than vp create, disable | |
| 128 | + * or delete, please make sure this is synchronized with the | |
| 129 | + * delete thread. | |
| 130 | + */ | |
| 96 | 131 | fc_port_t *fcport; |
| 97 | 132 | |
| 98 | 133 | list_for_each_entry(fcport, &vha->vp_fcports, list) { |
| @@ -100,7 +135,6 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha) · 1 unmodified line | ||
| 100 | 135 | "loop_id=0x%04x :%x\n", |
| 101 | 136 | vha->host_no, fcport->loop_id, fcport->vp_idx)); |
| 102 | 137 | |
| 103 | − atomic_set(&fcport->state, FCS_DEVICE_DEAD); | |
| 104 | 138 | qla2x00_mark_device_lost(vha, fcport, 0, 0); |
| 105 | 139 | atomic_set(&fcport->state, FCS_UNCONFIGURED); |
| 106 | 140 | } |
| @@ -194,12 +228,17 @@ qla24xx_configure_vp(scsi_qla_host_t *vha) · 87 unmodified lines | ||
| 194 | 228 | void |
| 195 | 229 | qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) |
| 196 | 230 | { |
| 197 | − scsi_qla_host_t *vha, *tvha; | |
| 231 | + scsi_qla_host_t *vha; | |
| 198 | 232 | struct qla_hw_data *ha = rsp->hw; |
| 199 | 233 | int i = 0; |
| 234 | + unsigned long flags; | |
| 200 | 235 | |
| 201 | − list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) { | |
| 236 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 237 | + list_for_each_entry(vha, &ha->vp_list, list) { | |
| 202 | 238 | if (vha->vp_idx) { |
| 239 | + atomic_inc(&vha->vref_count); | |
| 240 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 241 | + | |
| 203 | 242 | switch (mb[0]) { |
| 204 | 243 | case MBA_LIP_OCCURRED: |
| 205 | 244 | case MBA_LOOP_UP: |
| @@ -215,9 +254,13 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) · 9 unmodified lines | ||
| 215 | 254 | qla2x00_async_event(vha, rsp, mb); |
| 216 | 255 | break; |
| 217 | 256 | } |
| 257 | + | |
| 258 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 259 | + atomic_dec(&vha->vref_count); | |
| 218 | 260 | } |
| 219 | 261 | i++; |
| 220 | 262 | } |
| 263 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 221 | 264 | } |
| 222 | 265 | |
| 223 | 266 | int |
| @@ -297,7 +340,7 @@ qla2x00_do_dpc_all_vps(scsi_qla_host_t *vha) · 73 unmodified lines | ||
| 297 | 340 | int ret; |
| 298 | 341 | struct qla_hw_data *ha = vha->hw; |
| 299 | 342 | scsi_qla_host_t *vp; |
| 300 | − struct scsi_qla_host *tvp; | |
| 343 | + unsigned long flags = 0; | |
| 301 | 344 | |
| 302 | 345 | if (vha->vp_idx) |
| 303 | 346 | return; |
| @@ -309,10 +352,19 @@ qla2x00_do_dpc_all_vps(scsi_qla_host_t *vha) · 5 unmodified lines | ||
| 309 | 352 | if (!(ha->current_topology & ISP_CFG_F)) |
| 310 | 353 | return; |
| 311 | 354 | |
| 312 | − list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { | |
| 313 | − if (vp->vp_idx) | |
| 355 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 356 | + list_for_each_entry(vp, &ha->vp_list, list) { | |
| 357 | + if (vp->vp_idx) { | |
| 358 | + atomic_inc(&vp->vref_count); | |
| 359 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 360 | + | |
| 314 | 361 | ret = qla2x00_do_dpc_vp(vp); |
| 362 | + | |
| 363 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 364 | + atomic_dec(&vp->vref_count); | |
| 365 | + } | |
| 315 | 366 | } |
| 367 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 316 | 368 | } |
| 317 | 369 | |
| 318 | 370 | int |
| @@ -2672,6 +2672,19 @@ qla82xx_start_scsi(srb_t *sp) · 2671 unmodified lines | ||
| 2672 | 2672 | sufficient_dsds: |
| 2673 | 2673 | req_cnt = 1; |
| 2674 | 2674 | |
| 2675 | + if (req->cnt < (req_cnt + 2)) { | |
| 2676 | + cnt = (uint16_t)RD_REG_DWORD_RELAXED( | |
| 2677 | + ®->req_q_out[0]); | |
| 2678 | + if (req->ring_index < cnt) | |
| 2679 | + req->cnt = cnt - req->ring_index; | |
| 2680 | + else | |
| 2681 | + req->cnt = req->length - | |
| 2682 | + (req->ring_index - cnt); | |
| 2683 | + } | |
| 2684 | + | |
| 2685 | + if (req->cnt < (req_cnt + 2)) | |
| 2686 | + goto queuing_error; | |
| 2687 | + | |
| 2675 | 2688 | ctx = sp->ctx = mempool_alloc(ha->ctx_mempool, GFP_ATOMIC); |
| 2676 | 2689 | if (!sp->ctx) { |
| 2677 | 2690 | DEBUG(printk(KERN_INFO |
| @@ -3307,16 +3320,19 @@ qla82xx_check_fw_alive(scsi_qla_host_t *vha) · 629 unmodified lines | ||
| 3307 | 3320 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
| 3308 | 3321 | } |
| 3309 | 3322 | qla2xxx_wake_dpc(vha); |
| 3323 | + ha->flags.fw_hung = 1; | |
| 3310 | 3324 | if (ha->flags.mbox_busy) { |
| 3311 | − ha->flags.fw_hung = 1; | |
| 3312 | 3325 | ha->flags.mbox_int = 1; |
| 3313 | 3326 | DEBUG2(qla_printk(KERN_ERR, ha, |
| 3314 | − "Due to fw hung, doing premature " | |
| 3315 | − "completion of mbx command\n")); | |
| 3316 | − complete(&ha->mbx_intr_comp); | |
| 3327 | + "Due to fw hung, doing premature " | |
| 3328 | + "completion of mbx command\n")); | |
| 3329 | + if (test_bit(MBX_INTR_WAIT, | |
| 3330 | + &ha->mbx_cmd_flags)) | |
| 3331 | + complete(&ha->mbx_intr_comp); | |
| 3317 | 3332 | } |
| 3318 | 3333 | } |
| 3319 | − } | |
| 3334 | + } else | |
| 3335 | + vha->seconds_since_last_heartbeat = 0; | |
| 3320 | 3336 | vha->fw_heartbeat_counter = fw_heartbeat_counter; |
| 3321 | 3337 | } |
| 3322 | 3338 | |
| @@ -3418,13 +3434,15 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) · 95 unmodified lines | ||
| 3418 | 3434 | "%s(): Adapter reset needed!\n", __func__); |
| 3419 | 3435 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
| 3420 | 3436 | qla2xxx_wake_dpc(vha); |
| 3437 | + ha->flags.fw_hung = 1; | |
| 3421 | 3438 | if (ha->flags.mbox_busy) { |
| 3422 | − ha->flags.fw_hung = 1; | |
| 3423 | 3439 | ha->flags.mbox_int = 1; |
| 3424 | 3440 | DEBUG2(qla_printk(KERN_ERR, ha, |
| 3425 | − "Need reset, doing premature " | |
| 3426 | − "completion of mbx command\n")); | |
| 3427 | − complete(&ha->mbx_intr_comp); | |
| 3441 | + "Need reset, doing premature " | |
| 3442 | + "completion of mbx command\n")); | |
| 3443 | + if (test_bit(MBX_INTR_WAIT, | |
| 3444 | + &ha->mbx_cmd_flags)) | |
| 3445 | + complete(&ha->mbx_intr_comp); | |
| 3428 | 3446 | } |
| 3429 | 3447 | } else { |
| 3430 | 3448 | qla82xx_check_fw_alive(vha); |
| @@ -2341,16 +2341,28 @@ probe_out: · 2340 unmodified lines | ||
| 2341 | 2341 | static void |
| 2342 | 2342 | qla2x00_remove_one(struct pci_dev *pdev) |
| 2343 | 2343 | { |
| 2344 | − scsi_qla_host_t *base_vha, *vha, *temp; | |
| 2344 | + scsi_qla_host_t *base_vha, *vha; | |
| 2345 | 2345 | struct qla_hw_data *ha; |
| 2346 | + unsigned long flags; | |
| 2346 | 2347 | |
| 2347 | 2348 | base_vha = pci_get_drvdata(pdev); |
| 2348 | 2349 | ha = base_vha->hw; |
| 2349 | 2350 | |
| 2350 | − list_for_each_entry_safe(vha, temp, &ha->vp_list, list) { | |
| 2351 | − if (vha && vha->fc_vport) | |
| 2351 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 2352 | + list_for_each_entry(vha, &ha->vp_list, list) { | |
| 2353 | + atomic_inc(&vha->vref_count); | |
| 2354 | + | |
| 2355 | + if (vha && vha->fc_vport) { | |
| 2356 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 2357 | + | |
| 2352 | 2358 | fc_vport_terminate(vha->fc_vport); |
| 2359 | + | |
| 2360 | + spin_lock_irqsave(&ha->vport_slock, flags); | |
| 2361 | + } | |
| 2362 | + | |
| 2363 | + atomic_dec(&vha->vref_count); | |
| 2353 | 2364 | } |
| 2365 | + spin_unlock_irqrestore(&ha->vport_slock, flags); | |
| 2354 | 2366 | |
| 2355 | 2367 | set_bit(UNLOADING, &base_vha->dpc_flags); |
| 2356 | 2368 | |
| @@ -2975,10 +2987,17 @@ static struct qla_work_evt * · 618 unmodified lines | ||
| 2975 | 2987 | qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type) |
| 2976 | 2988 | { |
| 2977 | 2989 | struct qla_work_evt *e; |
| 2990 | + uint8_t bail; | |
| 2991 | + | |
| 2992 | + QLA_VHA_MARK_BUSY(vha, bail); | |
| 2993 | + if (bail) | |
| 2994 | + return NULL; | |
| 2978 | 2995 | |
| 2979 | 2996 | e = kzalloc(sizeof(struct qla_work_evt), GFP_ATOMIC); |
| 2980 | − if (!e) | |
| 2997 | + if (!e) { | |
| 2998 | + QLA_VHA_MARK_NOT_BUSY(vha); | |
| 2981 | 2999 | return NULL; |
| 3000 | + } | |
| 2982 | 3001 | |
| 2983 | 3002 | INIT_LIST_HEAD(&e->list); |
| 2984 | 3003 | e->type = type; |
| @@ -3135,6 +3154,9 @@ qla2x00_do_work(struct scsi_qla_host *vha) · 150 unmodified lines | ||
| 3135 | 3154 | } |
| 3136 | 3155 | if (e->flags & QLA_EVT_FLAG_FREE) |
| 3137 | 3156 | kfree(e); |
| 3157 | + | |
| 3158 | + /* For each work completed decrement vha ref count */ | |
| 3159 | + QLA_VHA_MARK_NOT_BUSY(vha); | |
| 3138 | 3160 | } |
| 3139 | 3161 | } |
| 3140 | 3162 | |
| @@ -7,9 +7,9 @@ · 6 unmodified lines | ||
| 7 | 7 | /* |
| 8 | 8 | * Driver version |
| 9 | 9 | */ |
| 10 | −#define QLA2XXX_VERSION "8.03.03-k0" | |
| 10 | +#define QLA2XXX_VERSION "8.03.04-k0" | |
| 11 | 11 | |
| 12 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
| 13 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
| 14 | −#define QLA_DRIVER_PATCH_VER 3 | |
| 14 | +#define QLA_DRIVER_PATCH_VER 4 | |
| 15 | 15 | #define QLA_DRIVER_BETA_VER 0 |
| @@ -1011,8 +1011,8 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) · 1010 unmodified lines | ||
| 1011 | 1011 | |
| 1012 | 1012 | err_exit: |
| 1013 | 1013 | scsi_release_buffers(cmd); |
| 1014 | − scsi_put_command(cmd); | |
| 1015 | 1014 | cmd->request->special = NULL; |
| 1015 | + scsi_put_command(cmd); | |
| 1016 | 1016 | return error; |
| 1017 | 1017 | } |
| 1018 | 1018 | EXPORT_SYMBOL(scsi_init_io); |
| @@ -870,7 +870,7 @@ static int sd_release(struct gendisk *disk, fmode_t mode) · 869 unmodified lines | ||
| 870 | 870 | |
| 871 | 871 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); |
| 872 | 872 | |
| 873 | − if (atomic_dec_return(&sdkp->openers) && sdev->removable) { | |
| 873 | + if (atomic_dec_return(&sdkp->openers) == 0 && sdev->removable) { | |
| 874 | 874 | if (scsi_block_when_processing_errors(sdev)) |
| 875 | 875 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); |
| 876 | 876 | } |
| @@ -2625,15 +2625,15 @@ module_exit(exit_sd); · 1748 unmodified lines | ||
| 2625 | 2625 | static void sd_print_sense_hdr(struct scsi_disk *sdkp, |
| 2626 | 2626 | struct scsi_sense_hdr *sshdr) |
| 2627 | 2627 | { |
| 2628 | − sd_printk(KERN_INFO, sdkp, ""); | |
| 2628 | + sd_printk(KERN_INFO, sdkp, " "); | |
| 2629 | 2629 | scsi_show_sense_hdr(sshdr); |
| 2630 | − sd_printk(KERN_INFO, sdkp, ""); | |
| 2630 | + sd_printk(KERN_INFO, sdkp, " "); | |
| 2631 | 2631 | scsi_show_extd_sense(sshdr->asc, sshdr->ascq); |
| 2632 | 2632 | } |
| 2633 | 2633 | |
| 2634 | 2634 | static void sd_print_result(struct scsi_disk *sdkp, int result) |
| 2635 | 2635 | { |
| 2636 | − sd_printk(KERN_INFO, sdkp, ""); | |
| 2636 | + sd_printk(KERN_INFO, sdkp, " "); | |
| 2637 | 2637 | scsi_show_result(result); |
| 2638 | 2638 | } |
| 2639 | 2639 | |
| @@ -72,10 +72,7 @@ static void sym_printl_hex(u_char *p, int n) · 71 unmodified lines | ||
| 72 | 72 | |
| 73 | 73 | static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg) |
| 74 | 74 | { |
| 75 | − if (label) | |
| 76 | − sym_print_addr(cp->cmd, "%s: ", label); | |
| 77 | − else | |
| 78 | − sym_print_addr(cp->cmd, ""); | |
| 75 | + sym_print_addr(cp->cmd, "%s: ", label); | |
| 79 | 76 | |
| 80 | 77 | spi_print_msg(msg); |
| 81 | 78 | printf("\n"); |
| @@ -4558,7 +4555,8 @@ static void sym_int_sir(struct sym_hcb *np) · 4476 unmodified lines | ||
| 4558 | 4555 | switch (np->msgin [2]) { |
| 4559 | 4556 | case M_X_MODIFY_DP: |
| 4560 | 4557 | if (DEBUG_FLAGS & DEBUG_POINTER) |
| 4561 | − sym_print_msg(cp, NULL, np->msgin); | |
| 4558 | + sym_print_msg(cp, "extended msg ", | |
| 4559 | + np->msgin); | |
| 4562 | 4560 | tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + |
| 4563 | 4561 | (np->msgin[5]<<8) + (np->msgin[6]); |
| 4564 | 4562 | sym_modify_dp(np, tp, cp, tmp); |
| @@ -4585,7 +4583,7 @@ static void sym_int_sir(struct sym_hcb *np) · 20 unmodified lines | ||
| 4585 | 4583 | */ |
| 4586 | 4584 | case M_IGN_RESIDUE: |
| 4587 | 4585 | if (DEBUG_FLAGS & DEBUG_POINTER) |
| 4588 | − sym_print_msg(cp, NULL, np->msgin); | |
| 4586 | + sym_print_msg(cp, "1 or 2 byte ", np->msgin); | |
| 4589 | 4587 | if (cp->host_flags & HF_SENSE) |
| 4590 | 4588 | OUTL_DSP(np, SCRIPTA_BA(np, clrack)); |
| 4591 | 4589 | else |
| @@ -121,7 +121,7 @@ static int sport_uart_setup(struct sport_uart_port *up, int size, int baud_rate) · 120 unmodified lines | ||
| 121 | 121 | unsigned int sclk = get_sclk(); |
| 122 | 122 | |
| 123 | 123 | /* Set TCR1 and TCR2, TFSR is not enabled for uart */ |
| 124 | − SPORT_PUT_TCR1(up, (ITFS | TLSBIT | ITCLK)); | |
| 124 | + SPORT_PUT_TCR1(up, (LATFS | ITFS | TFSR | TLSBIT | ITCLK)); | |
| 125 | 125 | SPORT_PUT_TCR2(up, size + 1); |
| 126 | 126 | pr_debug("%s TCR1:%x, TCR2:%x\n", __func__, SPORT_GET_TCR1(up), SPORT_GET_TCR2(up)); |
| 127 | 127 | |
| @@ -500,6 +500,7 @@ static int __init mpc512x_psc_fifoc_init(void) · 499 unmodified lines | ||
| 500 | 500 | psc_fifoc = of_iomap(np, 0); |
| 501 | 501 | if (!psc_fifoc) { |
| 502 | 502 | pr_err("%s: Can't map FIFOC\n", __func__); |
| 503 | + of_node_put(np); | |
| 503 | 504 | return -ENODEV; |
| 504 | 505 | } |
| 505 | 506 | |
| @@ -492,7 +492,7 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags) · 491 unmodified lines | ||
| 492 | 492 | sysrq_requested = 0; |
| 493 | 493 | if (ch && time_before(jiffies, sysrq_timeout)) { |
| 494 | 494 | spin_unlock_irqrestore(&port->sc_port.lock, flags); |
| 495 | − handle_sysrq(ch, NULL); | |
| 495 | + handle_sysrq(ch); | |
| 496 | 496 | spin_lock_irqsave(&port->sc_port.lock, flags); |
| 497 | 497 | /* ignore actual sysrq command char */ |
| 498 | 498 | continue; |
| @@ -503,8 +503,9 @@ static void giveback(struct pl022 *pl022) · 502 unmodified lines | ||
| 503 | 503 | msg->state = NULL; |
| 504 | 504 | if (msg->complete) |
| 505 | 505 | msg->complete(msg->context); |
| 506 | − /* This message is completed, so let's turn off the clock! */ | |
| 506 | + /* This message is completed, so let's turn off the clocks! */ | |
| 507 | 507 | clk_disable(pl022->clk); |
| 508 | + amba_pclk_disable(pl022->adev); | |
| 508 | 509 | } |
| 509 | 510 | |
| 510 | 511 | /** |
| @@ -1139,9 +1140,10 @@ static void pump_messages(struct work_struct *work) · 628 unmodified lines | ||
| 1139 | 1140 | /* Setup the SPI using the per chip configuration */ |
| 1140 | 1141 | pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi); |
| 1141 | 1142 | /* |
| 1142 | − * We enable the clock here, then the clock will be disabled when | |
| 1143 | + * We enable the clocks here, then the clocks will be disabled when | |
| 1143 | 1144 | * giveback() is called in each method (poll/interrupt/DMA) |
| 1144 | 1145 | */ |
| 1146 | + amba_pclk_enable(pl022->adev); | |
| 1145 | 1147 | clk_enable(pl022->clk); |
| 1146 | 1148 | restore_state(pl022); |
| 1147 | 1149 | flush(pl022); |
| @@ -1786,11 +1788,9 @@ pl022_probe(struct amba_device *adev, struct amba_id *id) · 638 unmodified lines | ||
| 1786 | 1788 | } |
| 1787 | 1789 | |
| 1788 | 1790 | /* Disable SSP */ |
| 1789 | − clk_enable(pl022->clk); | |
| 1790 | 1791 | writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), |
| 1791 | 1792 | SSP_CR1(pl022->virtbase)); |
| 1792 | 1793 | load_ssp_default_config(pl022); |
| 1793 | − clk_disable(pl022->clk); | |
| 1794 | 1794 | |
| 1795 | 1795 | status = request_irq(adev->irq[0], pl022_interrupt_handler, 0, "pl022", |
| 1796 | 1796 | pl022); |
| @@ -1818,6 +1818,8 @@ pl022_probe(struct amba_device *adev, struct amba_id *id) · 21 unmodified lines | ||
| 1818 | 1818 | goto err_spi_register; |
| 1819 | 1819 | } |
| 1820 | 1820 | dev_dbg(dev, "probe succeded\n"); |
| 1821 | + /* Disable the silicon block pclk and clock it when needed */ | |
| 1822 | + amba_pclk_disable(adev); | |
| 1821 | 1823 | return 0; |
| 1822 | 1824 | |
| 1823 | 1825 | err_spi_register: |
| @@ -1879,9 +1881,9 @@ static int pl022_suspend(struct amba_device *adev, pm_message_t state) · 55 unmodified lines | ||
| 1879 | 1881 | return status; |
| 1880 | 1882 | } |
| 1881 | 1883 | |
| 1882 | − clk_enable(pl022->clk); | |
| 1884 | + amba_pclk_enable(adev); | |
| 1883 | 1885 | load_ssp_default_config(pl022); |
| 1884 | − clk_disable(pl022->clk); | |
| 1886 | + amba_pclk_disable(adev); | |
| 1885 | 1887 | dev_dbg(&adev->dev, "suspended\n"); |
| 1886 | 1888 | return 0; |
| 1887 | 1889 | } |
| @@ -1981,7 +1983,7 @@ static int __init pl022_init(void) · 93 unmodified lines | ||
| 1981 | 1983 | return amba_driver_register(&pl022_driver); |
| 1982 | 1984 | } |
| 1983 | 1985 | |
| 1984 | −module_init(pl022_init); | |
| 1986 | +subsys_initcall(pl022_init); | |
| 1985 | 1987 | |
| 1986 | 1988 | static void __exit pl022_exit(void) |
| 1987 | 1989 | { |
| @@ -181,10 +181,6 @@ static void flush(struct dw_spi *dws) · 180 unmodified lines | ||
| 181 | 181 | wait_till_not_busy(dws); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | −static void null_cs_control(u32 command) | |
| 185 | −{ | |
| 186 | −} | |
| 187 | − | |
| 188 | 184 | static int null_writer(struct dw_spi *dws) |
| 189 | 185 | { |
| 190 | 186 | u8 n_bytes = dws->n_bytes; |
| @@ -322,7 +318,7 @@ static void giveback(struct dw_spi *dws) · 131 unmodified lines | ||
| 322 | 318 | struct spi_transfer, |
| 323 | 319 | transfer_list); |
| 324 | 320 | |
| 325 | − if (!last_transfer->cs_change) | |
| 321 | + if (!last_transfer->cs_change && dws->cs_control) | |
| 326 | 322 | dws->cs_control(MRST_SPI_DEASSERT); |
| 327 | 323 | |
| 328 | 324 | msg->state = NULL; |
| @@ -396,6 +392,11 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws) · 67 unmodified lines | ||
| 396 | 392 | static irqreturn_t dw_spi_irq(int irq, void *dev_id) |
| 397 | 393 | { |
| 398 | 394 | struct dw_spi *dws = dev_id; |
| 395 | + u16 irq_status, irq_mask = 0x3f; | |
| 396 | + | |
| 397 | + irq_status = dw_readw(dws, isr) & irq_mask; | |
| 398 | + if (!irq_status) | |
| 399 | + return IRQ_NONE; | |
| 399 | 400 | |
| 400 | 401 | if (!dws->cur_msg) { |
| 401 | 402 | spi_mask_intr(dws, SPI_INT_TXEI); |
| @@ -544,13 +545,13 @@ static void pump_transfers(unsigned long data) · 142 unmodified lines | ||
| 544 | 545 | */ |
| 545 | 546 | if (dws->cs_control) { |
| 546 | 547 | if (dws->rx && dws->tx) |
| 547 | − chip->tmode = 0x00; | |
| 548 | + chip->tmode = SPI_TMOD_TR; | |
| 548 | 549 | else if (dws->rx) |
| 549 | − chip->tmode = 0x02; | |
| 550 | + chip->tmode = SPI_TMOD_RO; | |
| 550 | 551 | else |
| 551 | − chip->tmode = 0x01; | |
| 552 | + chip->tmode = SPI_TMOD_TO; | |
| 552 | 553 | |
| 553 | − cr0 &= ~(0x3 << SPI_MODE_OFFSET); | |
| 554 | + cr0 &= ~SPI_TMOD_MASK; | |
| 554 | 555 | cr0 |= (chip->tmode << SPI_TMOD_OFFSET); |
| 555 | 556 | } |
| 556 | 557 | |
| @@ -699,9 +700,6 @@ static int dw_spi_setup(struct spi_device *spi) · 142 unmodified lines | ||
| 699 | 700 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); |
| 700 | 701 | if (!chip) |
| 701 | 702 | return -ENOMEM; |
| 702 | − | |
| 703 | − chip->cs_control = null_cs_control; | |
| 704 | − chip->enable_dma = 0; | |
| 705 | 703 | } |
| 706 | 704 | |
| 707 | 705 | /* |
| @@ -883,7 +881,7 @@ int __devinit dw_spi_add_host(struct dw_spi *dws) · 175 unmodified lines | ||
| 883 | 881 | dws->dma_inited = 0; |
| 884 | 882 | dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60); |
| 885 | 883 | |
| 886 | − ret = request_irq(dws->irq, dw_spi_irq, 0, | |
| 884 | + ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED, | |
| 887 | 885 | "dw_spi", dws); |
| 888 | 886 | if (ret < 0) { |
| 889 | 887 | dev_err(&master->dev, "can not get IRQ\n"); |
| @@ -554,11 +554,9 @@ done: · 553 unmodified lines | ||
| 554 | 554 | EXPORT_SYMBOL_GPL(spi_register_master); |
| 555 | 555 | |
| 556 | 556 | |
| 557 | −static int __unregister(struct device *dev, void *master_dev) | |
| 557 | +static int __unregister(struct device *dev, void *null) | |
| 558 | 558 | { |
| 559 | − /* note: before about 2.6.14-rc1 this would corrupt memory: */ | |
| 560 | − if (dev != master_dev) | |
| 561 | − spi_unregister_device(to_spi_device(dev)); | |
| 559 | + spi_unregister_device(to_spi_device(dev)); | |
| 562 | 560 | return 0; |
| 563 | 561 | } |
| 564 | 562 | |
| @@ -576,8 +574,7 @@ void spi_unregister_master(struct spi_master *master) · 11 unmodified lines | ||
| 576 | 574 | { |
| 577 | 575 | int dummy; |
| 578 | 576 | |
| 579 | − dummy = device_for_each_child(master->dev.parent, &master->dev, | |
| 580 | − __unregister); | |
| 577 | + dummy = device_for_each_child(&master->dev, NULL, __unregister); | |
| 581 | 578 | device_unregister(&master->dev); |
| 582 | 579 | } |
| 583 | 580 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
| @@ -200,6 +200,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) · 199 unmodified lines | ||
| 200 | 200 | val = readl(regs + S3C64XX_SPI_STATUS); |
| 201 | 201 | } while (TX_FIFO_LVL(val, sci) && loops--); |
| 202 | 202 | |
| 203 | + if (loops == 0) | |
| 204 | + dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n"); | |
| 205 | + | |
| 203 | 206 | /* Flush RxFIFO*/ |
| 204 | 207 | loops = msecs_to_loops(1); |
| 205 | 208 | do { |
| @@ -210,6 +213,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) · 4 unmodified lines | ||
| 210 | 213 | break; |
| 211 | 214 | } while (loops--); |
| 212 | 215 | |
| 216 | + if (loops == 0) | |
| 217 | + dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n"); | |
| 218 | + | |
| 213 | 219 | val = readl(regs + S3C64XX_SPI_CH_CFG); |
| 214 | 220 | val &= ~S3C64XX_SPI_CH_SW_RST; |
| 215 | 221 | writel(val, regs + S3C64XX_SPI_CH_CFG); |
| @@ -320,16 +326,17 @@ static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd, · 104 unmodified lines | ||
| 320 | 326 | |
| 321 | 327 | /* millisecs to xfer 'len' bytes @ 'cur_speed' */ |
| 322 | 328 | ms = xfer->len * 8 * 1000 / sdd->cur_speed; |
| 323 | − ms += 5; /* some tolerance */ | |
| 329 | + ms += 10; /* some tolerance */ | |
| 324 | 330 | |
| 325 | 331 | if (dma_mode) { |
| 326 | 332 | val = msecs_to_jiffies(ms) + 10; |
| 327 | 333 | val = wait_for_completion_timeout(&sdd->xfer_completion, val); |
| 328 | 334 | } else { |
| 335 | + u32 status; | |
| 329 | 336 | val = msecs_to_loops(ms); |
| 330 | 337 | do { |
| 331 | − val = readl(regs + S3C64XX_SPI_STATUS); | |
| 332 | − } while (RX_FIFO_LVL(val, sci) < xfer->len && --val); | |
| 338 | + status = readl(regs + S3C64XX_SPI_STATUS); | |
| 339 | + } while (RX_FIFO_LVL(status, sci) < xfer->len && --val); | |
| 333 | 340 | } |
| 334 | 341 | |
| 335 | 342 | if (!val) |
| @@ -447,8 +454,8 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) · 111 unmodified lines | ||
| 447 | 454 | writel(val, regs + S3C64XX_SPI_CLK_CFG); |
| 448 | 455 | } |
| 449 | 456 | |
| 450 | −void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id, | |
| 451 | − int size, enum s3c2410_dma_buffresult res) | |
| 457 | +static void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id, | |
| 458 | + int size, enum s3c2410_dma_buffresult res) | |
| 452 | 459 | { |
| 453 | 460 | struct s3c64xx_spi_driver_data *sdd = buf_id; |
| 454 | 461 | unsigned long flags; |
| @@ -467,8 +474,8 @@ void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id, · 12 unmodified lines | ||
| 467 | 474 | spin_unlock_irqrestore(&sdd->lock, flags); |
| 468 | 475 | } |
| 469 | 476 | |
| 470 | −void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id, | |
| 471 | − int size, enum s3c2410_dma_buffresult res) | |
| 477 | +static void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id, | |
| 478 | + int size, enum s3c2410_dma_buffresult res) | |
| 472 | 479 | { |
| 473 | 480 | struct s3c64xx_spi_driver_data *sdd = buf_id; |
| 474 | 481 | unsigned long flags; |
| @@ -508,8 +515,9 @@ static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd, · 33 unmodified lines | ||
| 508 | 515 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
| 509 | 516 | |
| 510 | 517 | if (xfer->tx_buf != NULL) { |
| 511 | − xfer->tx_dma = dma_map_single(dev, xfer->tx_buf, | |
| 512 | − xfer->len, DMA_TO_DEVICE); | |
| 518 | + xfer->tx_dma = dma_map_single(dev, | |
| 519 | + (void *)xfer->tx_buf, xfer->len, | |
| 520 | + DMA_TO_DEVICE); | |
| 513 | 521 | if (dma_mapping_error(dev, xfer->tx_dma)) { |
| 514 | 522 | dev_err(dev, "dma_map_single Tx failed\n"); |
| 515 | 523 | xfer->tx_dma = XFER_DMAADDR_INVALID; |
| @@ -919,6 +927,13 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) · 403 unmodified lines | ||
| 919 | 927 | return -ENODEV; |
| 920 | 928 | } |
| 921 | 929 | |
| 930 | + sci = pdev->dev.platform_data; | |
| 931 | + if (!sci->src_clk_name) { | |
| 932 | + dev_err(&pdev->dev, | |
| 933 | + "Board init must call s3c64xx_spi_set_info()\n"); | |
| 934 | + return -EINVAL; | |
| 935 | + } | |
| 936 | + | |
| 922 | 937 | /* Check for availability of necessary resource */ |
| 923 | 938 | |
| 924 | 939 | dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
| @@ -946,8 +961,6 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) · 21 unmodified lines | ||
| 946 | 961 | return -ENOMEM; |
| 947 | 962 | } |
| 948 | 963 | |
| 949 | − sci = pdev->dev.platform_data; | |
| 950 | − | |
| 951 | 964 | platform_set_drvdata(pdev, master); |
| 952 | 965 | |
| 953 | 966 | sdd = spi_master_get_devdata(master); |
| @@ -1170,7 +1183,7 @@ static int __init s3c64xx_spi_init(void) · 216 unmodified lines | ||
| 1170 | 1183 | { |
| 1171 | 1184 | return platform_driver_probe(&s3c64xx_spi_driver, s3c64xx_spi_probe); |
| 1172 | 1185 | } |
| 1173 | −module_init(s3c64xx_spi_init); | |
| 1186 | +subsys_initcall(s3c64xx_spi_init); | |
| 1174 | 1187 | |
| 1175 | 1188 | static void __exit s3c64xx_spi_exit(void) |
| 1176 | 1189 | { |
| @@ -222,7 +222,6 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, · 221 unmodified lines | ||
| 222 | 222 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
| 223 | 223 | p_dev->resource[0]->flags |= |
| 224 | 224 | pcmcia_io_cfg_data_width(io->flags); |
| 225 | − p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | |
| 226 | 225 | p_dev->resource[0]->start = io->win[0].base; |
| 227 | 226 | p_dev->resource[0]->end = io->win[0].len; |
| 228 | 227 | if (io->nwin > 1) { |
| @@ -327,6 +327,9 @@ static const struct net_device_ops device_ops = { · 326 unmodified lines | ||
| 327 | 327 | .ndo_stop = netvsc_close, |
| 328 | 328 | .ndo_start_xmit = netvsc_start_xmit, |
| 329 | 329 | .ndo_set_multicast_list = netvsc_set_multicast_list, |
| 330 | + .ndo_change_mtu = eth_change_mtu, | |
| 331 | + .ndo_validate_addr = eth_validate_addr, | |
| 332 | + .ndo_set_mac_address = eth_mac_addr, | |
| 330 | 333 | }; |
| 331 | 334 | |
| 332 | 335 | static int netvsc_probe(struct device *device) |
| @@ -193,8 +193,7 @@ Description: · 192 unmodified lines | ||
| 193 | 193 | static inline u64 |
| 194 | 194 | GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) |
| 195 | 195 | { |
| 196 | − return ((u64)RingInfo->RingBuffer->WriteIndex << 32) | |
| 197 | − || RingInfo->RingBuffer->ReadIndex; | |
| 196 | + return (u64)RingInfo->RingBuffer->WriteIndex << 32; | |
| 198 | 197 | } |
| 199 | 198 | |
| 200 | 199 | |
| @@ -28,10 +28,10 @@ · 27 unmodified lines | ||
| 28 | 28 | #include "vmbus_api.h" |
| 29 | 29 | |
| 30 | 30 | /* Defines */ |
| 31 | −#define STORVSC_RING_BUFFER_SIZE (10*PAGE_SIZE) | |
| 31 | +#define STORVSC_RING_BUFFER_SIZE (20*PAGE_SIZE) | |
| 32 | 32 | #define BLKVSC_RING_BUFFER_SIZE (20*PAGE_SIZE) |
| 33 | 33 | |
| 34 | −#define STORVSC_MAX_IO_REQUESTS 64 | |
| 34 | +#define STORVSC_MAX_IO_REQUESTS 128 | |
| 35 | 35 | |
| 36 | 36 | /* |
| 37 | 37 | * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In |
| @@ -495,7 +495,7 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl, · 494 unmodified lines | ||
| 495 | 495 | |
| 496 | 496 | /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length <= PAGE_SIZE); */ |
| 497 | 497 | |
| 498 | − if (j == 0) | |
| 498 | + if (bounce_addr == 0) | |
| 499 | 499 | bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0); |
| 500 | 500 | |
| 501 | 501 | while (srclen) { |
| @@ -556,7 +556,7 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl, · 54 unmodified lines | ||
| 556 | 556 | destlen = orig_sgl[i].length; |
| 557 | 557 | /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length <= PAGE_SIZE); */ |
| 558 | 558 | |
| 559 | − if (j == 0) | |
| 559 | + if (bounce_addr == 0) | |
| 560 | 560 | bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0); |
| 561 | 561 | |
| 562 | 562 | while (destlen) { |
| @@ -615,6 +615,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, · 52 unmodified lines | ||
| 615 | 615 | unsigned int request_size = 0; |
| 616 | 616 | int i; |
| 617 | 617 | struct scatterlist *sgl; |
| 618 | + unsigned int sg_count = 0; | |
| 618 | 619 | |
| 619 | 620 | DPRINT_DBG(STORVSC_DRV, "scmnd %p dir %d, use_sg %d buf %p len %d " |
| 620 | 621 | "queue depth %d tagged %d", scmnd, scmnd->sc_data_direction, |
| @@ -697,6 +698,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, · 76 unmodified lines | ||
| 697 | 698 | request->DataBuffer.Length = scsi_bufflen(scmnd); |
| 698 | 699 | if (scsi_sg_count(scmnd)) { |
| 699 | 700 | sgl = (struct scatterlist *)scsi_sglist(scmnd); |
| 701 | + sg_count = scsi_sg_count(scmnd); | |
| 700 | 702 | |
| 701 | 703 | /* check if we need to bounce the sgl */ |
| 702 | 704 | if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) { |
| @@ -731,15 +733,16 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, · 28 unmodified lines | ||
| 731 | 733 | scsi_sg_count(scmnd)); |
| 732 | 734 | |
| 733 | 735 | sgl = cmd_request->bounce_sgl; |
| 736 | + sg_count = cmd_request->bounce_sgl_count; | |
| 734 | 737 | } |
| 735 | 738 | |
| 736 | 739 | request->DataBuffer.Offset = sgl[0].offset; |
| 737 | 740 | |
| 738 | − for (i = 0; i < scsi_sg_count(scmnd); i++) { | |
| 741 | + for (i = 0; i < sg_count; i++) { | |
| 739 | 742 | DPRINT_DBG(STORVSC_DRV, "sgl[%d] len %d offset %d\n", |
| 740 | 743 | i, sgl[i].length, sgl[i].offset); |
| 741 | 744 | request->DataBuffer.PfnArray[i] = |
| 742 | − page_to_pfn(sg_page((&sgl[i]))); | |
| 745 | + page_to_pfn(sg_page((&sgl[i]))); | |
| 743 | 746 | } |
| 744 | 747 | } else if (scsi_sglist(scmnd)) { |
| 745 | 748 | /* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */ |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | config OCTEON_ETHERNET |
| 2 | 2 | tristate "Cavium Networks Octeon Ethernet support" |
| 3 | − depends on CPU_CAVIUM_OCTEON | |
| 3 | + depends on CPU_CAVIUM_OCTEON && NETDEVICES | |
| 4 | 4 | select PHYLIB |
| 5 | 5 | select MDIO_OCTEON |
| 6 | 6 | help |
| @@ -44,6 +44,7 @@ struct usb_device_id rtusb_usb_id[] = { · 43 unmodified lines | ||
| 44 | 44 | {USB_DEVICE(0x07B8, 0x2870)}, /* AboCom */ |
| 45 | 45 | {USB_DEVICE(0x07B8, 0x2770)}, /* AboCom */ |
| 46 | 46 | {USB_DEVICE(0x0DF6, 0x0039)}, /* Sitecom 2770 */ |
| 47 | + {USB_DEVICE(0x0DF6, 0x003F)}, /* Sitecom 2770 */ | |
| 47 | 48 | {USB_DEVICE(0x083A, 0x7512)}, /* Arcadyan 2770 */ |
| 48 | 49 | {USB_DEVICE(0x0789, 0x0162)}, /* Logitec 2870 */ |
| 49 | 50 | {USB_DEVICE(0x0789, 0x0163)}, /* Logitec 2870 */ |
| @@ -95,7 +96,8 @@ struct usb_device_id rtusb_usb_id[] = { · 45 unmodified lines | ||
| 95 | 96 | {USB_DEVICE(0x050d, 0x815c)}, |
| 96 | 97 | {USB_DEVICE(0x1482, 0x3C09)}, /* Abocom */ |
| 97 | 98 | {USB_DEVICE(0x14B2, 0x3C09)}, /* Alpha */ |
| 98 | − {USB_DEVICE(0x04E8, 0x2018)}, /* samsung */ | |
| 99 | + {USB_DEVICE(0x04E8, 0x2018)}, /* samsung linkstick2 */ | |
| 100 | + {USB_DEVICE(0x1690, 0x0740)}, /* Askey */ | |
| 99 | 101 | {USB_DEVICE(0x5A57, 0x0280)}, /* Zinwell */ |
| 100 | 102 | {USB_DEVICE(0x5A57, 0x0282)}, /* Zinwell */ |
| 101 | 103 | {USB_DEVICE(0x7392, 0x7718)}, |
| @@ -105,21 +107,34 @@ struct usb_device_id rtusb_usb_id[] = { · 3 unmodified lines | ||
| 105 | 107 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ |
| 106 | 108 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ |
| 107 | 109 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ |
| 110 | + {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ | |
| 108 | 111 | #endif /* RT2870 // */ |
| 109 | 112 | #ifdef RT3070 |
| 110 | 113 | {USB_DEVICE(0x148F, 0x3070)}, /* Ralink 3070 */ |
| 111 | 114 | {USB_DEVICE(0x148F, 0x3071)}, /* Ralink 3071 */ |
| 112 | 115 | {USB_DEVICE(0x148F, 0x3072)}, /* Ralink 3072 */ |
| 113 | 116 | {USB_DEVICE(0x0DB0, 0x3820)}, /* Ralink 3070 */ |
| 117 | + {USB_DEVICE(0x0DB0, 0x871C)}, /* Ralink 3070 */ | |
| 118 | + {USB_DEVICE(0x0DB0, 0x822C)}, /* Ralink 3070 */ | |
| 119 | + {USB_DEVICE(0x0DB0, 0x871B)}, /* Ralink 3070 */ | |
| 120 | + {USB_DEVICE(0x0DB0, 0x822B)}, /* Ralink 3070 */ | |
| 114 | 121 | {USB_DEVICE(0x0DF6, 0x003E)}, /* Sitecom 3070 */ |
| 115 | 122 | {USB_DEVICE(0x0DF6, 0x0042)}, /* Sitecom 3072 */ |
| 123 | + {USB_DEVICE(0x0DF6, 0x0048)}, /* Sitecom 3070 */ | |
| 124 | + {USB_DEVICE(0x0DF6, 0x0047)}, /* Sitecom 3071 */ | |
| 116 | 125 | {USB_DEVICE(0x14B2, 0x3C12)}, /* AL 3070 */ |
| 117 | 126 | {USB_DEVICE(0x18C5, 0x0012)}, /* Corega 3070 */ |
| 118 | 127 | {USB_DEVICE(0x083A, 0x7511)}, /* Arcadyan 3070 */ |
| 128 | + {USB_DEVICE(0x083A, 0xA701)}, /* SMC 3070 */ | |
| 129 | + {USB_DEVICE(0x083A, 0xA702)}, /* SMC 3072 */ | |
| 119 | 130 | {USB_DEVICE(0x1740, 0x9703)}, /* EnGenius 3070 */ |
| 120 | 131 | {USB_DEVICE(0x1740, 0x9705)}, /* EnGenius 3071 */ |
| 121 | 132 | {USB_DEVICE(0x1740, 0x9706)}, /* EnGenius 3072 */ |
| 133 | + {USB_DEVICE(0x1740, 0x9707)}, /* EnGenius 3070 */ | |
| 134 | + {USB_DEVICE(0x1740, 0x9708)}, /* EnGenius 3071 */ | |
| 135 | + {USB_DEVICE(0x1740, 0x9709)}, /* EnGenius 3072 */ | |
| 122 | 136 | {USB_DEVICE(0x13D3, 0x3273)}, /* AzureWave 3070 */ |
| 137 | + {USB_DEVICE(0x13D3, 0x3305)}, /* AzureWave 3070*/ | |
| 123 | 138 | {USB_DEVICE(0x1044, 0x800D)}, /* Gigabyte GN-WB32L 3070 */ |
| 124 | 139 | {USB_DEVICE(0x2019, 0xAB25)}, /* Planex Communications, Inc. RT3070 */ |
| 125 | 140 | {USB_DEVICE(0x07B8, 0x3070)}, /* AboCom 3070 */ |
| @@ -132,14 +147,36 @@ struct usb_device_id rtusb_usb_id[] = { · 6 unmodified lines | ||
| 132 | 147 | {USB_DEVICE(0x07D1, 0x3C0D)}, /* D-Link 3070 */ |
| 133 | 148 | {USB_DEVICE(0x07D1, 0x3C0E)}, /* D-Link 3070 */ |
| 134 | 149 | {USB_DEVICE(0x07D1, 0x3C0F)}, /* D-Link 3070 */ |
| 150 | + {USB_DEVICE(0x07D1, 0x3C16)}, /* D-Link 3070 */ | |
| 151 | + {USB_DEVICE(0x07D1, 0x3C17)}, /* D-Link 8070 */ | |
| 135 | 152 | {USB_DEVICE(0x1D4D, 0x000C)}, /* Pegatron Corporation 3070 */ |
| 136 | 153 | {USB_DEVICE(0x1D4D, 0x000E)}, /* Pegatron Corporation 3070 */ |
| 137 | 154 | {USB_DEVICE(0x5A57, 0x5257)}, /* Zinwell 3070 */ |
| 138 | 155 | {USB_DEVICE(0x5A57, 0x0283)}, /* Zinwell 3072 */ |
| 139 | 156 | {USB_DEVICE(0x04BB, 0x0945)}, /* I-O DATA 3072 */ |
| 157 | + {USB_DEVICE(0x04BB, 0x0947)}, /* I-O DATA 3070 */ | |
| 158 | + {USB_DEVICE(0x04BB, 0x0948)}, /* I-O DATA 3072 */ | |
| 140 | 159 | {USB_DEVICE(0x203D, 0x1480)}, /* Encore 3070 */ |
| 160 | + {USB_DEVICE(0x20B8, 0x8888)}, /* PARA INDUSTRIAL 3070 */ | |
| 161 | + {USB_DEVICE(0x0B05, 0x1784)}, /* Asus 3072 */ | |
| 162 | + {USB_DEVICE(0x203D, 0x14A9)}, /* Encore 3070*/ | |
| 163 | + {USB_DEVICE(0x0DB0, 0x899A)}, /* MSI 3070*/ | |
| 164 | + {USB_DEVICE(0x0DB0, 0x3870)}, /* MSI 3070*/ | |
| 165 | + {USB_DEVICE(0x0DB0, 0x870A)}, /* MSI 3070*/ | |
| 166 | + {USB_DEVICE(0x0DB0, 0x6899)}, /* MSI 3070 */ | |
| 167 | + {USB_DEVICE(0x0DB0, 0x3822)}, /* MSI 3070 */ | |
| 168 | + {USB_DEVICE(0x0DB0, 0x3871)}, /* MSI 3070 */ | |
| 169 | + {USB_DEVICE(0x0DB0, 0x871A)}, /* MSI 3070 */ | |
| 170 | + {USB_DEVICE(0x0DB0, 0x822A)}, /* MSI 3070 */ | |
| 171 | + {USB_DEVICE(0x0DB0, 0x3821)}, /* Ralink 3070 */ | |
| 172 | + {USB_DEVICE(0x0DB0, 0x821A)}, /* Ralink 3070 */ | |
| 173 | + {USB_DEVICE(0x083A, 0xA703)}, /* IO-MAGIC */ | |
| 174 | + {USB_DEVICE(0x13D3, 0x3307)}, /* Azurewave */ | |
| 175 | + {USB_DEVICE(0x13D3, 0x3321)}, /* Azurewave */ | |
| 176 | + {USB_DEVICE(0x07FA, 0x7712)}, /* Edimax */ | |
| 177 | + {USB_DEVICE(0x0789, 0x0166)}, /* Edimax */ | |
| 178 | + {USB_DEVICE(0x148F, 0x2070)}, /* Edimax */ | |
| 141 | 179 | #endif /* RT3070 // */ |
| 142 | − {USB_DEVICE(0x0DF6, 0x003F)}, /* Sitecom WL-608 */ | |
| 143 | 180 | {USB_DEVICE(0x1737, 0x0077)}, /* Linksys WUSB54GC-EU v3 */ |
| 144 | 181 | {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ |
| 145 | 182 | {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ |
| @@ -2,6 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | menuconfig SPECTRA |
| 3 | 3 | tristate "Denali Spectra Flash Translation Layer" |
| 4 | 4 | depends on BLOCK |
| 5 | + depends on X86_MRST | |
| 5 | 6 | default n |
| 6 | 7 | ---help--- |
| 7 | 8 | Enable the FTL pseudo-filesystem used with the NAND Flash |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <linux/log2.h> |
| 29 | 29 | #include <linux/init.h> |
| 30 | 30 | #include <linux/smp_lock.h> |
| 31 | +#include <linux/slab.h> | |
| 31 | 32 | |
| 32 | 33 | /**** Helper functions used for Div, Remainder operation on u64 ****/ |
| 33 | 34 | |
| @@ -219,6 +219,7 @@ int prism2_get_key(struct wiphy *wiphy, struct net_device *dev, · 218 unmodified lines | ||
| 219 | 219 | return -ENOENT; |
| 220 | 220 | params.key_len = len; |
| 221 | 221 | params.key = wlandev->wep_keys[key_index]; |
| 222 | + params.seq_len = 0; | |
| 222 | 223 | |
| 223 | 224 | callback(cookie, ¶ms); |
| 224 | 225 | |
| @@ -735,6 +736,8 @@ struct wiphy *wlan_create_wiphy(struct device *dev, wlandevice_t *wlandev) · 510 unmodified lines | ||
| 735 | 736 | priv->band.n_channels = ARRAY_SIZE(prism2_channels); |
| 736 | 737 | priv->band.bitrates = priv->rates; |
| 737 | 738 | priv->band.n_bitrates = ARRAY_SIZE(prism2_rates); |
| 739 | + priv->band.band = IEEE80211_BAND_2GHZ; | |
| 740 | + priv->band.ht_cap.ht_supported = false; | |
| 738 | 741 | wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; |
| 739 | 742 | |
| 740 | 743 | set_wiphy_dev(wiphy, dev); |
| @@ -769,6 +769,7 @@ static int __init zram_init(void) · 768 unmodified lines | ||
| 769 | 769 | free_devices: |
| 770 | 770 | while (dev_id) |
| 771 | 771 | destroy_device(&devices[--dev_id]); |
| 772 | + kfree(devices); | |
| 772 | 773 | unregister: |
| 773 | 774 | unregister_blkdev(zram_major, "zram"); |
| 774 | 775 | out: |
| @@ -1127,6 +1127,7 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance, · 1126 unmodified lines | ||
| 1127 | 1127 | { |
| 1128 | 1128 | struct cxacru_data *instance; |
| 1129 | 1129 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
| 1130 | + struct usb_host_endpoint *cmd_ep = usb_dev->ep_in[CXACRU_EP_CMD]; | |
| 1130 | 1131 | int ret; |
| 1131 | 1132 | |
| 1132 | 1133 | /* instance init */ |
| @@ -1171,15 +1172,34 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance, · 38 unmodified lines | ||
| 1171 | 1172 | goto fail; |
| 1172 | 1173 | } |
| 1173 | 1174 | |
| 1174 | − usb_fill_int_urb(instance->rcv_urb, | |
| 1175 | + if (!cmd_ep) { | |
| 1176 | + dbg("cxacru_bind: no command endpoint"); | |
| 1177 | + ret = -ENODEV; | |
| 1178 | + goto fail; | |
| 1179 | + } | |
| 1180 | + | |
| 1181 | + if ((cmd_ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | |
| 1182 | + == USB_ENDPOINT_XFER_INT) { | |
| 1183 | + usb_fill_int_urb(instance->rcv_urb, | |
| 1175 | 1184 | usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD), |
| 1176 | 1185 | instance->rcv_buf, PAGE_SIZE, |
| 1177 | 1186 | cxacru_blocking_completion, &instance->rcv_done, 1); |
| 1178 | 1187 | |
| 1179 | − usb_fill_int_urb(instance->snd_urb, | |
| 1188 | + usb_fill_int_urb(instance->snd_urb, | |
| 1180 | 1189 | usb_dev, usb_sndintpipe(usb_dev, CXACRU_EP_CMD), |
| 1181 | 1190 | instance->snd_buf, PAGE_SIZE, |
| 1182 | 1191 | cxacru_blocking_completion, &instance->snd_done, 4); |
| 1192 | + } else { | |
| 1193 | + usb_fill_bulk_urb(instance->rcv_urb, | |
| 1194 | + usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_CMD), | |
| 1195 | + instance->rcv_buf, PAGE_SIZE, | |
| 1196 | + cxacru_blocking_completion, &instance->rcv_done); | |
| 1197 | + | |
| 1198 | + usb_fill_bulk_urb(instance->snd_urb, | |
| 1199 | + usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_CMD), | |
| 1200 | + instance->snd_buf, PAGE_SIZE, | |
| 1201 | + cxacru_blocking_completion, &instance->snd_done); | |
| 1202 | + } | |
| 1183 | 1203 | |
| 1184 | 1204 | mutex_init(&instance->cm_serialize); |
| 1185 | 1205 | |
| @@ -965,7 +965,8 @@ static int acm_probe(struct usb_interface *intf, · 964 unmodified lines | ||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | if (!buflen) { |
| 968 | − if (intf->cur_altsetting->endpoint->extralen && | |
| 968 | + if (intf->cur_altsetting->endpoint && | |
| 969 | + intf->cur_altsetting->endpoint->extralen && | |
| 969 | 970 | intf->cur_altsetting->endpoint->extra) { |
| 970 | 971 | dev_dbg(&intf->dev, |
| 971 | 972 | "Seeking extra descriptors on endpoint\n"); |
| @@ -1481,6 +1482,11 @@ static int acm_reset_resume(struct usb_interface *intf) · 509 unmodified lines | ||
| 1481 | 1482 | USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, \ |
| 1482 | 1483 | USB_CDC_ACM_PROTO_VENDOR) |
| 1483 | 1484 | |
| 1485 | +#define SAMSUNG_PCSUITE_ACM_INFO(x) \ | |
| 1486 | + USB_DEVICE_AND_INTERFACE_INFO(0x04e7, x, \ | |
| 1487 | + USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, \ | |
| 1488 | + USB_CDC_ACM_PROTO_VENDOR) | |
| 1489 | + | |
| 1484 | 1490 | /* |
| 1485 | 1491 | * USB driver structure. |
| 1486 | 1492 | */ |
| @@ -1591,6 +1597,17 @@ static const struct usb_device_id acm_ids[] = { · 104 unmodified lines | ||
| 1591 | 1597 | { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ |
| 1592 | 1598 | { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ |
| 1593 | 1599 | { NOKIA_PCSUITE_ACM_INFO(0x02e3), }, /* Nokia 5230, RM-588 */ |
| 1600 | + { NOKIA_PCSUITE_ACM_INFO(0x0178), }, /* Nokia E63 */ | |
| 1601 | + { NOKIA_PCSUITE_ACM_INFO(0x010e), }, /* Nokia E75 */ | |
| 1602 | + { NOKIA_PCSUITE_ACM_INFO(0x02d9), }, /* Nokia 6760 Slide */ | |
| 1603 | + { NOKIA_PCSUITE_ACM_INFO(0x01d0), }, /* Nokia E52 */ | |
| 1604 | + { NOKIA_PCSUITE_ACM_INFO(0x0223), }, /* Nokia E72 */ | |
| 1605 | + { NOKIA_PCSUITE_ACM_INFO(0x0275), }, /* Nokia X6 */ | |
| 1606 | + { NOKIA_PCSUITE_ACM_INFO(0x026c), }, /* Nokia N97 Mini */ | |
| 1607 | + { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ | |
| 1608 | + { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ | |
| 1609 | + { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ | |
| 1610 | + { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ | |
| 1594 | 1611 | |
| 1595 | 1612 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
| 1596 | 1613 | |
| @@ -1599,6 +1616,10 @@ static const struct usb_device_id acm_ids[] = { · 2 unmodified lines | ||
| 1599 | 1616 | .driver_info = NOT_A_MODEM, |
| 1600 | 1617 | }, |
| 1601 | 1618 | |
| 1619 | + /* control interfaces without any protocol set */ | |
| 1620 | + { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | |
| 1621 | + USB_CDC_PROTO_NONE) }, | |
| 1622 | + | |
| 1602 | 1623 | /* control interfaces with various AT-command sets */ |
| 1603 | 1624 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
| 1604 | 1625 | USB_CDC_ACM_PROTO_AT_V25TER) }, |
| @@ -1724,6 +1724,15 @@ free_interfaces: · 1723 unmodified lines | ||
| 1724 | 1724 | if (ret) |
| 1725 | 1725 | goto free_interfaces; |
| 1726 | 1726 | |
| 1727 | + /* if it's already configured, clear out old state first. | |
| 1728 | + * getting rid of old interfaces means unbinding their drivers. | |
| 1729 | + */ | |
| 1730 | + if (dev->state != USB_STATE_ADDRESS) | |
| 1731 | + usb_disable_device(dev, 1); /* Skip ep0 */ | |
| 1732 | + | |
| 1733 | + /* Get rid of pending async Set-Config requests for this device */ | |
| 1734 | + cancel_async_set_config(dev); | |
| 1735 | + | |
| 1727 | 1736 | /* Make sure we have bandwidth (and available HCD resources) for this |
| 1728 | 1737 | * configuration. Remove endpoints from the schedule if we're dropping |
| 1729 | 1738 | * this configuration to set configuration 0. After this point, the |
| @@ -1733,20 +1742,11 @@ free_interfaces: · 3 unmodified lines | ||
| 1733 | 1742 | mutex_lock(&hcd->bandwidth_mutex); |
| 1734 | 1743 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
| 1735 | 1744 | if (ret < 0) { |
| 1736 | − usb_autosuspend_device(dev); | |
| 1737 | 1745 | mutex_unlock(&hcd->bandwidth_mutex); |
| 1746 | + usb_autosuspend_device(dev); | |
| 1738 | 1747 | goto free_interfaces; |
| 1739 | 1748 | } |
| 1740 | 1749 | |
| 1741 | − /* if it's already configured, clear out old state first. | |
| 1742 | − * getting rid of old interfaces means unbinding their drivers. | |
| 1743 | − */ | |
| 1744 | − if (dev->state != USB_STATE_ADDRESS) | |
| 1745 | − usb_disable_device(dev, 1); /* Skip ep0 */ | |
| 1746 | − | |
| 1747 | − /* Get rid of pending async Set-Config requests for this device */ | |
| 1748 | − cancel_async_set_config(dev); | |
| 1749 | − | |
| 1750 | 1750 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 1751 | 1751 | USB_REQ_SET_CONFIGURATION, 0, configuration, 0, |
| 1752 | 1752 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
| @@ -1761,8 +1761,8 @@ free_interfaces: · 8 unmodified lines | ||
| 1761 | 1761 | if (!cp) { |
| 1762 | 1762 | usb_set_device_state(dev, USB_STATE_ADDRESS); |
| 1763 | 1763 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
| 1764 | − usb_autosuspend_device(dev); | |
| 1765 | 1764 | mutex_unlock(&hcd->bandwidth_mutex); |
| 1765 | + usb_autosuspend_device(dev); | |
| 1766 | 1766 | goto free_interfaces; |
| 1767 | 1767 | } |
| 1768 | 1768 | mutex_unlock(&hcd->bandwidth_mutex); |
| @@ -293,9 +293,13 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, · 292 unmodified lines | ||
| 293 | 293 | /* mandatory */ |
| 294 | 294 | case OID_GEN_VENDOR_DESCRIPTION: |
| 295 | 295 | pr_debug("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__); |
| 296 | − length = strlen (rndis_per_dev_params [configNr].vendorDescr); | |
| 297 | − memcpy (outbuf, | |
| 298 | − rndis_per_dev_params [configNr].vendorDescr, length); | |
| 296 | + if ( rndis_per_dev_params [configNr].vendorDescr ) { | |
| 297 | + length = strlen (rndis_per_dev_params [configNr].vendorDescr); | |
| 298 | + memcpy (outbuf, | |
| 299 | + rndis_per_dev_params [configNr].vendorDescr, length); | |
| 300 | + } else { | |
| 301 | + outbuf[0] = 0; | |
| 302 | + } | |
| 299 | 303 | retval = 0; |
| 300 | 304 | break; |
| 301 | 305 | |
| @@ -1148,7 +1152,7 @@ static struct proc_dir_entry *rndis_connect_state [RNDIS_MAX_CONFIGS]; · 846 unmodified lines | ||
| 1148 | 1152 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ |
| 1149 | 1153 | |
| 1150 | 1154 | |
| 1151 | −int __init rndis_init (void) | |
| 1155 | +int rndis_init(void) | |
| 1152 | 1156 | { |
| 1153 | 1157 | u8 i; |
| 1154 | 1158 | |
| @@ -262,7 +262,7 @@ int rndis_signal_disconnect (int configNr); · 261 unmodified lines | ||
| 262 | 262 | int rndis_state (int configNr); |
| 263 | 263 | extern void rndis_set_host_mac (int configNr, const u8 *addr); |
| 264 | 264 | |
| 265 | −int __devinit rndis_init (void); | |
| 265 | +int rndis_init(void); | |
| 266 | 266 | void rndis_exit (void); |
| 267 | 267 | |
| 268 | 268 | #endif /* _LINUX_RNDIS_H */ |
| @@ -12,8 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | * published by the Free Software Foundation. |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | −#define DEBUG | |
| 16 | − | |
| 17 | 15 | #include <linux/kernel.h> |
| 18 | 16 | #include <linux/module.h> |
| 19 | 17 | #include <linux/spinlock.h> |
| @@ -192,17 +192,19 @@ ehci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *mat · 191 unmodified lines | ||
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | rv = usb_add_hcd(hcd, irq, 0); |
| 195 | − if (rv == 0) | |
| 196 | − return 0; | |
| 195 | + if (rv) | |
| 196 | + goto err_ehci; | |
| 197 | + | |
| 198 | + return 0; | |
| 197 | 199 | |
| 200 | +err_ehci: | |
| 201 | + if (ehci->has_amcc_usb23) | |
| 202 | + iounmap(ehci->ohci_hcctrl_reg); | |
| 198 | 203 | iounmap(hcd->regs); |
| 199 | 204 | err_ioremap: |
| 200 | 205 | irq_dispose_mapping(irq); |
| 201 | 206 | err_irq: |
| 202 | 207 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
| 203 | − | |
| 204 | − if (ehci->has_amcc_usb23) | |
| 205 | − iounmap(ehci->ohci_hcctrl_reg); | |
| 206 | 208 | err_rmr: |
| 207 | 209 | usb_put_hcd(hcd); |
| 208 | 210 | |
| @@ -56,6 +56,7 @@ static int debug; · 55 unmodified lines | ||
| 56 | 56 | static const struct usb_device_id id_table[] = { |
| 57 | 57 | { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ |
| 58 | 58 | { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ |
| 59 | + { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ | |
| 59 | 60 | { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */ |
| 60 | 61 | { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ |
| 61 | 62 | { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ |
| @@ -88,6 +89,7 @@ static const struct usb_device_id id_table[] = { · 26 unmodified lines | ||
| 88 | 89 | { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ |
| 89 | 90 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
| 90 | 91 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
| 92 | + { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | |
| 91 | 93 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ |
| 92 | 94 | { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ |
| 93 | 95 | { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ |
| @@ -109,6 +111,7 @@ static const struct usb_device_id id_table[] = { · 15 unmodified lines | ||
| 109 | 111 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ |
| 110 | 112 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ |
| 111 | 113 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
| 114 | + { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ | |
| 112 | 115 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
| 113 | 116 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
| 114 | 117 | { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ |
| @@ -122,14 +125,14 @@ static const struct usb_device_id id_table[] = { · 7 unmodified lines | ||
| 122 | 125 | { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ |
| 123 | 126 | { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ |
| 124 | 127 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ |
| 125 | − { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ | |
| 126 | − { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ | |
| 127 | − { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | |
| 128 | − { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ | |
| 129 | 128 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ |
| 130 | 129 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ |
| 131 | 130 | { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */ |
| 132 | 131 | { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */ |
| 132 | + { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ | |
| 133 | + { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ | |
| 134 | + { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | |
| 135 | + { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ | |
| 133 | 136 | { } /* Terminating Entry */ |
| 134 | 137 | }; |
| 135 | 138 | |
| @@ -753,6 +753,14 @@ static struct usb_device_id id_table_combined [] = { · 752 unmodified lines | ||
| 753 | 753 | { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, |
| 754 | 754 | { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), |
| 755 | 755 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
| 756 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, | |
| 757 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_PC_WING_PID) }, | |
| 758 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_USB_DMX_PID) }, | |
| 759 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MIDI_TIMECODE_PID) }, | |
| 760 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MINI_WING_PID) }, | |
| 761 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, | |
| 762 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, | |
| 763 | + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, | |
| 756 | 764 | { }, /* Optional parameter entry */ |
| 757 | 765 | { } /* Terminating entry */ |
| 758 | 766 | }; |
| @@ -1834,7 +1842,7 @@ static int ftdi_process_packet(struct tty_struct *tty, · 1075 unmodified lines | ||
| 1834 | 1842 | |
| 1835 | 1843 | if (port->port.console && port->sysrq) { |
| 1836 | 1844 | for (i = 0; i < len; i++, ch++) { |
| 1837 | − if (!usb_serial_handle_sysrq_char(tty, port, *ch)) | |
| 1845 | + if (!usb_serial_handle_sysrq_char(port, *ch)) | |
| 1838 | 1846 | tty_insert_flip_char(tty, *ch, flag); |
| 1839 | 1847 | } |
| 1840 | 1848 | } else { |
| @@ -134,6 +134,18 @@ · 133 unmodified lines | ||
| 134 | 134 | #define FTDI_NDI_FUTURE_3_PID 0xDA73 /* NDI future device #3 */ |
| 135 | 135 | #define FTDI_NDI_AURORA_SCU_PID 0xDA74 /* NDI Aurora SCU */ |
| 136 | 136 | |
| 137 | +/* | |
| 138 | + * ChamSys Limited (www.chamsys.co.uk) USB wing/interface product IDs | |
| 139 | + */ | |
| 140 | +#define FTDI_CHAMSYS_24_MASTER_WING_PID 0xDAF8 | |
| 141 | +#define FTDI_CHAMSYS_PC_WING_PID 0xDAF9 | |
| 142 | +#define FTDI_CHAMSYS_USB_DMX_PID 0xDAFA | |
| 143 | +#define FTDI_CHAMSYS_MIDI_TIMECODE_PID 0xDAFB | |
| 144 | +#define FTDI_CHAMSYS_MINI_WING_PID 0xDAFC | |
| 145 | +#define FTDI_CHAMSYS_MAXI_WING_PID 0xDAFD | |
| 146 | +#define FTDI_CHAMSYS_MEDIA_WING_PID 0xDAFE | |
| 147 | +#define FTDI_CHAMSYS_WING_PID 0xDAFF | |
| 148 | + | |
| 137 | 149 | /* |
| 138 | 150 | * Westrex International devices submitted by Cory Lee |
| 139 | 151 | */ |
| @@ -343,7 +343,7 @@ void usb_serial_generic_process_read_urb(struct urb *urb) · 342 unmodified lines | ||
| 343 | 343 | tty_insert_flip_string(tty, ch, urb->actual_length); |
| 344 | 344 | else { |
| 345 | 345 | for (i = 0; i < urb->actual_length; i++, ch++) { |
| 346 | − if (!usb_serial_handle_sysrq_char(tty, port, *ch)) | |
| 346 | + if (!usb_serial_handle_sysrq_char(port, *ch)) | |
| 347 | 347 | tty_insert_flip_char(tty, *ch, TTY_NORMAL); |
| 348 | 348 | } |
| 349 | 349 | } |
| @@ -448,12 +448,11 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) · 98 unmodified lines | ||
| 448 | 448 | EXPORT_SYMBOL_GPL(usb_serial_generic_unthrottle); |
| 449 | 449 | |
| 450 | 450 | #ifdef CONFIG_MAGIC_SYSRQ |
| 451 | −int usb_serial_handle_sysrq_char(struct tty_struct *tty, | |
| 452 | − struct usb_serial_port *port, unsigned int ch) | |
| 451 | +int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) | |
| 453 | 452 | { |
| 454 | 453 | if (port->sysrq && port->port.console) { |
| 455 | 454 | if (ch && time_before(jiffies, port->sysrq)) { |
| 456 | − handle_sysrq(ch, tty); | |
| 455 | + handle_sysrq(ch); | |
| 457 | 456 | port->sysrq = 0; |
| 458 | 457 | return 1; |
| 459 | 458 | } |
| @@ -462,8 +461,7 @@ int usb_serial_handle_sysrq_char(struct tty_struct *tty, · 2 unmodified lines | ||
| 462 | 461 | return 0; |
| 463 | 462 | } |
| 464 | 463 | #else |
| 465 | −int usb_serial_handle_sysrq_char(struct tty_struct *tty, | |
| 466 | − struct usb_serial_port *port, unsigned int ch) | |
| 464 | +int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) | |
| 467 | 465 | { |
| 468 | 466 | return 0; |
| 469 | 467 | } |
| @@ -119,16 +119,20 @@ · 118 unmodified lines | ||
| 119 | 119 | * by making a change here, in moschip_port_id_table, and in |
| 120 | 120 | * moschip_id_table_combined |
| 121 | 121 | */ |
| 122 | −#define USB_VENDOR_ID_BANDB 0x0856 | |
| 123 | −#define BANDB_DEVICE_ID_USO9ML2_2 0xAC22 | |
| 124 | −#define BANDB_DEVICE_ID_USO9ML2_4 0xAC24 | |
| 125 | −#define BANDB_DEVICE_ID_US9ML2_2 0xAC29 | |
| 126 | −#define BANDB_DEVICE_ID_US9ML2_4 0xAC30 | |
| 127 | −#define BANDB_DEVICE_ID_USPTL4_2 0xAC31 | |
| 128 | −#define BANDB_DEVICE_ID_USPTL4_4 0xAC32 | |
| 129 | −#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 | |
| 130 | −#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 | |
| 131 | −#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 | |
| 122 | +#define USB_VENDOR_ID_BANDB 0x0856 | |
| 123 | +#define BANDB_DEVICE_ID_USO9ML2_2 0xAC22 | |
| 124 | +#define BANDB_DEVICE_ID_USO9ML2_2P 0xBC00 | |
| 125 | +#define BANDB_DEVICE_ID_USO9ML2_4 0xAC24 | |
| 126 | +#define BANDB_DEVICE_ID_USO9ML2_4P 0xBC01 | |
| 127 | +#define BANDB_DEVICE_ID_US9ML2_2 0xAC29 | |
| 128 | +#define BANDB_DEVICE_ID_US9ML2_4 0xAC30 | |
| 129 | +#define BANDB_DEVICE_ID_USPTL4_2 0xAC31 | |
| 130 | +#define BANDB_DEVICE_ID_USPTL4_4 0xAC32 | |
| 131 | +#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 | |
| 132 | +#define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02 | |
| 133 | +#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 | |
| 134 | +#define BANDB_DEVICE_ID_USOPTL4_4P 0xBC03 | |
| 135 | +#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 | |
| 132 | 136 | |
| 133 | 137 | /* This driver also supports |
| 134 | 138 | * ATEN UC2324 device using Moschip MCS7840 |
| @@ -184,13 +188,17 @@ static const struct usb_device_id moschip_port_id_table[] = { · 49 unmodified lines | ||
| 184 | 188 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, |
| 185 | 189 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, |
| 186 | 190 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, |
| 191 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, | |
| 187 | 192 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, |
| 193 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4P)}, | |
| 188 | 194 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2)}, |
| 189 | 195 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4)}, |
| 190 | 196 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2)}, |
| 191 | 197 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)}, |
| 192 | 198 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, |
| 199 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P)}, | |
| 193 | 200 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, |
| 201 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P)}, | |
| 194 | 202 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)}, |
| 195 | 203 | {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, |
| 196 | 204 | {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, |
| @@ -201,13 +209,17 @@ static const struct usb_device_id moschip_id_table_combined[] __devinitconst = { · 4 unmodified lines | ||
| 201 | 209 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, |
| 202 | 210 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, |
| 203 | 211 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, |
| 212 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, | |
| 204 | 213 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, |
| 214 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4P)}, | |
| 205 | 215 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2)}, |
| 206 | 216 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4)}, |
| 207 | 217 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2)}, |
| 208 | 218 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)}, |
| 209 | 219 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, |
| 220 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P)}, | |
| 210 | 221 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, |
| 222 | + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P)}, | |
| 211 | 223 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)}, |
| 212 | 224 | {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, |
| 213 | 225 | {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, |
| @@ -164,6 +164,14 @@ static void option_instat_callback(struct urb *urb); · 163 unmodified lines | ||
| 164 | 164 | #define YISO_VENDOR_ID 0x0EAB |
| 165 | 165 | #define YISO_PRODUCT_U893 0xC893 |
| 166 | 166 | |
| 167 | +/* | |
| 168 | + * NOVATEL WIRELESS PRODUCTS | |
| 169 | + * | |
| 170 | + * Note from Novatel Wireless: | |
| 171 | + * If your Novatel modem does not work on linux, don't | |
| 172 | + * change the option module, but check our website. If | |
| 173 | + * that does not help, contact ddeschepper@nvtl.com | |
| 174 | +*/ | |
| 167 | 175 | /* MERLIN EVDO PRODUCTS */ |
| 168 | 176 | #define NOVATELWIRELESS_PRODUCT_V640 0x1100 |
| 169 | 177 | #define NOVATELWIRELESS_PRODUCT_V620 0x1110 |
| @@ -185,24 +193,39 @@ static void option_instat_callback(struct urb *urb); · 15 unmodified lines | ||
| 185 | 193 | #define NOVATELWIRELESS_PRODUCT_EU730 0x2400 |
| 186 | 194 | #define NOVATELWIRELESS_PRODUCT_EU740 0x2410 |
| 187 | 195 | #define NOVATELWIRELESS_PRODUCT_EU870D 0x2420 |
| 188 | − | |
| 189 | 196 | /* OVATION PRODUCTS */ |
| 190 | 197 | #define NOVATELWIRELESS_PRODUCT_MC727 0x4100 |
| 191 | 198 | #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 |
| 192 | −#define NOVATELWIRELESS_PRODUCT_U727 0x5010 | |
| 193 | −#define NOVATELWIRELESS_PRODUCT_MC727_NEW 0x5100 | |
| 194 | −#define NOVATELWIRELESS_PRODUCT_MC760 0x6000 | |
| 199 | +/* | |
| 200 | + * Note from Novatel Wireless: | |
| 201 | + * All PID in the 5xxx range are currently reserved for | |
| 202 | + * auto-install CDROMs, and should not be added to this | |
| 203 | + * module. | |
| 204 | + * | |
| 205 | + * #define NOVATELWIRELESS_PRODUCT_U727 0x5010 | |
| 206 | + * #define NOVATELWIRELESS_PRODUCT_MC727_NEW 0x5100 | |
| 207 | +*/ | |
| 195 | 208 | #define NOVATELWIRELESS_PRODUCT_OVMC760 0x6002 |
| 196 | − | |
| 197 | −/* FUTURE NOVATEL PRODUCTS */ | |
| 198 | −#define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0X6001 | |
| 199 | −#define NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED 0X7000 | |
| 200 | −#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED 0X7001 | |
| 201 | −#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED 0X8000 | |
| 202 | −#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED 0X8001 | |
| 203 | −#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0X9000 | |
| 204 | −#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0X9001 | |
| 205 | −#define NOVATELWIRELESS_PRODUCT_GLOBAL 0XA001 | |
| 209 | +#define NOVATELWIRELESS_PRODUCT_MC780 0x6010 | |
| 210 | +#define NOVATELWIRELESS_PRODUCT_EVDO_FULLSPEED 0x6000 | |
| 211 | +#define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0x6001 | |
| 212 | +#define NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED 0x7000 | |
| 213 | +#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED 0x7001 | |
| 214 | +#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3 0x7003 | |
| 215 | +#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4 0x7004 | |
| 216 | +#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5 0x7005 | |
| 217 | +#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED6 0x7006 | |
| 218 | +#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED7 0x7007 | |
| 219 | +#define NOVATELWIRELESS_PRODUCT_MC996D 0x7030 | |
| 220 | +#define NOVATELWIRELESS_PRODUCT_MF3470 0x7041 | |
| 221 | +#define NOVATELWIRELESS_PRODUCT_MC547 0x7042 | |
| 222 | +#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED 0x8000 | |
| 223 | +#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED 0x8001 | |
| 224 | +#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000 | |
| 225 | +#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001 | |
| 226 | +#define NOVATELWIRELESS_PRODUCT_G1 0xA001 | |
| 227 | +#define NOVATELWIRELESS_PRODUCT_G1_M 0xA002 | |
| 228 | +#define NOVATELWIRELESS_PRODUCT_G2 0xA010 | |
| 206 | 229 | |
| 207 | 230 | /* AMOI PRODUCTS */ |
| 208 | 231 | #define AMOI_VENDOR_ID 0x1614 |
| @@ -490,36 +513,44 @@ static const struct usb_device_id option_ids[] = { · 281 unmodified lines | ||
| 490 | 513 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, |
| 491 | 514 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, |
| 492 | 515 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, |
| 493 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ | |
| 494 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ | |
| 495 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, /* Novatel Merlin EX720/V740/X720 */ | |
| 496 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V720) }, /* Novatel Merlin V720/S720/PC720 */ | |
| 497 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U730) }, /* Novatel U730/U740 (VF version) */ | |
| 498 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U740) }, /* Novatel U740 */ | |
| 499 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U870) }, /* Novatel U870 */ | |
| 500 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_XU870) }, /* Novatel Merlin XU870 HSDPA/3G */ | |
| 501 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_X950D) }, /* Novatel X950D */ | |
| 502 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EV620) }, /* Novatel EV620/ES620 CDMA/EV-DO */ | |
| 503 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES720) }, /* Novatel ES620/ES720/U720/USB720 */ | |
| 504 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E725) }, /* Novatel E725/E726 */ | |
| 505 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES620) }, /* Novatel Merlin ES620 SM Bus */ | |
| 506 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU730) }, /* Novatel EU730 and Vodafone EU740 */ | |
| 507 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU740) }, /* Novatel non-Vodafone EU740 */ | |
| 508 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */ | |
| 509 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */ | |
| 510 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ | |
| 511 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727_NEW) }, /* Novatel MC727/U727/USB727 refresh */ | |
| 512 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel MC727/U727/USB727 */ | |
| 513 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC760) }, /* Novatel MC760/U760/USB760 */ | |
| 514 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_OVMC760) }, /* Novatel Ovation MC760 */ | |
| 515 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, /* Novatel HSPA product */ | |
| 516 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, /* Novatel EVDO Embedded product */ | |
| 517 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, /* Novatel HSPA Embedded product */ | |
| 518 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, /* Novatel EVDO product */ | |
| 519 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, /* Novatel HSPA product */ | |
| 520 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED) }, /* Novatel EVDO Embedded product */ | |
| 521 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED) }, /* Novatel HSPA Embedded product */ | |
| 522 | − { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL) }, /* Novatel Global product */ | |
| 516 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, | |
| 517 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, | |
| 518 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, | |
| 519 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V720) }, | |
| 520 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U730) }, | |
| 521 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U740) }, | |
| 522 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U870) }, | |
| 523 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_XU870) }, | |
| 524 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_X950D) }, | |
| 525 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EV620) }, | |
| 526 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES720) }, | |
| 527 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E725) }, | |
| 528 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES620) }, | |
| 529 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU730) }, | |
| 530 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU740) }, | |
| 531 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, | |
| 532 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, | |
| 533 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, | |
| 534 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_OVMC760) }, | |
| 535 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC780) }, | |
| 536 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_FULLSPEED) }, | |
| 537 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, | |
| 538 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, | |
| 539 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, | |
| 540 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, | |
| 541 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, | |
| 542 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, | |
| 543 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, | |
| 544 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED6) }, | |
| 545 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED7) }, | |
| 546 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC996D) }, | |
| 547 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MF3470) }, | |
| 548 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC547) }, | |
| 549 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED) }, | |
| 550 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED) }, | |
| 551 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) }, | |
| 552 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) }, | |
| 553 | + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) }, | |
| 523 | 554 | |
| 524 | 555 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, |
| 525 | 556 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, |
| @@ -789,7 +789,7 @@ static void pl2303_process_read_urb(struct urb *urb) · 788 unmodified lines | ||
| 789 | 789 | |
| 790 | 790 | if (port->port.console && port->sysrq) { |
| 791 | 791 | for (i = 0; i < urb->actual_length; ++i) |
| 792 | − if (!usb_serial_handle_sysrq_char(tty, port, data[i])) | |
| 792 | + if (!usb_serial_handle_sysrq_char(port, data[i])) | |
| 793 | 793 | tty_insert_flip_char(tty, data[i], tty_flag); |
| 794 | 794 | } else { |
| 795 | 795 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, |
| @@ -46,7 +46,7 @@ · 45 unmodified lines | ||
| 46 | 46 | #define FULLPWRBIT 0x00000080 |
| 47 | 47 | #define NEXT_BOARD_POWER_BIT 0x00000004 |
| 48 | 48 | |
| 49 | −static int debug = 1; | |
| 49 | +static int debug; | |
| 50 | 50 | |
| 51 | 51 | /* Version Information */ |
| 52 | 52 | #define DRIVER_VERSION "v0.1" |
| @@ -672,7 +672,7 @@ static int ssu100_process_packet(struct tty_struct *tty, · 619 unmodified lines | ||
| 672 | 672 | |
| 673 | 673 | if (port->port.console && port->sysrq) { |
| 674 | 674 | for (i = 0; i < len; i++, ch++) { |
| 675 | − if (!usb_serial_handle_sysrq_char(tty, port, *ch)) | |
| 675 | + if (!usb_serial_handle_sysrq_char(port, *ch)) | |
| 676 | 676 | tty_insert_flip_char(tty, *ch, flag); |
| 677 | 677 | } |
| 678 | 678 | } else |
| @@ -60,22 +60,25 @@ static int vhost_poll_wakeup(wait_queue_t *wait, unsigned mode, int sync, · 59 unmodified lines | ||
| 60 | 60 | return 0; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | +static void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn) | |
| 64 | +{ | |
| 65 | + INIT_LIST_HEAD(&work->node); | |
| 66 | + work->fn = fn; | |
| 67 | + init_waitqueue_head(&work->done); | |
| 68 | + work->flushing = 0; | |
| 69 | + work->queue_seq = work->done_seq = 0; | |
| 70 | +} | |
| 71 | + | |
| 63 | 72 | /* Init poll structure */ |
| 64 | 73 | void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, |
| 65 | 74 | unsigned long mask, struct vhost_dev *dev) |
| 66 | 75 | { |
| 67 | − struct vhost_work *work = &poll->work; | |
| 68 | − | |
| 69 | 76 | init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup); |
| 70 | 77 | init_poll_funcptr(&poll->table, vhost_poll_func); |
| 71 | 78 | poll->mask = mask; |
| 72 | 79 | poll->dev = dev; |
| 73 | 80 | |
| 74 | − INIT_LIST_HEAD(&work->node); | |
| 75 | − work->fn = fn; | |
| 76 | − init_waitqueue_head(&work->done); | |
| 77 | − work->flushing = 0; | |
| 78 | − work->queue_seq = work->done_seq = 0; | |
| 81 | + vhost_work_init(&poll->work, fn); | |
| 79 | 82 | } |
| 80 | 83 | |
| 81 | 84 | /* Start polling a file. We add ourselves to file's wait queue. The caller must |
| @@ -95,35 +98,38 @@ void vhost_poll_stop(struct vhost_poll *poll) · 13 unmodified lines | ||
| 95 | 98 | remove_wait_queue(poll->wqh, &poll->wait); |
| 96 | 99 | } |
| 97 | 100 | |
| 98 | −/* Flush any work that has been scheduled. When calling this, don't hold any | |
| 99 | − * locks that are also used by the callback. */ | |
| 100 | −void vhost_poll_flush(struct vhost_poll *poll) | |
| 101 | +static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) | |
| 101 | 102 | { |
| 102 | − struct vhost_work *work = &poll->work; | |
| 103 | 103 | unsigned seq; |
| 104 | 104 | int left; |
| 105 | 105 | int flushing; |
| 106 | 106 | |
| 107 | − spin_lock_irq(&poll->dev->work_lock); | |
| 107 | + spin_lock_irq(&dev->work_lock); | |
| 108 | 108 | seq = work->queue_seq; |
| 109 | 109 | work->flushing++; |
| 110 | − spin_unlock_irq(&poll->dev->work_lock); | |
| 110 | + spin_unlock_irq(&dev->work_lock); | |
| 111 | 111 | wait_event(work->done, ({ |
| 112 | − spin_lock_irq(&poll->dev->work_lock); | |
| 112 | + spin_lock_irq(&dev->work_lock); | |
| 113 | 113 | left = seq - work->done_seq <= 0; |
| 114 | − spin_unlock_irq(&poll->dev->work_lock); | |
| 114 | + spin_unlock_irq(&dev->work_lock); | |
| 115 | 115 | left; |
| 116 | 116 | })); |
| 117 | − spin_lock_irq(&poll->dev->work_lock); | |
| 117 | + spin_lock_irq(&dev->work_lock); | |
| 118 | 118 | flushing = --work->flushing; |
| 119 | − spin_unlock_irq(&poll->dev->work_lock); | |
| 119 | + spin_unlock_irq(&dev->work_lock); | |
| 120 | 120 | BUG_ON(flushing < 0); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | −void vhost_poll_queue(struct vhost_poll *poll) | |
| 123 | +/* Flush any work that has been scheduled. When calling this, don't hold any | |
| 124 | + * locks that are also used by the callback. */ | |
| 125 | +void vhost_poll_flush(struct vhost_poll *poll) | |
| 126 | +{ | |
| 127 | + vhost_work_flush(poll->dev, &poll->work); | |
| 128 | +} | |
| 129 | + | |
| 130 | +static inline void vhost_work_queue(struct vhost_dev *dev, | |
| 131 | + struct vhost_work *work) | |
| 124 | 132 | { |
| 125 | − struct vhost_dev *dev = poll->dev; | |
| 126 | − struct vhost_work *work = &poll->work; | |
| 127 | 133 | unsigned long flags; |
| 128 | 134 | |
| 129 | 135 | spin_lock_irqsave(&dev->work_lock, flags); |
| @@ -135,6 +141,11 @@ void vhost_poll_queue(struct vhost_poll *poll) · 5 unmodified lines | ||
| 135 | 141 | spin_unlock_irqrestore(&dev->work_lock, flags); |
| 136 | 142 | } |
| 137 | 143 | |
| 144 | +void vhost_poll_queue(struct vhost_poll *poll) | |
| 145 | +{ | |
| 146 | + vhost_work_queue(poll->dev, &poll->work); | |
| 147 | +} | |
| 148 | + | |
| 138 | 149 | static void vhost_vq_reset(struct vhost_dev *dev, |
| 139 | 150 | struct vhost_virtqueue *vq) |
| 140 | 151 | { |
| @@ -236,6 +247,29 @@ long vhost_dev_check_owner(struct vhost_dev *dev) · 95 unmodified lines | ||
| 236 | 247 | return dev->mm == current->mm ? 0 : -EPERM; |
| 237 | 248 | } |
| 238 | 249 | |
| 250 | +struct vhost_attach_cgroups_struct { | |
| 251 | + struct vhost_work work; | |
| 252 | + struct task_struct *owner; | |
| 253 | + int ret; | |
| 254 | +}; | |
| 255 | + | |
| 256 | +static void vhost_attach_cgroups_work(struct vhost_work *work) | |
| 257 | +{ | |
| 258 | + struct vhost_attach_cgroups_struct *s; | |
| 259 | + s = container_of(work, struct vhost_attach_cgroups_struct, work); | |
| 260 | + s->ret = cgroup_attach_task_all(s->owner, current); | |
| 261 | +} | |
| 262 | + | |
| 263 | +static int vhost_attach_cgroups(struct vhost_dev *dev) | |
| 264 | +{ | |
| 265 | + struct vhost_attach_cgroups_struct attach; | |
| 266 | + attach.owner = current; | |
| 267 | + vhost_work_init(&attach.work, vhost_attach_cgroups_work); | |
| 268 | + vhost_work_queue(dev, &attach.work); | |
| 269 | + vhost_work_flush(dev, &attach.work); | |
| 270 | + return attach.ret; | |
| 271 | +} | |
| 272 | + | |
| 239 | 273 | /* Caller should have device mutex */ |
| 240 | 274 | static long vhost_dev_set_owner(struct vhost_dev *dev) |
| 241 | 275 | { |
| @@ -255,14 +289,16 @@ static long vhost_dev_set_owner(struct vhost_dev *dev) · 13 unmodified lines | ||
| 255 | 289 | } |
| 256 | 290 | |
| 257 | 291 | dev->worker = worker; |
| 258 | − err = cgroup_attach_task_current_cg(worker); | |
| 292 | + wake_up_process(worker); /* avoid contributing to loadavg */ | |
| 293 | + | |
| 294 | + err = vhost_attach_cgroups(dev); | |
| 259 | 295 | if (err) |
| 260 | 296 | goto err_cgroup; |
| 261 | − wake_up_process(worker); /* avoid contributing to loadavg */ | |
| 262 | 297 | |
| 263 | 298 | return 0; |
| 264 | 299 | err_cgroup: |
| 265 | 300 | kthread_stop(worker); |
| 301 | + dev->worker = NULL; | |
| 266 | 302 | err_worker: |
| 267 | 303 | if (dev->mm) |
| 268 | 304 | mmput(dev->mm); |
| @@ -323,7 +359,10 @@ void vhost_dev_cleanup(struct vhost_dev *dev) · 54 unmodified lines | ||
| 323 | 359 | dev->mm = NULL; |
| 324 | 360 | |
| 325 | 361 | WARN_ON(!list_empty(&dev->work_list)); |
| 326 | − kthread_stop(dev->worker); | |
| 362 | + if (dev->worker) { | |
| 363 | + kthread_stop(dev->worker); | |
| 364 | + dev->worker = NULL; | |
| 365 | + } | |
| 327 | 366 | } |
| 328 | 367 | |
| 329 | 368 | static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) |
| @@ -559,7 +559,7 @@ static struct fb_ops pxa168fb_ops = { · 558 unmodified lines | ||
| 559 | 559 | .fb_imageblit = cfb_imageblit, |
| 560 | 560 | }; |
| 561 | 561 | |
| 562 | −static int __init pxa168fb_init_mode(struct fb_info *info, | |
| 562 | +static int __devinit pxa168fb_init_mode(struct fb_info *info, | |
| 563 | 563 | struct pxa168fb_mach_info *mi) |
| 564 | 564 | { |
| 565 | 565 | struct pxa168fb_info *fbi = info->par; |
| @@ -599,7 +599,7 @@ static int __init pxa168fb_init_mode(struct fb_info *info, · 33 unmodified lines | ||
| 599 | 599 | return ret; |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | −static int __init pxa168fb_probe(struct platform_device *pdev) | |
| 602 | +static int __devinit pxa168fb_probe(struct platform_device *pdev) | |
| 603 | 603 | { |
| 604 | 604 | struct pxa168fb_mach_info *mi; |
| 605 | 605 | struct fb_info *info = 0; |
| @@ -792,7 +792,7 @@ static struct platform_driver pxa168fb_driver = { · 186 unmodified lines | ||
| 792 | 792 | .probe = pxa168fb_probe, |
| 793 | 793 | }; |
| 794 | 794 | |
| 795 | −static int __devinit pxa168fb_init(void) | |
| 795 | +static int __init pxa168fb_init(void) | |
| 796 | 796 | { |
| 797 | 797 | return platform_driver_register(&pxa168fb_driver); |
| 798 | 798 | } |
| @@ -112,6 +112,7 @@ static inline unsigned long *cpu_evtchn_mask(int cpu) · 111 unmodified lines | ||
| 112 | 112 | #define VALID_EVTCHN(chn) ((chn) != 0) |
| 113 | 113 | |
| 114 | 114 | static struct irq_chip xen_dynamic_chip; |
| 115 | +static struct irq_chip xen_percpu_chip; | |
| 115 | 116 | |
| 116 | 117 | /* Constructor for packed IRQ information. */ |
| 117 | 118 | static struct irq_info mk_unbound_info(void) |
| @@ -377,7 +378,7 @@ int bind_evtchn_to_irq(unsigned int evtchn) · 259 unmodified lines | ||
| 377 | 378 | irq = find_unbound_irq(); |
| 378 | 379 | |
| 379 | 380 | set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, |
| 380 | − handle_level_irq, "event"); | |
| 381 | + handle_edge_irq, "event"); | |
| 381 | 382 | |
| 382 | 383 | evtchn_to_irq[evtchn] = irq; |
| 383 | 384 | irq_info[irq] = mk_evtchn_info(evtchn); |
| @@ -403,8 +404,8 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) · 19 unmodified lines | ||
| 403 | 404 | if (irq < 0) |
| 404 | 405 | goto out; |
| 405 | 406 | |
| 406 | − set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, | |
| 407 | − handle_level_irq, "ipi"); | |
| 407 | + set_irq_chip_and_handler_name(irq, &xen_percpu_chip, | |
| 408 | + handle_percpu_irq, "ipi"); | |
| 408 | 409 | |
| 409 | 410 | bind_ipi.vcpu = cpu; |
| 410 | 411 | if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, |
| @@ -444,8 +445,8 @@ static int bind_virq_to_irq(unsigned int virq, unsigned int cpu) · 33 unmodified lines | ||
| 444 | 445 | |
| 445 | 446 | irq = find_unbound_irq(); |
| 446 | 447 | |
| 447 | − set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, | |
| 448 | − handle_level_irq, "virq"); | |
| 448 | + set_irq_chip_and_handler_name(irq, &xen_percpu_chip, | |
| 449 | + handle_percpu_irq, "virq"); | |
| 449 | 450 | |
| 450 | 451 | evtchn_to_irq[evtchn] = irq; |
| 451 | 452 | irq_info[irq] = mk_virq_info(evtchn, virq); |
| @@ -964,6 +965,16 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { · 512 unmodified lines | ||
| 964 | 965 | .retrigger = retrigger_dynirq, |
| 965 | 966 | }; |
| 966 | 967 | |
| 968 | +static struct irq_chip xen_percpu_chip __read_mostly = { | |
| 969 | + .name = "xen-percpu", | |
| 970 | + | |
| 971 | + .disable = disable_dynirq, | |
| 972 | + .mask = disable_dynirq, | |
| 973 | + .unmask = enable_dynirq, | |
| 974 | + | |
| 975 | + .ack = ack_dynirq, | |
| 976 | +}; | |
| 977 | + | |
| 967 | 978 | int xen_set_callback_via(uint64_t via) |
| 968 | 979 | { |
| 969 | 980 | struct xen_hvm_param a; |
| @@ -237,7 +237,7 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec, · 236 unmodified lines | ||
| 237 | 237 | goto again; |
| 238 | 238 | |
| 239 | 239 | if (sysrq_key != '\0') |
| 240 | − handle_sysrq(sysrq_key, NULL); | |
| 240 | + handle_sysrq(sysrq_key); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | static struct xenbus_watch sysrq_watch = { |
| @@ -242,7 +242,8 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) · 241 unmodified lines | ||
| 242 | 242 | } |
| 243 | 243 | kfree(wnames); |
| 244 | 244 | fid_out: |
| 245 | − v9fs_fid_add(dentry, fid); | |
| 245 | + if (!IS_ERR(fid)) | |
| 246 | + v9fs_fid_add(dentry, fid); | |
| 246 | 247 | err_out: |
| 247 | 248 | up_read(&v9ses->rename_sem); |
| 248 | 249 | return fid; |
| @@ -292,9 +292,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) · 291 unmodified lines | ||
| 292 | 292 | |
| 293 | 293 | fid = filp->private_data; |
| 294 | 294 | P9_DPRINTK(P9_DEBUG_VFS, |
| 295 | − "inode: %p filp: %p fid: %d\n", inode, filp, fid->fid); | |
| 295 | + "v9fs_dir_release: inode: %p filp: %p fid: %d\n", | |
| 296 | + inode, filp, fid ? fid->fid : -1); | |
| 296 | 297 | filemap_write_and_wait(inode->i_mapping); |
| 297 | − p9_client_clunk(fid); | |
| 298 | + if (fid) | |
| 299 | + p9_client_clunk(fid); | |
| 298 | 300 | return 0; |
| 299 | 301 | } |
| 300 | 302 | |
| @@ -730,7 +730,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int mode, · 729 unmodified lines | ||
| 730 | 730 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
| 731 | 731 | goto error; |
| 732 | 732 | } |
| 733 | − dentry->d_op = &v9fs_cached_dentry_operations; | |
| 733 | + if (v9ses->cache) | |
| 734 | + dentry->d_op = &v9fs_cached_dentry_operations; | |
| 735 | + else | |
| 736 | + dentry->d_op = &v9fs_dentry_operations; | |
| 734 | 737 | d_instantiate(dentry, inode); |
| 735 | 738 | err = v9fs_fid_add(dentry, fid); |
| 736 | 739 | if (err < 0) |
| @@ -1128,6 +1131,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, · 391 unmodified lines | ||
| 1128 | 1131 | v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); |
| 1129 | 1132 | generic_fillattr(dentry->d_inode, stat); |
| 1130 | 1133 | |
| 1134 | + p9stat_free(st); | |
| 1131 | 1135 | kfree(st); |
| 1132 | 1136 | return 0; |
| 1133 | 1137 | } |
| @@ -1489,6 +1493,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) · 355 unmodified lines | ||
| 1489 | 1493 | |
| 1490 | 1494 | retval = strnlen(buffer, buflen); |
| 1491 | 1495 | done: |
| 1496 | + p9stat_free(st); | |
| 1492 | 1497 | kfree(st); |
| 1493 | 1498 | return retval; |
| 1494 | 1499 | } |
| @@ -1942,7 +1947,7 @@ static const struct inode_operations v9fs_dir_inode_operations_dotu = { · 447 unmodified lines | ||
| 1942 | 1947 | .unlink = v9fs_vfs_unlink, |
| 1943 | 1948 | .mkdir = v9fs_vfs_mkdir, |
| 1944 | 1949 | .rmdir = v9fs_vfs_rmdir, |
| 1945 | − .mknod = v9fs_vfs_mknod_dotl, | |
| 1950 | + .mknod = v9fs_vfs_mknod, | |
| 1946 | 1951 | .rename = v9fs_vfs_rename, |
| 1947 | 1952 | .getattr = v9fs_vfs_getattr, |
| 1948 | 1953 | .setattr = v9fs_vfs_setattr, |
| @@ -122,6 +122,10 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, · 121 unmodified lines | ||
| 122 | 122 | fid = v9fs_session_init(v9ses, dev_name, data); |
| 123 | 123 | if (IS_ERR(fid)) { |
| 124 | 124 | retval = PTR_ERR(fid); |
| 125 | + /* | |
| 126 | + * we need to call session_close to tear down some | |
| 127 | + * of the data structure setup by session_init | |
| 128 | + */ | |
| 125 | 129 | goto close_session; |
| 126 | 130 | } |
| 127 | 131 | |
| @@ -144,7 +148,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, · 16 unmodified lines | ||
| 144 | 148 | retval = -ENOMEM; |
| 145 | 149 | goto release_sb; |
| 146 | 150 | } |
| 147 | − | |
| 148 | 151 | sb->s_root = root; |
| 149 | 152 | |
| 150 | 153 | if (v9fs_proto_dotl(v9ses)) { |
| @@ -152,7 +155,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, · 1 unmodified line | ||
| 152 | 155 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); |
| 153 | 156 | if (IS_ERR(st)) { |
| 154 | 157 | retval = PTR_ERR(st); |
| 155 | − goto clunk_fid; | |
| 158 | + goto release_sb; | |
| 156 | 159 | } |
| 157 | 160 | |
| 158 | 161 | v9fs_stat2inode_dotl(st, root->d_inode); |
| @@ -162,7 +165,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, · 3 unmodified lines | ||
| 162 | 165 | st = p9_client_stat(fid); |
| 163 | 166 | if (IS_ERR(st)) { |
| 164 | 167 | retval = PTR_ERR(st); |
| 165 | − goto clunk_fid; | |
| 168 | + goto release_sb; | |
| 166 | 169 | } |
| 167 | 170 | |
| 168 | 171 | root->d_inode->i_ino = v9fs_qid2ino(&st->qid); |
| @@ -174,19 +177,24 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, · 5 unmodified lines | ||
| 174 | 177 | |
| 175 | 178 | v9fs_fid_add(root, fid); |
| 176 | 179 | |
| 177 | −P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |
| 180 | + P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |
| 178 | 181 | simple_set_mnt(mnt, sb); |
| 179 | 182 | return 0; |
| 180 | 183 | |
| 181 | 184 | clunk_fid: |
| 182 | 185 | p9_client_clunk(fid); |
| 183 | − | |
| 184 | 186 | close_session: |
| 185 | 187 | v9fs_session_close(v9ses); |
| 186 | 188 | kfree(v9ses); |
| 187 | 189 | return retval; |
| 188 | − | |
| 189 | 190 | release_sb: |
| 191 | + /* | |
| 192 | + * we will do the session_close and root dentry release | |
| 193 | + * in the below call. But we need to clunk fid, because we haven't | |
| 194 | + * attached the fid to dentry so it won't get clunked | |
| 195 | + * automatically. | |
| 196 | + */ | |
| 197 | + p9_client_clunk(fid); | |
| 190 | 198 | deactivate_locked_super(sb); |
| 191 | 199 | return retval; |
| 192 | 200 | } |
| @@ -724,7 +724,7 @@ static int __init init_misc_binfmt(void) · 723 unmodified lines | ||
| 724 | 724 | { |
| 725 | 725 | int err = register_filesystem(&bm_fs_type); |
| 726 | 726 | if (!err) { |
| 727 | − err = register_binfmt(&misc_format); | |
| 727 | + err = insert_binfmt(&misc_format); | |
| 728 | 728 | if (err) |
| 729 | 729 | unregister_filesystem(&bm_fs_type); |
| 730 | 730 | } |
| @@ -413,10 +413,10 @@ int bio_integrity_prep(struct bio *bio) · 412 unmodified lines | ||
| 413 | 413 | |
| 414 | 414 | /* Allocate kernel buffer for protection data */ |
| 415 | 415 | len = sectors * blk_integrity_tuple_size(bi); |
| 416 | − buf = kmalloc(len, GFP_NOIO | __GFP_NOFAIL | q->bounce_gfp); | |
| 416 | + buf = kmalloc(len, GFP_NOIO | q->bounce_gfp); | |
| 417 | 417 | if (unlikely(buf == NULL)) { |
| 418 | 418 | printk(KERN_ERR "could not allocate integrity buffer\n"); |
| 419 | − return -EIO; | |
| 419 | + return -ENOMEM; | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | end = (((unsigned long) buf) + len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
| @@ -87,7 +87,7 @@ static int ceph_set_page_dirty(struct page *page) · 86 unmodified lines | ||
| 87 | 87 | |
| 88 | 88 | /* dirty the head */ |
| 89 | 89 | spin_lock(&inode->i_lock); |
| 90 | − if (ci->i_wrbuffer_ref_head == 0) | |
| 90 | + if (ci->i_head_snapc == NULL) | |
| 91 | 91 | ci->i_head_snapc = ceph_get_snap_context(snapc); |
| 92 | 92 | ++ci->i_wrbuffer_ref_head; |
| 93 | 93 | if (ci->i_wrbuffer_ref == 0) |
| @@ -105,13 +105,7 @@ static int ceph_set_page_dirty(struct page *page) · 11 unmodified lines | ||
| 105 | 105 | spin_lock_irq(&mapping->tree_lock); |
| 106 | 106 | if (page->mapping) { /* Race with truncate? */ |
| 107 | 107 | WARN_ON_ONCE(!PageUptodate(page)); |
| 108 | − | |
| 109 | − if (mapping_cap_account_dirty(mapping)) { | |
| 110 | − __inc_zone_page_state(page, NR_FILE_DIRTY); | |
| 111 | − __inc_bdi_stat(mapping->backing_dev_info, | |
| 112 | − BDI_RECLAIMABLE); | |
| 113 | − task_io_account_write(PAGE_CACHE_SIZE); | |
| 114 | − } | |
| 108 | + account_page_dirtied(page, page->mapping); | |
| 115 | 109 | radix_tree_tag_set(&mapping->page_tree, |
| 116 | 110 | page_index(page), PAGECACHE_TAG_DIRTY); |
| 117 | 111 | |
| @@ -352,7 +346,7 @@ static struct ceph_snap_context *get_oldest_context(struct inode *inode, · 234 unmodified lines | ||
| 352 | 346 | break; |
| 353 | 347 | } |
| 354 | 348 | } |
| 355 | − if (!snapc && ci->i_head_snapc) { | |
| 349 | + if (!snapc && ci->i_wrbuffer_ref_head) { | |
| 356 | 350 | snapc = ceph_get_snap_context(ci->i_head_snapc); |
| 357 | 351 | dout(" head snapc %p has %d dirty pages\n", |
| 358 | 352 | snapc, ci->i_wrbuffer_ref_head); |
| @@ -376,7 +376,7 @@ static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed) · 375 unmodified lines | ||
| 376 | 376 | |
| 377 | 377 | th = get_ticket_handler(ac, service); |
| 378 | 378 | |
| 379 | − if (!th) { | |
| 379 | + if (IS_ERR(th)) { | |
| 380 | 380 | *pneed |= service; |
| 381 | 381 | continue; |
| 382 | 382 | } |
| @@ -399,6 +399,9 @@ static int ceph_x_build_request(struct ceph_auth_client *ac, · 16 unmodified lines | ||
| 399 | 399 | struct ceph_x_ticket_handler *th = |
| 400 | 400 | get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); |
| 401 | 401 | |
| 402 | + if (IS_ERR(th)) | |
| 403 | + return PTR_ERR(th); | |
| 404 | + | |
| 402 | 405 | ceph_x_validate_tickets(ac, &need); |
| 403 | 406 | |
| 404 | 407 | dout("build_request want %x have %x need %x\n", |
| @@ -450,7 +453,6 @@ static int ceph_x_build_request(struct ceph_auth_client *ac, · 45 unmodified lines | ||
| 450 | 453 | return -ERANGE; |
| 451 | 454 | head->op = cpu_to_le16(CEPHX_GET_PRINCIPAL_SESSION_KEY); |
| 452 | 455 | |
| 453 | − BUG_ON(!th); | |
| 454 | 456 | ret = ceph_x_build_authorizer(ac, th, &xi->auth_authorizer); |
| 455 | 457 | if (ret) |
| 456 | 458 | return ret; |
| @@ -505,7 +507,8 @@ static int ceph_x_handle_reply(struct ceph_auth_client *ac, int result, · 48 unmodified lines | ||
| 505 | 507 | |
| 506 | 508 | case CEPHX_GET_PRINCIPAL_SESSION_KEY: |
| 507 | 509 | th = get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); |
| 508 | − BUG_ON(!th); | |
| 510 | + if (IS_ERR(th)) | |
| 511 | + return PTR_ERR(th); | |
| 509 | 512 | ret = ceph_x_proc_ticket_reply(ac, &th->session_key, |
| 510 | 513 | buf + sizeof(*head), end); |
| 511 | 514 | break; |
| @@ -563,8 +566,8 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, · 51 unmodified lines | ||
| 563 | 566 | void *end = p + sizeof(au->reply_buf); |
| 564 | 567 | |
| 565 | 568 | th = get_ticket_handler(ac, au->service); |
| 566 | − if (!th) | |
| 567 | − return -EIO; /* hrm! */ | |
| 569 | + if (IS_ERR(th)) | |
| 570 | + return PTR_ERR(th); | |
| 568 | 571 | ret = ceph_x_decrypt(&th->session_key, &p, end, &reply, sizeof(reply)); |
| 569 | 572 | if (ret < 0) |
| 570 | 573 | return ret; |
| @@ -626,7 +629,7 @@ static void ceph_x_invalidate_authorizer(struct ceph_auth_client *ac, · 55 unmodified lines | ||
| 626 | 629 | struct ceph_x_ticket_handler *th; |
| 627 | 630 | |
| 628 | 631 | th = get_ticket_handler(ac, peer_type); |
| 629 | − if (th && !IS_ERR(th)) | |
| 632 | + if (!IS_ERR(th)) | |
| 630 | 633 | remove_ticket_handler(ac, th); |
| 631 | 634 | } |
| 632 | 635 | |
| @@ -1082,6 +1082,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, · 1081 unmodified lines | ||
| 1082 | 1082 | gid_t gid; |
| 1083 | 1083 | struct ceph_mds_session *session; |
| 1084 | 1084 | u64 xattr_version = 0; |
| 1085 | + struct ceph_buffer *xattr_blob = NULL; | |
| 1085 | 1086 | int delayed = 0; |
| 1086 | 1087 | u64 flush_tid = 0; |
| 1087 | 1088 | int i; |
| @@ -1142,6 +1143,10 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, · 54 unmodified lines | ||
| 1142 | 1143 | for (i = 0; i < CEPH_CAP_BITS; i++) |
| 1143 | 1144 | if (flushing & (1 << i)) |
| 1144 | 1145 | ci->i_cap_flush_tid[i] = flush_tid; |
| 1146 | + | |
| 1147 | + follows = ci->i_head_snapc->seq; | |
| 1148 | + } else { | |
| 1149 | + follows = 0; | |
| 1145 | 1150 | } |
| 1146 | 1151 | |
| 1147 | 1152 | keep = cap->implemented; |
| @@ -1155,14 +1160,14 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, · 7 unmodified lines | ||
| 1155 | 1160 | mtime = inode->i_mtime; |
| 1156 | 1161 | atime = inode->i_atime; |
| 1157 | 1162 | time_warp_seq = ci->i_time_warp_seq; |
| 1158 | − follows = ci->i_snap_realm->cached_context->seq; | |
| 1159 | 1163 | uid = inode->i_uid; |
| 1160 | 1164 | gid = inode->i_gid; |
| 1161 | 1165 | mode = inode->i_mode; |
| 1162 | 1166 | |
| 1163 | − if (dropping & CEPH_CAP_XATTR_EXCL) { | |
| 1167 | + if (flushing & CEPH_CAP_XATTR_EXCL) { | |
| 1164 | 1168 | __ceph_build_xattrs_blob(ci); |
| 1165 | − xattr_version = ci->i_xattrs.version + 1; | |
| 1169 | + xattr_blob = ci->i_xattrs.blob; | |
| 1170 | + xattr_version = ci->i_xattrs.version; | |
| 1166 | 1171 | } |
| 1167 | 1172 | |
| 1168 | 1173 | spin_unlock(&inode->i_lock); |
| @@ -1170,9 +1175,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, · 1 unmodified line | ||
| 1170 | 1175 | ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id, |
| 1171 | 1176 | op, keep, want, flushing, seq, flush_tid, issue_seq, mseq, |
| 1172 | 1177 | size, max_size, &mtime, &atime, time_warp_seq, |
| 1173 | − uid, gid, mode, | |
| 1174 | − xattr_version, | |
| 1175 | − (flushing & CEPH_CAP_XATTR_EXCL) ? ci->i_xattrs.blob : NULL, | |
| 1178 | + uid, gid, mode, xattr_version, xattr_blob, | |
| 1176 | 1179 | follows); |
| 1177 | 1180 | if (ret < 0) { |
| 1178 | 1181 | dout("error sending cap msg, must requeue %p\n", inode); |
| @@ -1282,7 +1285,7 @@ retry: · 103 unmodified lines | ||
| 1282 | 1285 | &capsnap->mtime, &capsnap->atime, |
| 1283 | 1286 | capsnap->time_warp_seq, |
| 1284 | 1287 | capsnap->uid, capsnap->gid, capsnap->mode, |
| 1285 | − 0, NULL, | |
| 1288 | + capsnap->xattr_version, capsnap->xattr_blob, | |
| 1286 | 1289 | capsnap->follows); |
| 1287 | 1290 | |
| 1288 | 1291 | next_follows = capsnap->follows + 1; |
| @@ -1332,7 +1335,11 @@ void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) · 43 unmodified lines | ||
| 1332 | 1335 | ceph_cap_string(was | mask)); |
| 1333 | 1336 | ci->i_dirty_caps |= mask; |
| 1334 | 1337 | if (was == 0) { |
| 1335 | − dout(" inode %p now dirty\n", &ci->vfs_inode); | |
| 1338 | + if (!ci->i_head_snapc) | |
| 1339 | + ci->i_head_snapc = ceph_get_snap_context( | |
| 1340 | + ci->i_snap_realm->cached_context); | |
| 1341 | + dout(" inode %p now dirty snapc %p\n", &ci->vfs_inode, | |
| 1342 | + ci->i_head_snapc); | |
| 1336 | 1343 | BUG_ON(!list_empty(&ci->i_dirty_item)); |
| 1337 | 1344 | spin_lock(&mdsc->cap_dirty_lock); |
| 1338 | 1345 | list_add(&ci->i_dirty_item, &mdsc->cap_dirty); |
| @@ -2190,7 +2197,9 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, · 851 unmodified lines | ||
| 2190 | 2197 | |
| 2191 | 2198 | if (ci->i_head_snapc == snapc) { |
| 2192 | 2199 | ci->i_wrbuffer_ref_head -= nr; |
| 2193 | − if (!ci->i_wrbuffer_ref_head) { | |
| 2200 | + if (ci->i_wrbuffer_ref_head == 0 && | |
| 2201 | + ci->i_dirty_caps == 0 && ci->i_flushing_caps == 0) { | |
| 2202 | + BUG_ON(!ci->i_head_snapc); | |
| 2194 | 2203 | ceph_put_snap_context(ci->i_head_snapc); |
| 2195 | 2204 | ci->i_head_snapc = NULL; |
| 2196 | 2205 | } |
| @@ -2483,6 +2492,11 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, · 286 unmodified lines | ||
| 2483 | 2492 | dout(" inode %p now clean\n", inode); |
| 2484 | 2493 | BUG_ON(!list_empty(&ci->i_dirty_item)); |
| 2485 | 2494 | drop = 1; |
| 2495 | + if (ci->i_wrbuffer_ref_head == 0) { | |
| 2496 | + BUG_ON(!ci->i_head_snapc); | |
| 2497 | + ceph_put_snap_context(ci->i_head_snapc); | |
| 2498 | + ci->i_head_snapc = NULL; | |
| 2499 | + } | |
| 2486 | 2500 | } else { |
| 2487 | 2501 | BUG_ON(list_empty(&ci->i_dirty_item)); |
| 2488 | 2502 | } |
| @@ -171,6 +171,8 @@ static int mdsc_show(struct seq_file *s, void *p) · 170 unmodified lines | ||
| 171 | 171 | } else if (req->r_dentry) { |
| 172 | 172 | path = ceph_mdsc_build_path(req->r_dentry, &pathlen, |
| 173 | 173 | &pathbase, 0); |
| 174 | + if (IS_ERR(path)) | |
| 175 | + path = NULL; | |
| 174 | 176 | spin_lock(&req->r_dentry->d_lock); |
| 175 | 177 | seq_printf(s, " #%llx/%.*s (%s)", |
| 176 | 178 | ceph_ino(req->r_dentry->d_parent->d_inode), |
| @@ -187,6 +189,8 @@ static int mdsc_show(struct seq_file *s, void *p) · 10 unmodified lines | ||
| 187 | 189 | if (req->r_old_dentry) { |
| 188 | 190 | path = ceph_mdsc_build_path(req->r_old_dentry, &pathlen, |
| 189 | 191 | &pathbase, 0); |
| 192 | + if (IS_ERR(path)) | |
| 193 | + path = NULL; | |
| 190 | 194 | spin_lock(&req->r_old_dentry->d_lock); |
| 191 | 195 | seq_printf(s, " #%llx/%.*s (%s)", |
| 192 | 196 | ceph_ino(req->r_old_dentry->d_parent->d_inode), |
| @@ -46,7 +46,7 @@ int ceph_init_dentry(struct dentry *dentry) · 45 unmodified lines | ||
| 46 | 46 | else |
| 47 | 47 | dentry->d_op = &ceph_snap_dentry_ops; |
| 48 | 48 | |
| 49 | − di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS); | |
| 49 | + di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS | __GFP_ZERO); | |
| 50 | 50 | if (!di) |
| 51 | 51 | return -ENOMEM; /* oh well */ |
| 52 | 52 | |
| @@ -677,6 +677,7 @@ static int fill_inode(struct inode *inode, · 676 unmodified lines | ||
| 677 | 677 | if (ci->i_files == 0 && ci->i_subdirs == 0 && |
| 678 | 678 | ceph_snap(inode) == CEPH_NOSNAP && |
| 679 | 679 | (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED) && |
| 680 | + (issued & CEPH_CAP_FILE_EXCL) == 0 && | |
| 680 | 681 | (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) { |
| 681 | 682 | dout(" marking %p complete (empty)\n", inode); |
| 682 | 683 | ci->i_ceph_flags |= CEPH_I_COMPLETE; |
| @@ -1229,11 +1230,11 @@ retry_lookup: · 546 unmodified lines | ||
| 1229 | 1230 | in = dn->d_inode; |
| 1230 | 1231 | } else { |
| 1231 | 1232 | in = ceph_get_inode(parent->d_sb, vino); |
| 1232 | − if (in == NULL) { | |
| 1233 | + if (IS_ERR(in)) { | |
| 1233 | 1234 | dout("new_inode badness\n"); |
| 1234 | 1235 | d_delete(dn); |
| 1235 | 1236 | dput(dn); |
| 1236 | − err = -ENOMEM; | |
| 1237 | + err = PTR_ERR(in); | |
| 1237 | 1238 | goto out; |
| 1238 | 1239 | } |
| 1239 | 1240 | dn = splice_dentry(dn, in, NULL); |
| @@ -82,7 +82,8 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) · 81 unmodified lines | ||
| 82 | 82 | length = fl->fl_end - fl->fl_start + 1; |
| 83 | 83 | |
| 84 | 84 | err = ceph_lock_message(CEPH_LOCK_FCNTL, op, file, |
| 85 | − (u64)fl->fl_pid, (u64)fl->fl_nspid, | |
| 85 | + (u64)fl->fl_pid, | |
| 86 | + (u64)(unsigned long)fl->fl_nspid, | |
| 86 | 87 | lock_cmd, fl->fl_start, |
| 87 | 88 | length, wait); |
| 88 | 89 | if (!err) { |
| @@ -92,7 +93,8 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) · 3 unmodified lines | ||
| 92 | 93 | /* undo! This should only happen if the kernel detects |
| 93 | 94 | * local deadlock. */ |
| 94 | 95 | ceph_lock_message(CEPH_LOCK_FCNTL, op, file, |
| 95 | − (u64)fl->fl_pid, (u64)fl->fl_nspid, | |
| 96 | + (u64)fl->fl_pid, | |
| 97 | + (u64)(unsigned long)fl->fl_nspid, | |
| 96 | 98 | CEPH_LOCK_UNLOCK, fl->fl_start, |
| 97 | 99 | length, 0); |
| 98 | 100 | dout("got %d on posix_lock_file, undid lock", err); |
| @@ -132,7 +134,8 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) · 33 unmodified lines | ||
| 132 | 134 | length = fl->fl_end - fl->fl_start + 1; |
| 133 | 135 | |
| 134 | 136 | err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK, |
| 135 | − file, (u64)fl->fl_pid, (u64)fl->fl_nspid, | |
| 137 | + file, (u64)fl->fl_pid, | |
| 138 | + (u64)(unsigned long)fl->fl_nspid, | |
| 136 | 139 | lock_cmd, fl->fl_start, |
| 137 | 140 | length, wait); |
| 138 | 141 | if (!err) { |
| @@ -141,7 +144,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) · 2 unmodified lines | ||
| 141 | 144 | ceph_lock_message(CEPH_LOCK_FLOCK, |
| 142 | 145 | CEPH_MDS_OP_SETFILELOCK, |
| 143 | 146 | file, (u64)fl->fl_pid, |
| 144 | − (u64)fl->fl_nspid, | |
| 147 | + (u64)(unsigned long)fl->fl_nspid, | |
| 145 | 148 | CEPH_LOCK_UNLOCK, fl->fl_start, |
| 146 | 149 | length, 0); |
| 147 | 150 | dout("got %d on flock_lock_file_wait, undid lock", err); |
| @@ -235,7 +238,8 @@ int lock_to_ceph_filelock(struct file_lock *lock, · 87 unmodified lines | ||
| 235 | 238 | cephlock->length = cpu_to_le64(lock->fl_end - lock->fl_start + 1); |
| 236 | 239 | cephlock->client = cpu_to_le64(0); |
| 237 | 240 | cephlock->pid = cpu_to_le64(lock->fl_pid); |
| 238 | − cephlock->pid_namespace = cpu_to_le64((u64)lock->fl_nspid); | |
| 241 | + cephlock->pid_namespace = | |
| 242 | + cpu_to_le64((u64)(unsigned long)lock->fl_nspid); | |
| 239 | 243 | |
| 240 | 244 | switch (lock->fl_type) { |
| 241 | 245 | case F_RDLCK: |
| @@ -560,6 +560,13 @@ static void __unregister_request(struct ceph_mds_client *mdsc, · 559 unmodified lines | ||
| 560 | 560 | * |
| 561 | 561 | * Called under mdsc->mutex. |
| 562 | 562 | */ |
| 563 | +struct dentry *get_nonsnap_parent(struct dentry *dentry) | |
| 564 | +{ | |
| 565 | + while (!IS_ROOT(dentry) && ceph_snap(dentry->d_inode) != CEPH_NOSNAP) | |
| 566 | + dentry = dentry->d_parent; | |
| 567 | + return dentry; | |
| 568 | +} | |
| 569 | + | |
| 563 | 570 | static int __choose_mds(struct ceph_mds_client *mdsc, |
| 564 | 571 | struct ceph_mds_request *req) |
| 565 | 572 | { |
| @@ -590,14 +597,29 @@ static int __choose_mds(struct ceph_mds_client *mdsc, · 24 unmodified lines | ||
| 590 | 597 | if (req->r_inode) { |
| 591 | 598 | inode = req->r_inode; |
| 592 | 599 | } else if (req->r_dentry) { |
| 593 | − if (req->r_dentry->d_inode) { | |
| 600 | + struct inode *dir = req->r_dentry->d_parent->d_inode; | |
| 601 | + | |
| 602 | + if (dir->i_sb != mdsc->client->sb) { | |
| 603 | + /* not this fs! */ | |
| 604 | + inode = req->r_dentry->d_inode; | |
| 605 | + } else if (ceph_snap(dir) != CEPH_NOSNAP) { | |
| 606 | + /* direct snapped/virtual snapdir requests | |
| 607 | + * based on parent dir inode */ | |
| 608 | + struct dentry *dn = | |
| 609 | + get_nonsnap_parent(req->r_dentry->d_parent); | |
| 610 | + inode = dn->d_inode; | |
| 611 | + dout("__choose_mds using nonsnap parent %p\n", inode); | |
| 612 | + } else if (req->r_dentry->d_inode) { | |
| 613 | + /* dentry target */ | |
| 594 | 614 | inode = req->r_dentry->d_inode; |
| 595 | 615 | } else { |
| 596 | − inode = req->r_dentry->d_parent->d_inode; | |
| 616 | + /* dir + name */ | |
| 617 | + inode = dir; | |
| 597 | 618 | hash = req->r_dentry->d_name.hash; |
| 598 | 619 | is_hash = true; |
| 599 | 620 | } |
| 600 | 621 | } |
| 622 | + | |
| 601 | 623 | dout("__choose_mds %p is_hash=%d (%d) mode %d\n", inode, (int)is_hash, |
| 602 | 624 | (int)hash, mode); |
| 603 | 625 | if (!inode) |
| @@ -2208,7 +2230,7 @@ static void handle_session(struct ceph_mds_session *session, · 1604 unmodified lines | ||
| 2208 | 2230 | pr_info("mds%d reconnect denied\n", session->s_mds); |
| 2209 | 2231 | remove_session_caps(session); |
| 2210 | 2232 | wake = 1; /* for good measure */ |
| 2211 | − complete_all(&mdsc->session_close_waiters); | |
| 2233 | + wake_up_all(&mdsc->session_close_wq); | |
| 2212 | 2234 | kick_requests(mdsc, mds); |
| 2213 | 2235 | break; |
| 2214 | 2236 | |
| @@ -2302,7 +2324,7 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, · 87 unmodified lines | ||
| 2302 | 2324 | path = ceph_mdsc_build_path(dentry, &pathlen, &pathbase, 0); |
| 2303 | 2325 | if (IS_ERR(path)) { |
| 2304 | 2326 | err = PTR_ERR(path); |
| 2305 | − BUG_ON(err); | |
| 2327 | + goto out_dput; | |
| 2306 | 2328 | } |
| 2307 | 2329 | } else { |
| 2308 | 2330 | path = NULL; |
| @@ -2310,7 +2332,7 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, · 1 unmodified line | ||
| 2310 | 2332 | } |
| 2311 | 2333 | err = ceph_pagelist_encode_string(pagelist, path, pathlen); |
| 2312 | 2334 | if (err) |
| 2313 | − goto out; | |
| 2335 | + goto out_free; | |
| 2314 | 2336 | |
| 2315 | 2337 | spin_lock(&inode->i_lock); |
| 2316 | 2338 | cap->seq = 0; /* reset cap seq */ |
| @@ -2354,8 +2376,9 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, · 37 unmodified lines | ||
| 2354 | 2376 | unlock_kernel(); |
| 2355 | 2377 | } |
| 2356 | 2378 | |
| 2357 | −out: | |
| 2379 | +out_free: | |
| 2358 | 2380 | kfree(path); |
| 2381 | +out_dput: | |
| 2359 | 2382 | dput(dentry); |
| 2360 | 2383 | return err; |
| 2361 | 2384 | } |
| @@ -2876,7 +2899,7 @@ int ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client) · 514 unmodified lines | ||
| 2876 | 2899 | return -ENOMEM; |
| 2877 | 2900 | |
| 2878 | 2901 | init_completion(&mdsc->safe_umount_waiters); |
| 2879 | − init_completion(&mdsc->session_close_waiters); | |
| 2902 | + init_waitqueue_head(&mdsc->session_close_wq); | |
| 2880 | 2903 | INIT_LIST_HEAD(&mdsc->waiting_for_map); |
| 2881 | 2904 | mdsc->sessions = NULL; |
| 2882 | 2905 | mdsc->max_sessions = 0; |
| @@ -3021,6 +3044,23 @@ void ceph_mdsc_sync(struct ceph_mds_client *mdsc) · 138 unmodified lines | ||
| 3021 | 3044 | wait_event(mdsc->cap_flushing_wq, check_cap_flush(mdsc, want_flush)); |
| 3022 | 3045 | } |
| 3023 | 3046 | |
| 3047 | +/* | |
| 3048 | + * true if all sessions are closed, or we force unmount | |
| 3049 | + */ | |
| 3050 | +bool done_closing_sessions(struct ceph_mds_client *mdsc) | |
| 3051 | +{ | |
| 3052 | + int i, n = 0; | |
| 3053 | + | |
| 3054 | + if (mdsc->client->mount_state == CEPH_MOUNT_SHUTDOWN) | |
| 3055 | + return true; | |
| 3056 | + | |
| 3057 | + mutex_lock(&mdsc->mutex); | |
| 3058 | + for (i = 0; i < mdsc->max_sessions; i++) | |
| 3059 | + if (mdsc->sessions[i]) | |
| 3060 | + n++; | |
| 3061 | + mutex_unlock(&mdsc->mutex); | |
| 3062 | + return n == 0; | |
| 3063 | +} | |
| 3024 | 3064 | |
| 3025 | 3065 | /* |
| 3026 | 3066 | * called after sb is ro. |
| @@ -3029,45 +3069,32 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc) · 2 unmodified lines | ||
| 3029 | 3069 | { |
| 3030 | 3070 | struct ceph_mds_session *session; |
| 3031 | 3071 | int i; |
| 3032 | − int n; | |
| 3033 | 3072 | struct ceph_client *client = mdsc->client; |
| 3034 | − unsigned long started, timeout = client->mount_args->mount_timeout * HZ; | |
| 3073 | + unsigned long timeout = client->mount_args->mount_timeout * HZ; | |
| 3035 | 3074 | |
| 3036 | 3075 | dout("close_sessions\n"); |
| 3037 | 3076 | |
| 3038 | − mutex_lock(&mdsc->mutex); | |
| 3039 | − | |
| 3040 | 3077 | /* close sessions */ |
| 3041 | − started = jiffies; | |
| 3042 | − while (time_before(jiffies, started + timeout)) { | |
| 3043 | − dout("closing sessions\n"); | |
| 3044 | − n = 0; | |
| 3045 | − for (i = 0; i < mdsc->max_sessions; i++) { | |
| 3046 | − session = __ceph_lookup_mds_session(mdsc, i); | |
| 3047 | − if (!session) | |
| 3048 | − continue; | |
| 3049 | − mutex_unlock(&mdsc->mutex); | |
| 3050 | − mutex_lock(&session->s_mutex); | |
| 3051 | − __close_session(mdsc, session); | |
| 3052 | − mutex_unlock(&session->s_mutex); | |
| 3053 | − ceph_put_mds_session(session); | |
| 3054 | − mutex_lock(&mdsc->mutex); | |
| 3055 | − n++; | |
| 3056 | − } | |
| 3057 | − if (n == 0) | |
| 3058 | − break; | |
| 3059 | − | |
| 3060 | − if (client->mount_state == CEPH_MOUNT_SHUTDOWN) | |
| 3061 | − break; | |
| 3062 | − | |
| 3063 | − dout("waiting for sessions to close\n"); | |
| 3078 | + mutex_lock(&mdsc->mutex); | |
| 3079 | + for (i = 0; i < mdsc->max_sessions; i++) { | |
| 3080 | + session = __ceph_lookup_mds_session(mdsc, i); | |
| 3081 | + if (!session) | |
| 3082 | + continue; | |
| 3064 | 3083 | mutex_unlock(&mdsc->mutex); |
| 3065 | − wait_for_completion_timeout(&mdsc->session_close_waiters, | |
| 3066 | − timeout); | |
| 3084 | + mutex_lock(&session->s_mutex); | |
| 3085 | + __close_session(mdsc, session); | |
| 3086 | + mutex_unlock(&session->s_mutex); | |
| 3087 | + ceph_put_mds_session(session); | |
| 3067 | 3088 | mutex_lock(&mdsc->mutex); |
| 3068 | 3089 | } |
| 3090 | + mutex_unlock(&mdsc->mutex); | |
| 3091 | + | |
| 3092 | + dout("waiting for sessions to close\n"); | |
| 3093 | + wait_event_timeout(mdsc->session_close_wq, done_closing_sessions(mdsc), | |
| 3094 | + timeout); | |
| 3069 | 3095 | |
| 3070 | 3096 | /* tear down remaining sessions */ |
| 3097 | + mutex_lock(&mdsc->mutex); | |
| 3071 | 3098 | for (i = 0; i < mdsc->max_sessions; i++) { |
| 3072 | 3099 | if (mdsc->sessions[i]) { |
| 3073 | 3100 | session = get_session(mdsc->sessions[i]); |
| @@ -3080,9 +3107,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc) · 6 unmodified lines | ||
| 3080 | 3107 | mutex_lock(&mdsc->mutex); |
| 3081 | 3108 | } |
| 3082 | 3109 | } |
| 3083 | − | |
| 3084 | 3110 | WARN_ON(!list_empty(&mdsc->cap_delay_list)); |
| 3085 | − | |
| 3086 | 3111 | mutex_unlock(&mdsc->mutex); |
| 3087 | 3112 | |
| 3088 | 3113 | ceph_cleanup_empty_realms(mdsc); |
| @@ -234,7 +234,8 @@ struct ceph_mds_client { · 233 unmodified lines | ||
| 234 | 234 | struct mutex mutex; /* all nested structures */ |
| 235 | 235 | |
| 236 | 236 | struct ceph_mdsmap *mdsmap; |
| 237 | − struct completion safe_umount_waiters, session_close_waiters; | |
| 237 | + struct completion safe_umount_waiters; | |
| 238 | + wait_queue_head_t session_close_wq; | |
| 238 | 239 | struct list_head waiting_for_map; |
| 239 | 240 | |
| 240 | 241 | struct ceph_mds_session **sessions; /* NULL for mds if no session */ |
| @@ -661,7 +661,7 @@ static int __send_request(struct ceph_osd_client *osdc, · 660 unmodified lines | ||
| 661 | 661 | reqhead->reassert_version = req->r_reassert_version; |
| 662 | 662 | |
| 663 | 663 | req->r_stamp = jiffies; |
| 664 | − list_move_tail(&osdc->req_lru, &req->r_req_lru_item); | |
| 664 | + list_move_tail(&req->r_req_lru_item, &osdc->req_lru); | |
| 665 | 665 | |
| 666 | 666 | ceph_msg_get(req->r_request); /* send consumes a ref */ |
| 667 | 667 | ceph_con_send(&req->r_osd->o_con, req->r_request); |
| @@ -435,7 +435,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) · 434 unmodified lines | ||
| 435 | 435 | { |
| 436 | 436 | struct inode *inode = &ci->vfs_inode; |
| 437 | 437 | struct ceph_cap_snap *capsnap; |
| 438 | − int used; | |
| 438 | + int used, dirty; | |
| 439 | 439 | |
| 440 | 440 | capsnap = kzalloc(sizeof(*capsnap), GFP_NOFS); |
| 441 | 441 | if (!capsnap) { |
| @@ -445,6 +445,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) · 3 unmodified lines | ||
| 445 | 445 | |
| 446 | 446 | spin_lock(&inode->i_lock); |
| 447 | 447 | used = __ceph_caps_used(ci); |
| 448 | + dirty = __ceph_caps_dirty(ci); | |
| 448 | 449 | if (__ceph_have_pending_cap_snap(ci)) { |
| 449 | 450 | /* there is no point in queuing multiple "pending" cap_snaps, |
| 450 | 451 | as no new writes are allowed to start when pending, so any |
| @@ -452,11 +453,15 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) · 1 unmodified line | ||
| 452 | 453 | cap_snap. lucky us. */ |
| 453 | 454 | dout("queue_cap_snap %p already pending\n", inode); |
| 454 | 455 | kfree(capsnap); |
| 455 | − } else if (ci->i_wrbuffer_ref_head || (used & CEPH_CAP_FILE_WR)) { | |
| 456 | + } else if (ci->i_wrbuffer_ref_head || (used & CEPH_CAP_FILE_WR) || | |
| 457 | + (dirty & (CEPH_CAP_AUTH_EXCL|CEPH_CAP_XATTR_EXCL| | |
| 458 | + CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR))) { | |
| 456 | 459 | struct ceph_snap_context *snapc = ci->i_head_snapc; |
| 457 | 460 | |
| 461 | + dout("queue_cap_snap %p cap_snap %p queuing under %p\n", inode, | |
| 462 | + capsnap, snapc); | |
| 458 | 463 | igrab(inode); |
| 459 | − | |
| 464 | + | |
| 460 | 465 | atomic_set(&capsnap->nref, 1); |
| 461 | 466 | capsnap->ci = ci; |
| 462 | 467 | INIT_LIST_HEAD(&capsnap->ci_item); |
| @@ -464,15 +469,21 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) · 1 unmodified line | ||
| 464 | 469 | |
| 465 | 470 | capsnap->follows = snapc->seq - 1; |
| 466 | 471 | capsnap->issued = __ceph_caps_issued(ci, NULL); |
| 467 | − capsnap->dirty = __ceph_caps_dirty(ci); | |
| 472 | + capsnap->dirty = dirty; | |
| 468 | 473 | |
| 469 | 474 | capsnap->mode = inode->i_mode; |
| 470 | 475 | capsnap->uid = inode->i_uid; |
| 471 | 476 | capsnap->gid = inode->i_gid; |
| 472 | 477 | |
| 473 | − /* fixme? */ | |
| 474 | − capsnap->xattr_blob = NULL; | |
| 475 | − capsnap->xattr_len = 0; | |
| 478 | + if (dirty & CEPH_CAP_XATTR_EXCL) { | |
| 479 | + __ceph_build_xattrs_blob(ci); | |
| 480 | + capsnap->xattr_blob = | |
| 481 | + ceph_buffer_get(ci->i_xattrs.blob); | |
| 482 | + capsnap->xattr_version = ci->i_xattrs.version; | |
| 483 | + } else { | |
| 484 | + capsnap->xattr_blob = NULL; | |
| 485 | + capsnap->xattr_version = 0; | |
| 486 | + } | |
| 476 | 487 | |
| 477 | 488 | /* dirty page count moved from _head to this cap_snap; |
| 478 | 489 | all subsequent writes page dirties occur _after_ this |
| @@ -480,7 +491,9 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) · 1 unmodified line | ||
| 480 | 491 | capsnap->dirty_pages = ci->i_wrbuffer_ref_head; |
| 481 | 492 | ci->i_wrbuffer_ref_head = 0; |
| 482 | 493 | capsnap->context = snapc; |
| 483 | − ci->i_head_snapc = NULL; | |
| 494 | + ci->i_head_snapc = | |
| 495 | + ceph_get_snap_context(ci->i_snap_realm->cached_context); | |
| 496 | + dout(" new snapc is %p\n", ci->i_head_snapc); | |
| 484 | 497 | list_add_tail(&capsnap->ci_item, &ci->i_cap_snaps); |
| 485 | 498 | |
| 486 | 499 | if (used & CEPH_CAP_FILE_WR) { |
| @@ -539,6 +552,41 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci, · 52 unmodified lines | ||
| 539 | 552 | return 1; /* caller may want to ceph_flush_snaps */ |
| 540 | 553 | } |
| 541 | 554 | |
| 555 | +/* | |
| 556 | + * Queue cap_snaps for snap writeback for this realm and its children. | |
| 557 | + * Called under snap_rwsem, so realm topology won't change. | |
| 558 | + */ | |
| 559 | +static void queue_realm_cap_snaps(struct ceph_snap_realm *realm) | |
| 560 | +{ | |
| 561 | + struct ceph_inode_info *ci; | |
| 562 | + struct inode *lastinode = NULL; | |
| 563 | + struct ceph_snap_realm *child; | |
| 564 | + | |
| 565 | + dout("queue_realm_cap_snaps %p %llx inodes\n", realm, realm->ino); | |
| 566 | + | |
| 567 | + spin_lock(&realm->inodes_with_caps_lock); | |
| 568 | + list_for_each_entry(ci, &realm->inodes_with_caps, | |
| 569 | + i_snap_realm_item) { | |
| 570 | + struct inode *inode = igrab(&ci->vfs_inode); | |
| 571 | + if (!inode) | |
| 572 | + continue; | |
| 573 | + spin_unlock(&realm->inodes_with_caps_lock); | |
| 574 | + if (lastinode) | |
| 575 | + iput(lastinode); | |
| 576 | + lastinode = inode; | |
| 577 | + ceph_queue_cap_snap(ci); | |
| 578 | + spin_lock(&realm->inodes_with_caps_lock); | |
| 579 | + } | |
| 580 | + spin_unlock(&realm->inodes_with_caps_lock); | |
| 581 | + if (lastinode) | |
| 582 | + iput(lastinode); | |
| 583 | + | |
| 584 | + dout("queue_realm_cap_snaps %p %llx children\n", realm, realm->ino); | |
| 585 | + list_for_each_entry(child, &realm->children, child_item) | |
| 586 | + queue_realm_cap_snaps(child); | |
| 587 | + | |
| 588 | + dout("queue_realm_cap_snaps %p %llx done\n", realm, realm->ino); | |
| 589 | +} | |
| 542 | 590 | |
| 543 | 591 | /* |
| 544 | 592 | * Parse and apply a snapblob "snap trace" from the MDS. This specifies |
| @@ -589,29 +637,8 @@ more: · 44 unmodified lines | ||
| 589 | 637 | * |
| 590 | 638 | * ...unless it's a snap deletion! |
| 591 | 639 | */ |
| 592 | − if (!deletion) { | |
| 593 | − struct ceph_inode_info *ci; | |
| 594 | − struct inode *lastinode = NULL; | |
| 595 | − | |
| 596 | − spin_lock(&realm->inodes_with_caps_lock); | |
| 597 | − list_for_each_entry(ci, &realm->inodes_with_caps, | |
| 598 | − i_snap_realm_item) { | |
| 599 | − struct inode *inode = igrab(&ci->vfs_inode); | |
| 600 | − if (!inode) | |
| 601 | − continue; | |
| 602 | − spin_unlock(&realm->inodes_with_caps_lock); | |
| 603 | − if (lastinode) | |
| 604 | − iput(lastinode); | |
| 605 | − lastinode = inode; | |
| 606 | − ceph_queue_cap_snap(ci); | |
| 607 | − spin_lock(&realm->inodes_with_caps_lock); | |
| 608 | − } | |
| 609 | − spin_unlock(&realm->inodes_with_caps_lock); | |
| 610 | − if (lastinode) | |
| 611 | − iput(lastinode); | |
| 612 | − dout("update_snap_trace cap_snaps queued\n"); | |
| 613 | − } | |
| 614 | − | |
| 640 | + if (!deletion) | |
| 641 | + queue_realm_cap_snaps(realm); | |
| 615 | 642 | } else { |
| 616 | 643 | dout("update_snap_trace %llx %p seq %lld unchanged\n", |
| 617 | 644 | realm->ino, realm, realm->seq); |
| @@ -216,8 +216,7 @@ struct ceph_cap_snap { · 215 unmodified lines | ||
| 216 | 216 | uid_t uid; |
| 217 | 217 | gid_t gid; |
| 218 | 218 | |
| 219 | − void *xattr_blob; | |
| 220 | − int xattr_len; | |
| 219 | + struct ceph_buffer *xattr_blob; | |
| 221 | 220 | u64 xattr_version; |
| 222 | 221 | |
| 223 | 222 | u64 size; |
| @@ -229,8 +228,11 @@ struct ceph_cap_snap { · 5 unmodified lines | ||
| 229 | 228 | |
| 230 | 229 | static inline void ceph_put_cap_snap(struct ceph_cap_snap *capsnap) |
| 231 | 230 | { |
| 232 | − if (atomic_dec_and_test(&capsnap->nref)) | |
| 231 | + if (atomic_dec_and_test(&capsnap->nref)) { | |
| 232 | + if (capsnap->xattr_blob) | |
| 233 | + ceph_buffer_put(capsnap->xattr_blob); | |
| 233 | 234 | kfree(capsnap); |
| 235 | + } | |
| 234 | 236 | } |
| 235 | 237 | |
| 236 | 238 | /* |
| @@ -342,7 +344,8 @@ struct ceph_inode_info { · 105 unmodified lines | ||
| 342 | 344 | unsigned i_cap_exporting_issued; |
| 343 | 345 | struct ceph_cap_reservation i_cap_migration_resv; |
| 344 | 346 | struct list_head i_cap_snaps; /* snapped state pending flush to mds */ |
| 345 | − struct ceph_snap_context *i_head_snapc; /* set if wr_buffer_head > 0 */ | |
| 347 | + struct ceph_snap_context *i_head_snapc; /* set if wr_buffer_head > 0 or | |
| 348 | + dirty|flushing caps */ | |
| 346 | 349 | unsigned i_snap_caps; /* cap bits for snapped files */ |
| 347 | 350 | |
| 348 | 351 | int i_nr_by_mode[CEPH_FILE_MODE_NUM]; /* open file counts */ |
| @@ -485,6 +485,7 @@ void __ceph_build_xattrs_blob(struct ceph_inode_info *ci) · 484 unmodified lines | ||
| 485 | 485 | ci->i_xattrs.blob = ci->i_xattrs.prealloc_blob; |
| 486 | 486 | ci->i_xattrs.prealloc_blob = NULL; |
| 487 | 487 | ci->i_xattrs.dirty = false; |
| 488 | + ci->i_xattrs.version++; | |
| 488 | 489 | } |
| 489 | 490 | } |
| 490 | 491 | |
| @@ -30,6 +30,8 @@ · 29 unmodified lines | ||
| 30 | 30 | * This is a compressed table of upper and lower case conversion. |
| 31 | 31 | * |
| 32 | 32 | */ |
| 33 | +#ifndef _CIFS_UNICODE_H | |
| 34 | +#define _CIFS_UNICODE_H | |
| 33 | 35 | |
| 34 | 36 | #include <asm/byteorder.h> |
| 35 | 37 | #include <linux/types.h> |
| @@ -67,8 +69,8 @@ extern const struct UniCaseRange CifsUniUpperRange[]; · 31 unmodified lines | ||
| 67 | 69 | #endif /* UNIUPR_NOUPPER */ |
| 68 | 70 | |
| 69 | 71 | #ifndef UNIUPR_NOLOWER |
| 70 | −extern signed char UniLowerTable[512]; | |
| 71 | −extern struct UniCaseRange UniLowerRange[]; | |
| 72 | +extern signed char CifsUniLowerTable[512]; | |
| 73 | +extern const struct UniCaseRange CifsUniLowerRange[]; | |
| 72 | 74 | #endif /* UNIUPR_NOLOWER */ |
| 73 | 75 | |
| 74 | 76 | #ifdef __KERNEL__ |
| @@ -337,15 +339,15 @@ UniStrupr(register wchar_t *upin) · 262 unmodified lines | ||
| 337 | 339 | * UniTolower: Convert a unicode character to lower case |
| 338 | 340 | */ |
| 339 | 341 | static inline wchar_t |
| 340 | −UniTolower(wchar_t uc) | |
| 342 | +UniTolower(register wchar_t uc) | |
| 341 | 343 | { |
| 342 | − register struct UniCaseRange *rp; | |
| 344 | + register const struct UniCaseRange *rp; | |
| 343 | 345 | |
| 344 | − if (uc < sizeof(UniLowerTable)) { | |
| 346 | + if (uc < sizeof(CifsUniLowerTable)) { | |
| 345 | 347 | /* Latin characters */ |
| 346 | − return uc + UniLowerTable[uc]; /* Use base tables */ | |
| 348 | + return uc + CifsUniLowerTable[uc]; /* Use base tables */ | |
| 347 | 349 | } else { |
| 348 | − rp = UniLowerRange; /* Use range tables */ | |
| 350 | + rp = CifsUniLowerRange; /* Use range tables */ | |
| 349 | 351 | while (rp->start) { |
| 350 | 352 | if (uc < rp->start) /* Before start of range */ |
| 351 | 353 | return uc; /* Uppercase = input */ |
| @@ -374,3 +376,5 @@ UniStrlwr(register wchar_t *upin) · 22 unmodified lines | ||
| 374 | 376 | } |
| 375 | 377 | |
| 376 | 378 | #endif |
| 379 | + | |
| 380 | +#endif /* _CIFS_UNICODE_H */ | |
| @@ -140,7 +140,7 @@ const struct UniCaseRange CifsUniUpperRange[] = { · 139 unmodified lines | ||
| 140 | 140 | /* |
| 141 | 141 | * Latin lower case |
| 142 | 142 | */ |
| 143 | −static signed char CifsUniLowerTable[512] = { | |
| 143 | +signed char CifsUniLowerTable[512] = { | |
| 144 | 144 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 000-00f */ |
| 145 | 145 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 010-01f */ |
| 146 | 146 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 020-02f */ |
| @@ -242,12 +242,12 @@ static signed char UniCaseRangeLff20[27] = { · 95 unmodified lines | ||
| 242 | 242 | /* |
| 243 | 243 | * Lower Case Range |
| 244 | 244 | */ |
| 245 | −static const struct UniCaseRange CifsUniLowerRange[] = { | |
| 246 | − 0x0380, 0x03ab, UniCaseRangeL0380, | |
| 247 | − 0x0400, 0x042f, UniCaseRangeL0400, | |
| 248 | − 0x0490, 0x04cb, UniCaseRangeL0490, | |
| 249 | − 0x1e00, 0x1ff7, UniCaseRangeL1e00, | |
| 250 | − 0xff20, 0xff3a, UniCaseRangeLff20, | |
| 251 | − 0, 0, 0 | |
| 245 | +const struct UniCaseRange CifsUniLowerRange[] = { | |
| 246 | + {0x0380, 0x03ab, UniCaseRangeL0380}, | |
| 247 | + {0x0400, 0x042f, UniCaseRangeL0400}, | |
| 248 | + {0x0490, 0x04cb, UniCaseRangeL0490}, | |
| 249 | + {0x1e00, 0x1ff7, UniCaseRangeL1e00}, | |
| 250 | + {0xff20, 0xff3a, UniCaseRangeLff20}, | |
| 251 | + {0} | |
| 252 | 252 | }; |
| 253 | 253 | #endif |
| @@ -223,63 +223,6 @@ int cifs_calculate_mac_key(struct mac_key *key, const char *rn, · 222 unmodified lines | ||
| 223 | 223 | return 0; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | −int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *ses, | |
| 227 | − const struct nls_table *nls_info) | |
| 228 | −{ | |
| 229 | − char temp_hash[16]; | |
| 230 | − struct HMACMD5Context ctx; | |
| 231 | − char *ucase_buf; | |
| 232 | − __le16 *unicode_buf; | |
| 233 | − unsigned int i, user_name_len, dom_name_len; | |
| 234 | − | |
| 235 | − if (ses == NULL) | |
| 236 | − return -EINVAL; | |
| 237 | − | |
| 238 | − E_md4hash(ses->password, temp_hash); | |
| 239 | − | |
| 240 | − hmac_md5_init_limK_to_64(temp_hash, 16, &ctx); | |
| 241 | − user_name_len = strlen(ses->userName); | |
| 242 | − if (user_name_len > MAX_USERNAME_SIZE) | |
| 243 | − return -EINVAL; | |
| 244 | − if (ses->domainName == NULL) | |
| 245 | − return -EINVAL; /* BB should we use CIFS_LINUX_DOM */ | |
| 246 | − dom_name_len = strlen(ses->domainName); | |
| 247 | − if (dom_name_len > MAX_USERNAME_SIZE) | |
| 248 | − return -EINVAL; | |
| 249 | − | |
| 250 | − ucase_buf = kmalloc((MAX_USERNAME_SIZE+1), GFP_KERNEL); | |
| 251 | − if (ucase_buf == NULL) | |
| 252 | − return -ENOMEM; | |
| 253 | − unicode_buf = kmalloc((MAX_USERNAME_SIZE+1)*4, GFP_KERNEL); | |
| 254 | − if (unicode_buf == NULL) { | |
| 255 | − kfree(ucase_buf); | |
| 256 | − return -ENOMEM; | |
| 257 | − } | |
| 258 | − | |
| 259 | − for (i = 0; i < user_name_len; i++) | |
| 260 | − ucase_buf[i] = nls_info->charset2upper[(int)ses->userName[i]]; | |
| 261 | − ucase_buf[i] = 0; | |
| 262 | − user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf, | |
| 263 | − MAX_USERNAME_SIZE*2, nls_info); | |
| 264 | − unicode_buf[user_name_len] = 0; | |
| 265 | − user_name_len++; | |
| 266 | − | |
| 267 | − for (i = 0; i < dom_name_len; i++) | |
| 268 | − ucase_buf[i] = nls_info->charset2upper[(int)ses->domainName[i]]; | |
| 269 | − ucase_buf[i] = 0; | |
| 270 | − dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf, | |
| 271 | − MAX_USERNAME_SIZE*2, nls_info); | |
| 272 | − | |
| 273 | − unicode_buf[user_name_len + dom_name_len] = 0; | |
| 274 | − hmac_md5_update((const unsigned char *) unicode_buf, | |
| 275 | − (user_name_len+dom_name_len)*2, &ctx); | |
| 276 | − | |
| 277 | − hmac_md5_final(ses->server->ntlmv2_hash, &ctx); | |
| 278 | − kfree(ucase_buf); | |
| 279 | − kfree(unicode_buf); | |
| 280 | − return 0; | |
| 281 | −} | |
| 282 | − | |
| 283 | 226 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
| 284 | 227 | void calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt, |
| 285 | 228 | char *lnm_session_key) |
| @@ -87,8 +87,9 @@ extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); · 86 unmodified lines | ||
| 87 | 87 | extern int decode_negTokenInit(unsigned char *security_blob, int length, |
| 88 | 88 | struct TCP_Server_Info *server); |
| 89 | 89 | extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len); |
| 90 | +extern int cifs_set_port(struct sockaddr *addr, const unsigned short int port); | |
| 90 | 91 | extern int cifs_fill_sockaddr(struct sockaddr *dst, const char *src, int len, |
| 91 | − unsigned short int port); | |
| 92 | + const unsigned short int port); | |
| 92 | 93 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); |
| 93 | 94 | extern void header_assemble(struct smb_hdr *, char /* command */ , |
| 94 | 95 | const struct cifsTconInfo *, int /* length of |
| @@ -365,8 +366,6 @@ extern int cifs_verify_signature(struct smb_hdr *, · 270 unmodified lines | ||
| 365 | 366 | __u32 expected_sequence_number); |
| 366 | 367 | extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn, |
| 367 | 368 | const char *pass); |
| 368 | −extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, | |
| 369 | − const struct nls_table *); | |
| 370 | 369 | extern void CalcNTLMv2_response(const struct cifsSesInfo *, char *); |
| 371 | 370 | extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, |
| 372 | 371 | const struct nls_table *); |
| @@ -400,7 +400,9 @@ incomplete_rcv: · 399 unmodified lines | ||
| 400 | 400 | cFYI(1, "call to reconnect done"); |
| 401 | 401 | csocket = server->ssocket; |
| 402 | 402 | continue; |
| 403 | − } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) { | |
| 403 | + } else if (length == -ERESTARTSYS || | |
| 404 | + length == -EAGAIN || | |
| 405 | + length == -EINTR) { | |
| 404 | 406 | msleep(1); /* minimum sleep to prevent looping |
| 405 | 407 | allowing socket to clear and app threads to set |
| 406 | 408 | tcpStatus CifsNeedReconnect if server hung */ |
| @@ -414,18 +416,6 @@ incomplete_rcv: · 7 unmodified lines | ||
| 414 | 416 | } else |
| 415 | 417 | continue; |
| 416 | 418 | } else if (length <= 0) { |
| 417 | − if (server->tcpStatus == CifsNew) { | |
| 418 | − cFYI(1, "tcp session abend after SMBnegprot"); | |
| 419 | − /* some servers kill the TCP session rather than | |
| 420 | − returning an SMB negprot error, in which | |
| 421 | − case reconnecting here is not going to help, | |
| 422 | − and so simply return error to mount */ | |
| 423 | − break; | |
| 424 | − } | |
| 425 | − if (!try_to_freeze() && (length == -EINTR)) { | |
| 426 | − cFYI(1, "cifsd thread killed"); | |
| 427 | − break; | |
| 428 | − } | |
| 429 | 419 | cFYI(1, "Reconnect after unexpected peek error %d", |
| 430 | 420 | length); |
| 431 | 421 | cifs_reconnect(server); |
| @@ -466,27 +456,19 @@ incomplete_rcv: · 34 unmodified lines | ||
| 466 | 456 | an error on SMB negprot response */ |
| 467 | 457 | cFYI(1, "Negative RFC1002 Session Response Error 0x%x)", |
| 468 | 458 | pdu_length); |
| 469 | − if (server->tcpStatus == CifsNew) { | |
| 470 | − /* if nack on negprot (rather than | |
| 471 | − ret of smb negprot error) reconnecting | |
| 472 | − not going to help, ret error to mount */ | |
| 473 | − break; | |
| 474 | − } else { | |
| 475 | − /* give server a second to | |
| 476 | − clean up before reconnect attempt */ | |
| 477 | − msleep(1000); | |
| 478 | − /* always try 445 first on reconnect | |
| 479 | − since we get NACK on some if we ever | |
| 480 | − connected to port 139 (the NACK is | |
| 481 | − since we do not begin with RFC1001 | |
| 482 | − session initialize frame) */ | |
| 483 | − server->addr.sockAddr.sin_port = | |
| 484 | − htons(CIFS_PORT); | |
| 485 | − cifs_reconnect(server); | |
| 486 | − csocket = server->ssocket; | |
| 487 | − wake_up(&server->response_q); | |
| 488 | − continue; | |
| 489 | − } | |
| 459 | + /* give server a second to clean up */ | |
| 460 | + msleep(1000); | |
| 461 | + /* always try 445 first on reconnect since we get NACK | |
| 462 | + * on some if we ever connected to port 139 (the NACK | |
| 463 | + * is since we do not begin with RFC1001 session | |
| 464 | + * initialize frame) | |
| 465 | + */ | |
| 466 | + cifs_set_port((struct sockaddr *) | |
| 467 | + &server->addr.sockAddr, CIFS_PORT); | |
| 468 | + cifs_reconnect(server); | |
| 469 | + csocket = server->ssocket; | |
| 470 | + wake_up(&server->response_q); | |
| 471 | + continue; | |
| 490 | 472 | } else if (temp != (char) 0) { |
| 491 | 473 | cERROR(1, "Unknown RFC 1002 frame"); |
| 492 | 474 | cifs_dump_mem(" Received Data: ", (char *)smb_buffer, |
| @@ -522,8 +504,7 @@ incomplete_rcv: · 29 unmodified lines | ||
| 522 | 504 | total_read += length) { |
| 523 | 505 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, |
| 524 | 506 | pdu_length - total_read, 0); |
| 525 | − if ((server->tcpStatus == CifsExiting) || | |
| 526 | − (length == -EINTR)) { | |
| 507 | + if (server->tcpStatus == CifsExiting) { | |
| 527 | 508 | /* then will exit */ |
| 528 | 509 | reconnect = 2; |
| 529 | 510 | break; |
| @@ -534,8 +515,9 @@ incomplete_rcv: · 4 unmodified lines | ||
| 534 | 515 | /* Now we will reread sock */ |
| 535 | 516 | reconnect = 1; |
| 536 | 517 | break; |
| 537 | − } else if ((length == -ERESTARTSYS) || | |
| 538 | − (length == -EAGAIN)) { | |
| 518 | + } else if (length == -ERESTARTSYS || | |
| 519 | + length == -EAGAIN || | |
| 520 | + length == -EINTR) { | |
| 539 | 521 | msleep(1); /* minimum sleep to prevent looping, |
| 540 | 522 | allowing socket to clear and app |
| 541 | 523 | threads to set tcpStatus |
| @@ -1673,7 +1655,9 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol) · 1131 unmodified lines | ||
| 1673 | 1655 | MAX_USERNAME_SIZE)) |
| 1674 | 1656 | continue; |
| 1675 | 1657 | if (strlen(vol->username) != 0 && |
| 1676 | − strncmp(ses->password, vol->password, | |
| 1658 | + ses->password != NULL && | |
| 1659 | + strncmp(ses->password, | |
| 1660 | + vol->password ? vol->password : "", | |
| 1677 | 1661 | MAX_PASSWORD_SIZE)) |
| 1678 | 1662 | continue; |
| 1679 | 1663 | } |
| @@ -305,8 +305,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, · 304 unmodified lines | ||
| 305 | 305 | full_path = build_path_from_dentry(direntry); |
| 306 | 306 | if (full_path == NULL) { |
| 307 | 307 | rc = -ENOMEM; |
| 308 | − FreeXid(xid); | |
| 309 | − return rc; | |
| 308 | + goto cifs_create_out; | |
| 310 | 309 | } |
| 311 | 310 | |
| 312 | 311 | if (oplockEnabled) |
| @@ -365,9 +364,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, · 52 unmodified lines | ||
| 365 | 364 | |
| 366 | 365 | buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); |
| 367 | 366 | if (buf == NULL) { |
| 368 | − kfree(full_path); | |
| 369 | − FreeXid(xid); | |
| 370 | − return -ENOMEM; | |
| 367 | + rc = -ENOMEM; | |
| 368 | + goto cifs_create_out; | |
| 371 | 369 | } |
| 372 | 370 | |
| 373 | 371 | /* |
| @@ -496,6 +494,11 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, · 122 unmodified lines | ||
| 496 | 494 | struct cifsTconInfo *pTcon; |
| 497 | 495 | char *full_path = NULL; |
| 498 | 496 | struct inode *newinode = NULL; |
| 497 | + int oplock = 0; | |
| 498 | + u16 fileHandle; | |
| 499 | + FILE_ALL_INFO *buf = NULL; | |
| 500 | + unsigned int bytes_written; | |
| 501 | + struct win_dev *pdev; | |
| 499 | 502 | |
| 500 | 503 | if (!old_valid_dev(device_number)) |
| 501 | 504 | return -EINVAL; |
| @@ -506,9 +509,12 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, · 4 unmodified lines | ||
| 506 | 509 | pTcon = cifs_sb->tcon; |
| 507 | 510 | |
| 508 | 511 | full_path = build_path_from_dentry(direntry); |
| 509 | − if (full_path == NULL) | |
| 512 | + if (full_path == NULL) { | |
| 510 | 513 | rc = -ENOMEM; |
| 511 | − else if (pTcon->unix_ext) { | |
| 514 | + goto mknod_out; | |
| 515 | + } | |
| 516 | + | |
| 517 | + if (pTcon->unix_ext) { | |
| 512 | 518 | struct cifs_unix_set_info_args args = { |
| 513 | 519 | .mode = mode & ~current_umask(), |
| 514 | 520 | .ctime = NO_CHANGE_64, |
| @@ -527,87 +533,78 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, · 12 unmodified lines | ||
| 527 | 533 | cifs_sb->local_nls, |
| 528 | 534 | cifs_sb->mnt_cifs_flags & |
| 529 | 535 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
| 536 | + if (rc) | |
| 537 | + goto mknod_out; | |
| 530 | 538 | |
| 531 | − if (!rc) { | |
| 532 | − rc = cifs_get_inode_info_unix(&newinode, full_path, | |
| 539 | + rc = cifs_get_inode_info_unix(&newinode, full_path, | |
| 533 | 540 | inode->i_sb, xid); |
| 534 | − if (pTcon->nocase) | |
| 535 | − direntry->d_op = &cifs_ci_dentry_ops; | |
| 536 | − else | |
| 537 | − direntry->d_op = &cifs_dentry_ops; | |
| 538 | − if (rc == 0) | |
| 539 | − d_instantiate(direntry, newinode); | |
| 540 | − } | |
| 541 | − } else { | |
| 542 | − if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { | |
| 543 | − int oplock = 0; | |
| 544 | − u16 fileHandle; | |
| 545 | − FILE_ALL_INFO *buf; | |
| 541 | + if (pTcon->nocase) | |
| 542 | + direntry->d_op = &cifs_ci_dentry_ops; | |
| 543 | + else | |
| 544 | + direntry->d_op = &cifs_dentry_ops; | |
| 546 | 545 | |
| 547 | − cFYI(1, "sfu compat create special file"); | |
| 546 | + if (rc == 0) | |
| 547 | + d_instantiate(direntry, newinode); | |
| 548 | + goto mknod_out; | |
| 549 | + } | |
| 548 | 550 | |
| 549 | − buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); | |
| 550 | − if (buf == NULL) { | |
| 551 | − kfree(full_path); | |
| 552 | − rc = -ENOMEM; | |
| 553 | − FreeXid(xid); | |
| 554 | − return rc; | |
| 555 | − } | |
| 551 | + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) | |
| 552 | + goto mknod_out; | |
| 556 | 553 | |
| 557 | − rc = CIFSSMBOpen(xid, pTcon, full_path, | |
| 558 | − FILE_CREATE, /* fail if exists */ | |
| 559 | − GENERIC_WRITE /* BB would | |
| 560 | − WRITE_OWNER | WRITE_DAC be better? */, | |
| 561 | − /* Create a file and set the | |
| 562 | − file attribute to SYSTEM */ | |
| 563 | − CREATE_NOT_DIR | CREATE_OPTION_SPECIAL, | |
| 564 | − &fileHandle, &oplock, buf, | |
| 565 | − cifs_sb->local_nls, | |
| 566 | − cifs_sb->mnt_cifs_flags & | |
| 567 | − CIFS_MOUNT_MAP_SPECIAL_CHR); | |
| 568 | − | |
| 569 | − /* BB FIXME - add handling for backlevel servers | |
| 570 | − which need legacy open and check for all | |
| 571 | − calls to SMBOpen for fallback to SMBLeagcyOpen */ | |
| 572 | − if (!rc) { | |
| 573 | − /* BB Do not bother to decode buf since no | |
| 574 | − local inode yet to put timestamps in, | |
| 575 | − but we can reuse it safely */ | |
| 576 | − unsigned int bytes_written; | |
| 577 | − struct win_dev *pdev; | |
| 578 | − pdev = (struct win_dev *)buf; | |
| 579 | − if (S_ISCHR(mode)) { | |
| 580 | − memcpy(pdev->type, "IntxCHR", 8); | |
| 581 | − pdev->major = | |
| 582 | − cpu_to_le64(MAJOR(device_number)); | |
| 583 | − pdev->minor = | |
| 584 | − cpu_to_le64(MINOR(device_number)); | |
| 585 | − rc = CIFSSMBWrite(xid, pTcon, | |
| 586 | − fileHandle, | |
| 587 | − sizeof(struct win_dev), | |
| 588 | − 0, &bytes_written, (char *)pdev, | |
| 589 | − NULL, 0); | |
| 590 | − } else if (S_ISBLK(mode)) { | |
| 591 | − memcpy(pdev->type, "IntxBLK", 8); | |
| 592 | − pdev->major = | |
| 593 | − cpu_to_le64(MAJOR(device_number)); | |
| 594 | − pdev->minor = | |
| 595 | − cpu_to_le64(MINOR(device_number)); | |
| 596 | − rc = CIFSSMBWrite(xid, pTcon, | |
| 597 | − fileHandle, | |
| 598 | − sizeof(struct win_dev), | |
| 599 | − 0, &bytes_written, (char *)pdev, | |
| 600 | − NULL, 0); | |
| 601 | − } /* else if(S_ISFIFO */ | |
| 602 | − CIFSSMBClose(xid, pTcon, fileHandle); | |
| 603 | − d_drop(direntry); | |
| 604 | − } | |
| 605 | − kfree(buf); | |
| 606 | − /* add code here to set EAs */ | |
| 607 | − } | |
| 554 | + | |
| 555 | + cFYI(1, "sfu compat create special file"); | |
| 556 | + | |
| 557 | + buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); | |
| 558 | + if (buf == NULL) { | |
| 559 | + kfree(full_path); | |
| 560 | + rc = -ENOMEM; | |
| 561 | + FreeXid(xid); | |
| 562 | + return rc; | |
| 608 | 563 | } |
| 609 | 564 | |
| 565 | + /* FIXME: would WRITE_OWNER | WRITE_DAC be better? */ | |
| 566 | + rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_CREATE, | |
| 567 | + GENERIC_WRITE, CREATE_NOT_DIR | CREATE_OPTION_SPECIAL, | |
| 568 | + &fileHandle, &oplock, buf, cifs_sb->local_nls, | |
| 569 | + cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | |
| 570 | + if (rc) | |
| 571 | + goto mknod_out; | |
| 572 | + | |
| 573 | + /* BB Do not bother to decode buf since no local inode yet to put | |
| 574 | + * timestamps in, but we can reuse it safely */ | |
| 575 | + | |
| 576 | + pdev = (struct win_dev *)buf; | |
| 577 | + if (S_ISCHR(mode)) { | |
| 578 | + memcpy(pdev->type, "IntxCHR", 8); | |
| 579 | + pdev->major = | |
| 580 | + cpu_to_le64(MAJOR(device_number)); | |
| 581 | + pdev->minor = | |
| 582 | + cpu_to_le64(MINOR(device_number)); | |
| 583 | + rc = CIFSSMBWrite(xid, pTcon, | |
| 584 | + fileHandle, | |
| 585 | + sizeof(struct win_dev), | |
| 586 | + 0, &bytes_written, (char *)pdev, | |
| 587 | + NULL, 0); | |
| 588 | + } else if (S_ISBLK(mode)) { | |
| 589 | + memcpy(pdev->type, "IntxBLK", 8); | |
| 590 | + pdev->major = | |
| 591 | + cpu_to_le64(MAJOR(device_number)); | |
| 592 | + pdev->minor = | |
| 593 | + cpu_to_le64(MINOR(device_number)); | |
| 594 | + rc = CIFSSMBWrite(xid, pTcon, | |
| 595 | + fileHandle, | |
| 596 | + sizeof(struct win_dev), | |
| 597 | + 0, &bytes_written, (char *)pdev, | |
| 598 | + NULL, 0); | |
| 599 | + } /* else if (S_ISFIFO) */ | |
| 600 | + CIFSSMBClose(xid, pTcon, fileHandle); | |
| 601 | + d_drop(direntry); | |
| 602 | + | |
| 603 | + /* FIXME: add code here to set EAs */ | |
| 604 | + | |
| 605 | +mknod_out: | |
| 610 | 606 | kfree(full_path); |
| 607 | + kfree(buf); | |
| 611 | 608 | FreeXid(xid); |
| 612 | 609 | return rc; |
| 613 | 610 | } |
| @@ -242,8 +242,7 @@ int cifs_open(struct inode *inode, struct file *file) · 241 unmodified lines | ||
| 242 | 242 | full_path = build_path_from_dentry(file->f_path.dentry); |
| 243 | 243 | if (full_path == NULL) { |
| 244 | 244 | rc = -ENOMEM; |
| 245 | − FreeXid(xid); | |
| 246 | − return rc; | |
| 245 | + goto out; | |
| 247 | 246 | } |
| 248 | 247 | |
| 249 | 248 | cFYI(1, "inode = 0x%p file flags are 0x%x for %s", |
| @@ -834,7 +834,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) · 833 unmodified lines | ||
| 834 | 834 | xid, NULL); |
| 835 | 835 | |
| 836 | 836 | if (!inode) |
| 837 | − return ERR_PTR(-ENOMEM); | |
| 837 | + return ERR_PTR(rc); | |
| 838 | 838 | |
| 839 | 839 | #ifdef CONFIG_CIFS_FSCACHE |
| 840 | 840 | /* populate tcon->resource_id */ |
| @@ -1462,28 +1462,17 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, · 621 unmodified lines | ||
| 1462 | 1462 | { |
| 1463 | 1463 | char *fromName = NULL; |
| 1464 | 1464 | char *toName = NULL; |
| 1465 | − struct cifs_sb_info *cifs_sb_source; | |
| 1466 | − struct cifs_sb_info *cifs_sb_target; | |
| 1465 | + struct cifs_sb_info *cifs_sb; | |
| 1467 | 1466 | struct cifsTconInfo *tcon; |
| 1468 | 1467 | FILE_UNIX_BASIC_INFO *info_buf_source = NULL; |
| 1469 | 1468 | FILE_UNIX_BASIC_INFO *info_buf_target; |
| 1470 | 1469 | int xid, rc, tmprc; |
| 1471 | 1470 | |
| 1472 | − cifs_sb_target = CIFS_SB(target_dir->i_sb); | |
| 1473 | − cifs_sb_source = CIFS_SB(source_dir->i_sb); | |
| 1474 | − tcon = cifs_sb_source->tcon; | |
| 1471 | + cifs_sb = CIFS_SB(source_dir->i_sb); | |
| 1472 | + tcon = cifs_sb->tcon; | |
| 1475 | 1473 | |
| 1476 | 1474 | xid = GetXid(); |
| 1477 | 1475 | |
| 1478 | − /* | |
| 1479 | − * BB: this might be allowed if same server, but different share. | |
| 1480 | − * Consider adding support for this | |
| 1481 | − */ | |
| 1482 | − if (tcon != cifs_sb_target->tcon) { | |
| 1483 | − rc = -EXDEV; | |
| 1484 | − goto cifs_rename_exit; | |
| 1485 | − } | |
| 1486 | − | |
| 1487 | 1476 | /* |
| 1488 | 1477 | * we already have the rename sem so we do not need to |
| 1489 | 1478 | * grab it again here to protect the path integrity |
| @@ -1519,17 +1508,16 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, · 29 unmodified lines | ||
| 1519 | 1508 | info_buf_target = info_buf_source + 1; |
| 1520 | 1509 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName, |
| 1521 | 1510 | info_buf_source, |
| 1522 | − cifs_sb_source->local_nls, | |
| 1523 | − cifs_sb_source->mnt_cifs_flags & | |
| 1511 | + cifs_sb->local_nls, | |
| 1512 | + cifs_sb->mnt_cifs_flags & | |
| 1524 | 1513 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
| 1525 | 1514 | if (tmprc != 0) |
| 1526 | 1515 | goto unlink_target; |
| 1527 | 1516 | |
| 1528 | − tmprc = CIFSSMBUnixQPathInfo(xid, tcon, | |
| 1529 | − toName, info_buf_target, | |
| 1530 | − cifs_sb_target->local_nls, | |
| 1531 | − /* remap based on source sb */ | |
| 1532 | − cifs_sb_source->mnt_cifs_flags & | |
| 1517 | + tmprc = CIFSSMBUnixQPathInfo(xid, tcon, toName, | |
| 1518 | + info_buf_target, | |
| 1519 | + cifs_sb->local_nls, | |
| 1520 | + cifs_sb->mnt_cifs_flags & | |
| 1533 | 1521 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
| 1534 | 1522 | |
| 1535 | 1523 | if (tmprc == 0 && (info_buf_source->UniqueId == |
| @@ -206,26 +206,30 @@ cifs_convert_address(struct sockaddr *dst, const char *src, int len) · 205 unmodified lines | ||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | int |
| 209 | −cifs_fill_sockaddr(struct sockaddr *dst, const char *src, int len, | |
| 210 | − const unsigned short int port) | |
| 209 | +cifs_set_port(struct sockaddr *addr, const unsigned short int port) | |
| 211 | 210 | { |
| 212 | − if (!cifs_convert_address(dst, src, len)) | |
| 213 | − return 0; | |
| 214 | − | |
| 215 | − switch (dst->sa_family) { | |
| 211 | + switch (addr->sa_family) { | |
| 216 | 212 | case AF_INET: |
| 217 | − ((struct sockaddr_in *)dst)->sin_port = htons(port); | |
| 213 | + ((struct sockaddr_in *)addr)->sin_port = htons(port); | |
| 218 | 214 | break; |
| 219 | 215 | case AF_INET6: |
| 220 | − ((struct sockaddr_in6 *)dst)->sin6_port = htons(port); | |
| 216 | + ((struct sockaddr_in6 *)addr)->sin6_port = htons(port); | |
| 221 | 217 | break; |
| 222 | 218 | default: |
| 223 | 219 | return 0; |
| 224 | 220 | } |
| 225 | − | |
| 226 | 221 | return 1; |
| 227 | 222 | } |
| 228 | 223 | |
| 224 | +int | |
| 225 | +cifs_fill_sockaddr(struct sockaddr *dst, const char *src, int len, | |
| 226 | + const unsigned short int port) | |
| 227 | +{ | |
| 228 | + if (!cifs_convert_address(dst, src, len)) | |
| 229 | + return 0; | |
| 230 | + return cifs_set_port(dst, port); | |
| 231 | +} | |
| 232 | + | |
| 229 | 233 | /***************************************************************************** |
| 230 | 234 | convert a NT status code to a dos class/code |
| 231 | 235 | *****************************************************************************/ |
| @@ -634,7 +634,7 @@ static int dio_send_cur_page(struct dio *dio) · 633 unmodified lines | ||
| 634 | 634 | int ret = 0; |
| 635 | 635 | |
| 636 | 636 | if (dio->bio) { |
| 637 | − loff_t cur_offset = dio->block_in_file << dio->blkbits; | |
| 637 | + loff_t cur_offset = dio->cur_page_fs_offset; | |
| 638 | 638 | loff_t bio_next_offset = dio->logical_offset_in_bio + |
| 639 | 639 | dio->bio->bi_size; |
| 640 | 640 | |
| @@ -659,7 +659,7 @@ static int dio_send_cur_page(struct dio *dio) · 18 unmodified lines | ||
| 659 | 659 | * Submit now if the underlying fs is about to perform a |
| 660 | 660 | * metadata read |
| 661 | 661 | */ |
| 662 | − if (dio->boundary) | |
| 662 | + else if (dio->boundary) | |
| 663 | 663 | dio_bio_submit(dio); |
| 664 | 664 | } |
| 665 | 665 | |
| @@ -1793,7 +1793,7 @@ struct kmem_cache *ecryptfs_key_tfm_cache; · 1792 unmodified lines | ||
| 1793 | 1793 | static struct list_head key_tfm_list; |
| 1794 | 1794 | struct mutex key_tfm_list_mutex; |
| 1795 | 1795 | |
| 1796 | −int ecryptfs_init_crypto(void) | |
| 1796 | +int __init ecryptfs_init_crypto(void) | |
| 1797 | 1797 | { |
| 1798 | 1798 | mutex_init(&key_tfm_list_mutex); |
| 1799 | 1799 | INIT_LIST_HEAD(&key_tfm_list); |
| @@ -2169,7 +2169,6 @@ int ecryptfs_encrypt_and_encode_filename( · 369 unmodified lines | ||
| 2169 | 2169 | (ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE |
| 2170 | 2170 | + encoded_name_no_prefix_size); |
| 2171 | 2171 | (*encoded_name)[(*encoded_name_size)] = '\0'; |
| 2172 | − (*encoded_name_size)++; | |
| 2173 | 2172 | } else { |
| 2174 | 2173 | rc = -EOPNOTSUPP; |
| 2175 | 2174 | } |
| @@ -349,7 +349,7 @@ out: · 348 unmodified lines | ||
| 349 | 349 | |
| 350 | 350 | /** |
| 351 | 351 | * ecryptfs_new_lower_dentry |
| 352 | − * @ename: The name of the new dentry. | |
| 352 | + * @name: The name of the new dentry. | |
| 353 | 353 | * @lower_dir_dentry: Parent directory of the new dentry. |
| 354 | 354 | * @nd: nameidata from last lookup. |
| 355 | 355 | * |
| @@ -386,20 +386,19 @@ ecryptfs_new_lower_dentry(struct qstr *name, struct dentry *lower_dir_dentry, · 30 unmodified lines | ||
| 386 | 386 | * ecryptfs_lookup_one_lower |
| 387 | 387 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up |
| 388 | 388 | * @lower_dir_dentry: lower parent directory |
| 389 | + * @name: lower file name | |
| 389 | 390 | * |
| 390 | 391 | * Get the lower dentry from vfs. If lower dentry does not exist yet, |
| 391 | 392 | * create it. |
| 392 | 393 | */ |
| 393 | 394 | static struct dentry * |
| 394 | 395 | ecryptfs_lookup_one_lower(struct dentry *ecryptfs_dentry, |
| 395 | − struct dentry *lower_dir_dentry) | |
| 396 | + struct dentry *lower_dir_dentry, struct qstr *name) | |
| 396 | 397 | { |
| 397 | 398 | struct nameidata nd; |
| 398 | 399 | struct vfsmount *lower_mnt; |
| 399 | − struct qstr *name; | |
| 400 | 400 | int err; |
| 401 | 401 | |
| 402 | − name = &ecryptfs_dentry->d_name; | |
| 403 | 402 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( |
| 404 | 403 | ecryptfs_dentry->d_parent)); |
| 405 | 404 | err = vfs_path_lookup(lower_dir_dentry, lower_mnt, name->name , 0, &nd); |
| @@ -434,6 +433,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, · 28 unmodified lines | ||
| 434 | 433 | size_t encrypted_and_encoded_name_size; |
| 435 | 434 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = NULL; |
| 436 | 435 | struct dentry *lower_dir_dentry, *lower_dentry; |
| 436 | + struct qstr lower_name; | |
| 437 | 437 | int rc = 0; |
| 438 | 438 | |
| 439 | 439 | ecryptfs_dentry->d_op = &ecryptfs_dops; |
| @@ -444,9 +444,17 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, · 4 unmodified lines | ||
| 444 | 444 | goto out_d_drop; |
| 445 | 445 | } |
| 446 | 446 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); |
| 447 | − | |
| 447 | + lower_name.name = ecryptfs_dentry->d_name.name; | |
| 448 | + lower_name.len = ecryptfs_dentry->d_name.len; | |
| 449 | + lower_name.hash = ecryptfs_dentry->d_name.hash; | |
| 450 | + if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { | |
| 451 | + rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, | |
| 452 | + &lower_name); | |
| 453 | + if (rc < 0) | |
| 454 | + goto out_d_drop; | |
| 455 | + } | |
| 448 | 456 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, |
| 449 | − lower_dir_dentry); | |
| 457 | + lower_dir_dentry, &lower_name); | |
| 450 | 458 | if (IS_ERR(lower_dentry)) { |
| 451 | 459 | rc = PTR_ERR(lower_dentry); |
| 452 | 460 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " |
| @@ -471,8 +479,17 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, · 18 unmodified lines | ||
| 471 | 479 | "filename; rc = [%d]\n", __func__, rc); |
| 472 | 480 | goto out_d_drop; |
| 473 | 481 | } |
| 482 | + lower_name.name = encrypted_and_encoded_name; | |
| 483 | + lower_name.len = encrypted_and_encoded_name_size; | |
| 484 | + lower_name.hash = full_name_hash(lower_name.name, lower_name.len); | |
| 485 | + if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { | |
| 486 | + rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, | |
| 487 | + &lower_name); | |
| 488 | + if (rc < 0) | |
| 489 | + goto out_d_drop; | |
| 490 | + } | |
| 474 | 491 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, |
| 475 | − lower_dir_dentry); | |
| 492 | + lower_dir_dentry, &lower_name); | |
| 476 | 493 | if (IS_ERR(lower_dentry)) { |
| 477 | 494 | rc = PTR_ERR(lower_dentry); |
| 478 | 495 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " |
| @@ -515,6 +515,7 @@ ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, · 514 unmodified lines | ||
| 515 | 515 | if (!s) { |
| 516 | 516 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " |
| 517 | 517 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); |
| 518 | + rc = -ENOMEM; | |
| 518 | 519 | goto out; |
| 519 | 520 | } |
| 520 | 521 | s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; |
| @@ -806,6 +807,7 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size, · 285 unmodified lines | ||
| 806 | 807 | if (!s) { |
| 807 | 808 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " |
| 808 | 809 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); |
| 810 | + rc = -ENOMEM; | |
| 809 | 811 | goto out; |
| 810 | 812 | } |
| 811 | 813 | s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; |
| @@ -86,7 +86,7 @@ out: · 85 unmodified lines | ||
| 86 | 86 | return 0; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | −int ecryptfs_init_kthread(void) | |
| 89 | +int __init ecryptfs_init_kthread(void) | |
| 90 | 90 | { |
| 91 | 91 | int rc = 0; |
| 92 | 92 | |
| @@ -473,7 +473,7 @@ sleep: · 472 unmodified lines | ||
| 473 | 473 | return rc; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | −int ecryptfs_init_messaging(void) | |
| 476 | +int __init ecryptfs_init_messaging(void) | |
| 477 | 477 | { |
| 478 | 478 | int i; |
| 479 | 479 | int rc = 0; |
| @@ -500,7 +500,7 @@ static struct miscdevice ecryptfs_miscdev = { · 499 unmodified lines | ||
| 500 | 500 | * |
| 501 | 501 | * Returns zero on success; non-zero otherwise |
| 502 | 502 | */ |
| 503 | −int ecryptfs_init_ecryptfs_miscdev(void) | |
| 503 | +int __init ecryptfs_init_ecryptfs_miscdev(void) | |
| 504 | 504 | { |
| 505 | 505 | int rc; |
| 506 | 506 | |
| @@ -376,6 +376,9 @@ static int count(const char __user * const __user * argv, int max) · 375 unmodified lines | ||
| 376 | 376 | argv++; |
| 377 | 377 | if (i++ >= max) |
| 378 | 378 | return -E2BIG; |
| 379 | + | |
| 380 | + if (fatal_signal_pending(current)) | |
| 381 | + return -ERESTARTNOHAND; | |
| 379 | 382 | cond_resched(); |
| 380 | 383 | } |
| 381 | 384 | } |
| @@ -419,6 +422,12 @@ static int copy_strings(int argc, const char __user *const __user *argv, · 37 unmodified lines | ||
| 419 | 422 | while (len > 0) { |
| 420 | 423 | int offset, bytes_to_copy; |
| 421 | 424 | |
| 425 | + if (fatal_signal_pending(current)) { | |
| 426 | + ret = -ERESTARTNOHAND; | |
| 427 | + goto out; | |
| 428 | + } | |
| 429 | + cond_resched(); | |
| 430 | + | |
| 422 | 431 | offset = pos % PAGE_SIZE; |
| 423 | 432 | if (offset == 0) |
| 424 | 433 | offset = PAGE_SIZE; |
| @@ -594,6 +603,11 @@ int setup_arg_pages(struct linux_binprm *bprm, · 169 unmodified lines | ||
| 594 | 603 | #else |
| 595 | 604 | stack_top = arch_align_stack(stack_top); |
| 596 | 605 | stack_top = PAGE_ALIGN(stack_top); |
| 606 | + | |
| 607 | + if (unlikely(stack_top < mmap_min_addr) || | |
| 608 | + unlikely(vma->vm_end - vma->vm_start >= stack_top - mmap_min_addr)) | |
| 609 | + return -ENOMEM; | |
| 610 | + | |
| 597 | 611 | stack_shift = vma->vm_end - stack_top; |
| 598 | 612 | |
| 599 | 613 | bprm->p -= stack_shift; |
| @@ -769,11 +769,15 @@ EXPORT_SYMBOL(kill_fasync); · 768 unmodified lines | ||
| 769 | 769 | |
| 770 | 770 | static int __init fcntl_init(void) |
| 771 | 771 | { |
| 772 | − /* please add new bits here to ensure allocation uniqueness */ | |
| 773 | − BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( | |
| 772 | + /* | |
| 773 | + * Please add new bits here to ensure allocation uniqueness. | |
| 774 | + * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY | |
| 775 | + * is defined as O_NONBLOCK on some platforms and not on others. | |
| 776 | + */ | |
| 777 | + BUILD_BUG_ON(18 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( | |
| 774 | 778 | O_RDONLY | O_WRONLY | O_RDWR | |
| 775 | 779 | O_CREAT | O_EXCL | O_NOCTTY | |
| 776 | − O_TRUNC | O_APPEND | O_NONBLOCK | | |
| 780 | + O_TRUNC | O_APPEND | /* O_NONBLOCK | */ | |
| 777 | 781 | __O_SYNC | O_DSYNC | FASYNC | |
| 778 | 782 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | |
| 779 | 783 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | |
| @@ -808,7 +808,7 @@ int bdi_writeback_thread(void *data) · 807 unmodified lines | ||
| 808 | 808 | wb->last_active = jiffies; |
| 809 | 809 | |
| 810 | 810 | set_current_state(TASK_INTERRUPTIBLE); |
| 811 | − if (!list_empty(&bdi->work_list)) { | |
| 811 | + if (!list_empty(&bdi->work_list) || kthread_should_stop()) { | |
| 812 | 812 | __set_current_state(TASK_RUNNING); |
| 813 | 813 | continue; |
| 814 | 814 | } |
| @@ -276,7 +276,7 @@ static void flush_bg_queue(struct fuse_conn *fc) · 275 unmodified lines | ||
| 276 | 276 | * Called with fc->lock, unlocks it |
| 277 | 277 | */ |
| 278 | 278 | static void request_end(struct fuse_conn *fc, struct fuse_req *req) |
| 279 | −__releases(&fc->lock) | |
| 279 | +__releases(fc->lock) | |
| 280 | 280 | { |
| 281 | 281 | void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; |
| 282 | 282 | req->end = NULL; |
| @@ -306,8 +306,8 @@ __releases(&fc->lock) · 23 unmodified lines | ||
| 306 | 306 | |
| 307 | 307 | static void wait_answer_interruptible(struct fuse_conn *fc, |
| 308 | 308 | struct fuse_req *req) |
| 309 | −__releases(&fc->lock) | |
| 310 | −__acquires(&fc->lock) | |
| 309 | +__releases(fc->lock) | |
| 310 | +__acquires(fc->lock) | |
| 311 | 311 | { |
| 312 | 312 | if (signal_pending(current)) |
| 313 | 313 | return; |
| @@ -325,8 +325,8 @@ static void queue_interrupt(struct fuse_conn *fc, struct fuse_req *req) · 11 unmodified lines | ||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) |
| 328 | −__releases(&fc->lock) | |
| 329 | −__acquires(&fc->lock) | |
| 328 | +__releases(fc->lock) | |
| 329 | +__acquires(fc->lock) | |
| 330 | 330 | { |
| 331 | 331 | if (!fc->no_interrupt) { |
| 332 | 332 | /* Any signal may interrupt this */ |
| @@ -905,8 +905,8 @@ static int request_pending(struct fuse_conn *fc) · 572 unmodified lines | ||
| 905 | 905 | |
| 906 | 906 | /* Wait until a request is available on the pending list */ |
| 907 | 907 | static void request_wait(struct fuse_conn *fc) |
| 908 | −__releases(&fc->lock) | |
| 909 | −__acquires(&fc->lock) | |
| 908 | +__releases(fc->lock) | |
| 909 | +__acquires(fc->lock) | |
| 910 | 910 | { |
| 911 | 911 | DECLARE_WAITQUEUE(wait, current); |
| 912 | 912 | |
| @@ -934,7 +934,7 @@ __acquires(&fc->lock) · 21 unmodified lines | ||
| 934 | 934 | */ |
| 935 | 935 | static int fuse_read_interrupt(struct fuse_conn *fc, struct fuse_copy_state *cs, |
| 936 | 936 | size_t nbytes, struct fuse_req *req) |
| 937 | −__releases(&fc->lock) | |
| 937 | +__releases(fc->lock) | |
| 938 | 938 | { |
| 939 | 939 | struct fuse_in_header ih; |
| 940 | 940 | struct fuse_interrupt_in arg; |
| @@ -1720,8 +1720,8 @@ static unsigned fuse_dev_poll(struct file *file, poll_table *wait) · 779 unmodified lines | ||
| 1720 | 1720 | * This function releases and reacquires fc->lock |
| 1721 | 1721 | */ |
| 1722 | 1722 | static void end_requests(struct fuse_conn *fc, struct list_head *head) |
| 1723 | −__releases(&fc->lock) | |
| 1724 | −__acquires(&fc->lock) | |
| 1723 | +__releases(fc->lock) | |
| 1724 | +__acquires(fc->lock) | |
| 1725 | 1725 | { |
| 1726 | 1726 | while (!list_empty(head)) { |
| 1727 | 1727 | struct fuse_req *req; |
| @@ -1744,8 +1744,8 @@ __acquires(&fc->lock) · 16 unmodified lines | ||
| 1744 | 1744 | * locked). |
| 1745 | 1745 | */ |
| 1746 | 1746 | static void end_io_requests(struct fuse_conn *fc) |
| 1747 | −__releases(&fc->lock) | |
| 1748 | −__acquires(&fc->lock) | |
| 1747 | +__releases(fc->lock) | |
| 1748 | +__acquires(fc->lock) | |
| 1749 | 1749 | { |
| 1750 | 1750 | while (!list_empty(&fc->io)) { |
| 1751 | 1751 | struct fuse_req *req = |
| @@ -1769,6 +1769,16 @@ __acquires(&fc->lock) · 17 unmodified lines | ||
| 1769 | 1769 | } |
| 1770 | 1770 | } |
| 1771 | 1771 | |
| 1772 | +static void end_queued_requests(struct fuse_conn *fc) | |
| 1773 | +__releases(fc->lock) | |
| 1774 | +__acquires(fc->lock) | |
| 1775 | +{ | |
| 1776 | + fc->max_background = UINT_MAX; | |
| 1777 | + flush_bg_queue(fc); | |
| 1778 | + end_requests(fc, &fc->pending); | |
| 1779 | + end_requests(fc, &fc->processing); | |
| 1780 | +} | |
| 1781 | + | |
| 1772 | 1782 | /* |
| 1773 | 1783 | * Abort all requests. |
| 1774 | 1784 | * |
| @@ -1795,8 +1805,7 @@ void fuse_abort_conn(struct fuse_conn *fc) · 20 unmodified lines | ||
| 1795 | 1805 | fc->connected = 0; |
| 1796 | 1806 | fc->blocked = 0; |
| 1797 | 1807 | end_io_requests(fc); |
| 1798 | − end_requests(fc, &fc->pending); | |
| 1799 | − end_requests(fc, &fc->processing); | |
| 1808 | + end_queued_requests(fc); | |
| 1800 | 1809 | wake_up_all(&fc->waitq); |
| 1801 | 1810 | wake_up_all(&fc->blocked_waitq); |
| 1802 | 1811 | kill_fasync(&fc->fasync, SIGIO, POLL_IN); |
| @@ -1811,8 +1820,9 @@ int fuse_dev_release(struct inode *inode, struct file *file) · 8 unmodified lines | ||
| 1811 | 1820 | if (fc) { |
| 1812 | 1821 | spin_lock(&fc->lock); |
| 1813 | 1822 | fc->connected = 0; |
| 1814 | − end_requests(fc, &fc->pending); | |
| 1815 | − end_requests(fc, &fc->processing); | |
| 1823 | + fc->blocked = 0; | |
| 1824 | + end_queued_requests(fc); | |
| 1825 | + wake_up_all(&fc->blocked_waitq); | |
| 1816 | 1826 | spin_unlock(&fc->lock); |
| 1817 | 1827 | fuse_conn_put(fc); |
| 1818 | 1828 | } |
| @@ -1144,8 +1144,8 @@ static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) · 1143 unmodified lines | ||
| 1144 | 1144 | |
| 1145 | 1145 | /* Called under fc->lock, may release and reacquire it */ |
| 1146 | 1146 | static void fuse_send_writepage(struct fuse_conn *fc, struct fuse_req *req) |
| 1147 | −__releases(&fc->lock) | |
| 1148 | −__acquires(&fc->lock) | |
| 1147 | +__releases(fc->lock) | |
| 1148 | +__acquires(fc->lock) | |
| 1149 | 1149 | { |
| 1150 | 1150 | struct fuse_inode *fi = get_fuse_inode(req->inode); |
| 1151 | 1151 | loff_t size = i_size_read(req->inode); |
| @@ -1183,8 +1183,8 @@ __acquires(&fc->lock) · 31 unmodified lines | ||
| 1183 | 1183 | * Called with fc->lock |
| 1184 | 1184 | */ |
| 1185 | 1185 | void fuse_flush_writepages(struct inode *inode) |
| 1186 | −__releases(&fc->lock) | |
| 1187 | −__acquires(&fc->lock) | |
| 1186 | +__releases(fc->lock) | |
| 1187 | +__acquires(fc->lock) | |
| 1188 | 1188 | { |
| 1189 | 1189 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 1190 | 1190 | struct fuse_inode *fi = get_fuse_inode(inode); |
| @@ -115,7 +115,7 @@ static int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode) · 114 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | inode_inc_link_count(dir); |
| 117 | 117 | |
| 118 | − inode = minix_new_inode(dir, mode, &err); | |
| 118 | + inode = minix_new_inode(dir, S_IFDIR | mode, &err); | |
| 119 | 119 | if (!inode) |
| 120 | 120 | goto out_dir; |
| 121 | 121 | |
| @@ -1483,6 +1483,23 @@ out_unlock: · 1482 unmodified lines | ||
| 1483 | 1483 | return err; |
| 1484 | 1484 | } |
| 1485 | 1485 | |
| 1486 | +/* | |
| 1487 | + * Sanity check the flags to change_mnt_propagation. | |
| 1488 | + */ | |
| 1489 | + | |
| 1490 | +static int flags_to_propagation_type(int flags) | |
| 1491 | +{ | |
| 1492 | + int type = flags & ~MS_REC; | |
| 1493 | + | |
| 1494 | + /* Fail if any non-propagation flags are set */ | |
| 1495 | + if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) | |
| 1496 | + return 0; | |
| 1497 | + /* Only one propagation flag should be set */ | |
| 1498 | + if (!is_power_of_2(type)) | |
| 1499 | + return 0; | |
| 1500 | + return type; | |
| 1501 | +} | |
| 1502 | + | |
| 1486 | 1503 | /* |
| 1487 | 1504 | * recursively change the type of the mountpoint. |
| 1488 | 1505 | */ |
| @@ -1490,7 +1507,7 @@ static int do_change_type(struct path *path, int flag) · 1 unmodified line | ||
| 1490 | 1507 | { |
| 1491 | 1508 | struct vfsmount *m, *mnt = path->mnt; |
| 1492 | 1509 | int recurse = flag & MS_REC; |
| 1493 | − int type = flag & ~MS_REC; | |
| 1510 | + int type; | |
| 1494 | 1511 | int err = 0; |
| 1495 | 1512 | |
| 1496 | 1513 | if (!capable(CAP_SYS_ADMIN)) |
| @@ -1499,6 +1516,10 @@ static int do_change_type(struct path *path, int flag) · 2 unmodified lines | ||
| 1499 | 1516 | if (path->dentry != path->mnt->mnt_root) |
| 1500 | 1517 | return -EINVAL; |
| 1501 | 1518 | |
| 1519 | + type = flags_to_propagation_type(flag); | |
| 1520 | + if (!type) | |
| 1521 | + return -EINVAL; | |
| 1522 | + | |
| 1502 | 1523 | down_write(&namespace_sem); |
| 1503 | 1524 | if (type == MS_SHARED) { |
| 1504 | 1525 | err = invent_group_ids(mnt, recurse); |
| @@ -440,7 +440,7 @@ test_share(struct nfs4_stateid *stp, struct nfsd4_open *open) { · 439 unmodified lines | ||
| 440 | 440 | |
| 441 | 441 | static int nfs4_access_to_omode(u32 access) |
| 442 | 442 | { |
| 443 | − switch (access) { | |
| 443 | + switch (access & NFS4_SHARE_ACCESS_BOTH) { | |
| 444 | 444 | case NFS4_SHARE_ACCESS_READ: |
| 445 | 445 | return O_RDONLY; |
| 446 | 446 | case NFS4_SHARE_ACCESS_WRITE: |
| @@ -2450,14 +2450,13 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, · 2003 unmodified lines | ||
| 2450 | 2450 | static __be32 |
| 2451 | 2451 | nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open) |
| 2452 | 2452 | { |
| 2453 | − u32 op_share_access, new_access; | |
| 2453 | + u32 op_share_access = open->op_share_access & ~NFS4_SHARE_WANT_MASK; | |
| 2454 | + bool new_access; | |
| 2454 | 2455 | __be32 status; |
| 2455 | 2456 | |
| 2456 | − set_access(&new_access, stp->st_access_bmap); | |
| 2457 | − new_access = (~new_access) & open->op_share_access & ~NFS4_SHARE_WANT_MASK; | |
| 2458 | − | |
| 2457 | + new_access = !test_bit(op_share_access, &stp->st_access_bmap); | |
| 2459 | 2458 | if (new_access) { |
| 2460 | − status = nfs4_get_vfs_file(rqstp, fp, cur_fh, new_access); | |
| 2459 | + status = nfs4_get_vfs_file(rqstp, fp, cur_fh, op_share_access); | |
| 2461 | 2460 | if (status) |
| 2462 | 2461 | return status; |
| 2463 | 2462 | } |
| @@ -2470,7 +2469,6 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c · 6 unmodified lines | ||
| 2470 | 2469 | return status; |
| 2471 | 2470 | } |
| 2472 | 2471 | /* remember the open */ |
| 2473 | − op_share_access = open->op_share_access & ~NFS4_SHARE_WANT_MASK; | |
| 2474 | 2472 | __set_bit(op_share_access, &stp->st_access_bmap); |
| 2475 | 2473 | __set_bit(open->op_share_deny, &stp->st_deny_bmap); |
| 2476 | 2474 | |
| @@ -2983,7 +2981,6 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, · 506 unmodified lines | ||
| 2983 | 2981 | *filpp = find_readable_file(stp->st_file); |
| 2984 | 2982 | else |
| 2985 | 2983 | *filpp = find_writeable_file(stp->st_file); |
| 2986 | − BUG_ON(!*filpp); /* assured by check_openmode */ | |
| 2987 | 2984 | } |
| 2988 | 2985 | } |
| 2989 | 2986 | status = nfs_ok; |
| @@ -3561,7 +3558,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 571 unmodified lines | ||
| 3561 | 3558 | struct nfs4_stateowner *open_sop = NULL; |
| 3562 | 3559 | struct nfs4_stateowner *lock_sop = NULL; |
| 3563 | 3560 | struct nfs4_stateid *lock_stp; |
| 3564 | − struct file *filp; | |
| 3561 | + struct nfs4_file *fp; | |
| 3562 | + struct file *filp = NULL; | |
| 3565 | 3563 | struct file_lock file_lock; |
| 3566 | 3564 | struct file_lock conflock; |
| 3567 | 3565 | __be32 status = 0; |
| @@ -3591,7 +3589,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 23 unmodified lines | ||
| 3591 | 3589 | * lock stateid. |
| 3592 | 3590 | */ |
| 3593 | 3591 | struct nfs4_stateid *open_stp = NULL; |
| 3594 | − struct nfs4_file *fp; | |
| 3595 | 3592 | |
| 3596 | 3593 | status = nfserr_stale_clientid; |
| 3597 | 3594 | if (!nfsd4_has_session(cstate) && |
| @@ -3634,6 +3631,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 36 unmodified lines | ||
| 3634 | 3631 | if (status) |
| 3635 | 3632 | goto out; |
| 3636 | 3633 | lock_sop = lock->lk_replay_owner; |
| 3634 | + fp = lock_stp->st_file; | |
| 3637 | 3635 | } |
| 3638 | 3636 | /* lock->lk_replay_owner and lock_stp have been created or found */ |
| 3639 | 3637 | |
| @@ -3648,13 +3646,19 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 8 unmodified lines | ||
| 3648 | 3646 | switch (lock->lk_type) { |
| 3649 | 3647 | case NFS4_READ_LT: |
| 3650 | 3648 | case NFS4_READW_LT: |
| 3651 | − filp = find_readable_file(lock_stp->st_file); | |
| 3649 | + if (find_readable_file(lock_stp->st_file)) { | |
| 3650 | + nfs4_get_vfs_file(rqstp, fp, &cstate->current_fh, NFS4_SHARE_ACCESS_READ); | |
| 3651 | + filp = find_readable_file(lock_stp->st_file); | |
| 3652 | + } | |
| 3652 | 3653 | file_lock.fl_type = F_RDLCK; |
| 3653 | 3654 | cmd = F_SETLK; |
| 3654 | 3655 | break; |
| 3655 | 3656 | case NFS4_WRITE_LT: |
| 3656 | 3657 | case NFS4_WRITEW_LT: |
| 3657 | − filp = find_writeable_file(lock_stp->st_file); | |
| 3658 | + if (find_writeable_file(lock_stp->st_file)) { | |
| 3659 | + nfs4_get_vfs_file(rqstp, fp, &cstate->current_fh, NFS4_SHARE_ACCESS_WRITE); | |
| 3660 | + filp = find_writeable_file(lock_stp->st_file); | |
| 3661 | + } | |
| 3658 | 3662 | file_lock.fl_type = F_WRLCK; |
| 3659 | 3663 | cmd = F_SETLK; |
| 3660 | 3664 | break; |
| @@ -363,23 +363,23 @@ struct nfs4_file { · 362 unmodified lines | ||
| 363 | 363 | * at all? */ |
| 364 | 364 | static inline struct file *find_writeable_file(struct nfs4_file *f) |
| 365 | 365 | { |
| 366 | − if (f->fi_fds[O_RDWR]) | |
| 367 | − return f->fi_fds[O_RDWR]; | |
| 368 | − return f->fi_fds[O_WRONLY]; | |
| 366 | + if (f->fi_fds[O_WRONLY]) | |
| 367 | + return f->fi_fds[O_WRONLY]; | |
| 368 | + return f->fi_fds[O_RDWR]; | |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | static inline struct file *find_readable_file(struct nfs4_file *f) |
| 372 | 372 | { |
| 373 | − if (f->fi_fds[O_RDWR]) | |
| 374 | − return f->fi_fds[O_RDWR]; | |
| 375 | − return f->fi_fds[O_RDONLY]; | |
| 373 | + if (f->fi_fds[O_RDONLY]) | |
| 374 | + return f->fi_fds[O_RDONLY]; | |
| 375 | + return f->fi_fds[O_RDWR]; | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | static inline struct file *find_any_file(struct nfs4_file *f) |
| 379 | 379 | { |
| 380 | 380 | if (f->fi_fds[O_RDWR]) |
| 381 | 381 | return f->fi_fds[O_RDWR]; |
| 382 | − else if (f->fi_fds[O_RDWR]) | |
| 382 | + else if (f->fi_fds[O_WRONLY]) | |
| 383 | 383 | return f->fi_fds[O_WRONLY]; |
| 384 | 384 | else |
| 385 | 385 | return f->fi_fds[O_RDONLY]; |
| @@ -2033,15 +2033,17 @@ out: · 2032 unmodified lines | ||
| 2033 | 2033 | __be32 |
| 2034 | 2034 | nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat, int access) |
| 2035 | 2035 | { |
| 2036 | − struct path path = { | |
| 2037 | − .mnt = fhp->fh_export->ex_path.mnt, | |
| 2038 | − .dentry = fhp->fh_dentry, | |
| 2039 | − }; | |
| 2040 | 2036 | __be32 err; |
| 2041 | 2037 | |
| 2042 | 2038 | err = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP | access); |
| 2043 | − if (!err && vfs_statfs(&path, stat)) | |
| 2044 | − err = nfserr_io; | |
| 2039 | + if (!err) { | |
| 2040 | + struct path path = { | |
| 2041 | + .mnt = fhp->fh_export->ex_path.mnt, | |
| 2042 | + .dentry = fhp->fh_dentry, | |
| 2043 | + }; | |
| 2044 | + if (vfs_statfs(&path, stat)) | |
| 2045 | + err = nfserr_io; | |
| 2046 | + } | |
| 2045 | 2047 | return err; |
| 2046 | 2048 | } |
| 2047 | 2049 | |
| @@ -446,6 +446,7 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi) · 445 unmodified lines | ||
| 446 | 446 | nilfs_mdt_destroy(nilfs->ns_cpfile); |
| 447 | 447 | nilfs_mdt_destroy(nilfs->ns_sufile); |
| 448 | 448 | nilfs_mdt_destroy(nilfs->ns_dat); |
| 449 | + nilfs_mdt_destroy(nilfs->ns_gc_dat); | |
| 449 | 450 | |
| 450 | 451 | failed: |
| 451 | 452 | nilfs_clear_recovery_info(&ri); |
| @@ -165,9 +165,6 @@ static bool fanotify_should_send_event(struct fsnotify_group *group, · 164 unmodified lines | ||
| 165 | 165 | "mask=%x data=%p data_type=%d\n", __func__, group, to_tell, |
| 166 | 166 | inode_mark, vfsmnt_mark, event_mask, data, data_type); |
| 167 | 167 | |
| 168 | − pr_debug("%s: group=%p vfsmount_mark=%p inode_mark=%p mask=%x\n", | |
| 169 | − __func__, group, vfsmnt_mark, inode_mark, event_mask); | |
| 170 | − | |
| 171 | 168 | /* sorry, fanotify only gives a damn about files and dirs */ |
| 172 | 169 | if (!S_ISREG(to_tell->i_mode) && |
| 173 | 170 | !S_ISDIR(to_tell->i_mode)) |
| @@ -195,6 +195,14 @@ static int prepare_for_access_response(struct fsnotify_group *group, · 194 unmodified lines | ||
| 195 | 195 | re->fd = fd; |
| 196 | 196 | |
| 197 | 197 | mutex_lock(&group->fanotify_data.access_mutex); |
| 198 | + | |
| 199 | + if (group->fanotify_data.bypass_perm) { | |
| 200 | + mutex_unlock(&group->fanotify_data.access_mutex); | |
| 201 | + kmem_cache_free(fanotify_response_event_cache, re); | |
| 202 | + event->response = FAN_ALLOW; | |
| 203 | + return 0; | |
| 204 | + } | |
| 205 | + | |
| 198 | 206 | list_add_tail(&re->list, &group->fanotify_data.access_list); |
| 199 | 207 | mutex_unlock(&group->fanotify_data.access_mutex); |
| 200 | 208 | |
| @@ -364,9 +372,28 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t · 163 unmodified lines | ||
| 364 | 372 | static int fanotify_release(struct inode *ignored, struct file *file) |
| 365 | 373 | { |
| 366 | 374 | struct fsnotify_group *group = file->private_data; |
| 375 | + struct fanotify_response_event *re, *lre; | |
| 367 | 376 | |
| 368 | 377 | pr_debug("%s: file=%p group=%p\n", __func__, file, group); |
| 369 | 378 | |
| 379 | +#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | |
| 380 | + mutex_lock(&group->fanotify_data.access_mutex); | |
| 381 | + | |
| 382 | + group->fanotify_data.bypass_perm = true; | |
| 383 | + | |
| 384 | + list_for_each_entry_safe(re, lre, &group->fanotify_data.access_list, list) { | |
| 385 | + pr_debug("%s: found group=%p re=%p event=%p\n", __func__, group, | |
| 386 | + re, re->event); | |
| 387 | + | |
| 388 | + list_del_init(&re->list); | |
| 389 | + re->event->response = FAN_ALLOW; | |
| 390 | + | |
| 391 | + kmem_cache_free(fanotify_response_event_cache, re); | |
| 392 | + } | |
| 393 | + mutex_unlock(&group->fanotify_data.access_mutex); | |
| 394 | + | |
| 395 | + wake_up(&group->fanotify_data.access_waitq); | |
| 396 | +#endif | |
| 370 | 397 | /* matches the fanotify_init->fsnotify_alloc_group */ |
| 371 | 398 | fsnotify_put_group(group); |
| 372 | 399 | |
| @@ -614,7 +641,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) · 241 unmodified lines | ||
| 614 | 641 | __func__, flags, event_f_flags); |
| 615 | 642 | |
| 616 | 643 | if (!capable(CAP_SYS_ADMIN)) |
| 617 | − return -EACCES; | |
| 644 | + return -EPERM; | |
| 618 | 645 | |
| 619 | 646 | if (flags & ~FAN_ALL_INIT_FLAGS) |
| 620 | 647 | return -EINVAL; |
| @@ -148,13 +148,14 @@ static int send_to_group(struct inode *to_tell, struct vfsmount *mnt, · 147 unmodified lines | ||
| 148 | 148 | const unsigned char *file_name, |
| 149 | 149 | struct fsnotify_event **event) |
| 150 | 150 | { |
| 151 | − struct fsnotify_group *group = inode_mark->group; | |
| 152 | − __u32 inode_test_mask = (mask & ~FS_EVENT_ON_CHILD); | |
| 153 | − __u32 vfsmount_test_mask = (mask & ~FS_EVENT_ON_CHILD); | |
| 151 | + struct fsnotify_group *group = NULL; | |
| 152 | + __u32 inode_test_mask = 0; | |
| 153 | + __u32 vfsmount_test_mask = 0; | |
| 154 | 154 | |
| 155 | − pr_debug("%s: group=%p to_tell=%p mnt=%p mark=%p mask=%x data=%p" | |
| 156 | − " data_is=%d cookie=%d event=%p\n", __func__, group, to_tell, | |
| 157 | − mnt, inode_mark, mask, data, data_is, cookie, *event); | |
| 155 | + if (unlikely(!inode_mark && !vfsmount_mark)) { | |
| 156 | + BUG(); | |
| 157 | + return 0; | |
| 158 | + } | |
| 158 | 159 | |
| 159 | 160 | /* clear ignored on inode modification */ |
| 160 | 161 | if (mask & FS_MODIFY) { |
| @@ -168,18 +169,29 @@ static int send_to_group(struct inode *to_tell, struct vfsmount *mnt, · 7 unmodified lines | ||
| 168 | 169 | |
| 169 | 170 | /* does the inode mark tell us to do something? */ |
| 170 | 171 | if (inode_mark) { |
| 172 | + group = inode_mark->group; | |
| 173 | + inode_test_mask = (mask & ~FS_EVENT_ON_CHILD); | |
| 171 | 174 | inode_test_mask &= inode_mark->mask; |
| 172 | 175 | inode_test_mask &= ~inode_mark->ignored_mask; |
| 173 | 176 | } |
| 174 | 177 | |
| 175 | 178 | /* does the vfsmount_mark tell us to do something? */ |
| 176 | 179 | if (vfsmount_mark) { |
| 180 | + vfsmount_test_mask = (mask & ~FS_EVENT_ON_CHILD); | |
| 181 | + group = vfsmount_mark->group; | |
| 177 | 182 | vfsmount_test_mask &= vfsmount_mark->mask; |
| 178 | 183 | vfsmount_test_mask &= ~vfsmount_mark->ignored_mask; |
| 179 | 184 | if (inode_mark) |
| 180 | 185 | vfsmount_test_mask &= ~inode_mark->ignored_mask; |
| 181 | 186 | } |
| 182 | 187 | |
| 188 | + pr_debug("%s: group=%p to_tell=%p mnt=%p mask=%x inode_mark=%p" | |
| 189 | + " inode_test_mask=%x vfsmount_mark=%p vfsmount_test_mask=%x" | |
| 190 | + " data=%p data_is=%d cookie=%d event=%p\n", | |
| 191 | + __func__, group, to_tell, mnt, mask, inode_mark, | |
| 192 | + inode_test_mask, vfsmount_mark, vfsmount_test_mask, data, | |
| 193 | + data_is, cookie, *event); | |
| 194 | + | |
| 183 | 195 | if (!inode_test_mask && !vfsmount_test_mask) |
| 184 | 196 | return 0; |
| 185 | 197 | |
| @@ -207,13 +219,12 @@ static int send_to_group(struct inode *to_tell, struct vfsmount *mnt, · 21 unmodified lines | ||
| 207 | 219 | int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, |
| 208 | 220 | const unsigned char *file_name, u32 cookie) |
| 209 | 221 | { |
| 210 | − struct hlist_node *inode_node, *vfsmount_node; | |
| 222 | + struct hlist_node *inode_node = NULL, *vfsmount_node = NULL; | |
| 211 | 223 | struct fsnotify_mark *inode_mark = NULL, *vfsmount_mark = NULL; |
| 212 | 224 | struct fsnotify_group *inode_group, *vfsmount_group; |
| 213 | 225 | struct fsnotify_event *event = NULL; |
| 214 | 226 | struct vfsmount *mnt; |
| 215 | 227 | int idx, ret = 0; |
| 216 | − bool used_inode = false, used_vfsmount = false; | |
| 217 | 228 | /* global tests shouldn't care about events on child only the specific event */ |
| 218 | 229 | __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); |
| 219 | 230 | |
| @@ -238,57 +249,50 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, · 18 unmodified lines | ||
| 238 | 249 | (test_mask & to_tell->i_fsnotify_mask)) |
| 239 | 250 | inode_node = srcu_dereference(to_tell->i_fsnotify_marks.first, |
| 240 | 251 | &fsnotify_mark_srcu); |
| 241 | − else | |
| 242 | − inode_node = NULL; | |
| 243 | 252 | |
| 244 | − if (mnt) { | |
| 245 | − if ((mask & FS_MODIFY) || | |
| 246 | − (test_mask & mnt->mnt_fsnotify_mask)) | |
| 247 | − vfsmount_node = srcu_dereference(mnt->mnt_fsnotify_marks.first, | |
| 248 | − &fsnotify_mark_srcu); | |
| 249 | − else | |
| 250 | − vfsmount_node = NULL; | |
| 251 | − } else { | |
| 252 | − mnt = NULL; | |
| 253 | − vfsmount_node = NULL; | |
| 253 | + if (mnt && ((mask & FS_MODIFY) || | |
| 254 | + (test_mask & mnt->mnt_fsnotify_mask))) { | |
| 255 | + vfsmount_node = srcu_dereference(mnt->mnt_fsnotify_marks.first, | |
| 256 | + &fsnotify_mark_srcu); | |
| 257 | + inode_node = srcu_dereference(to_tell->i_fsnotify_marks.first, | |
| 258 | + &fsnotify_mark_srcu); | |
| 254 | 259 | } |
| 255 | 260 | |
| 256 | 261 | while (inode_node || vfsmount_node) { |
| 262 | + inode_group = vfsmount_group = NULL; | |
| 263 | + | |
| 257 | 264 | if (inode_node) { |
| 258 | 265 | inode_mark = hlist_entry(srcu_dereference(inode_node, &fsnotify_mark_srcu), |
| 259 | 266 | struct fsnotify_mark, i.i_list); |
| 260 | 267 | inode_group = inode_mark->group; |
| 261 | − } else | |
| 262 | − inode_group = (void *)-1; | |
| 268 | + } | |
| 263 | 269 | |
| 264 | 270 | if (vfsmount_node) { |
| 265 | 271 | vfsmount_mark = hlist_entry(srcu_dereference(vfsmount_node, &fsnotify_mark_srcu), |
| 266 | 272 | struct fsnotify_mark, m.m_list); |
| 267 | 273 | vfsmount_group = vfsmount_mark->group; |
| 268 | − } else | |
| 269 | − vfsmount_group = (void *)-1; | |
| 274 | + } | |
| 270 | 275 | |
| 271 | − if (inode_group < vfsmount_group) { | |
| 276 | + if (inode_group > vfsmount_group) { | |
| 272 | 277 | /* handle inode */ |
| 273 | 278 | send_to_group(to_tell, NULL, inode_mark, NULL, mask, data, |
| 274 | 279 | data_is, cookie, file_name, &event); |
| 275 | − used_inode = true; | |
| 276 | − } else if (vfsmount_group < inode_group) { | |
| 280 | + /* we didn't use the vfsmount_mark */ | |
| 281 | + vfsmount_group = NULL; | |
| 282 | + } else if (vfsmount_group > inode_group) { | |
| 277 | 283 | send_to_group(to_tell, mnt, NULL, vfsmount_mark, mask, data, |
| 278 | 284 | data_is, cookie, file_name, &event); |
| 279 | − used_vfsmount = true; | |
| 285 | + inode_group = NULL; | |
| 280 | 286 | } else { |
| 281 | 287 | send_to_group(to_tell, mnt, inode_mark, vfsmount_mark, |
| 282 | 288 | mask, data, data_is, cookie, file_name, |
| 283 | 289 | &event); |
| 284 | − used_vfsmount = true; | |
| 285 | − used_inode = true; | |
| 286 | 290 | } |
| 287 | 291 | |
| 288 | − if (used_inode) | |
| 292 | + if (inode_group) | |
| 289 | 293 | inode_node = srcu_dereference(inode_node->next, |
| 290 | 294 | &fsnotify_mark_srcu); |
| 291 | − if (used_vfsmount) | |
| 295 | + if (vfsmount_group) | |
| 292 | 296 | vfsmount_node = srcu_dereference(vfsmount_node->next, |
| 293 | 297 | &fsnotify_mark_srcu); |
| 294 | 298 | } |
| @@ -6672,7 +6672,7 @@ int ocfs2_grab_pages(struct inode *inode, loff_t start, loff_t end, · 6671 unmodified lines | ||
| 6672 | 6672 | last_page_bytes = PAGE_ALIGN(end); |
| 6673 | 6673 | index = start >> PAGE_CACHE_SHIFT; |
| 6674 | 6674 | do { |
| 6675 | − pages[numpages] = grab_cache_page(mapping, index); | |
| 6675 | + pages[numpages] = find_or_create_page(mapping, index, GFP_NOFS); | |
| 6676 | 6676 | if (!pages[numpages]) { |
| 6677 | 6677 | ret = -ENOMEM; |
| 6678 | 6678 | mlog_errno(ret); |
| @@ -439,7 +439,7 @@ int ocfs2_block_check_validate(void *data, size_t blocksize, · 438 unmodified lines | ||
| 439 | 439 | |
| 440 | 440 | ocfs2_blockcheck_inc_failure(stats); |
| 441 | 441 | mlog(ML_ERROR, |
| 442 | − "CRC32 failed: stored: %u, computed %u. Applying ECC.\n", | |
| 442 | + "CRC32 failed: stored: 0x%x, computed 0x%x. Applying ECC.\n", | |
| 443 | 443 | (unsigned int)check.bc_crc32e, (unsigned int)crc); |
| 444 | 444 | |
| 445 | 445 | /* Ok, try ECC fixups */ |
| @@ -453,7 +453,7 @@ int ocfs2_block_check_validate(void *data, size_t blocksize, · 7 unmodified lines | ||
| 453 | 453 | goto out; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | − mlog(ML_ERROR, "Fixed CRC32 failed: stored: %u, computed %u\n", | |
| 456 | + mlog(ML_ERROR, "Fixed CRC32 failed: stored: 0x%x, computed 0x%x\n", | |
| 457 | 457 | (unsigned int)check.bc_crc32e, (unsigned int)crc); |
| 458 | 458 | |
| 459 | 459 | rc = -EIO; |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <linux/writeback.h> |
| 37 | 37 | #include <linux/falloc.h> |
| 38 | 38 | #include <linux/quotaops.h> |
| 39 | +#include <linux/blkdev.h> | |
| 39 | 40 | |
| 40 | 41 | #define MLOG_MASK_PREFIX ML_INODE |
| 41 | 42 | #include <cluster/masklog.h> |
| @@ -190,8 +191,16 @@ static int ocfs2_sync_file(struct file *file, int datasync) · 148 unmodified lines | ||
| 190 | 191 | if (err) |
| 191 | 192 | goto bail; |
| 192 | 193 | |
| 193 | − if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) | |
| 194 | + if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) { | |
| 195 | + /* | |
| 196 | + * We still have to flush drive's caches to get data to the | |
| 197 | + * platter | |
| 198 | + */ | |
| 199 | + if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER) | |
| 200 | + blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, | |
| 201 | + NULL, BLKDEV_IFL_WAIT); | |
| 194 | 202 | goto bail; |
| 203 | + } | |
| 195 | 204 | |
| 196 | 205 | journal = osb->journal->j_journal; |
| 197 | 206 | err = jbd2_journal_force_commit(journal); |
| @@ -774,7 +783,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, · 576 unmodified lines | ||
| 774 | 783 | BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT)); |
| 775 | 784 | BUG_ON(abs_from & (inode->i_blkbits - 1)); |
| 776 | 785 | |
| 777 | − page = grab_cache_page(mapping, index); | |
| 786 | + page = find_or_create_page(mapping, index, GFP_NOFS); | |
| 778 | 787 | if (!page) { |
| 779 | 788 | ret = -ENOMEM; |
| 780 | 789 | mlog_errno(ret); |
| @@ -2329,7 +2338,7 @@ out_dio: · 1548 unmodified lines | ||
| 2329 | 2338 | BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); |
| 2330 | 2339 | |
| 2331 | 2340 | if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || |
| 2332 | − ((file->f_flags & O_DIRECT) && has_refcount)) { | |
| 2341 | + ((file->f_flags & O_DIRECT) && !direct_io)) { | |
| 2333 | 2342 | ret = filemap_fdatawrite_range(file->f_mapping, pos, |
| 2334 | 2343 | pos + count - 1); |
| 2335 | 2344 | if (ret < 0) |
| @@ -488,7 +488,11 @@ static int ocfs2_read_locked_inode(struct inode *inode, · 487 unmodified lines | ||
| 488 | 488 | OCFS2_BH_IGNORE_CACHE); |
| 489 | 489 | } else { |
| 490 | 490 | status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh); |
| 491 | − if (!status) | |
| 491 | + /* | |
| 492 | + * If buffer is in jbd, then its checksum may not have been | |
| 493 | + * computed as yet. | |
| 494 | + */ | |
| 495 | + if (!status && !buffer_jbd(bh)) | |
| 492 | 496 | status = ocfs2_validate_inode_block(osb->sb, bh); |
| 493 | 497 | } |
| 494 | 498 | if (status < 0) { |
| @@ -74,9 +74,11 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh, · 73 unmodified lines | ||
| 74 | 74 | /* |
| 75 | 75 | * Another node might have truncated while we were waiting on |
| 76 | 76 | * cluster locks. |
| 77 | + * We don't check size == 0 before the shift. This is borrowed | |
| 78 | + * from do_generic_file_read. | |
| 77 | 79 | */ |
| 78 | − last_index = size >> PAGE_CACHE_SHIFT; | |
| 79 | − if (page->index > last_index) { | |
| 80 | + last_index = (size - 1) >> PAGE_CACHE_SHIFT; | |
| 81 | + if (unlikely(!size || page->index > last_index)) { | |
| 80 | 82 | ret = -EINVAL; |
| 81 | 83 | goto out; |
| 82 | 84 | } |
| @@ -107,7 +109,7 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh, · 24 unmodified lines | ||
| 107 | 109 | * because the "write" would invalidate their data. |
| 108 | 110 | */ |
| 109 | 111 | if (page->index == last_index) |
| 110 | − len = size & ~PAGE_CACHE_MASK; | |
| 112 | + len = ((size - 1) & ~PAGE_CACHE_MASK) + 1; | |
| 111 | 113 | |
| 112 | 114 | ret = ocfs2_write_begin_nolock(mapping, pos, len, 0, &locked_page, |
| 113 | 115 | &fsdata, di_bh, page); |
| @@ -472,32 +472,23 @@ leave: · 471 unmodified lines | ||
| 472 | 472 | return status; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | −static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |
| 476 | − struct inode *dir, | |
| 477 | − struct inode *inode, | |
| 478 | − dev_t dev, | |
| 479 | − struct buffer_head **new_fe_bh, | |
| 480 | − struct buffer_head *parent_fe_bh, | |
| 481 | − handle_t *handle, | |
| 482 | − struct ocfs2_alloc_context *inode_ac) | |
| 475 | +static int __ocfs2_mknod_locked(struct inode *dir, | |
| 476 | + struct inode *inode, | |
| 477 | + dev_t dev, | |
| 478 | + struct buffer_head **new_fe_bh, | |
| 479 | + struct buffer_head *parent_fe_bh, | |
| 480 | + handle_t *handle, | |
| 481 | + struct ocfs2_alloc_context *inode_ac, | |
| 482 | + u64 fe_blkno, u64 suballoc_loc, u16 suballoc_bit) | |
| 483 | 483 | { |
| 484 | 484 | int status = 0; |
| 485 | + struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); | |
| 485 | 486 | struct ocfs2_dinode *fe = NULL; |
| 486 | 487 | struct ocfs2_extent_list *fel; |
| 487 | − u64 suballoc_loc, fe_blkno = 0; | |
| 488 | − u16 suballoc_bit; | |
| 489 | 488 | u16 feat; |
| 490 | 489 | |
| 491 | 490 | *new_fe_bh = NULL; |
| 492 | 491 | |
| 493 | − status = ocfs2_claim_new_inode(handle, dir, parent_fe_bh, | |
| 494 | − inode_ac, &suballoc_loc, | |
| 495 | − &suballoc_bit, &fe_blkno); | |
| 496 | − if (status < 0) { | |
| 497 | − mlog_errno(status); | |
| 498 | − goto leave; | |
| 499 | − } | |
| 500 | − | |
| 501 | 492 | /* populate as many fields early on as possible - many of |
| 502 | 493 | * these are used by the support functions here and in |
| 503 | 494 | * callers. */ |
| @@ -591,6 +582,34 @@ leave: · 87 unmodified lines | ||
| 591 | 582 | return status; |
| 592 | 583 | } |
| 593 | 584 | |
| 585 | +static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |
| 586 | + struct inode *dir, | |
| 587 | + struct inode *inode, | |
| 588 | + dev_t dev, | |
| 589 | + struct buffer_head **new_fe_bh, | |
| 590 | + struct buffer_head *parent_fe_bh, | |
| 591 | + handle_t *handle, | |
| 592 | + struct ocfs2_alloc_context *inode_ac) | |
| 593 | +{ | |
| 594 | + int status = 0; | |
| 595 | + u64 suballoc_loc, fe_blkno = 0; | |
| 596 | + u16 suballoc_bit; | |
| 597 | + | |
| 598 | + *new_fe_bh = NULL; | |
| 599 | + | |
| 600 | + status = ocfs2_claim_new_inode(handle, dir, parent_fe_bh, | |
| 601 | + inode_ac, &suballoc_loc, | |
| 602 | + &suballoc_bit, &fe_blkno); | |
| 603 | + if (status < 0) { | |
| 604 | + mlog_errno(status); | |
| 605 | + return status; | |
| 606 | + } | |
| 607 | + | |
| 608 | + return __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh, | |
| 609 | + parent_fe_bh, handle, inode_ac, | |
| 610 | + fe_blkno, suballoc_loc, suballoc_bit); | |
| 611 | +} | |
| 612 | + | |
| 594 | 613 | static int ocfs2_mkdir(struct inode *dir, |
| 595 | 614 | struct dentry *dentry, |
| 596 | 615 | int mode) |
| @@ -1852,61 +1871,117 @@ bail: · 1255 unmodified lines | ||
| 1852 | 1871 | return status; |
| 1853 | 1872 | } |
| 1854 | 1873 | |
| 1855 | −static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, | |
| 1856 | − struct inode **ret_orphan_dir, | |
| 1857 | − u64 blkno, | |
| 1858 | − char *name, | |
| 1859 | − struct ocfs2_dir_lookup_result *lookup) | |
| 1874 | +static int ocfs2_lookup_lock_orphan_dir(struct ocfs2_super *osb, | |
| 1875 | + struct inode **ret_orphan_dir, | |
| 1876 | + struct buffer_head **ret_orphan_dir_bh) | |
| 1860 | 1877 | { |
| 1861 | 1878 | struct inode *orphan_dir_inode; |
| 1862 | 1879 | struct buffer_head *orphan_dir_bh = NULL; |
| 1863 | − int status = 0; | |
| 1864 | − | |
| 1865 | − status = ocfs2_blkno_stringify(blkno, name); | |
| 1866 | − if (status < 0) { | |
| 1867 | − mlog_errno(status); | |
| 1868 | − return status; | |
| 1869 | − } | |
| 1880 | + int ret = 0; | |
| 1870 | 1881 | |
| 1871 | 1882 | orphan_dir_inode = ocfs2_get_system_file_inode(osb, |
| 1872 | 1883 | ORPHAN_DIR_SYSTEM_INODE, |
| 1873 | 1884 | osb->slot_num); |
| 1874 | 1885 | if (!orphan_dir_inode) { |
| 1875 | − status = -ENOENT; | |
| 1876 | − mlog_errno(status); | |
| 1877 | − return status; | |
| 1886 | + ret = -ENOENT; | |
| 1887 | + mlog_errno(ret); | |
| 1888 | + return ret; | |
| 1878 | 1889 | } |
| 1879 | 1890 | |
| 1880 | 1891 | mutex_lock(&orphan_dir_inode->i_mutex); |
| 1881 | 1892 | |
| 1882 | − status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); | |
| 1883 | − if (status < 0) { | |
| 1884 | − mlog_errno(status); | |
| 1885 | − goto leave; | |
| 1893 | + ret = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); | |
| 1894 | + if (ret < 0) { | |
| 1895 | + mutex_unlock(&orphan_dir_inode->i_mutex); | |
| 1896 | + iput(orphan_dir_inode); | |
| 1897 | + | |
| 1898 | + mlog_errno(ret); | |
| 1899 | + return ret; | |
| 1886 | 1900 | } |
| 1887 | 1901 | |
| 1888 | − status = ocfs2_prepare_dir_for_insert(osb, orphan_dir_inode, | |
| 1889 | − orphan_dir_bh, name, | |
| 1890 | − OCFS2_ORPHAN_NAMELEN, lookup); | |
| 1891 | − if (status < 0) { | |
| 1892 | − ocfs2_inode_unlock(orphan_dir_inode, 1); | |
| 1902 | + *ret_orphan_dir = orphan_dir_inode; | |
| 1903 | + *ret_orphan_dir_bh = orphan_dir_bh; | |
| 1893 | 1904 | |
| 1894 | − mlog_errno(status); | |
| 1895 | − goto leave; | |
| 1905 | + return 0; | |
| 1906 | +} | |
| 1907 | + | |
| 1908 | +static int __ocfs2_prepare_orphan_dir(struct inode *orphan_dir_inode, | |
| 1909 | + struct buffer_head *orphan_dir_bh, | |
| 1910 | + u64 blkno, | |
| 1911 | + char *name, | |
| 1912 | + struct ocfs2_dir_lookup_result *lookup) | |
| 1913 | +{ | |
| 1914 | + int ret; | |
| 1915 | + struct ocfs2_super *osb = OCFS2_SB(orphan_dir_inode->i_sb); | |
| 1916 | + | |
| 1917 | + ret = ocfs2_blkno_stringify(blkno, name); | |
| 1918 | + if (ret < 0) { | |
| 1919 | + mlog_errno(ret); | |
| 1920 | + return ret; | |
| 1921 | + } | |
| 1922 | + | |
| 1923 | + ret = ocfs2_prepare_dir_for_insert(osb, orphan_dir_inode, | |
| 1924 | + orphan_dir_bh, name, | |
| 1925 | + OCFS2_ORPHAN_NAMELEN, lookup); | |
| 1926 | + if (ret < 0) { | |
| 1927 | + mlog_errno(ret); | |
| 1928 | + return ret; | |
| 1929 | + } | |
| 1930 | + | |
| 1931 | + return 0; | |
| 1932 | +} | |
| 1933 | + | |
| 1934 | +/** | |
| 1935 | + * ocfs2_prepare_orphan_dir() - Prepare an orphan directory for | |
| 1936 | + * insertion of an orphan. | |
| 1937 | + * @osb: ocfs2 file system | |
| 1938 | + * @ret_orphan_dir: Orphan dir inode - returned locked! | |
| 1939 | + * @blkno: Actual block number of the inode to be inserted into orphan dir. | |
| 1940 | + * @lookup: dir lookup result, to be passed back into functions like | |
| 1941 | + * ocfs2_orphan_add | |
| 1942 | + * | |
| 1943 | + * Returns zero on success and the ret_orphan_dir, name and lookup | |
| 1944 | + * fields will be populated. | |
| 1945 | + * | |
| 1946 | + * Returns non-zero on failure. | |
| 1947 | + */ | |
| 1948 | +static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, | |
| 1949 | + struct inode **ret_orphan_dir, | |
| 1950 | + u64 blkno, | |
| 1951 | + char *name, | |
| 1952 | + struct ocfs2_dir_lookup_result *lookup) | |
| 1953 | +{ | |
| 1954 | + struct inode *orphan_dir_inode = NULL; | |
| 1955 | + struct buffer_head *orphan_dir_bh = NULL; | |
| 1956 | + int ret = 0; | |
| 1957 | + | |
| 1958 | + ret = ocfs2_lookup_lock_orphan_dir(osb, &orphan_dir_inode, | |
| 1959 | + &orphan_dir_bh); | |
| 1960 | + if (ret < 0) { | |
| 1961 | + mlog_errno(ret); | |
| 1962 | + return ret; | |
| 1963 | + } | |
| 1964 | + | |
| 1965 | + ret = __ocfs2_prepare_orphan_dir(orphan_dir_inode, orphan_dir_bh, | |
| 1966 | + blkno, name, lookup); | |
| 1967 | + if (ret < 0) { | |
| 1968 | + mlog_errno(ret); | |
| 1969 | + goto out; | |
| 1896 | 1970 | } |
| 1897 | 1971 | |
| 1898 | 1972 | *ret_orphan_dir = orphan_dir_inode; |
| 1899 | 1973 | |
| 1900 | −leave: | |
| 1901 | − if (status) { | |
| 1974 | +out: | |
| 1975 | + brelse(orphan_dir_bh); | |
| 1976 | + | |
| 1977 | + if (ret) { | |
| 1978 | + ocfs2_inode_unlock(orphan_dir_inode, 1); | |
| 1902 | 1979 | mutex_unlock(&orphan_dir_inode->i_mutex); |
| 1903 | 1980 | iput(orphan_dir_inode); |
| 1904 | 1981 | } |
| 1905 | 1982 | |
| 1906 | − brelse(orphan_dir_bh); | |
| 1907 | − | |
| 1908 | − mlog_exit(status); | |
| 1909 | − return status; | |
| 1983 | + mlog_exit(ret); | |
| 1984 | + return ret; | |
| 1910 | 1985 | } |
| 1911 | 1986 | |
| 1912 | 1987 | static int ocfs2_orphan_add(struct ocfs2_super *osb, |
| @@ -2053,6 +2128,99 @@ leave: · 140 unmodified lines | ||
| 2053 | 2128 | return status; |
| 2054 | 2129 | } |
| 2055 | 2130 | |
| 2131 | +/** | |
| 2132 | + * ocfs2_prep_new_orphaned_file() - Prepare the orphan dir to recieve a newly | |
| 2133 | + * allocated file. This is different from the typical 'add to orphan dir' | |
| 2134 | + * operation in that the inode does not yet exist. This is a problem because | |
| 2135 | + * the orphan dir stringifies the inode block number to come up with it's | |
| 2136 | + * dirent. Obviously if the inode does not yet exist we have a chicken and egg | |
| 2137 | + * problem. This function works around it by calling deeper into the orphan | |
| 2138 | + * and suballoc code than other callers. Use this only by necessity. | |
| 2139 | + * @dir: The directory which this inode will ultimately wind up under - not the | |
| 2140 | + * orphan dir! | |
| 2141 | + * @dir_bh: buffer_head the @dir inode block | |
| 2142 | + * @orphan_name: string of length (CFS2_ORPHAN_NAMELEN + 1). Will be filled | |
| 2143 | + * with the string to be used for orphan dirent. Pass back to the orphan dir | |
| 2144 | + * code. | |
| 2145 | + * @ret_orphan_dir: orphan dir inode returned to be passed back into orphan | |
| 2146 | + * dir code. | |
| 2147 | + * @ret_di_blkno: block number where the new inode will be allocated. | |
| 2148 | + * @orphan_insert: Dir insert context to be passed back into orphan dir code. | |
| 2149 | + * @ret_inode_ac: Inode alloc context to be passed back to the allocator. | |
| 2150 | + * | |
| 2151 | + * Returns zero on success and the ret_orphan_dir, name and lookup | |
| 2152 | + * fields will be populated. | |
| 2153 | + * | |
| 2154 | + * Returns non-zero on failure. | |
| 2155 | + */ | |
| 2156 | +static int ocfs2_prep_new_orphaned_file(struct inode *dir, | |
| 2157 | + struct buffer_head *dir_bh, | |
| 2158 | + char *orphan_name, | |
| 2159 | + struct inode **ret_orphan_dir, | |
| 2160 | + u64 *ret_di_blkno, | |
| 2161 | + struct ocfs2_dir_lookup_result *orphan_insert, | |
| 2162 | + struct ocfs2_alloc_context **ret_inode_ac) | |
| 2163 | +{ | |
| 2164 | + int ret; | |
| 2165 | + u64 di_blkno; | |
| 2166 | + struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); | |
| 2167 | + struct inode *orphan_dir = NULL; | |
| 2168 | + struct buffer_head *orphan_dir_bh = NULL; | |
| 2169 | + struct ocfs2_alloc_context *inode_ac = NULL; | |
| 2170 | + | |
| 2171 | + ret = ocfs2_lookup_lock_orphan_dir(osb, &orphan_dir, &orphan_dir_bh); | |
| 2172 | + if (ret < 0) { | |
| 2173 | + mlog_errno(ret); | |
| 2174 | + return ret; | |
| 2175 | + } | |
| 2176 | + | |
| 2177 | + /* reserve an inode spot */ | |
| 2178 | + ret = ocfs2_reserve_new_inode(osb, &inode_ac); | |
| 2179 | + if (ret < 0) { | |
| 2180 | + if (ret != -ENOSPC) | |
| 2181 | + mlog_errno(ret); | |
| 2182 | + goto out; | |
| 2183 | + } | |
| 2184 | + | |
| 2185 | + ret = ocfs2_find_new_inode_loc(dir, dir_bh, inode_ac, | |
| 2186 | + &di_blkno); | |
| 2187 | + if (ret) { | |
| 2188 | + mlog_errno(ret); | |
| 2189 | + goto out; | |
| 2190 | + } | |
| 2191 | + | |
| 2192 | + ret = __ocfs2_prepare_orphan_dir(orphan_dir, orphan_dir_bh, | |
| 2193 | + di_blkno, orphan_name, orphan_insert); | |
| 2194 | + if (ret < 0) { | |
| 2195 | + mlog_errno(ret); | |
| 2196 | + goto out; | |
| 2197 | + } | |
| 2198 | + | |
| 2199 | +out: | |
| 2200 | + if (ret == 0) { | |
| 2201 | + *ret_orphan_dir = orphan_dir; | |
| 2202 | + *ret_di_blkno = di_blkno; | |
| 2203 | + *ret_inode_ac = inode_ac; | |
| 2204 | + /* | |
| 2205 | + * orphan_name and orphan_insert are already up to | |
| 2206 | + * date via prepare_orphan_dir | |
| 2207 | + */ | |
| 2208 | + } else { | |
| 2209 | + /* Unroll reserve_new_inode* */ | |
| 2210 | + if (inode_ac) | |
| 2211 | + ocfs2_free_alloc_context(inode_ac); | |
| 2212 | + | |
| 2213 | + /* Unroll orphan dir locking */ | |
| 2214 | + mutex_unlock(&orphan_dir->i_mutex); | |
| 2215 | + ocfs2_inode_unlock(orphan_dir, 1); | |
| 2216 | + iput(orphan_dir); | |
| 2217 | + } | |
| 2218 | + | |
| 2219 | + brelse(orphan_dir_bh); | |
| 2220 | + | |
| 2221 | + return 0; | |
| 2222 | +} | |
| 2223 | + | |
| 2056 | 2224 | int ocfs2_create_inode_in_orphan(struct inode *dir, |
| 2057 | 2225 | int mode, |
| 2058 | 2226 | struct inode **new_inode) |
| @@ -2068,6 +2236,8 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, · 9 unmodified lines | ||
| 2068 | 2236 | struct buffer_head *new_di_bh = NULL; |
| 2069 | 2237 | struct ocfs2_alloc_context *inode_ac = NULL; |
| 2070 | 2238 | struct ocfs2_dir_lookup_result orphan_insert = { NULL, }; |
| 2239 | + u64 uninitialized_var(di_blkno), suballoc_loc; | |
| 2240 | + u16 suballoc_bit; | |
| 2071 | 2241 | |
| 2072 | 2242 | status = ocfs2_inode_lock(dir, &parent_di_bh, 1); |
| 2073 | 2243 | if (status < 0) { |
| @@ -2076,20 +2246,9 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, · 2 unmodified lines | ||
| 2076 | 2246 | return status; |
| 2077 | 2247 | } |
| 2078 | 2248 | |
| 2079 | − /* | |
| 2080 | − * We give the orphan dir the root blkno to fake an orphan name, | |
| 2081 | − * and allocate enough space for our insertion. | |
| 2082 | − */ | |
| 2083 | − status = ocfs2_prepare_orphan_dir(osb, &orphan_dir, | |
| 2084 | − osb->root_blkno, | |
| 2085 | − orphan_name, &orphan_insert); | |
| 2086 | − if (status < 0) { | |
| 2087 | − mlog_errno(status); | |
| 2088 | − goto leave; | |
| 2089 | − } | |
| 2090 | − | |
| 2091 | − /* reserve an inode spot */ | |
| 2092 | − status = ocfs2_reserve_new_inode(osb, &inode_ac); | |
| 2249 | + status = ocfs2_prep_new_orphaned_file(dir, parent_di_bh, | |
| 2250 | + orphan_name, &orphan_dir, | |
| 2251 | + &di_blkno, &orphan_insert, &inode_ac); | |
| 2093 | 2252 | if (status < 0) { |
| 2094 | 2253 | if (status != -ENOSPC) |
| 2095 | 2254 | mlog_errno(status); |
| @@ -2116,17 +2275,20 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, · 20 unmodified lines | ||
| 2116 | 2275 | goto leave; |
| 2117 | 2276 | did_quota_inode = 1; |
| 2118 | 2277 | |
| 2119 | − inode->i_nlink = 0; | |
| 2120 | − /* do the real work now. */ | |
| 2121 | − status = ocfs2_mknod_locked(osb, dir, inode, | |
| 2122 | − 0, &new_di_bh, parent_di_bh, handle, | |
| 2123 | − inode_ac); | |
| 2278 | + status = ocfs2_claim_new_inode_at_loc(handle, dir, inode_ac, | |
| 2279 | + &suballoc_loc, | |
| 2280 | + &suballoc_bit, di_blkno); | |
| 2124 | 2281 | if (status < 0) { |
| 2125 | 2282 | mlog_errno(status); |
| 2126 | 2283 | goto leave; |
| 2127 | 2284 | } |
| 2128 | 2285 | |
| 2129 | − status = ocfs2_blkno_stringify(OCFS2_I(inode)->ip_blkno, orphan_name); | |
| 2286 | + inode->i_nlink = 0; | |
| 2287 | + /* do the real work now. */ | |
| 2288 | + status = __ocfs2_mknod_locked(dir, inode, | |
| 2289 | + 0, &new_di_bh, parent_di_bh, handle, | |
| 2290 | + inode_ac, di_blkno, suballoc_loc, | |
| 2291 | + suballoc_bit); | |
| 2130 | 2292 | if (status < 0) { |
| 2131 | 2293 | mlog_errno(status); |
| 2132 | 2294 | goto leave; |
| @@ -2960,7 +2960,7 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle, · 2959 unmodified lines | ||
| 2960 | 2960 | if (map_end & (PAGE_CACHE_SIZE - 1)) |
| 2961 | 2961 | to = map_end & (PAGE_CACHE_SIZE - 1); |
| 2962 | 2962 | |
| 2963 | − page = grab_cache_page(mapping, page_index); | |
| 2963 | + page = find_or_create_page(mapping, page_index, GFP_NOFS); | |
| 2964 | 2964 | |
| 2965 | 2965 | /* |
| 2966 | 2966 | * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page |
| @@ -3179,7 +3179,8 @@ static int ocfs2_cow_sync_writeback(struct super_block *sb, · 212 unmodified lines | ||
| 3179 | 3179 | if (map_end > end) |
| 3180 | 3180 | map_end = end; |
| 3181 | 3181 | |
| 3182 | − page = grab_cache_page(context->inode->i_mapping, page_index); | |
| 3182 | + page = find_or_create_page(context->inode->i_mapping, | |
| 3183 | + page_index, GFP_NOFS); | |
| 3183 | 3184 | BUG_ON(!page); |
| 3184 | 3185 | |
| 3185 | 3186 | wait_on_page_writeback(page); |
| @@ -57,11 +57,28 @@ struct ocfs2_suballoc_result { · 56 unmodified lines | ||
| 57 | 57 | u64 sr_bg_blkno; /* The bg we allocated from. Set |
| 58 | 58 | to 0 when a block group is |
| 59 | 59 | contiguous. */ |
| 60 | + u64 sr_bg_stable_blkno; /* | |
| 61 | + * Doesn't change, always | |
| 62 | + * set to target block | |
| 63 | + * group descriptor | |
| 64 | + * block. | |
| 65 | + */ | |
| 60 | 66 | u64 sr_blkno; /* The first allocated block */ |
| 61 | 67 | unsigned int sr_bit_offset; /* The bit in the bg */ |
| 62 | 68 | unsigned int sr_bits; /* How many bits we claimed */ |
| 63 | 69 | }; |
| 64 | 70 | |
| 71 | +static u64 ocfs2_group_from_res(struct ocfs2_suballoc_result *res) | |
| 72 | +{ | |
| 73 | + if (res->sr_blkno == 0) | |
| 74 | + return 0; | |
| 75 | + | |
| 76 | + if (res->sr_bg_blkno) | |
| 77 | + return res->sr_bg_blkno; | |
| 78 | + | |
| 79 | + return ocfs2_which_suballoc_group(res->sr_blkno, res->sr_bit_offset); | |
| 80 | +} | |
| 81 | + | |
| 65 | 82 | static inline void ocfs2_debug_bg(struct ocfs2_group_desc *bg); |
| 66 | 83 | static inline void ocfs2_debug_suballoc_inode(struct ocfs2_dinode *fe); |
| 67 | 84 | static inline u16 ocfs2_find_victim_chain(struct ocfs2_chain_list *cl); |
| @@ -138,6 +155,10 @@ void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac) · 70 unmodified lines | ||
| 138 | 155 | brelse(ac->ac_bh); |
| 139 | 156 | ac->ac_bh = NULL; |
| 140 | 157 | ac->ac_resv = NULL; |
| 158 | + if (ac->ac_find_loc_priv) { | |
| 159 | + kfree(ac->ac_find_loc_priv); | |
| 160 | + ac->ac_find_loc_priv = NULL; | |
| 161 | + } | |
| 141 | 162 | } |
| 142 | 163 | |
| 143 | 164 | void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac) |
| @@ -1678,6 +1699,15 @@ static int ocfs2_search_one_group(struct ocfs2_alloc_context *ac, · 1534 unmodified lines | ||
| 1678 | 1699 | if (!ret) |
| 1679 | 1700 | ocfs2_bg_discontig_fix_result(ac, gd, res); |
| 1680 | 1701 | |
| 1702 | + /* | |
| 1703 | + * sr_bg_blkno might have been changed by | |
| 1704 | + * ocfs2_bg_discontig_fix_result | |
| 1705 | + */ | |
| 1706 | + res->sr_bg_stable_blkno = group_bh->b_blocknr; | |
| 1707 | + | |
| 1708 | + if (ac->ac_find_loc_only) | |
| 1709 | + goto out_loc_only; | |
| 1710 | + | |
| 1681 | 1711 | ret = ocfs2_alloc_dinode_update_counts(alloc_inode, handle, ac->ac_bh, |
| 1682 | 1712 | res->sr_bits, |
| 1683 | 1713 | le16_to_cpu(gd->bg_chain)); |
| @@ -1691,6 +1721,7 @@ static int ocfs2_search_one_group(struct ocfs2_alloc_context *ac, · 7 unmodified lines | ||
| 1691 | 1721 | if (ret < 0) |
| 1692 | 1722 | mlog_errno(ret); |
| 1693 | 1723 | |
| 1724 | +out_loc_only: | |
| 1694 | 1725 | *bits_left = le16_to_cpu(gd->bg_free_bits_count); |
| 1695 | 1726 | |
| 1696 | 1727 | out: |
| @@ -1708,7 +1739,6 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, · 11 unmodified lines | ||
| 1708 | 1739 | { |
| 1709 | 1740 | int status; |
| 1710 | 1741 | u16 chain; |
| 1711 | − u32 tmp_used; | |
| 1712 | 1742 | u64 next_group; |
| 1713 | 1743 | struct inode *alloc_inode = ac->ac_inode; |
| 1714 | 1744 | struct buffer_head *group_bh = NULL; |
| @@ -1770,6 +1800,11 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, · 55 unmodified lines | ||
| 1770 | 1800 | if (!status) |
| 1771 | 1801 | ocfs2_bg_discontig_fix_result(ac, bg, res); |
| 1772 | 1802 | |
| 1803 | + /* | |
| 1804 | + * sr_bg_blkno might have been changed by | |
| 1805 | + * ocfs2_bg_discontig_fix_result | |
| 1806 | + */ | |
| 1807 | + res->sr_bg_stable_blkno = group_bh->b_blocknr; | |
| 1773 | 1808 | |
| 1774 | 1809 | /* |
| 1775 | 1810 | * Keep track of previous block descriptor read. When |
| @@ -1796,22 +1831,17 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, · 20 unmodified lines | ||
| 1796 | 1831 | } |
| 1797 | 1832 | } |
| 1798 | 1833 | |
| 1799 | − /* Ok, claim our bits now: set the info on dinode, chainlist | |
| 1800 | − * and then the group */ | |
| 1801 | − status = ocfs2_journal_access_di(handle, | |
| 1802 | − INODE_CACHE(alloc_inode), | |
| 1803 | − ac->ac_bh, | |
| 1804 | − OCFS2_JOURNAL_ACCESS_WRITE); | |
| 1805 | − if (status < 0) { | |
| 1834 | + if (ac->ac_find_loc_only) | |
| 1835 | + goto out_loc_only; | |
| 1836 | + | |
| 1837 | + status = ocfs2_alloc_dinode_update_counts(alloc_inode, handle, | |
| 1838 | + ac->ac_bh, res->sr_bits, | |
| 1839 | + chain); | |
| 1840 | + if (status) { | |
| 1806 | 1841 | mlog_errno(status); |
| 1807 | 1842 | goto bail; |
| 1808 | 1843 | } |
| 1809 | 1844 | |
| 1810 | − tmp_used = le32_to_cpu(fe->id1.bitmap1.i_used); | |
| 1811 | − fe->id1.bitmap1.i_used = cpu_to_le32(res->sr_bits + tmp_used); | |
| 1812 | − le32_add_cpu(&cl->cl_recs[chain].c_free, -res->sr_bits); | |
| 1813 | − ocfs2_journal_dirty(handle, ac->ac_bh); | |
| 1814 | − | |
| 1815 | 1845 | status = ocfs2_block_group_set_bits(handle, |
| 1816 | 1846 | alloc_inode, |
| 1817 | 1847 | bg, |
| @@ -1826,6 +1856,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, · 8 unmodified lines | ||
| 1826 | 1856 | mlog(0, "Allocated %u bits from suballocator %llu\n", res->sr_bits, |
| 1827 | 1857 | (unsigned long long)le64_to_cpu(fe->i_blkno)); |
| 1828 | 1858 | |
| 1859 | +out_loc_only: | |
| 1829 | 1860 | *bits_left = le16_to_cpu(bg->bg_free_bits_count); |
| 1830 | 1861 | bail: |
| 1831 | 1862 | brelse(group_bh); |
| @@ -1845,6 +1876,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, · 13 unmodified lines | ||
| 1845 | 1876 | int status; |
| 1846 | 1877 | u16 victim, i; |
| 1847 | 1878 | u16 bits_left = 0; |
| 1879 | + u64 hint = ac->ac_last_group; | |
| 1848 | 1880 | struct ocfs2_chain_list *cl; |
| 1849 | 1881 | struct ocfs2_dinode *fe; |
| 1850 | 1882 | |
| @@ -1872,7 +1904,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, · 21 unmodified lines | ||
| 1872 | 1904 | goto bail; |
| 1873 | 1905 | } |
| 1874 | 1906 | |
| 1875 | − res->sr_bg_blkno = ac->ac_last_group; | |
| 1907 | + res->sr_bg_blkno = hint; | |
| 1876 | 1908 | if (res->sr_bg_blkno) { |
| 1877 | 1909 | /* Attempt to short-circuit the usual search mechanism |
| 1878 | 1910 | * by jumping straight to the most recently used |
| @@ -1896,8 +1928,10 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, · 17 unmodified lines | ||
| 1896 | 1928 | |
| 1897 | 1929 | status = ocfs2_search_chain(ac, handle, bits_wanted, min_bits, |
| 1898 | 1930 | res, &bits_left); |
| 1899 | − if (!status) | |
| 1931 | + if (!status) { | |
| 1932 | + hint = ocfs2_group_from_res(res); | |
| 1900 | 1933 | goto set_hint; |
| 1934 | + } | |
| 1901 | 1935 | if (status < 0 && status != -ENOSPC) { |
| 1902 | 1936 | mlog_errno(status); |
| 1903 | 1937 | goto bail; |
| @@ -1920,8 +1954,10 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, · 16 unmodified lines | ||
| 1920 | 1954 | ac->ac_chain = i; |
| 1921 | 1955 | status = ocfs2_search_chain(ac, handle, bits_wanted, min_bits, |
| 1922 | 1956 | res, &bits_left); |
| 1923 | − if (!status) | |
| 1957 | + if (!status) { | |
| 1958 | + hint = ocfs2_group_from_res(res); | |
| 1924 | 1959 | break; |
| 1960 | + } | |
| 1925 | 1961 | if (status < 0 && status != -ENOSPC) { |
| 1926 | 1962 | mlog_errno(status); |
| 1927 | 1963 | goto bail; |
| @@ -1936,7 +1972,7 @@ set_hint: · 8 unmodified lines | ||
| 1936 | 1972 | if (bits_left < min_bits) |
| 1937 | 1973 | ac->ac_last_group = 0; |
| 1938 | 1974 | else |
| 1939 | − ac->ac_last_group = res->sr_bg_blkno; | |
| 1975 | + ac->ac_last_group = hint; | |
| 1940 | 1976 | } |
| 1941 | 1977 | |
| 1942 | 1978 | bail: |
| @@ -2016,6 +2052,136 @@ static inline void ocfs2_save_inode_ac_group(struct inode *dir, · 73 unmodified lines | ||
| 2016 | 2052 | OCFS2_I(dir)->ip_last_used_slot = ac->ac_alloc_slot; |
| 2017 | 2053 | } |
| 2018 | 2054 | |
| 2055 | +int ocfs2_find_new_inode_loc(struct inode *dir, | |
| 2056 | + struct buffer_head *parent_fe_bh, | |
| 2057 | + struct ocfs2_alloc_context *ac, | |
| 2058 | + u64 *fe_blkno) | |
| 2059 | +{ | |
| 2060 | + int ret; | |
| 2061 | + handle_t *handle = NULL; | |
| 2062 | + struct ocfs2_suballoc_result *res; | |
| 2063 | + | |
| 2064 | + BUG_ON(!ac); | |
| 2065 | + BUG_ON(ac->ac_bits_given != 0); | |
| 2066 | + BUG_ON(ac->ac_bits_wanted != 1); | |
| 2067 | + BUG_ON(ac->ac_which != OCFS2_AC_USE_INODE); | |
| 2068 | + | |
| 2069 | + res = kzalloc(sizeof(*res), GFP_NOFS); | |
| 2070 | + if (res == NULL) { | |
| 2071 | + ret = -ENOMEM; | |
| 2072 | + mlog_errno(ret); | |
| 2073 | + goto out; | |
| 2074 | + } | |
| 2075 | + | |
| 2076 | + ocfs2_init_inode_ac_group(dir, parent_fe_bh, ac); | |
| 2077 | + | |
| 2078 | + /* | |
| 2079 | + * The handle started here is for chain relink. Alternatively, | |
| 2080 | + * we could just disable relink for these calls. | |
| 2081 | + */ | |
| 2082 | + handle = ocfs2_start_trans(OCFS2_SB(dir->i_sb), OCFS2_SUBALLOC_ALLOC); | |
| 2083 | + if (IS_ERR(handle)) { | |
| 2084 | + ret = PTR_ERR(handle); | |
| 2085 | + handle = NULL; | |
| 2086 | + mlog_errno(ret); | |
| 2087 | + goto out; | |
| 2088 | + } | |
| 2089 | + | |
| 2090 | + /* | |
| 2091 | + * This will instruct ocfs2_claim_suballoc_bits and | |
| 2092 | + * ocfs2_search_one_group to search but save actual allocation | |
| 2093 | + * for later. | |
| 2094 | + */ | |
| 2095 | + ac->ac_find_loc_only = 1; | |
| 2096 | + | |
| 2097 | + ret = ocfs2_claim_suballoc_bits(ac, handle, 1, 1, res); | |
| 2098 | + if (ret < 0) { | |
| 2099 | + mlog_errno(ret); | |
| 2100 | + goto out; | |
| 2101 | + } | |
| 2102 | + | |
| 2103 | + ac->ac_find_loc_priv = res; | |
| 2104 | + *fe_blkno = res->sr_blkno; | |
| 2105 | + | |
| 2106 | +out: | |
| 2107 | + if (handle) | |
| 2108 | + ocfs2_commit_trans(OCFS2_SB(dir->i_sb), handle); | |
| 2109 | + | |
| 2110 | + if (ret) | |
| 2111 | + kfree(res); | |
| 2112 | + | |
| 2113 | + return ret; | |
| 2114 | +} | |
| 2115 | + | |
| 2116 | +int ocfs2_claim_new_inode_at_loc(handle_t *handle, | |
| 2117 | + struct inode *dir, | |
| 2118 | + struct ocfs2_alloc_context *ac, | |
| 2119 | + u64 *suballoc_loc, | |
| 2120 | + u16 *suballoc_bit, | |
| 2121 | + u64 di_blkno) | |
| 2122 | +{ | |
| 2123 | + int ret; | |
| 2124 | + u16 chain; | |
| 2125 | + struct ocfs2_suballoc_result *res = ac->ac_find_loc_priv; | |
| 2126 | + struct buffer_head *bg_bh = NULL; | |
| 2127 | + struct ocfs2_group_desc *bg; | |
| 2128 | + struct ocfs2_dinode *di = (struct ocfs2_dinode *) ac->ac_bh->b_data; | |
| 2129 | + | |
| 2130 | + /* | |
| 2131 | + * Since di_blkno is being passed back in, we check for any | |
| 2132 | + * inconsistencies which may have happened between | |
| 2133 | + * calls. These are code bugs as di_blkno is not expected to | |
| 2134 | + * change once returned from ocfs2_find_new_inode_loc() | |
| 2135 | + */ | |
| 2136 | + BUG_ON(res->sr_blkno != di_blkno); | |
| 2137 | + | |
| 2138 | + ret = ocfs2_read_group_descriptor(ac->ac_inode, di, | |
| 2139 | + res->sr_bg_stable_blkno, &bg_bh); | |
| 2140 | + if (ret) { | |
| 2141 | + mlog_errno(ret); | |
| 2142 | + goto out; | |
| 2143 | + } | |
| 2144 | + | |
| 2145 | + bg = (struct ocfs2_group_desc *) bg_bh->b_data; | |
| 2146 | + chain = le16_to_cpu(bg->bg_chain); | |
| 2147 | + | |
| 2148 | + ret = ocfs2_alloc_dinode_update_counts(ac->ac_inode, handle, | |
| 2149 | + ac->ac_bh, res->sr_bits, | |
| 2150 | + chain); | |
| 2151 | + if (ret) { | |
| 2152 | + mlog_errno(ret); | |
| 2153 | + goto out; | |
| 2154 | + } | |
| 2155 | + | |
| 2156 | + ret = ocfs2_block_group_set_bits(handle, | |
| 2157 | + ac->ac_inode, | |
| 2158 | + bg, | |
| 2159 | + bg_bh, | |
| 2160 | + res->sr_bit_offset, | |
| 2161 | + res->sr_bits); | |
| 2162 | + if (ret < 0) { | |
| 2163 | + mlog_errno(ret); | |
| 2164 | + goto out; | |
| 2165 | + } | |
| 2166 | + | |
| 2167 | + mlog(0, "Allocated %u bits from suballocator %llu\n", res->sr_bits, | |
| 2168 | + (unsigned long long)di_blkno); | |
| 2169 | + | |
| 2170 | + atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs); | |
| 2171 | + | |
| 2172 | + BUG_ON(res->sr_bits != 1); | |
| 2173 | + | |
| 2174 | + *suballoc_loc = res->sr_bg_blkno; | |
| 2175 | + *suballoc_bit = res->sr_bit_offset; | |
| 2176 | + ac->ac_bits_given++; | |
| 2177 | + ocfs2_save_inode_ac_group(dir, ac); | |
| 2178 | + | |
| 2179 | +out: | |
| 2180 | + brelse(bg_bh); | |
| 2181 | + | |
| 2182 | + return ret; | |
| 2183 | +} | |
| 2184 | + | |
| 2019 | 2185 | int ocfs2_claim_new_inode(handle_t *handle, |
| 2020 | 2186 | struct inode *dir, |
| 2021 | 2187 | struct buffer_head *parent_fe_bh, |
| @@ -2567,7 +2733,8 @@ out: · 545 unmodified lines | ||
| 2567 | 2733 | * suballoc_bit. |
| 2568 | 2734 | */ |
| 2569 | 2735 | static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno, |
| 2570 | − u16 *suballoc_slot, u16 *suballoc_bit) | |
| 2736 | + u16 *suballoc_slot, u64 *group_blkno, | |
| 2737 | + u16 *suballoc_bit) | |
| 2571 | 2738 | { |
| 2572 | 2739 | int status; |
| 2573 | 2740 | struct buffer_head *inode_bh = NULL; |
| @@ -2604,6 +2771,8 @@ static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno, · 30 unmodified lines | ||
| 2604 | 2771 | *suballoc_slot = le16_to_cpu(inode_fe->i_suballoc_slot); |
| 2605 | 2772 | if (suballoc_bit) |
| 2606 | 2773 | *suballoc_bit = le16_to_cpu(inode_fe->i_suballoc_bit); |
| 2774 | + if (group_blkno) | |
| 2775 | + *group_blkno = le64_to_cpu(inode_fe->i_suballoc_loc); | |
| 2607 | 2776 | |
| 2608 | 2777 | bail: |
| 2609 | 2778 | brelse(inode_bh); |
| @@ -2621,7 +2790,8 @@ bail: · 11 unmodified lines | ||
| 2621 | 2790 | */ |
| 2622 | 2791 | static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb, |
| 2623 | 2792 | struct inode *suballoc, |
| 2624 | − struct buffer_head *alloc_bh, u64 blkno, | |
| 2793 | + struct buffer_head *alloc_bh, | |
| 2794 | + u64 group_blkno, u64 blkno, | |
| 2625 | 2795 | u16 bit, int *res) |
| 2626 | 2796 | { |
| 2627 | 2797 | struct ocfs2_dinode *alloc_di; |
| @@ -2642,10 +2812,8 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb, · 14 unmodified lines | ||
| 2642 | 2812 | goto bail; |
| 2643 | 2813 | } |
| 2644 | 2814 | |
| 2645 | − if (alloc_di->i_suballoc_loc) | |
| 2646 | − bg_blkno = le64_to_cpu(alloc_di->i_suballoc_loc); | |
| 2647 | − else | |
| 2648 | − bg_blkno = ocfs2_which_suballoc_group(blkno, bit); | |
| 2815 | + bg_blkno = group_blkno ? group_blkno : | |
| 2816 | + ocfs2_which_suballoc_group(blkno, bit); | |
| 2649 | 2817 | status = ocfs2_read_group_descriptor(suballoc, alloc_di, bg_blkno, |
| 2650 | 2818 | &group_bh); |
| 2651 | 2819 | if (status < 0) { |
| @@ -2680,6 +2848,7 @@ bail: · 28 unmodified lines | ||
| 2680 | 2848 | int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) |
| 2681 | 2849 | { |
| 2682 | 2850 | int status; |
| 2851 | + u64 group_blkno = 0; | |
| 2683 | 2852 | u16 suballoc_bit = 0, suballoc_slot = 0; |
| 2684 | 2853 | struct inode *inode_alloc_inode; |
| 2685 | 2854 | struct buffer_head *alloc_bh = NULL; |
| @@ -2687,7 +2856,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) · 1 unmodified line | ||
| 2687 | 2856 | mlog_entry("blkno: %llu", (unsigned long long)blkno); |
| 2688 | 2857 | |
| 2689 | 2858 | status = ocfs2_get_suballoc_slot_bit(osb, blkno, &suballoc_slot, |
| 2690 | − &suballoc_bit); | |
| 2859 | + &group_blkno, &suballoc_bit); | |
| 2691 | 2860 | if (status < 0) { |
| 2692 | 2861 | mlog(ML_ERROR, "get alloc slot and bit failed %d\n", status); |
| 2693 | 2862 | goto bail; |
| @@ -2715,7 +2884,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) · 21 unmodified lines | ||
| 2715 | 2884 | } |
| 2716 | 2885 | |
| 2717 | 2886 | status = ocfs2_test_suballoc_bit(osb, inode_alloc_inode, alloc_bh, |
| 2718 | − blkno, suballoc_bit, res); | |
| 2887 | + group_blkno, blkno, suballoc_bit, res); | |
| 2719 | 2888 | if (status < 0) |
| 2720 | 2889 | mlog(ML_ERROR, "test suballoc bit failed %d\n", status); |
| 2721 | 2890 | |
| @@ -56,6 +56,9 @@ struct ocfs2_alloc_context { · 55 unmodified lines | ||
| 56 | 56 | u64 ac_max_block; /* Highest block number to allocate. 0 is |
| 57 | 57 | is the same as ~0 - unlimited */ |
| 58 | 58 | |
| 59 | + int ac_find_loc_only; /* hack for reflink operation ordering */ | |
| 60 | + struct ocfs2_suballoc_result *ac_find_loc_priv; /* */ | |
| 61 | + | |
| 59 | 62 | struct ocfs2_alloc_reservation *ac_resv; |
| 60 | 63 | }; |
| 61 | 64 | |
| @@ -197,4 +200,22 @@ int ocfs2_lock_allocators(struct inode *inode, struct ocfs2_extent_tree *et, · 135 unmodified lines | ||
| 197 | 200 | struct ocfs2_alloc_context **meta_ac); |
| 198 | 201 | |
| 199 | 202 | int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res); |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | +/* | |
| 207 | + * The following two interfaces are for ocfs2_create_inode_in_orphan(). | |
| 208 | + */ | |
| 209 | +int ocfs2_find_new_inode_loc(struct inode *dir, | |
| 210 | + struct buffer_head *parent_fe_bh, | |
| 211 | + struct ocfs2_alloc_context *ac, | |
| 212 | + u64 *fe_blkno); | |
| 213 | + | |
| 214 | +int ocfs2_claim_new_inode_at_loc(handle_t *handle, | |
| 215 | + struct inode *dir, | |
| 216 | + struct ocfs2_alloc_context *ac, | |
| 217 | + u64 *suballoc_loc, | |
| 218 | + u16 *suballoc_bit, | |
| 219 | + u64 di_blkno); | |
| 220 | + | |
| 200 | 221 | #endif /* _CHAINALLOC_H_ */ |
| @@ -146,7 +146,7 @@ u64 stable_page_flags(struct page *page) · 145 unmodified lines | ||
| 146 | 146 | u |= kpf_copy_bit(k, KPF_HWPOISON, PG_hwpoison); |
| 147 | 147 | #endif |
| 148 | 148 | |
| 149 | −#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR | |
| 149 | +#ifdef CONFIG_ARCH_USES_PG_UNCACHED | |
| 150 | 150 | u |= kpf_copy_bit(k, KPF_UNCACHED, PG_uncached); |
| 151 | 151 | #endif |
| 152 | 152 | |
| @@ -224,7 +224,8 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma) · 223 unmodified lines | ||
| 224 | 224 | /* We don't show the stack guard page in /proc/maps */ |
| 225 | 225 | start = vma->vm_start; |
| 226 | 226 | if (vma->vm_flags & VM_GROWSDOWN) |
| 227 | − start += PAGE_SIZE; | |
| 227 | + if (!vma_stack_continue(vma->vm_prev, vma->vm_start)) | |
| 228 | + start += PAGE_SIZE; | |
| 228 | 229 | |
| 229 | 230 | seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", |
| 230 | 231 | start, |
| @@ -340,7 +340,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 339 unmodified lines | ||
| 340 | 340 | char *p; |
| 341 | 341 | |
| 342 | 342 | p = d_path(&file->f_path, last_sysfs_file, sizeof(last_sysfs_file)); |
| 343 | − if (p) | |
| 343 | + if (!IS_ERR(p)) | |
| 344 | 344 | memmove(last_sysfs_file, p, strlen(p) + 1); |
| 345 | 345 | |
| 346 | 346 | /* need attr_sd for attr and ops, its parent for kobj */ |
| @@ -852,8 +852,8 @@ xfs_convert_page( · 851 unmodified lines | ||
| 852 | 852 | SetPageUptodate(page); |
| 853 | 853 | |
| 854 | 854 | if (count) { |
| 855 | − wbc->nr_to_write--; | |
| 856 | − if (wbc->nr_to_write <= 0) | |
| 855 | + if (--wbc->nr_to_write <= 0 && | |
| 856 | + wbc->sync_mode == WB_SYNC_NONE) | |
| 857 | 857 | done = 1; |
| 858 | 858 | } |
| 859 | 859 | xfs_start_page_writeback(page, !page_dirty, count); |
| @@ -1068,7 +1068,7 @@ xfs_vm_writepage( · 208 unmodified lines | ||
| 1068 | 1068 | * by themselves. |
| 1069 | 1069 | */ |
| 1070 | 1070 | if ((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC) |
| 1071 | − goto out_fail; | |
| 1071 | + goto redirty; | |
| 1072 | 1072 | |
| 1073 | 1073 | /* |
| 1074 | 1074 | * We need a transaction if there are delalloc or unwritten buffers |
| @@ -1080,7 +1080,7 @@ xfs_vm_writepage( · 5 unmodified lines | ||
| 1080 | 1080 | */ |
| 1081 | 1081 | xfs_count_page_state(page, &delalloc, &unwritten); |
| 1082 | 1082 | if ((current->flags & PF_FSTRANS) && (delalloc || unwritten)) |
| 1083 | − goto out_fail; | |
| 1083 | + goto redirty; | |
| 1084 | 1084 | |
| 1085 | 1085 | /* Is this page beyond the end of the file? */ |
| 1086 | 1086 | offset = i_size_read(inode); |
| @@ -1245,12 +1245,15 @@ error: · 158 unmodified lines | ||
| 1245 | 1245 | if (iohead) |
| 1246 | 1246 | xfs_cancel_ioend(iohead); |
| 1247 | 1247 | |
| 1248 | + if (err == -EAGAIN) | |
| 1249 | + goto redirty; | |
| 1250 | + | |
| 1248 | 1251 | xfs_aops_discard_page(page); |
| 1249 | 1252 | ClearPageUptodate(page); |
| 1250 | 1253 | unlock_page(page); |
| 1251 | 1254 | return err; |
| 1252 | 1255 | |
| 1253 | −out_fail: | |
| 1256 | +redirty: | |
| 1254 | 1257 | redirty_page_for_writepage(wbc, page); |
| 1255 | 1258 | unlock_page(page); |
| 1256 | 1259 | return 0; |
| @@ -440,12 +440,7 @@ _xfs_buf_find( · 439 unmodified lines | ||
| 440 | 440 | ASSERT(btp == bp->b_target); |
| 441 | 441 | if (bp->b_file_offset == range_base && |
| 442 | 442 | bp->b_buffer_length == range_length) { |
| 443 | − /* | |
| 444 | − * If we look at something, bring it to the | |
| 445 | − * front of the list for next time. | |
| 446 | − */ | |
| 447 | 443 | atomic_inc(&bp->b_hold); |
| 448 | − list_move(&bp->b_hash_list, &hash->bh_list); | |
| 449 | 444 | goto found; |
| 450 | 445 | } |
| 451 | 446 | } |
| @@ -1443,8 +1438,7 @@ xfs_alloc_bufhash( · 991 unmodified lines | ||
| 1443 | 1438 | { |
| 1444 | 1439 | unsigned int i; |
| 1445 | 1440 | |
| 1446 | − btp->bt_hashshift = external ? 3 : 8; /* 8 or 256 buckets */ | |
| 1447 | − btp->bt_hashmask = (1 << btp->bt_hashshift) - 1; | |
| 1441 | + btp->bt_hashshift = external ? 3 : 12; /* 8 or 4096 buckets */ | |
| 1448 | 1442 | btp->bt_hash = kmem_zalloc_large((1 << btp->bt_hashshift) * |
| 1449 | 1443 | sizeof(xfs_bufhash_t)); |
| 1450 | 1444 | for (i = 0; i < (1 << btp->bt_hashshift); i++) { |
| @@ -1938,7 +1932,8 @@ xfs_buf_init(void) · 487 unmodified lines | ||
| 1938 | 1932 | if (!xfs_buf_zone) |
| 1939 | 1933 | goto out; |
| 1940 | 1934 | |
| 1941 | − xfslogd_workqueue = create_workqueue("xfslogd"); | |
| 1935 | + xfslogd_workqueue = alloc_workqueue("xfslogd", | |
| 1936 | + WQ_RESCUER | WQ_HIGHPRI, 1); | |
| 1942 | 1937 | if (!xfslogd_workqueue) |
| 1943 | 1938 | goto out_free_buf_zone; |
| 1944 | 1939 | |
| @@ -137,7 +137,6 @@ typedef struct xfs_buftarg { · 136 unmodified lines | ||
| 137 | 137 | size_t bt_smask; |
| 138 | 138 | |
| 139 | 139 | /* per device buffer hash table */ |
| 140 | − uint bt_hashmask; | |
| 141 | 140 | uint bt_hashshift; |
| 142 | 141 | xfs_bufhash_t *bt_hash; |
| 143 | 142 | |
| @@ -785,6 +785,8 @@ xfs_ioc_fsgetxattr( · 784 unmodified lines | ||
| 785 | 785 | { |
| 786 | 786 | struct fsxattr fa; |
| 787 | 787 | |
| 788 | + memset(&fa, 0, sizeof(struct fsxattr)); | |
| 789 | + | |
| 788 | 790 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
| 789 | 791 | fa.fsx_xflags = xfs_ip2xflags(ip); |
| 790 | 792 | fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog; |
| @@ -906,6 +908,13 @@ xfs_ioctl_setattr( · 115 unmodified lines | ||
| 906 | 908 | if (XFS_FORCED_SHUTDOWN(mp)) |
| 907 | 909 | return XFS_ERROR(EIO); |
| 908 | 910 | |
| 911 | + /* | |
| 912 | + * Disallow 32bit project ids because on-disk structure | |
| 913 | + * is 16bit only. | |
| 914 | + */ | |
| 915 | + if ((mask & FSX_PROJID) && (fa->fsx_projid > (__uint16_t)-1)) | |
| 916 | + return XFS_ERROR(EINVAL); | |
| 917 | + | |
| 909 | 918 | /* |
| 910 | 919 | * If disk quotas is on, we make sure that the dquots do exist on disk, |
| 911 | 920 | * before we start any other transactions. Trying to do this later |
| @@ -664,7 +664,7 @@ xfs_vn_fiemap( · 663 unmodified lines | ||
| 664 | 664 | fieinfo->fi_extents_max + 1; |
| 665 | 665 | bm.bmv_count = min_t(__s32, bm.bmv_count, |
| 666 | 666 | (PAGE_SIZE * 16 / sizeof(struct getbmapx))); |
| 667 | − bm.bmv_iflags = BMV_IF_PREALLOC; | |
| 667 | + bm.bmv_iflags = BMV_IF_PREALLOC | BMV_IF_NO_HOLES; | |
| 668 | 668 | if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) |
| 669 | 669 | bm.bmv_iflags |= BMV_IF_ATTRFORK; |
| 670 | 670 | if (!(fieinfo->fi_flags & FIEMAP_FLAG_SYNC)) |
| @@ -1226,6 +1226,7 @@ xfs_fs_statfs( · 1225 unmodified lines | ||
| 1226 | 1226 | struct xfs_inode *ip = XFS_I(dentry->d_inode); |
| 1227 | 1227 | __uint64_t fakeinos, id; |
| 1228 | 1228 | xfs_extlen_t lsize; |
| 1229 | + __int64_t ffree; | |
| 1229 | 1230 | |
| 1230 | 1231 | statp->f_type = XFS_SB_MAGIC; |
| 1231 | 1232 | statp->f_namelen = MAXNAMELEN - 1; |
| @@ -1249,7 +1250,11 @@ xfs_fs_statfs( · 17 unmodified lines | ||
| 1249 | 1250 | statp->f_files = min_t(typeof(statp->f_files), |
| 1250 | 1251 | statp->f_files, |
| 1251 | 1252 | mp->m_maxicount); |
| 1252 | − statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree); | |
| 1253 | + | |
| 1254 | + /* make sure statp->f_ffree does not underflow */ | |
| 1255 | + ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree); | |
| 1256 | + statp->f_ffree = max_t(__int64_t, ffree, 0); | |
| 1257 | + | |
| 1253 | 1258 | spin_unlock(&mp->m_sb_lock); |
| 1254 | 1259 | |
| 1255 | 1260 | if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) || |
| @@ -1402,7 +1407,7 @@ xfs_fs_freeze( · 146 unmodified lines | ||
| 1402 | 1407 | |
| 1403 | 1408 | xfs_save_resvblks(mp); |
| 1404 | 1409 | xfs_quiesce_attr(mp); |
| 1405 | − return -xfs_fs_log_dummy(mp); | |
| 1410 | + return -xfs_fs_log_dummy(mp, SYNC_WAIT); | |
| 1406 | 1411 | } |
| 1407 | 1412 | |
| 1408 | 1413 | STATIC int |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "xfs_inode_item.h" |
| 35 | 35 | #include "xfs_quota.h" |
| 36 | 36 | #include "xfs_trace.h" |
| 37 | +#include "xfs_fsops.h" | |
| 37 | 38 | |
| 38 | 39 | #include <linux/kthread.h> |
| 39 | 40 | #include <linux/freezer.h> |
| @@ -340,38 +341,6 @@ xfs_sync_attr( · 300 unmodified lines | ||
| 340 | 341 | XFS_ICI_NO_TAG, 0, NULL); |
| 341 | 342 | } |
| 342 | 343 | |
| 343 | −STATIC int | |
| 344 | −xfs_commit_dummy_trans( | |
| 345 | − struct xfs_mount *mp, | |
| 346 | − uint flags) | |
| 347 | −{ | |
| 348 | − struct xfs_inode *ip = mp->m_rootip; | |
| 349 | − struct xfs_trans *tp; | |
| 350 | − int error; | |
| 351 | − | |
| 352 | − /* | |
| 353 | − * Put a dummy transaction in the log to tell recovery | |
| 354 | − * that all others are OK. | |
| 355 | − */ | |
| 356 | − tp = xfs_trans_alloc(mp, XFS_TRANS_DUMMY1); | |
| 357 | − error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0); | |
| 358 | − if (error) { | |
| 359 | − xfs_trans_cancel(tp, 0); | |
| 360 | − return error; | |
| 361 | − } | |
| 362 | − | |
| 363 | − xfs_ilock(ip, XFS_ILOCK_EXCL); | |
| 364 | − | |
| 365 | − xfs_trans_ijoin(tp, ip); | |
| 366 | − xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | |
| 367 | − error = xfs_trans_commit(tp, 0); | |
| 368 | − xfs_iunlock(ip, XFS_ILOCK_EXCL); | |
| 369 | − | |
| 370 | − /* the log force ensures this transaction is pushed to disk */ | |
| 371 | − xfs_log_force(mp, (flags & SYNC_WAIT) ? XFS_LOG_SYNC : 0); | |
| 372 | − return error; | |
| 373 | −} | |
| 374 | − | |
| 375 | 344 | STATIC int |
| 376 | 345 | xfs_sync_fsdata( |
| 377 | 346 | struct xfs_mount *mp) |
| @@ -432,7 +401,7 @@ xfs_quiesce_data( · 54 unmodified lines | ||
| 432 | 401 | |
| 433 | 402 | /* mark the log as covered if needed */ |
| 434 | 403 | if (xfs_log_need_covered(mp)) |
| 435 | − error2 = xfs_commit_dummy_trans(mp, SYNC_WAIT); | |
| 404 | + error2 = xfs_fs_log_dummy(mp, SYNC_WAIT); | |
| 436 | 405 | |
| 437 | 406 | /* flush data-only devices */ |
| 438 | 407 | if (mp->m_rtdev_targp) |
| @@ -563,7 +532,7 @@ xfs_flush_inodes( · 124 unmodified lines | ||
| 563 | 532 | /* |
| 564 | 533 | * Every sync period we need to unpin all items, reclaim inodes and sync |
| 565 | 534 | * disk quotas. We might need to cover the log to indicate that the |
| 566 | − * filesystem is idle. | |
| 535 | + * filesystem is idle and not frozen. | |
| 567 | 536 | */ |
| 568 | 537 | STATIC void |
| 569 | 538 | xfs_sync_worker( |
| @@ -577,8 +546,9 @@ xfs_sync_worker( · 7 unmodified lines | ||
| 577 | 546 | xfs_reclaim_inodes(mp, 0); |
| 578 | 547 | /* dgc: errors ignored here */ |
| 579 | 548 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); |
| 580 | − if (xfs_log_need_covered(mp)) | |
| 581 | − error = xfs_commit_dummy_trans(mp, 0); | |
| 549 | + if (mp->m_super->s_frozen == SB_UNFROZEN && | |
| 550 | + xfs_log_need_covered(mp)) | |
| 551 | + error = xfs_fs_log_dummy(mp, 0); | |
| 582 | 552 | } |
| 583 | 553 | mp->m_sync_seq++; |
| 584 | 554 | wake_up(&mp->m_wait_single_sync_task); |
| @@ -5533,12 +5533,24 @@ xfs_getbmap( · 5532 unmodified lines | ||
| 5533 | 5533 | map[i].br_startblock)) |
| 5534 | 5534 | goto out_free_map; |
| 5535 | 5535 | |
| 5536 | − nexleft--; | |
| 5537 | 5536 | bmv->bmv_offset = |
| 5538 | 5537 | out[cur_ext].bmv_offset + |
| 5539 | 5538 | out[cur_ext].bmv_length; |
| 5540 | 5539 | bmv->bmv_length = |
| 5541 | 5540 | max_t(__int64_t, 0, bmvend - bmv->bmv_offset); |
| 5541 | + | |
| 5542 | + /* | |
| 5543 | + * In case we don't want to return the hole, | |
| 5544 | + * don't increase cur_ext so that we can reuse | |
| 5545 | + * it in the next loop. | |
| 5546 | + */ | |
| 5547 | + if ((iflags & BMV_IF_NO_HOLES) && | |
| 5548 | + map[i].br_startblock == HOLESTARTBLOCK) { | |
| 5549 | + memset(&out[cur_ext], 0, sizeof(out[cur_ext])); | |
| 5550 | + continue; | |
| 5551 | + } | |
| 5552 | + | |
| 5553 | + nexleft--; | |
| 5542 | 5554 | bmv->bmv_entries++; |
| 5543 | 5555 | cur_ext++; |
| 5544 | 5556 | } |
| @@ -114,8 +114,10 @@ struct getbmapx { · 113 unmodified lines | ||
| 114 | 114 | #define BMV_IF_NO_DMAPI_READ 0x2 /* Do not generate DMAPI read event */ |
| 115 | 115 | #define BMV_IF_PREALLOC 0x4 /* rtn status BMV_OF_PREALLOC if req */ |
| 116 | 116 | #define BMV_IF_DELALLOC 0x8 /* rtn status BMV_OF_DELALLOC if req */ |
| 117 | +#define BMV_IF_NO_HOLES 0x10 /* Do not return holes */ | |
| 117 | 118 | #define BMV_IF_VALID \ |
| 118 | − (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC|BMV_IF_DELALLOC) | |
| 119 | + (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC| \ | |
| 120 | + BMV_IF_DELALLOC|BMV_IF_NO_HOLES) | |
| 119 | 121 | |
| 120 | 122 | /* bmv_oflags values - returned for each non-header segment */ |
| 121 | 123 | #define BMV_OF_PREALLOC 0x1 /* segment = unwritten pre-allocation */ |
| @@ -604,31 +604,36 @@ out: · 603 unmodified lines | ||
| 604 | 604 | return 0; |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | +/* | |
| 608 | + * Dump a transaction into the log that contains no real change. This is needed | |
| 609 | + * to be able to make the log dirty or stamp the current tail LSN into the log | |
| 610 | + * during the covering operation. | |
| 611 | + * | |
| 612 | + * We cannot use an inode here for this - that will push dirty state back up | |
| 613 | + * into the VFS and then periodic inode flushing will prevent log covering from | |
| 614 | + * making progress. Hence we log a field in the superblock instead. | |
| 615 | + */ | |
| 607 | 616 | int |
| 608 | 617 | xfs_fs_log_dummy( |
| 609 | − xfs_mount_t *mp) | |
| 618 | + xfs_mount_t *mp, | |
| 619 | + int flags) | |
| 610 | 620 | { |
| 611 | 621 | xfs_trans_t *tp; |
| 612 | − xfs_inode_t *ip; | |
| 613 | 622 | int error; |
| 614 | 623 | |
| 615 | 624 | tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1, KM_SLEEP); |
| 616 | − error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0); | |
| 625 | + error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | |
| 626 | + XFS_DEFAULT_LOG_COUNT); | |
| 617 | 627 | if (error) { |
| 618 | 628 | xfs_trans_cancel(tp, 0); |
| 619 | 629 | return error; |
| 620 | 630 | } |
| 621 | 631 | |
| 622 | − ip = mp->m_rootip; | |
| 623 | − xfs_ilock(ip, XFS_ILOCK_EXCL); | |
| 624 | − | |
| 625 | − xfs_trans_ijoin(tp, ip); | |
| 626 | − xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | |
| 627 | − xfs_trans_set_sync(tp); | |
| 628 | − error = xfs_trans_commit(tp, 0); | |
| 629 | − | |
| 630 | − xfs_iunlock(ip, XFS_ILOCK_EXCL); | |
| 631 | − return error; | |
| 632 | + /* log the UUID because it is an unchanging field */ | |
| 633 | + xfs_mod_sb(tp, XFS_SB_UUID); | |
| 634 | + if (flags & SYNC_WAIT) | |
| 635 | + xfs_trans_set_sync(tp); | |
| 636 | + return xfs_trans_commit(tp, 0); | |
| 632 | 637 | } |
| 633 | 638 | |
| 634 | 639 | int |
| @@ -25,6 +25,6 @@ extern int xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt); · 24 unmodified lines | ||
| 25 | 25 | extern int xfs_reserve_blocks(xfs_mount_t *mp, __uint64_t *inval, |
| 26 | 26 | xfs_fsop_resblks_t *outval); |
| 27 | 27 | extern int xfs_fs_goingdown(xfs_mount_t *mp, __uint32_t inflags); |
| 28 | −extern int xfs_fs_log_dummy(xfs_mount_t *mp); | |
| 28 | +extern int xfs_fs_log_dummy(xfs_mount_t *mp, int flags); | |
| 29 | 29 | |
| 30 | 30 | #endif /* __XFS_FSOPS_H__ */ |
| @@ -1213,7 +1213,6 @@ xfs_imap_lookup( · 1212 unmodified lines | ||
| 1213 | 1213 | struct xfs_inobt_rec_incore rec; |
| 1214 | 1214 | struct xfs_btree_cur *cur; |
| 1215 | 1215 | struct xfs_buf *agbp; |
| 1216 | − xfs_agino_t startino; | |
| 1217 | 1216 | int error; |
| 1218 | 1217 | int i; |
| 1219 | 1218 | |
| @@ -1227,13 +1226,13 @@ xfs_imap_lookup( · 7 unmodified lines | ||
| 1227 | 1226 | } |
| 1228 | 1227 | |
| 1229 | 1228 | /* |
| 1230 | − * derive and lookup the exact inode record for the given agino. If the | |
| 1231 | − * record cannot be found, then it's an invalid inode number and we | |
| 1232 | − * should abort. | |
| 1229 | + * Lookup the inode record for the given agino. If the record cannot be | |
| 1230 | + * found, then it's an invalid inode number and we should abort. Once | |
| 1231 | + * we have a record, we need to ensure it contains the inode number | |
| 1232 | + * we are looking up. | |
| 1233 | 1233 | */ |
| 1234 | 1234 | cur = xfs_inobt_init_cursor(mp, tp, agbp, agno); |
| 1235 | − startino = agino & ~(XFS_IALLOC_INODES(mp) - 1); | |
| 1236 | − error = xfs_inobt_lookup(cur, startino, XFS_LOOKUP_EQ, &i); | |
| 1235 | + error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE, &i); | |
| 1237 | 1236 | if (!error) { |
| 1238 | 1237 | if (i) |
| 1239 | 1238 | error = xfs_inobt_get_rec(cur, &rec, &i); |
| @@ -1246,6 +1245,11 @@ xfs_imap_lookup( · 6 unmodified lines | ||
| 1246 | 1245 | if (error) |
| 1247 | 1246 | return error; |
| 1248 | 1247 | |
| 1248 | + /* check that the returned record contains the required inode */ | |
| 1249 | + if (rec.ir_startino > agino || | |
| 1250 | + rec.ir_startino + XFS_IALLOC_INODES(mp) <= agino) | |
| 1251 | + return EINVAL; | |
| 1252 | + | |
| 1249 | 1253 | /* for untrusted inodes check it is allocated first */ |
| 1250 | 1254 | if ((flags & XFS_IGET_UNTRUSTED) && |
| 1251 | 1255 | (rec.ir_free & XFS_INOBT_MASK(agino - rec.ir_startino))) |
| @@ -1914,6 +1914,11 @@ xfs_iunlink_remove( · 1913 unmodified lines | ||
| 1914 | 1914 | return 0; |
| 1915 | 1915 | } |
| 1916 | 1916 | |
| 1917 | +/* | |
| 1918 | + * A big issue when freeing the inode cluster is is that we _cannot_ skip any | |
| 1919 | + * inodes that are in memory - they all must be marked stale and attached to | |
| 1920 | + * the cluster buffer. | |
| 1921 | + */ | |
| 1917 | 1922 | STATIC void |
| 1918 | 1923 | xfs_ifree_cluster( |
| 1919 | 1924 | xfs_inode_t *free_ip, |
| @@ -1945,8 +1950,6 @@ xfs_ifree_cluster( · 25 unmodified lines | ||
| 1945 | 1950 | } |
| 1946 | 1951 | |
| 1947 | 1952 | for (j = 0; j < nbufs; j++, inum += ninodes) { |
| 1948 | − int found = 0; | |
| 1949 | − | |
| 1950 | 1953 | blkno = XFS_AGB_TO_DADDR(mp, XFS_INO_TO_AGNO(mp, inum), |
| 1951 | 1954 | XFS_INO_TO_AGBNO(mp, inum)); |
| 1952 | 1955 | |
| @@ -1965,7 +1968,9 @@ xfs_ifree_cluster( · 12 unmodified lines | ||
| 1965 | 1968 | /* |
| 1966 | 1969 | * Walk the inodes already attached to the buffer and mark them |
| 1967 | 1970 | * stale. These will all have the flush locks held, so an |
| 1968 | − * in-memory inode walk can't lock them. | |
| 1971 | + * in-memory inode walk can't lock them. By marking them all | |
| 1972 | + * stale first, we will not attempt to lock them in the loop | |
| 1973 | + * below as the XFS_ISTALE flag will be set. | |
| 1969 | 1974 | */ |
| 1970 | 1975 | lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); |
| 1971 | 1976 | while (lip) { |
| @@ -1977,11 +1982,11 @@ xfs_ifree_cluster( · 5 unmodified lines | ||
| 1977 | 1982 | &iip->ili_flush_lsn, |
| 1978 | 1983 | &iip->ili_item.li_lsn); |
| 1979 | 1984 | xfs_iflags_set(iip->ili_inode, XFS_ISTALE); |
| 1980 | − found++; | |
| 1981 | 1985 | } |
| 1982 | 1986 | lip = lip->li_bio_list; |
| 1983 | 1987 | } |
| 1984 | 1988 | |
| 1989 | + | |
| 1985 | 1990 | /* |
| 1986 | 1991 | * For each inode in memory attempt to add it to the inode |
| 1987 | 1992 | * buffer and set it up for being staled on buffer IO |
| @@ -1993,6 +1998,7 @@ xfs_ifree_cluster( · 5 unmodified lines | ||
| 1993 | 1998 | * even trying to lock them. |
| 1994 | 1999 | */ |
| 1995 | 2000 | for (i = 0; i < ninodes; i++) { |
| 2001 | +retry: | |
| 1996 | 2002 | read_lock(&pag->pag_ici_lock); |
| 1997 | 2003 | ip = radix_tree_lookup(&pag->pag_ici_root, |
| 1998 | 2004 | XFS_INO_TO_AGINO(mp, (inum + i))); |
| @@ -2003,38 +2009,36 @@ xfs_ifree_cluster( · 4 unmodified lines | ||
| 2003 | 2009 | continue; |
| 2004 | 2010 | } |
| 2005 | 2011 | |
| 2006 | − /* don't try to lock/unlock the current inode */ | |
| 2012 | + /* | |
| 2013 | + * Don't try to lock/unlock the current inode, but we | |
| 2014 | + * _cannot_ skip the other inodes that we did not find | |
| 2015 | + * in the list attached to the buffer and are not | |
| 2016 | + * already marked stale. If we can't lock it, back off | |
| 2017 | + * and retry. | |
| 2018 | + */ | |
| 2007 | 2019 | if (ip != free_ip && |
| 2008 | 2020 | !xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) { |
| 2009 | 2021 | read_unlock(&pag->pag_ici_lock); |
| 2010 | − continue; | |
| 2022 | + delay(1); | |
| 2023 | + goto retry; | |
| 2011 | 2024 | } |
| 2012 | 2025 | read_unlock(&pag->pag_ici_lock); |
| 2013 | 2026 | |
| 2014 | − if (!xfs_iflock_nowait(ip)) { | |
| 2015 | − if (ip != free_ip) | |
| 2016 | − xfs_iunlock(ip, XFS_ILOCK_EXCL); | |
| 2017 | − continue; | |
| 2018 | − } | |
| 2019 | − | |
| 2027 | + xfs_iflock(ip); | |
| 2020 | 2028 | xfs_iflags_set(ip, XFS_ISTALE); |
| 2021 | − if (xfs_inode_clean(ip)) { | |
| 2022 | − ASSERT(ip != free_ip); | |
| 2023 | − xfs_ifunlock(ip); | |
| 2024 | − xfs_iunlock(ip, XFS_ILOCK_EXCL); | |
| 2025 | − continue; | |
| 2026 | − } | |
| 2027 | 2029 | |
| 2030 | + /* | |
| 2031 | + * we don't need to attach clean inodes or those only | |
| 2032 | + * with unlogged changes (which we throw away, anyway). | |
| 2033 | + */ | |
| 2028 | 2034 | iip = ip->i_itemp; |
| 2029 | − if (!iip) { | |
| 2030 | − /* inode with unlogged changes only */ | |
| 2035 | + if (!iip || xfs_inode_clean(ip)) { | |
| 2031 | 2036 | ASSERT(ip != free_ip); |
| 2032 | 2037 | ip->i_update_core = 0; |
| 2033 | 2038 | xfs_ifunlock(ip); |
| 2034 | 2039 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| 2035 | 2040 | continue; |
| 2036 | 2041 | } |
| 2037 | − found++; | |
| 2038 | 2042 | |
| 2039 | 2043 | iip->ili_last_fields = iip->ili_format.ilf_fields; |
| 2040 | 2044 | iip->ili_format.ilf_fields = 0; |
| @@ -2049,8 +2053,7 @@ xfs_ifree_cluster( · 8 unmodified lines | ||
| 2049 | 2053 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| 2050 | 2054 | } |
| 2051 | 2055 | |
| 2052 | − if (found) | |
| 2053 | − xfs_trans_stale_inode_buf(tp, bp); | |
| 2056 | + xfs_trans_stale_inode_buf(tp, bp); | |
| 2054 | 2057 | xfs_trans_binval(tp, bp); |
| 2055 | 2058 | } |
| 2056 | 2059 | |
| @@ -3015,7 +3015,8 @@ _xfs_log_force( · 3014 unmodified lines | ||
| 3015 | 3015 | |
| 3016 | 3016 | XFS_STATS_INC(xs_log_force); |
| 3017 | 3017 | |
| 3018 | − xlog_cil_push(log, 1); | |
| 3018 | + if (log->l_cilp) | |
| 3019 | + xlog_cil_force(log); | |
| 3019 | 3020 | |
| 3020 | 3021 | spin_lock(&log->l_icloglock); |
| 3021 | 3022 | |
| @@ -3167,7 +3168,7 @@ _xfs_log_force_lsn( · 145 unmodified lines | ||
| 3167 | 3168 | XFS_STATS_INC(xs_log_force); |
| 3168 | 3169 | |
| 3169 | 3170 | if (log->l_cilp) { |
| 3170 | − lsn = xlog_cil_push_lsn(log, lsn); | |
| 3171 | + lsn = xlog_cil_force_lsn(log, lsn); | |
| 3171 | 3172 | if (lsn == NULLCOMMITLSN) |
| 3172 | 3173 | return 0; |
| 3173 | 3174 | } |
| @@ -3724,7 +3725,7 @@ xfs_log_force_umount( · 550 unmodified lines | ||
| 3724 | 3725 | * call below. |
| 3725 | 3726 | */ |
| 3726 | 3727 | if (!logerror && (mp->m_flags & XFS_MOUNT_DELAYLOG)) |
| 3727 | − xlog_cil_push(log, 1); | |
| 3728 | + xlog_cil_force(log); | |
| 3728 | 3729 | |
| 3729 | 3730 | /* |
| 3730 | 3731 | * We must hold both the GRANT lock and the LOG lock, |
| @@ -68,6 +68,7 @@ xlog_cil_init( · 67 unmodified lines | ||
| 68 | 68 | ctx->sequence = 1; |
| 69 | 69 | ctx->cil = cil; |
| 70 | 70 | cil->xc_ctx = ctx; |
| 71 | + cil->xc_current_sequence = ctx->sequence; | |
| 71 | 72 | |
| 72 | 73 | cil->xc_log = log; |
| 73 | 74 | log->l_cilp = cil; |
| @@ -269,15 +270,10 @@ xlog_cil_insert( · 195 unmodified lines | ||
| 269 | 270 | static void |
| 270 | 271 | xlog_cil_format_items( |
| 271 | 272 | struct log *log, |
| 272 | − struct xfs_log_vec *log_vector, | |
| 273 | − struct xlog_ticket *ticket, | |
| 274 | − xfs_lsn_t *start_lsn) | |
| 273 | + struct xfs_log_vec *log_vector) | |
| 275 | 274 | { |
| 276 | 275 | struct xfs_log_vec *lv; |
| 277 | 276 | |
| 278 | − if (start_lsn) | |
| 279 | − *start_lsn = log->l_cilp->xc_ctx->sequence; | |
| 280 | − | |
| 281 | 277 | ASSERT(log_vector); |
| 282 | 278 | for (lv = log_vector; lv; lv = lv->lv_next) { |
| 283 | 279 | void *ptr; |
| @@ -301,9 +297,24 @@ xlog_cil_format_items( · 17 unmodified lines | ||
| 301 | 297 | ptr += vec->i_len; |
| 302 | 298 | } |
| 303 | 299 | ASSERT(ptr == lv->lv_buf + lv->lv_buf_len); |
| 300 | + } | |
| 301 | +} | |
| 302 | + | |
| 303 | +static void | |
| 304 | +xlog_cil_insert_items( | |
| 305 | + struct log *log, | |
| 306 | + struct xfs_log_vec *log_vector, | |
| 307 | + struct xlog_ticket *ticket, | |
| 308 | + xfs_lsn_t *start_lsn) | |
| 309 | +{ | |
| 310 | + struct xfs_log_vec *lv; | |
| 311 | + | |
| 312 | + if (start_lsn) | |
| 313 | + *start_lsn = log->l_cilp->xc_ctx->sequence; | |
| 304 | 314 | |
| 315 | + ASSERT(log_vector); | |
| 316 | + for (lv = log_vector; lv; lv = lv->lv_next) | |
| 305 | 317 | xlog_cil_insert(log, ticket, lv->lv_item, lv); |
| 306 | − } | |
| 307 | 318 | } |
| 308 | 319 | |
| 309 | 320 | static void |
| @@ -320,80 +331,6 @@ xlog_cil_free_logvec( · 10 unmodified lines | ||
| 320 | 331 | } |
| 321 | 332 | } |
| 322 | 333 | |
| 323 | −/* | |
| 324 | − * Commit a transaction with the given vector to the Committed Item List. | |
| 325 | − * | |
| 326 | − * To do this, we need to format the item, pin it in memory if required and | |
| 327 | − * account for the space used by the transaction. Once we have done that we | |
| 328 | − * need to release the unused reservation for the transaction, attach the | |
| 329 | − * transaction to the checkpoint context so we carry the busy extents through | |
| 330 | − * to checkpoint completion, and then unlock all the items in the transaction. | |
| 331 | − * | |
| 332 | − * For more specific information about the order of operations in | |
| 333 | − * xfs_log_commit_cil() please refer to the comments in | |
| 334 | − * xfs_trans_commit_iclog(). | |
| 335 | − * | |
| 336 | − * Called with the context lock already held in read mode to lock out | |
| 337 | − * background commit, returns without it held once background commits are | |
| 338 | − * allowed again. | |
| 339 | − */ | |
| 340 | −int | |
| 341 | −xfs_log_commit_cil( | |
| 342 | − struct xfs_mount *mp, | |
| 343 | − struct xfs_trans *tp, | |
| 344 | − struct xfs_log_vec *log_vector, | |
| 345 | − xfs_lsn_t *commit_lsn, | |
| 346 | − int flags) | |
| 347 | −{ | |
| 348 | − struct log *log = mp->m_log; | |
| 349 | − int log_flags = 0; | |
| 350 | − int push = 0; | |
| 351 | − | |
| 352 | − if (flags & XFS_TRANS_RELEASE_LOG_RES) | |
| 353 | − log_flags = XFS_LOG_REL_PERM_RESERV; | |
| 354 | − | |
| 355 | − if (XLOG_FORCED_SHUTDOWN(log)) { | |
| 356 | − xlog_cil_free_logvec(log_vector); | |
| 357 | − return XFS_ERROR(EIO); | |
| 358 | − } | |
| 359 | − | |
| 360 | − /* lock out background commit */ | |
| 361 | − down_read(&log->l_cilp->xc_ctx_lock); | |
| 362 | − xlog_cil_format_items(log, log_vector, tp->t_ticket, commit_lsn); | |
| 363 | − | |
| 364 | − /* check we didn't blow the reservation */ | |
| 365 | − if (tp->t_ticket->t_curr_res < 0) | |
| 366 | − xlog_print_tic_res(log->l_mp, tp->t_ticket); | |
| 367 | − | |
| 368 | − /* attach the transaction to the CIL if it has any busy extents */ | |
| 369 | − if (!list_empty(&tp->t_busy)) { | |
| 370 | − spin_lock(&log->l_cilp->xc_cil_lock); | |
| 371 | − list_splice_init(&tp->t_busy, | |
| 372 | − &log->l_cilp->xc_ctx->busy_extents); | |
| 373 | − spin_unlock(&log->l_cilp->xc_cil_lock); | |
| 374 | − } | |
| 375 | − | |
| 376 | − tp->t_commit_lsn = *commit_lsn; | |
| 377 | − xfs_log_done(mp, tp->t_ticket, NULL, log_flags); | |
| 378 | − xfs_trans_unreserve_and_mod_sb(tp); | |
| 379 | − | |
| 380 | − /* check for background commit before unlock */ | |
| 381 | − if (log->l_cilp->xc_ctx->space_used > XLOG_CIL_SPACE_LIMIT(log)) | |
| 382 | − push = 1; | |
| 383 | − up_read(&log->l_cilp->xc_ctx_lock); | |
| 384 | − | |
| 385 | − /* | |
| 386 | − * We need to push CIL every so often so we don't cache more than we | |
| 387 | − * can fit in the log. The limit really is that a checkpoint can't be | |
| 388 | − * more than half the log (the current checkpoint is not allowed to | |
| 389 | − * overwrite the previous checkpoint), but commit latency and memory | |
| 390 | − * usage limit this to a smaller size in most cases. | |
| 391 | − */ | |
| 392 | − if (push) | |
| 393 | − xlog_cil_push(log, 0); | |
| 394 | − return 0; | |
| 395 | −} | |
| 396 | − | |
| 397 | 334 | /* |
| 398 | 335 | * Mark all items committed and clear busy extents. We free the log vector |
| 399 | 336 | * chains in a separate pass so that we unpin the log items as quickly as |
| @@ -427,13 +364,23 @@ xlog_cil_committed( · 27 unmodified lines | ||
| 427 | 364 | } |
| 428 | 365 | |
| 429 | 366 | /* |
| 430 | − * Push the Committed Item List to the log. If the push_now flag is not set, | |
| 431 | − * then it is a background flush and so we can chose to ignore it. | |
| 367 | + * Push the Committed Item List to the log. If @push_seq flag is zero, then it | |
| 368 | + * is a background flush and so we can chose to ignore it. Otherwise, if the | |
| 369 | + * current sequence is the same as @push_seq we need to do a flush. If | |
| 370 | + * @push_seq is less than the current sequence, then it has already been | |
| 371 | + * flushed and we don't need to do anything - the caller will wait for it to | |
| 372 | + * complete if necessary. | |
| 373 | + * | |
| 374 | + * @push_seq is a value rather than a flag because that allows us to do an | |
| 375 | + * unlocked check of the sequence number for a match. Hence we can allows log | |
| 376 | + * forces to run racily and not issue pushes for the same sequence twice. If we | |
| 377 | + * get a race between multiple pushes for the same sequence they will block on | |
| 378 | + * the first one and then abort, hence avoiding needless pushes. | |
| 432 | 379 | */ |
| 433 | −int | |
| 380 | +STATIC int | |
| 434 | 381 | xlog_cil_push( |
| 435 | 382 | struct log *log, |
| 436 | − int push_now) | |
| 383 | + xfs_lsn_t push_seq) | |
| 437 | 384 | { |
| 438 | 385 | struct xfs_cil *cil = log->l_cilp; |
| 439 | 386 | struct xfs_log_vec *lv; |
| @@ -453,12 +400,14 @@ xlog_cil_push( · 13 unmodified lines | ||
| 453 | 400 | if (!cil) |
| 454 | 401 | return 0; |
| 455 | 402 | |
| 403 | + ASSERT(!push_seq || push_seq <= cil->xc_ctx->sequence); | |
| 404 | + | |
| 456 | 405 | new_ctx = kmem_zalloc(sizeof(*new_ctx), KM_SLEEP|KM_NOFS); |
| 457 | 406 | new_ctx->ticket = xlog_cil_ticket_alloc(log); |
| 458 | 407 | |
| 459 | 408 | /* lock out transaction commit, but don't block on background push */ |
| 460 | 409 | if (!down_write_trylock(&cil->xc_ctx_lock)) { |
| 461 | − if (!push_now) | |
| 410 | + if (!push_seq) | |
| 462 | 411 | goto out_free_ticket; |
| 463 | 412 | down_write(&cil->xc_ctx_lock); |
| 464 | 413 | } |
| @@ -469,7 +418,11 @@ xlog_cil_push( · 4 unmodified lines | ||
| 469 | 418 | goto out_skip; |
| 470 | 419 | |
| 471 | 420 | /* check for spurious background flush */ |
| 472 | − if (!push_now && cil->xc_ctx->space_used < XLOG_CIL_SPACE_LIMIT(log)) | |
| 421 | + if (!push_seq && cil->xc_ctx->space_used < XLOG_CIL_SPACE_LIMIT(log)) | |
| 422 | + goto out_skip; | |
| 423 | + | |
| 424 | + /* check for a previously pushed seqeunce */ | |
| 425 | + if (push_seq < cil->xc_ctx->sequence) | |
| 473 | 426 | goto out_skip; |
| 474 | 427 | |
| 475 | 428 | /* |
| @@ -514,6 +467,13 @@ xlog_cil_push( · 38 unmodified lines | ||
| 514 | 467 | new_ctx->cil = cil; |
| 515 | 468 | cil->xc_ctx = new_ctx; |
| 516 | 469 | |
| 470 | + /* | |
| 471 | + * mirror the new sequence into the cil structure so that we can do | |
| 472 | + * unlocked checks against the current sequence in log forces without | |
| 473 | + * risking deferencing a freed context pointer. | |
| 474 | + */ | |
| 475 | + cil->xc_current_sequence = new_ctx->sequence; | |
| 476 | + | |
| 517 | 477 | /* |
| 518 | 478 | * The switch is now done, so we can drop the context lock and move out |
| 519 | 479 | * of a shared context. We can't just go straight to the commit record, |
| @@ -625,6 +585,102 @@ out_abort: · 105 unmodified lines | ||
| 625 | 585 | return XFS_ERROR(EIO); |
| 626 | 586 | } |
| 627 | 587 | |
| 588 | +/* | |
| 589 | + * Commit a transaction with the given vector to the Committed Item List. | |
| 590 | + * | |
| 591 | + * To do this, we need to format the item, pin it in memory if required and | |
| 592 | + * account for the space used by the transaction. Once we have done that we | |
| 593 | + * need to release the unused reservation for the transaction, attach the | |
| 594 | + * transaction to the checkpoint context so we carry the busy extents through | |
| 595 | + * to checkpoint completion, and then unlock all the items in the transaction. | |
| 596 | + * | |
| 597 | + * For more specific information about the order of operations in | |
| 598 | + * xfs_log_commit_cil() please refer to the comments in | |
| 599 | + * xfs_trans_commit_iclog(). | |
| 600 | + * | |
| 601 | + * Called with the context lock already held in read mode to lock out | |
| 602 | + * background commit, returns without it held once background commits are | |
| 603 | + * allowed again. | |
| 604 | + */ | |
| 605 | +int | |
| 606 | +xfs_log_commit_cil( | |
| 607 | + struct xfs_mount *mp, | |
| 608 | + struct xfs_trans *tp, | |
| 609 | + struct xfs_log_vec *log_vector, | |
| 610 | + xfs_lsn_t *commit_lsn, | |
| 611 | + int flags) | |
| 612 | +{ | |
| 613 | + struct log *log = mp->m_log; | |
| 614 | + int log_flags = 0; | |
| 615 | + int push = 0; | |
| 616 | + | |
| 617 | + if (flags & XFS_TRANS_RELEASE_LOG_RES) | |
| 618 | + log_flags = XFS_LOG_REL_PERM_RESERV; | |
| 619 | + | |
| 620 | + if (XLOG_FORCED_SHUTDOWN(log)) { | |
| 621 | + xlog_cil_free_logvec(log_vector); | |
| 622 | + return XFS_ERROR(EIO); | |
| 623 | + } | |
| 624 | + | |
| 625 | + /* | |
| 626 | + * do all the hard work of formatting items (including memory | |
| 627 | + * allocation) outside the CIL context lock. This prevents stalling CIL | |
| 628 | + * pushes when we are low on memory and a transaction commit spends a | |
| 629 | + * lot of time in memory reclaim. | |
| 630 | + */ | |
| 631 | + xlog_cil_format_items(log, log_vector); | |
| 632 | + | |
| 633 | + /* lock out background commit */ | |
| 634 | + down_read(&log->l_cilp->xc_ctx_lock); | |
| 635 | + xlog_cil_insert_items(log, log_vector, tp->t_ticket, commit_lsn); | |
| 636 | + | |
| 637 | + /* check we didn't blow the reservation */ | |
| 638 | + if (tp->t_ticket->t_curr_res < 0) | |
| 639 | + xlog_print_tic_res(log->l_mp, tp->t_ticket); | |
| 640 | + | |
| 641 | + /* attach the transaction to the CIL if it has any busy extents */ | |
| 642 | + if (!list_empty(&tp->t_busy)) { | |
| 643 | + spin_lock(&log->l_cilp->xc_cil_lock); | |
| 644 | + list_splice_init(&tp->t_busy, | |
| 645 | + &log->l_cilp->xc_ctx->busy_extents); | |
| 646 | + spin_unlock(&log->l_cilp->xc_cil_lock); | |
| 647 | + } | |
| 648 | + | |
| 649 | + tp->t_commit_lsn = *commit_lsn; | |
| 650 | + xfs_log_done(mp, tp->t_ticket, NULL, log_flags); | |
| 651 | + xfs_trans_unreserve_and_mod_sb(tp); | |
| 652 | + | |
| 653 | + /* | |
| 654 | + * Once all the items of the transaction have been copied to the CIL, | |
| 655 | + * the items can be unlocked and freed. | |
| 656 | + * | |
| 657 | + * This needs to be done before we drop the CIL context lock because we | |
| 658 | + * have to update state in the log items and unlock them before they go | |
| 659 | + * to disk. If we don't, then the CIL checkpoint can race with us and | |
| 660 | + * we can run checkpoint completion before we've updated and unlocked | |
| 661 | + * the log items. This affects (at least) processing of stale buffers, | |
| 662 | + * inodes and EFIs. | |
| 663 | + */ | |
| 664 | + xfs_trans_free_items(tp, *commit_lsn, 0); | |
| 665 | + | |
| 666 | + /* check for background commit before unlock */ | |
| 667 | + if (log->l_cilp->xc_ctx->space_used > XLOG_CIL_SPACE_LIMIT(log)) | |
| 668 | + push = 1; | |
| 669 | + | |
| 670 | + up_read(&log->l_cilp->xc_ctx_lock); | |
| 671 | + | |
| 672 | + /* | |
| 673 | + * We need to push CIL every so often so we don't cache more than we | |
| 674 | + * can fit in the log. The limit really is that a checkpoint can't be | |
| 675 | + * more than half the log (the current checkpoint is not allowed to | |
| 676 | + * overwrite the previous checkpoint), but commit latency and memory | |
| 677 | + * usage limit this to a smaller size in most cases. | |
| 678 | + */ | |
| 679 | + if (push) | |
| 680 | + xlog_cil_push(log, 0); | |
| 681 | + return 0; | |
| 682 | +} | |
| 683 | + | |
| 628 | 684 | /* |
| 629 | 685 | * Conditionally push the CIL based on the sequence passed in. |
| 630 | 686 | * |
| @@ -639,39 +695,34 @@ out_abort: · 8 unmodified lines | ||
| 639 | 695 | * commit lsn is there. It'll be empty, so this is broken for now. |
| 640 | 696 | */ |
| 641 | 697 | xfs_lsn_t |
| 642 | −xlog_cil_push_lsn( | |
| 698 | +xlog_cil_force_lsn( | |
| 643 | 699 | struct log *log, |
| 644 | − xfs_lsn_t push_seq) | |
| 700 | + xfs_lsn_t sequence) | |
| 645 | 701 | { |
| 646 | 702 | struct xfs_cil *cil = log->l_cilp; |
| 647 | 703 | struct xfs_cil_ctx *ctx; |
| 648 | 704 | xfs_lsn_t commit_lsn = NULLCOMMITLSN; |
| 649 | 705 | |
| 650 | −restart: | |
| 651 | − down_write(&cil->xc_ctx_lock); | |
| 652 | − ASSERT(push_seq <= cil->xc_ctx->sequence); | |
| 653 | − | |
| 654 | − /* check to see if we need to force out the current context */ | |
| 655 | − if (push_seq == cil->xc_ctx->sequence) { | |
| 656 | − up_write(&cil->xc_ctx_lock); | |
| 657 | − xlog_cil_push(log, 1); | |
| 658 | − goto restart; | |
| 659 | − } | |
| 706 | + ASSERT(sequence <= cil->xc_current_sequence); | |
| 707 | + | |
| 708 | + /* | |
| 709 | + * check to see if we need to force out the current context. | |
| 710 | + * xlog_cil_push() handles racing pushes for the same sequence, | |
| 711 | + * so no need to deal with it here. | |
| 712 | + */ | |
| 713 | + if (sequence == cil->xc_current_sequence) | |
| 714 | + xlog_cil_push(log, sequence); | |
| 660 | 715 | |
| 661 | 716 | /* |
| 662 | 717 | * See if we can find a previous sequence still committing. |
| 663 | − * We can drop the flush lock as soon as we have the cil lock | |
| 664 | − * because we are now only comparing contexts protected by | |
| 665 | − * the cil lock. | |
| 666 | − * | |
| 667 | 718 | * We need to wait for all previous sequence commits to complete |
| 668 | 719 | * before allowing the force of push_seq to go ahead. Hence block |
| 669 | 720 | * on commits for those as well. |
| 670 | 721 | */ |
| 722 | +restart: | |
| 671 | 723 | spin_lock(&cil->xc_cil_lock); |
| 672 | − up_write(&cil->xc_ctx_lock); | |
| 673 | 724 | list_for_each_entry(ctx, &cil->xc_committing, committing) { |
| 674 | − if (ctx->sequence > push_seq) | |
| 725 | + if (ctx->sequence > sequence) | |
| 675 | 726 | continue; |
| 676 | 727 | if (!ctx->commit_lsn) { |
| 677 | 728 | /* |
| @@ -681,7 +732,7 @@ restart: · 3 unmodified lines | ||
| 681 | 732 | sv_wait(&cil->xc_commit_wait, 0, &cil->xc_cil_lock, 0); |
| 682 | 733 | goto restart; |
| 683 | 734 | } |
| 684 | − if (ctx->sequence != push_seq) | |
| 735 | + if (ctx->sequence != sequence) | |
| 685 | 736 | continue; |
| 686 | 737 | /* found it! */ |
| 687 | 738 | commit_lsn = ctx->commit_lsn; |
| @@ -422,6 +422,7 @@ struct xfs_cil { · 421 unmodified lines | ||
| 422 | 422 | struct rw_semaphore xc_ctx_lock; |
| 423 | 423 | struct list_head xc_committing; |
| 424 | 424 | sv_t xc_commit_wait; |
| 425 | + xfs_lsn_t xc_current_sequence; | |
| 425 | 426 | }; |
| 426 | 427 | |
| 427 | 428 | /* |
| @@ -562,8 +563,16 @@ int xlog_cil_init(struct log *log); · 134 unmodified lines | ||
| 562 | 563 | void xlog_cil_init_post_recovery(struct log *log); |
| 563 | 564 | void xlog_cil_destroy(struct log *log); |
| 564 | 565 | |
| 565 | −int xlog_cil_push(struct log *log, int push_now); | |
| 566 | −xfs_lsn_t xlog_cil_push_lsn(struct log *log, xfs_lsn_t push_sequence); | |
| 566 | +/* | |
| 567 | + * CIL force routines | |
| 568 | + */ | |
| 569 | +xfs_lsn_t xlog_cil_force_lsn(struct log *log, xfs_lsn_t sequence); | |
| 570 | + | |
| 571 | +static inline void | |
| 572 | +xlog_cil_force(struct log *log) | |
| 573 | +{ | |
| 574 | + xlog_cil_force_lsn(log, log->l_cilp->xc_current_sequence); | |
| 575 | +} | |
| 567 | 576 | |
| 568 | 577 | /* |
| 569 | 578 | * Unmount record type is used as a pseudo transaction type for the ticket. |
| @@ -1167,7 +1167,7 @@ xfs_trans_del_item( · 1166 unmodified lines | ||
| 1167 | 1167 | * Unlock all of the items of a transaction and free all the descriptors |
| 1168 | 1168 | * of that transaction. |
| 1169 | 1169 | */ |
| 1170 | −STATIC void | |
| 1170 | +void | |
| 1171 | 1171 | xfs_trans_free_items( |
| 1172 | 1172 | struct xfs_trans *tp, |
| 1173 | 1173 | xfs_lsn_t commit_lsn, |
| @@ -1653,9 +1653,6 @@ xfs_trans_commit_cil( · 479 unmodified lines | ||
| 1653 | 1653 | return error; |
| 1654 | 1654 | |
| 1655 | 1655 | current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); |
| 1656 | − | |
| 1657 | − /* xfs_trans_free_items() unlocks them first */ | |
| 1658 | − xfs_trans_free_items(tp, *commit_lsn, 0); | |
| 1659 | 1656 | xfs_trans_free(tp); |
| 1660 | 1657 | return 0; |
| 1661 | 1658 | } |
| @@ -25,7 +25,8 @@ struct xfs_trans; · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *); |
| 27 | 27 | void xfs_trans_del_item(struct xfs_log_item *); |
| 28 | − | |
| 28 | +void xfs_trans_free_items(struct xfs_trans *tp, xfs_lsn_t commit_lsn, | |
| 29 | + int flags); | |
| 29 | 30 | void xfs_trans_item_committed(struct xfs_log_item *lip, |
| 30 | 31 | xfs_lsn_t commit_lsn, int aborted); |
| 31 | 32 | void xfs_trans_unreserve_and_mod_sb(struct xfs_trans *tp); |
| @@ -2299,15 +2299,22 @@ xfs_alloc_file_space( · 2298 unmodified lines | ||
| 2299 | 2299 | e = allocatesize_fsb; |
| 2300 | 2300 | } |
| 2301 | 2301 | |
| 2302 | + /* | |
| 2303 | + * The transaction reservation is limited to a 32-bit block | |
| 2304 | + * count, hence we need to limit the number of blocks we are | |
| 2305 | + * trying to reserve to avoid an overflow. We can't allocate | |
| 2306 | + * more than @nimaps extents, and an extent is limited on disk | |
| 2307 | + * to MAXEXTLEN (21 bits), so use that to enforce the limit. | |
| 2308 | + */ | |
| 2309 | + resblks = min_t(xfs_fileoff_t, (e - s), (MAXEXTLEN * nimaps)); | |
| 2302 | 2310 | if (unlikely(rt)) { |
| 2303 | − resrtextents = qblocks = (uint)(e - s); | |
| 2311 | + resrtextents = qblocks = resblks; | |
| 2304 | 2312 | resrtextents /= mp->m_sb.sb_rextsize; |
| 2305 | 2313 | resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0); |
| 2306 | 2314 | quota_flag = XFS_QMOPT_RES_RTBLKS; |
| 2307 | 2315 | } else { |
| 2308 | 2316 | resrtextents = 0; |
| 2309 | − resblks = qblocks = \ | |
| 2310 | − XFS_DIOSTRAT_SPACE_RES(mp, (uint)(e - s)); | |
| 2317 | + resblks = qblocks = XFS_DIOSTRAT_SPACE_RES(mp, resblks); | |
| 2311 | 2318 | quota_flag = XFS_QMOPT_RES_REGBLKS; |
| 2312 | 2319 | } |
| 2313 | 2320 | |
| @@ -377,9 +377,6 @@ struct acpi_pci_root { · 376 unmodified lines | ||
| 377 | 377 | |
| 378 | 378 | u32 osc_support_set; /* _OSC state of support bits */ |
| 379 | 379 | u32 osc_control_set; /* _OSC state of control bits */ |
| 380 | − u32 osc_control_qry; /* the latest _OSC query result */ | |
| 381 | − | |
| 382 | − u32 osc_queried:1; /* has _OSC control been queried? */ | |
| 383 | 380 | }; |
| 384 | 381 | |
| 385 | 382 | /* helper */ |
| @@ -16,15 +16,27 @@ · 15 unmodified lines | ||
| 16 | 16 | * While the GPIO programming interface defines valid GPIO numbers |
| 17 | 17 | * to be in the range 0..MAX_INT, this library restricts them to the |
| 18 | 18 | * smaller range 0..ARCH_NR_GPIOS-1. |
| 19 | + * | |
| 20 | + * ARCH_NR_GPIOS is somewhat arbitrary; it usually reflects the sum of | |
| 21 | + * builtin/SoC GPIOs plus a number of GPIOs on expanders; the latter is | |
| 22 | + * actually an estimate of a board-specific value. | |
| 19 | 23 | */ |
| 20 | 24 | |
| 21 | 25 | #ifndef ARCH_NR_GPIOS |
| 22 | 26 | #define ARCH_NR_GPIOS 256 |
| 23 | 27 | #endif |
| 24 | 28 | |
| 29 | +/* | |
| 30 | + * "valid" GPIO numbers are nonnegative and may be passed to | |
| 31 | + * setup routines like gpio_request(). only some valid numbers | |
| 32 | + * can successfully be requested and used. | |
| 33 | + * | |
| 34 | + * Invalid GPIO numbers are useful for indicating no-such-GPIO in | |
| 35 | + * platform data and other tables. | |
| 36 | + */ | |
| 37 | + | |
| 25 | 38 | static inline int gpio_is_valid(int number) |
| 26 | 39 | { |
| 27 | − /* only some non-negative numbers are valid */ | |
| 28 | 40 | return ((unsigned)number) < ARCH_NR_GPIOS; |
| 29 | 41 | } |
| 30 | 42 | |
| @@ -70,11 +70,16 @@ extern void setup_per_cpu_areas(void); · 69 unmodified lines | ||
| 70 | 70 | |
| 71 | 71 | #else /* ! SMP */ |
| 72 | 72 | |
| 73 | −#define per_cpu(var, cpu) (*((void)(cpu), &(var))) | |
| 74 | −#define __get_cpu_var(var) (var) | |
| 75 | −#define __raw_get_cpu_var(var) (var) | |
| 76 | −#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) | |
| 77 | −#define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) | |
| 73 | +#define VERIFY_PERCPU_PTR(__p) ({ \ | |
| 74 | + __verify_pcpu_ptr((__p)); \ | |
| 75 | + (typeof(*(__p)) __kernel __force *)(__p); \ | |
| 76 | +}) | |
| 77 | + | |
| 78 | +#define per_cpu(var, cpu) (*((void)(cpu), VERIFY_PERCPU_PTR(&(var)))) | |
| 79 | +#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) | |
| 80 | +#define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) | |
| 81 | +#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) | |
| 82 | +#define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) | |
| 78 | 83 | |
| 79 | 84 | #endif /* SMP */ |
| 80 | 85 | |
| @@ -304,8 +304,8 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); · 303 unmodified lines | ||
| 304 | 304 | OSC_PCI_EXPRESS_PME_CONTROL | \ |
| 305 | 305 | OSC_PCI_EXPRESS_AER_CONTROL | \ |
| 306 | 306 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) |
| 307 | − | |
| 308 | −extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); | |
| 307 | +extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, | |
| 308 | + u32 *mask, u32 req); | |
| 309 | 309 | extern void acpi_early_init(void); |
| 310 | 310 | |
| 311 | 311 | #else /* !CONFIG_ACPI */ |
| @@ -578,7 +578,12 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp, · 577 unmodified lines | ||
| 578 | 578 | void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); |
| 579 | 579 | int cgroup_scan_tasks(struct cgroup_scanner *scan); |
| 580 | 580 | int cgroup_attach_task(struct cgroup *, struct task_struct *); |
| 581 | −int cgroup_attach_task_current_cg(struct task_struct *); | |
| 581 | +int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); | |
| 582 | + | |
| 583 | +static inline int cgroup_attach_task_current_cg(struct task_struct *tsk) | |
| 584 | +{ | |
| 585 | + return cgroup_attach_task_all(current, tsk); | |
| 586 | +} | |
| 582 | 587 | |
| 583 | 588 | /* |
| 584 | 589 | * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works |
| @@ -636,6 +641,11 @@ static inline int cgroupstats_build(struct cgroupstats *stats, · 51 unmodified lines | ||
| 636 | 641 | } |
| 637 | 642 | |
| 638 | 643 | /* No cgroups - nothing to do */ |
| 644 | +static inline int cgroup_attach_task_all(struct task_struct *from, | |
| 645 | + struct task_struct *t) | |
| 646 | +{ | |
| 647 | + return 0; | |
| 648 | +} | |
| 639 | 649 | static inline int cgroup_attach_task_current_cg(struct task_struct *t) |
| 640 | 650 | { |
| 641 | 651 | return 0; |
| @@ -136,6 +136,7 @@ extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t); · 135 unmodified lines | ||
| 136 | 136 | |
| 137 | 137 | extern int elevator_init(struct request_queue *, char *); |
| 138 | 138 | extern void elevator_exit(struct elevator_queue *); |
| 139 | +extern int elevator_change(struct request_queue *, const char *); | |
| 139 | 140 | extern int elv_rq_merge_ok(struct request *, struct bio *); |
| 140 | 141 | |
| 141 | 142 | /* |
| @@ -65,14 +65,14 @@ · 64 unmodified lines | ||
| 65 | 65 | FAN_ALL_PERM_EVENTS |\ |
| 66 | 66 | FAN_Q_OVERFLOW) |
| 67 | 67 | |
| 68 | −#define FANOTIFY_METADATA_VERSION 1 | |
| 68 | +#define FANOTIFY_METADATA_VERSION 2 | |
| 69 | 69 | |
| 70 | 70 | struct fanotify_event_metadata { |
| 71 | 71 | __u32 event_len; |
| 72 | 72 | __u32 vers; |
| 73 | − __s32 fd; | |
| 74 | 73 | __u64 mask; |
| 75 | − __s64 pid; | |
| 74 | + __s32 fd; | |
| 75 | + __s32 pid; | |
| 76 | 76 | } __attribute__ ((packed)); |
| 77 | 77 | |
| 78 | 78 | struct fanotify_response { |
| @@ -95,11 +95,4 @@ struct fanotify_response { · 16 unmodified lines | ||
| 95 | 95 | (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \ |
| 96 | 96 | (long)(meta)->event_len <= (long)(len)) |
| 97 | 97 | |
| 98 | −#ifdef __KERNEL__ | |
| 99 | − | |
| 100 | −struct fanotify_wait { | |
| 101 | − struct fsnotify_event *event; | |
| 102 | − __s32 fd; | |
| 103 | −}; | |
| 104 | −#endif /* __KERNEL__ */ | |
| 105 | 98 | #endif /* _LINUX_FANOTIFY_H */ |
| @@ -156,6 +156,7 @@ struct fsnotify_group { · 155 unmodified lines | ||
| 156 | 156 | struct mutex access_mutex; |
| 157 | 157 | struct list_head access_list; |
| 158 | 158 | wait_queue_head_t access_waitq; |
| 159 | + bool bypass_perm; /* protected by access_mutex */ | |
| 159 | 160 | #endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ |
| 160 | 161 | int f_flags; |
| 161 | 162 | } fanotify_data; |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/errno.h> |
| 14 | 14 | |
| 15 | 15 | struct device; |
| 16 | +struct gpio_chip; | |
| 16 | 17 | |
| 17 | 18 | /* |
| 18 | 19 | * Some platforms don't support the GPIO programming interface. |
| @@ -63,6 +63,9 @@ · 62 unmodified lines | ||
| 63 | 63 | * IRQ lines will appear. Similarly to gpio_base, the expander |
| 64 | 64 | * will create a block of irqs beginning at this number. |
| 65 | 65 | * This value is ignored if irq_summary is < 0. |
| 66 | + * @reset_during_probe: If set to true, the driver will trigger a full | |
| 67 | + * reset of the chip at the beginning of the probe | |
| 68 | + * in order to place it in a known state. | |
| 66 | 69 | */ |
| 67 | 70 | struct sx150x_platform_data { |
| 68 | 71 | unsigned gpio_base; |
| @@ -73,6 +76,7 @@ struct sx150x_platform_data { · 4 unmodified lines | ||
| 73 | 76 | u16 io_polarity; |
| 74 | 77 | int irq_summary; |
| 75 | 78 | unsigned irq_base; |
| 79 | + bool reset_during_probe; | |
| 76 | 80 | }; |
| 77 | 81 | |
| 78 | 82 | #endif /* __LINUX_I2C_SX150X_H */ |
| @@ -0,0 +1,20 @@ | ||
| 1 | +/* | |
| 2 | + * Common Intel AGPGART and GTT definitions. | |
| 3 | + */ | |
| 4 | +#ifndef _INTEL_GTT_H | |
| 5 | +#define _INTEL_GTT_H | |
| 6 | + | |
| 7 | +#include <linux/agp_backend.h> | |
| 8 | + | |
| 9 | +/* This is for Intel only GTT controls. | |
| 10 | + * | |
| 11 | + * Sandybridge: AGP_USER_CACHED_MEMORY default to LLC only | |
| 12 | + */ | |
| 13 | + | |
| 14 | +#define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2) | |
| 15 | +#define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4) | |
| 16 | + | |
| 17 | +/* flag for GFDT type */ | |
| 18 | +#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) | |
| 19 | + | |
| 20 | +#endif | |
| @@ -79,7 +79,7 @@ io_mapping_free(struct io_mapping *mapping) · 78 unmodified lines | ||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /* Atomic map/unmap */ |
| 82 | −static inline void * | |
| 82 | +static inline void __iomem * | |
| 83 | 83 | io_mapping_map_atomic_wc(struct io_mapping *mapping, |
| 84 | 84 | unsigned long offset, |
| 85 | 85 | int slot) |
| @@ -94,12 +94,12 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, · 8 unmodified lines | ||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | static inline void |
| 97 | −io_mapping_unmap_atomic(void *vaddr, int slot) | |
| 97 | +io_mapping_unmap_atomic(void __iomem *vaddr, int slot) | |
| 98 | 98 | { |
| 99 | 99 | iounmap_atomic(vaddr, slot); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | −static inline void * | |
| 102 | +static inline void __iomem * | |
| 103 | 103 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) |
| 104 | 104 | { |
| 105 | 105 | resource_size_t phys_addr; |
| @@ -111,7 +111,7 @@ io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) · 5 unmodified lines | ||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | static inline void |
| 114 | −io_mapping_unmap(void *vaddr) | |
| 114 | +io_mapping_unmap(void __iomem *vaddr) | |
| 115 | 115 | { |
| 116 | 116 | iounmap(vaddr); |
| 117 | 117 | } |
| @@ -125,38 +125,38 @@ struct io_mapping; · 7 unmodified lines | ||
| 125 | 125 | static inline struct io_mapping * |
| 126 | 126 | io_mapping_create_wc(resource_size_t base, unsigned long size) |
| 127 | 127 | { |
| 128 | − return (struct io_mapping *) ioremap_wc(base, size); | |
| 128 | + return (struct io_mapping __force *) ioremap_wc(base, size); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | static inline void |
| 132 | 132 | io_mapping_free(struct io_mapping *mapping) |
| 133 | 133 | { |
| 134 | − iounmap(mapping); | |
| 134 | + iounmap((void __force __iomem *) mapping); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /* Atomic map/unmap */ |
| 138 | −static inline void * | |
| 138 | +static inline void __iomem * | |
| 139 | 139 | io_mapping_map_atomic_wc(struct io_mapping *mapping, |
| 140 | 140 | unsigned long offset, |
| 141 | 141 | int slot) |
| 142 | 142 | { |
| 143 | − return ((char *) mapping) + offset; | |
| 143 | + return ((char __force __iomem *) mapping) + offset; | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | static inline void |
| 147 | −io_mapping_unmap_atomic(void *vaddr, int slot) | |
| 147 | +io_mapping_unmap_atomic(void __iomem *vaddr, int slot) | |
| 148 | 148 | { |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /* Non-atomic map/unmap */ |
| 152 | −static inline void * | |
| 152 | +static inline void __iomem * | |
| 153 | 153 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) |
| 154 | 154 | { |
| 155 | − return ((char *) mapping) + offset; | |
| 155 | + return ((char __force __iomem *) mapping) + offset; | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | static inline void |
| 159 | −io_mapping_unmap(void *vaddr) | |
| 159 | +io_mapping_unmap(void __iomem *vaddr) | |
| 160 | 160 | { |
| 161 | 161 | } |
| 162 | 162 | |
| @@ -214,7 +214,7 @@ __kfifo_must_check_helper(unsigned int val) · 213 unmodified lines | ||
| 214 | 214 | */ |
| 215 | 215 | #define kfifo_reset(fifo) \ |
| 216 | 216 | (void)({ \ |
| 217 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 217 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 218 | 218 | __tmp->kfifo.in = __tmp->kfifo.out = 0; \ |
| 219 | 219 | }) |
| 220 | 220 | |
| @@ -228,7 +228,7 @@ __kfifo_must_check_helper(unsigned int val) · 7 unmodified lines | ||
| 228 | 228 | */ |
| 229 | 229 | #define kfifo_reset_out(fifo) \ |
| 230 | 230 | (void)({ \ |
| 231 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 231 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 232 | 232 | __tmp->kfifo.out = __tmp->kfifo.in; \ |
| 233 | 233 | }) |
| 234 | 234 | |
| @@ -238,7 +238,7 @@ __kfifo_must_check_helper(unsigned int val) · 3 unmodified lines | ||
| 238 | 238 | */ |
| 239 | 239 | #define kfifo_len(fifo) \ |
| 240 | 240 | ({ \ |
| 241 | − typeof(fifo + 1) __tmpl = (fifo); \ | |
| 241 | + typeof((fifo) + 1) __tmpl = (fifo); \ | |
| 242 | 242 | __tmpl->kfifo.in - __tmpl->kfifo.out; \ |
| 243 | 243 | }) |
| 244 | 244 | |
| @@ -248,7 +248,7 @@ __kfifo_must_check_helper(unsigned int val) · 3 unmodified lines | ||
| 248 | 248 | */ |
| 249 | 249 | #define kfifo_is_empty(fifo) \ |
| 250 | 250 | ({ \ |
| 251 | − typeof(fifo + 1) __tmpq = (fifo); \ | |
| 251 | + typeof((fifo) + 1) __tmpq = (fifo); \ | |
| 252 | 252 | __tmpq->kfifo.in == __tmpq->kfifo.out; \ |
| 253 | 253 | }) |
| 254 | 254 | |
| @@ -258,7 +258,7 @@ __kfifo_must_check_helper(unsigned int val) · 3 unmodified lines | ||
| 258 | 258 | */ |
| 259 | 259 | #define kfifo_is_full(fifo) \ |
| 260 | 260 | ({ \ |
| 261 | − typeof(fifo + 1) __tmpq = (fifo); \ | |
| 261 | + typeof((fifo) + 1) __tmpq = (fifo); \ | |
| 262 | 262 | kfifo_len(__tmpq) > __tmpq->kfifo.mask; \ |
| 263 | 263 | }) |
| 264 | 264 | |
| @@ -269,7 +269,7 @@ __kfifo_must_check_helper(unsigned int val) · 4 unmodified lines | ||
| 269 | 269 | #define kfifo_avail(fifo) \ |
| 270 | 270 | __kfifo_must_check_helper( \ |
| 271 | 271 | ({ \ |
| 272 | − typeof(fifo + 1) __tmpq = (fifo); \ | |
| 272 | + typeof((fifo) + 1) __tmpq = (fifo); \ | |
| 273 | 273 | const size_t __recsize = sizeof(*__tmpq->rectype); \ |
| 274 | 274 | unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \ |
| 275 | 275 | (__recsize) ? ((__avail <= __recsize) ? 0 : \ |
| @@ -284,7 +284,7 @@ __kfifo_must_check_helper( \ · 8 unmodified lines | ||
| 284 | 284 | */ |
| 285 | 285 | #define kfifo_skip(fifo) \ |
| 286 | 286 | (void)({ \ |
| 287 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 287 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 288 | 288 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 289 | 289 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| 290 | 290 | if (__recsize) \ |
| @@ -302,7 +302,7 @@ __kfifo_must_check_helper( \ · 11 unmodified lines | ||
| 302 | 302 | #define kfifo_peek_len(fifo) \ |
| 303 | 303 | __kfifo_must_check_helper( \ |
| 304 | 304 | ({ \ |
| 305 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 305 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 306 | 306 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 307 | 307 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| 308 | 308 | (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \ |
| @@ -325,7 +325,7 @@ __kfifo_must_check_helper( \ · 16 unmodified lines | ||
| 325 | 325 | #define kfifo_alloc(fifo, size, gfp_mask) \ |
| 326 | 326 | __kfifo_must_check_helper( \ |
| 327 | 327 | ({ \ |
| 328 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 328 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 329 | 329 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| 330 | 330 | __is_kfifo_ptr(__tmp) ? \ |
| 331 | 331 | __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \ |
| @@ -339,7 +339,7 @@ __kfifo_must_check_helper( \ · 7 unmodified lines | ||
| 339 | 339 | */ |
| 340 | 340 | #define kfifo_free(fifo) \ |
| 341 | 341 | ({ \ |
| 342 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 342 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 343 | 343 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| 344 | 344 | if (__is_kfifo_ptr(__tmp)) \ |
| 345 | 345 | __kfifo_free(__kfifo); \ |
| @@ -358,7 +358,7 @@ __kfifo_must_check_helper( \ · 12 unmodified lines | ||
| 358 | 358 | */ |
| 359 | 359 | #define kfifo_init(fifo, buffer, size) \ |
| 360 | 360 | ({ \ |
| 361 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 361 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 362 | 362 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| 363 | 363 | __is_kfifo_ptr(__tmp) ? \ |
| 364 | 364 | __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \ |
| @@ -379,8 +379,8 @@ __kfifo_must_check_helper( \ · 14 unmodified lines | ||
| 379 | 379 | */ |
| 380 | 380 | #define kfifo_put(fifo, val) \ |
| 381 | 381 | ({ \ |
| 382 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 383 | − typeof(val + 1) __val = (val); \ | |
| 382 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 383 | + typeof((val) + 1) __val = (val); \ | |
| 384 | 384 | unsigned int __ret; \ |
| 385 | 385 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 386 | 386 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -421,8 +421,8 @@ __kfifo_must_check_helper( \ · 34 unmodified lines | ||
| 421 | 421 | #define kfifo_get(fifo, val) \ |
| 422 | 422 | __kfifo_must_check_helper( \ |
| 423 | 423 | ({ \ |
| 424 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 425 | − typeof(val + 1) __val = (val); \ | |
| 424 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 425 | + typeof((val) + 1) __val = (val); \ | |
| 426 | 426 | unsigned int __ret; \ |
| 427 | 427 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 428 | 428 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -462,8 +462,8 @@ __kfifo_must_check_helper( \ · 33 unmodified lines | ||
| 462 | 462 | #define kfifo_peek(fifo, val) \ |
| 463 | 463 | __kfifo_must_check_helper( \ |
| 464 | 464 | ({ \ |
| 465 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 466 | − typeof(val + 1) __val = (val); \ | |
| 465 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 466 | + typeof((val) + 1) __val = (val); \ | |
| 467 | 467 | unsigned int __ret; \ |
| 468 | 468 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 469 | 469 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -501,8 +501,8 @@ __kfifo_must_check_helper( \ · 31 unmodified lines | ||
| 501 | 501 | */ |
| 502 | 502 | #define kfifo_in(fifo, buf, n) \ |
| 503 | 503 | ({ \ |
| 504 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 505 | − typeof(buf + 1) __buf = (buf); \ | |
| 504 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 505 | + typeof((buf) + 1) __buf = (buf); \ | |
| 506 | 506 | unsigned long __n = (n); \ |
| 507 | 507 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 508 | 508 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -554,8 +554,8 @@ __kfifo_must_check_helper( \ · 45 unmodified lines | ||
| 554 | 554 | #define kfifo_out(fifo, buf, n) \ |
| 555 | 555 | __kfifo_must_check_helper( \ |
| 556 | 556 | ({ \ |
| 557 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 558 | − typeof(buf + 1) __buf = (buf); \ | |
| 557 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 558 | + typeof((buf) + 1) __buf = (buf); \ | |
| 559 | 559 | unsigned long __n = (n); \ |
| 560 | 560 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 561 | 561 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -611,7 +611,7 @@ __kfifo_must_check_helper( \ · 49 unmodified lines | ||
| 611 | 611 | #define kfifo_from_user(fifo, from, len, copied) \ |
| 612 | 612 | __kfifo_must_check_helper( \ |
| 613 | 613 | ({ \ |
| 614 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 614 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 615 | 615 | const void __user *__from = (from); \ |
| 616 | 616 | unsigned int __len = (len); \ |
| 617 | 617 | unsigned int *__copied = (copied); \ |
| @@ -639,7 +639,7 @@ __kfifo_must_check_helper( \ · 21 unmodified lines | ||
| 639 | 639 | #define kfifo_to_user(fifo, to, len, copied) \ |
| 640 | 640 | __kfifo_must_check_helper( \ |
| 641 | 641 | ({ \ |
| 642 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 642 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 643 | 643 | void __user *__to = (to); \ |
| 644 | 644 | unsigned int __len = (len); \ |
| 645 | 645 | unsigned int *__copied = (copied); \ |
| @@ -666,7 +666,7 @@ __kfifo_must_check_helper( \ · 20 unmodified lines | ||
| 666 | 666 | */ |
| 667 | 667 | #define kfifo_dma_in_prepare(fifo, sgl, nents, len) \ |
| 668 | 668 | ({ \ |
| 669 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 669 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 670 | 670 | struct scatterlist *__sgl = (sgl); \ |
| 671 | 671 | int __nents = (nents); \ |
| 672 | 672 | unsigned int __len = (len); \ |
| @@ -690,7 +690,7 @@ __kfifo_must_check_helper( \ · 17 unmodified lines | ||
| 690 | 690 | */ |
| 691 | 691 | #define kfifo_dma_in_finish(fifo, len) \ |
| 692 | 692 | (void)({ \ |
| 693 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 693 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 694 | 694 | unsigned int __len = (len); \ |
| 695 | 695 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 696 | 696 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -717,7 +717,7 @@ __kfifo_must_check_helper( \ · 20 unmodified lines | ||
| 717 | 717 | */ |
| 718 | 718 | #define kfifo_dma_out_prepare(fifo, sgl, nents, len) \ |
| 719 | 719 | ({ \ |
| 720 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 720 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 721 | 721 | struct scatterlist *__sgl = (sgl); \ |
| 722 | 722 | int __nents = (nents); \ |
| 723 | 723 | unsigned int __len = (len); \ |
| @@ -741,7 +741,7 @@ __kfifo_must_check_helper( \ · 17 unmodified lines | ||
| 741 | 741 | */ |
| 742 | 742 | #define kfifo_dma_out_finish(fifo, len) \ |
| 743 | 743 | (void)({ \ |
| 744 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 744 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 745 | 745 | unsigned int __len = (len); \ |
| 746 | 746 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 747 | 747 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -766,8 +766,8 @@ __kfifo_must_check_helper( \ · 18 unmodified lines | ||
| 766 | 766 | #define kfifo_out_peek(fifo, buf, n) \ |
| 767 | 767 | __kfifo_must_check_helper( \ |
| 768 | 768 | ({ \ |
| 769 | − typeof(fifo + 1) __tmp = (fifo); \ | |
| 770 | − typeof(buf + 1) __buf = (buf); \ | |
| 769 | + typeof((fifo) + 1) __tmp = (fifo); \ | |
| 770 | + typeof((buf) + 1) __buf = (buf); \ | |
| 771 | 771 | unsigned long __n = (n); \ |
| 772 | 772 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| 773 | 773 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -16,6 +16,9 @@ · 15 unmodified lines | ||
| 16 | 16 | struct stable_node; |
| 17 | 17 | struct mem_cgroup; |
| 18 | 18 | |
| 19 | +struct page *ksm_does_need_to_copy(struct page *page, | |
| 20 | + struct vm_area_struct *vma, unsigned long address); | |
| 21 | + | |
| 19 | 22 | #ifdef CONFIG_KSM |
| 20 | 23 | int ksm_madvise(struct vm_area_struct *vma, unsigned long start, |
| 21 | 24 | unsigned long end, int advice, unsigned long *vm_flags); |
| @@ -70,19 +73,14 @@ static inline void set_page_stable_node(struct page *page, · 48 unmodified lines | ||
| 70 | 73 | * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE, |
| 71 | 74 | * but what if the vma was unmerged while the page was swapped out? |
| 72 | 75 | */ |
| 73 | −struct page *ksm_does_need_to_copy(struct page *page, | |
| 74 | − struct vm_area_struct *vma, unsigned long address); | |
| 75 | −static inline struct page *ksm_might_need_to_copy(struct page *page, | |
| 76 | +static inline int ksm_might_need_to_copy(struct page *page, | |
| 76 | 77 | struct vm_area_struct *vma, unsigned long address) |
| 77 | 78 | { |
| 78 | 79 | struct anon_vma *anon_vma = page_anon_vma(page); |
| 79 | 80 | |
| 80 | − if (!anon_vma || | |
| 81 | − (anon_vma->root == vma->anon_vma->root && | |
| 82 | − page->index == linear_page_index(vma, address))) | |
| 83 | − return page; | |
| 84 | − | |
| 85 | − return ksm_does_need_to_copy(page, vma, address); | |
| 81 | + return anon_vma && | |
| 82 | + (anon_vma->root != vma->anon_vma->root || | |
| 83 | + page->index != linear_page_index(vma, address)); | |
| 86 | 84 | } |
| 87 | 85 | |
| 88 | 86 | int page_referenced_ksm(struct page *page, |
| @@ -115,10 +113,10 @@ static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, · 26 unmodified lines | ||
| 115 | 113 | return 0; |
| 116 | 114 | } |
| 117 | 115 | |
| 118 | −static inline struct page *ksm_might_need_to_copy(struct page *page, | |
| 116 | +static inline int ksm_might_need_to_copy(struct page *page, | |
| 119 | 117 | struct vm_area_struct *vma, unsigned long address) |
| 120 | 118 | { |
| 121 | − return page; | |
| 119 | + return 0; | |
| 122 | 120 | } |
| 123 | 121 | |
| 124 | 122 | static inline int page_referenced_ksm(struct page *page, |
| @@ -150,7 +150,7 @@ · 149 unmodified lines | ||
| 150 | 150 | int i; \ |
| 151 | 151 | preempt_disable(); \ |
| 152 | 152 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ |
| 153 | − for_each_online_cpu(i) { \ | |
| 153 | + for_each_possible_cpu(i) { \ | |
| 154 | 154 | arch_spinlock_t *lock; \ |
| 155 | 155 | lock = &per_cpu(name##_lock, i); \ |
| 156 | 156 | arch_spin_lock(lock); \ |
| @@ -161,7 +161,7 @@ · 4 unmodified lines | ||
| 161 | 161 | void name##_global_unlock(void) { \ |
| 162 | 162 | int i; \ |
| 163 | 163 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ |
| 164 | − for_each_online_cpu(i) { \ | |
| 164 | + for_each_possible_cpu(i) { \ | |
| 165 | 165 | arch_spinlock_t *lock; \ |
| 166 | 166 | lock = &per_cpu(name##_lock, i); \ |
| 167 | 167 | arch_spin_unlock(lock); \ |
| @@ -335,6 +335,7 @@ enum { · 334 unmodified lines | ||
| 335 | 335 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ |
| 336 | 336 | ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ |
| 337 | 337 | ATA_EHI_QUIET = (1 << 3), /* be quiet */ |
| 338 | + ATA_EHI_NO_RECOVERY = (1 << 4), /* no recovery */ | |
| 338 | 339 | |
| 339 | 340 | ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */ |
| 340 | 341 | ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */ |
| @@ -723,6 +724,7 @@ struct ata_port { · 382 unmodified lines | ||
| 723 | 724 | struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ |
| 724 | 725 | u8 ctl; /* cache of ATA control register */ |
| 725 | 726 | u8 last_ctl; /* Cache last written value */ |
| 727 | + struct ata_link* sff_pio_task_link; /* link currently used */ | |
| 726 | 728 | struct delayed_work sff_pio_task; |
| 727 | 729 | #ifdef CONFIG_ATA_BMDMA |
| 728 | 730 | struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */ |
| @@ -1594,7 +1596,7 @@ extern void ata_sff_irq_on(struct ata_port *ap); · 865 unmodified lines | ||
| 1594 | 1596 | extern void ata_sff_irq_clear(struct ata_port *ap); |
| 1595 | 1597 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
| 1596 | 1598 | u8 status, int in_wq); |
| 1597 | −extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay); | |
| 1599 | +extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); | |
| 1598 | 1600 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); |
| 1599 | 1601 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); |
| 1600 | 1602 | extern unsigned int ata_sff_port_intr(struct ata_port *ap, |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #define MWAVE_MINOR 219 /* ACP/Mwave Modem */ |
| 34 | 34 | #define MPT_MINOR 220 |
| 35 | 35 | #define MPT2SAS_MINOR 221 |
| 36 | +#define UINPUT_MINOR 223 | |
| 36 | 37 | #define HPET_MINOR 228 |
| 37 | 38 | #define FUSE_MINOR 229 |
| 38 | 39 | #define KVM_MINOR 232 |
| @@ -864,6 +864,12 @@ int set_page_dirty(struct page *page); · 863 unmodified lines | ||
| 864 | 864 | int set_page_dirty_lock(struct page *page); |
| 865 | 865 | int clear_page_dirty_for_io(struct page *page); |
| 866 | 866 | |
| 867 | +/* Is the vma a continuation of the stack vma above it? */ | |
| 868 | +static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr) | |
| 869 | +{ | |
| 870 | + return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); | |
| 871 | +} | |
| 872 | + | |
| 867 | 873 | extern unsigned long move_page_tables(struct vm_area_struct *vma, |
| 868 | 874 | unsigned long old_addr, struct vm_area_struct *new_vma, |
| 869 | 875 | unsigned long new_addr, unsigned long len); |
| @@ -1363,7 +1369,15 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma) · 493 unmodified lines | ||
| 1363 | 1369 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
| 1364 | 1370 | } |
| 1365 | 1371 | |
| 1372 | +#ifdef CONFIG_MMU | |
| 1366 | 1373 | pgprot_t vm_get_page_prot(unsigned long vm_flags); |
| 1374 | +#else | |
| 1375 | +static inline pgprot_t vm_get_page_prot(unsigned long vm_flags) | |
| 1376 | +{ | |
| 1377 | + return __pgprot(0); | |
| 1378 | +} | |
| 1379 | +#endif | |
| 1380 | + | |
| 1367 | 1381 | struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); |
| 1368 | 1382 | int remap_pfn_range(struct vm_area_struct *, unsigned long addr, |
| 1369 | 1383 | unsigned long pfn, unsigned long size, pgprot_t); |
| @@ -38,6 +38,8 @@ · 37 unmodified lines | ||
| 38 | 38 | * [8:0] Byte/block count |
| 39 | 39 | */ |
| 40 | 40 | |
| 41 | +#define R4_MEMORY_PRESENT (1 << 27) | |
| 42 | + | |
| 41 | 43 | /* |
| 42 | 44 | SDIO status in R5 |
| 43 | 45 | Type |
| @@ -283,6 +283,13 @@ struct zone { · 282 unmodified lines | ||
| 283 | 283 | /* zone watermarks, access with *_wmark_pages(zone) macros */ |
| 284 | 284 | unsigned long watermark[NR_WMARK]; |
| 285 | 285 | |
| 286 | + /* | |
| 287 | + * When free pages are below this point, additional steps are taken | |
| 288 | + * when reading the number of free pages to avoid per-cpu counter | |
| 289 | + * drift allowing watermarks to be breached | |
| 290 | + */ | |
| 291 | + unsigned long percpu_drift_mark; | |
| 292 | + | |
| 286 | 293 | /* |
| 287 | 294 | * We don't know if the memory that we're going to allocate will be freeable |
| 288 | 295 | * or/and it will be released eventually, so to avoid totally wasting several |
| @@ -441,6 +448,12 @@ static inline int zone_is_oom_locked(const struct zone *zone) · 152 unmodified lines | ||
| 441 | 448 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); |
| 442 | 449 | } |
| 443 | 450 | |
| 451 | +#ifdef CONFIG_SMP | |
| 452 | +unsigned long zone_nr_free_pages(struct zone *zone); | |
| 453 | +#else | |
| 454 | +#define zone_nr_free_pages(zone) zone_page_state(zone, NR_FREE_PAGES) | |
| 455 | +#endif /* CONFIG_SMP */ | |
| 456 | + | |
| 444 | 457 | /* |
| 445 | 458 | * The "priority" of VM scanning is how much of the queues we will scan in one |
| 446 | 459 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the |
| @@ -78,6 +78,14 @@ struct mutex_waiter { · 77 unmodified lines | ||
| 78 | 78 | # include <linux/mutex-debug.h> |
| 79 | 79 | #else |
| 80 | 80 | # define __DEBUG_MUTEX_INITIALIZER(lockname) |
| 81 | +/** | |
| 82 | + * mutex_init - initialize the mutex | |
| 83 | + * @mutex: the mutex to be initialized | |
| 84 | + * | |
| 85 | + * Initialize the mutex to unlocked state. | |
| 86 | + * | |
| 87 | + * It is not allowed to initialize an already locked mutex. | |
| 88 | + */ | |
| 81 | 89 | # define mutex_init(mutex) \ |
| 82 | 90 | do { \ |
| 83 | 91 | static struct lock_class_key __key; \ |
| @@ -1214,6 +1214,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, · 1213 unmodified lines | ||
| 1214 | 1214 | unsigned int devfn) |
| 1215 | 1215 | { return NULL; } |
| 1216 | 1216 | |
| 1217 | +static inline int pci_domain_nr(struct pci_bus *bus) | |
| 1218 | +{ return 0; } | |
| 1219 | + | |
| 1217 | 1220 | #define dev_is_pci(d) (false) |
| 1218 | 1221 | #define dev_is_pf(d) (false) |
| 1219 | 1222 | #define dev_num_vf(d) (0) |
| @@ -2300,6 +2300,8 @@ · 2299 unmodified lines | ||
| 2300 | 2300 | #define PCI_DEVICE_ID_P2010 0x0079 |
| 2301 | 2301 | #define PCI_DEVICE_ID_P1020E 0x0100 |
| 2302 | 2302 | #define PCI_DEVICE_ID_P1020 0x0101 |
| 2303 | +#define PCI_DEVICE_ID_P1021E 0x0102 | |
| 2304 | +#define PCI_DEVICE_ID_P1021 0x0103 | |
| 2303 | 2305 | #define PCI_DEVICE_ID_P1011E 0x0108 |
| 2304 | 2306 | #define PCI_DEVICE_ID_P1011 0x0109 |
| 2305 | 2307 | #define PCI_DEVICE_ID_P1022E 0x0110 |
| @@ -149,7 +149,7 @@ extern void __init percpu_init_late(void); · 148 unmodified lines | ||
| 149 | 149 | |
| 150 | 150 | #else /* CONFIG_SMP */ |
| 151 | 151 | |
| 152 | −#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | |
| 152 | +#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) | |
| 153 | 153 | |
| 154 | 154 | /* can't distinguish from other static vars, always false */ |
| 155 | 155 | static inline bool is_kernel_percpu_address(unsigned long addr) |
| @@ -274,8 +274,14 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) · 273 unmodified lines | ||
| 274 | 274 | int ret; |
| 275 | 275 | |
| 276 | 276 | ret = dquot_alloc_space_nodirty(inode, nr); |
| 277 | − if (!ret) | |
| 278 | − mark_inode_dirty_sync(inode); | |
| 277 | + if (!ret) { | |
| 278 | + /* | |
| 279 | + * Mark inode fully dirty. Since we are allocating blocks, inode | |
| 280 | + * would become fully dirty soon anyway and it reportedly | |
| 281 | + * reduces inode_lock contention. | |
| 282 | + */ | |
| 283 | + mark_inode_dirty(inode); | |
| 284 | + } | |
| 279 | 285 | return ret; |
| 280 | 286 | } |
| 281 | 287 | |
| @@ -26,6 +26,9 @@ struct semaphore { · 25 unmodified lines | ||
| 26 | 26 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | +#define DEFINE_SEMAPHORE(name) \ | |
| 30 | + struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) | |
| 31 | + | |
| 29 | 32 | #define DECLARE_MUTEX(name) \ |
| 30 | 33 | struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) |
| 31 | 34 | |
| @@ -77,8 +77,7 @@ struct serial_struct { · 76 unmodified lines | ||
| 77 | 77 | #define PORT_16654 11 |
| 78 | 78 | #define PORT_16850 12 |
| 79 | 79 | #define PORT_RSA 13 /* RSA-DV II/S card */ |
| 80 | −#define PORT_U6_16550A 14 | |
| 81 | −#define PORT_MAX 14 | |
| 80 | +#define PORT_MAX 13 | |
| 82 | 81 | |
| 83 | 82 | #define SERIAL_IO_PORT 0 |
| 84 | 83 | #define SERIAL_IO_HUB6 1 |
| @@ -44,7 +44,8 @@ · 43 unmodified lines | ||
| 44 | 44 | #define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ |
| 45 | 45 | #define PORT_OCTEON 17 /* Cavium OCTEON internal UART */ |
| 46 | 46 | #define PORT_AR7 18 /* Texas Instruments AR7 internal UART */ |
| 47 | −#define PORT_MAX_8250 18 /* max port ID */ | |
| 47 | +#define PORT_U6_16550A 19 /* ST-Ericsson U6xxx internal UART */ | |
| 48 | +#define PORT_MAX_8250 19 /* max port ID */ | |
| 48 | 49 | |
| 49 | 50 | /* |
| 50 | 51 | * ARM specific type numbers. These are not currently guaranteed |
| @@ -465,7 +466,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) · 414 unmodified lines | ||
| 465 | 466 | #ifdef SUPPORT_SYSRQ |
| 466 | 467 | if (port->sysrq) { |
| 467 | 468 | if (ch && time_before(jiffies, port->sysrq)) { |
| 468 | − handle_sysrq(ch, port->state->port.tty); | |
| 469 | + handle_sysrq(ch); | |
| 469 | 470 | port->sysrq = 0; |
| 470 | 471 | return 1; |
| 471 | 472 | } |
| @@ -14,7 +14,9 @@ · 13 unmodified lines | ||
| 14 | 14 | #define SPI_MODE_OFFSET 6 |
| 15 | 15 | #define SPI_SCPH_OFFSET 6 |
| 16 | 16 | #define SPI_SCOL_OFFSET 7 |
| 17 | + | |
| 17 | 18 | #define SPI_TMOD_OFFSET 8 |
| 19 | +#define SPI_TMOD_MASK (0x3 << SPI_TMOD_OFFSET) | |
| 18 | 20 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ |
| 19 | 21 | #define SPI_TMOD_TO 0x1 /* xmit only */ |
| 20 | 22 | #define SPI_TMOD_RO 0x2 /* recv only */ |
| @@ -19,6 +19,7 @@ struct bio; · 18 unmodified lines | ||
| 19 | 19 | #define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ |
| 20 | 20 | #define SWAP_FLAG_PRIO_MASK 0x7fff |
| 21 | 21 | #define SWAP_FLAG_PRIO_SHIFT 0 |
| 22 | +#define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */ | |
| 22 | 23 | |
| 23 | 24 | static inline int current_is_kswapd(void) |
| 24 | 25 | { |
| @@ -142,7 +143,7 @@ struct swap_extent { · 117 unmodified lines | ||
| 142 | 143 | enum { |
| 143 | 144 | SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ |
| 144 | 145 | SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ |
| 145 | − SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */ | |
| 146 | + SWP_DISCARDABLE = (1 << 2), /* swapon+blkdev support discard */ | |
| 146 | 147 | SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ |
| 147 | 148 | SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ |
| 148 | 149 | SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ |
| @@ -315,6 +316,7 @@ extern long nr_swap_pages; · 166 unmodified lines | ||
| 315 | 316 | extern long total_swap_pages; |
| 316 | 317 | extern void si_swapinfo(struct sysinfo *); |
| 317 | 318 | extern swp_entry_t get_swap_page(void); |
| 319 | +extern swp_entry_t get_swap_page_of_type(int); | |
| 318 | 320 | extern int valid_swaphandles(swp_entry_t, unsigned long *); |
| 319 | 321 | extern int add_swap_count_continuation(swp_entry_t, gfp_t); |
| 320 | 322 | extern void swap_shmem_alloc(swp_entry_t); |
| @@ -331,13 +333,6 @@ extern int reuse_swap_page(struct page *); · 10 unmodified lines | ||
| 331 | 333 | extern int try_to_free_swap(struct page *); |
| 332 | 334 | struct backing_dev_info; |
| 333 | 335 | |
| 334 | −#ifdef CONFIG_HIBERNATION | |
| 335 | −void hibernation_freeze_swap(void); | |
| 336 | −void hibernation_thaw_swap(void); | |
| 337 | −swp_entry_t get_swap_for_hibernation(int type); | |
| 338 | −void swap_free_for_hibernation(swp_entry_t val); | |
| 339 | −#endif | |
| 340 | − | |
| 341 | 336 | /* linux/mm/thrash.c */ |
| 342 | 337 | extern struct mm_struct *swap_token_mm; |
| 343 | 338 | extern void grab_swap_token(struct mm_struct *); |
| @@ -15,9 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #define _LINUX_SYSRQ_H |
| 16 | 16 | |
| 17 | 17 | #include <linux/errno.h> |
| 18 | − | |
| 19 | −struct pt_regs; | |
| 20 | −struct tty_struct; | |
| 18 | +#include <linux/types.h> | |
| 21 | 19 | |
| 22 | 20 | /* Possible values of bitmask for enabling sysrq functions */ |
| 23 | 21 | /* 0x0001 is reserved for enable everything */ |
| @@ -31,7 +29,7 @@ struct tty_struct; · 7 unmodified lines | ||
| 31 | 29 | #define SYSRQ_ENABLE_RTNICE 0x0100 |
| 32 | 30 | |
| 33 | 31 | struct sysrq_key_op { |
| 34 | − void (*handler)(int, struct tty_struct *); | |
| 32 | + void (*handler)(int); | |
| 35 | 33 | char *help_msg; |
| 36 | 34 | char *action_msg; |
| 37 | 35 | int enable_mask; |
| @@ -44,8 +42,8 @@ struct sysrq_key_op { · 6 unmodified lines | ||
| 44 | 42 | * are available -- else NULL's). |
| 45 | 43 | */ |
| 46 | 44 | |
| 47 | −void handle_sysrq(int key, struct tty_struct *tty); | |
| 48 | −void __handle_sysrq(int key, struct tty_struct *tty, int check_mask); | |
| 45 | +void handle_sysrq(int key); | |
| 46 | +void __handle_sysrq(int key, bool check_mask); | |
| 49 | 47 | int register_sysrq_key(int key, struct sysrq_key_op *op); |
| 50 | 48 | int unregister_sysrq_key(int key, struct sysrq_key_op *op); |
| 51 | 49 | struct sysrq_key_op *__sysrq_get_key_op(int key); |
| @@ -54,7 +52,11 @@ int sysrq_toggle_support(int enable_mask); · 2 unmodified lines | ||
| 54 | 52 | |
| 55 | 53 | #else |
| 56 | 54 | |
| 57 | −static inline void handle_sysrq(int key, struct tty_struct *tty) | |
| 55 | +static inline void handle_sysrq(int key) | |
| 56 | +{ | |
| 57 | +} | |
| 58 | + | |
| 59 | +static inline void __handle_sysrq(int key, bool check_mask) | |
| 58 | 60 | { |
| 59 | 61 | } |
| 60 | 62 | |
| @@ -37,7 +37,6 @@ · 36 unmodified lines | ||
| 37 | 37 | #define UINPUT_VERSION 3 |
| 38 | 38 | |
| 39 | 39 | #ifdef __KERNEL__ |
| 40 | −#define UINPUT_MINOR 223 | |
| 41 | 40 | #define UINPUT_NAME "uinput" |
| 42 | 41 | #define UINPUT_BUFFER_SIZE 16 |
| 43 | 42 | #define UINPUT_NUM_REQUESTS 16 |
| @@ -342,8 +342,7 @@ extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, · 341 unmodified lines | ||
| 342 | 342 | extern void usb_serial_generic_process_read_urb(struct urb *urb); |
| 343 | 343 | extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, |
| 344 | 344 | void *dest, size_t size); |
| 345 | −extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, | |
| 346 | − struct usb_serial_port *port, | |
| 345 | +extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, | |
| 347 | 346 | unsigned int ch); |
| 348 | 347 | extern int usb_serial_handle_break(struct usb_serial_port *port); |
| 349 | 348 | |
| @@ -93,8 +93,11 @@ extern void vga_set_legacy_decoding(struct pci_dev *pdev, · 92 unmodified lines | ||
| 93 | 93 | * Nested calls are supported (a per-resource counter is maintained) |
| 94 | 94 | */ |
| 95 | 95 | |
| 96 | −extern int vga_get(struct pci_dev *pdev, unsigned int rsrc, | |
| 97 | − int interruptible); | |
| 96 | +#if defined(CONFIG_VGA_ARB) | |
| 97 | +extern int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible); | |
| 98 | +#else | |
| 99 | +static inline int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible) { return 0; } | |
| 100 | +#endif | |
| 98 | 101 | |
| 99 | 102 | /** |
| 100 | 103 | * vga_get_interruptible |
| @@ -131,7 +134,11 @@ static inline int vga_get_uninterruptible(struct pci_dev *pdev, · 30 unmodified lines | ||
| 131 | 134 | * are already locked by another card. It can be called in any context |
| 132 | 135 | */ |
| 133 | 136 | |
| 137 | +#if defined(CONFIG_VGA_ARB) | |
| 134 | 138 | extern int vga_tryget(struct pci_dev *pdev, unsigned int rsrc); |
| 139 | +#else | |
| 140 | +static inline int vga_tryget(struct pci_dev *pdev, unsigned int rsrc) { return 0; } | |
| 141 | +#endif | |
| 135 | 142 | |
| 136 | 143 | /** |
| 137 | 144 | * vga_put - release lock on legacy VGA resources |
| @@ -146,7 +153,11 @@ extern int vga_tryget(struct pci_dev *pdev, unsigned int rsrc); · 8 unmodified lines | ||
| 146 | 153 | * released if the counter reaches 0. |
| 147 | 154 | */ |
| 148 | 155 | |
| 156 | +#if defined(CONFIG_VGA_ARB) | |
| 149 | 157 | extern void vga_put(struct pci_dev *pdev, unsigned int rsrc); |
| 158 | +#else | |
| 159 | +#define vga_put(pdev, rsrc) | |
| 160 | +#endif | |
| 150 | 161 | |
| 151 | 162 | |
| 152 | 163 | /** |
| @@ -170,6 +170,28 @@ static inline unsigned long zone_page_state(struct zone *zone, · 169 unmodified lines | ||
| 170 | 170 | return x; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | +/* | |
| 174 | + * More accurate version that also considers the currently pending | |
| 175 | + * deltas. For that we need to loop over all cpus to find the current | |
| 176 | + * deltas. There is no synchronization so the result cannot be | |
| 177 | + * exactly accurate either. | |
| 178 | + */ | |
| 179 | +static inline unsigned long zone_page_state_snapshot(struct zone *zone, | |
| 180 | + enum zone_stat_item item) | |
| 181 | +{ | |
| 182 | + long x = atomic_long_read(&zone->vm_stat[item]); | |
| 183 | + | |
| 184 | +#ifdef CONFIG_SMP | |
| 185 | + int cpu; | |
| 186 | + for_each_online_cpu(cpu) | |
| 187 | + x += per_cpu_ptr(zone->pageset, cpu)->vm_stat_diff[item]; | |
| 188 | + | |
| 189 | + if (x < 0) | |
| 190 | + x = 0; | |
| 191 | +#endif | |
| 192 | + return x; | |
| 193 | +} | |
| 194 | + | |
| 173 | 195 | extern unsigned long global_reclaimable_pages(void); |
| 174 | 196 | extern unsigned long zone_reclaimable_pages(struct zone *zone); |
| 175 | 197 | |
| @@ -25,18 +25,20 @@ typedef void (*work_func_t)(struct work_struct *work); · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | enum { |
| 27 | 27 | WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */ |
| 28 | − WORK_STRUCT_CWQ_BIT = 1, /* data points to cwq */ | |
| 29 | − WORK_STRUCT_LINKED_BIT = 2, /* next work is linked to this one */ | |
| 28 | + WORK_STRUCT_DELAYED_BIT = 1, /* work item is delayed */ | |
| 29 | + WORK_STRUCT_CWQ_BIT = 2, /* data points to cwq */ | |
| 30 | + WORK_STRUCT_LINKED_BIT = 3, /* next work is linked to this one */ | |
| 30 | 31 | #ifdef CONFIG_DEBUG_OBJECTS_WORK |
| 31 | − WORK_STRUCT_STATIC_BIT = 3, /* static initializer (debugobjects) */ | |
| 32 | − WORK_STRUCT_COLOR_SHIFT = 4, /* color for workqueue flushing */ | |
| 32 | + WORK_STRUCT_STATIC_BIT = 4, /* static initializer (debugobjects) */ | |
| 33 | + WORK_STRUCT_COLOR_SHIFT = 5, /* color for workqueue flushing */ | |
| 33 | 34 | #else |
| 34 | − WORK_STRUCT_COLOR_SHIFT = 3, /* color for workqueue flushing */ | |
| 35 | + WORK_STRUCT_COLOR_SHIFT = 4, /* color for workqueue flushing */ | |
| 35 | 36 | #endif |
| 36 | 37 | |
| 37 | 38 | WORK_STRUCT_COLOR_BITS = 4, |
| 38 | 39 | |
| 39 | 40 | WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT, |
| 41 | + WORK_STRUCT_DELAYED = 1 << WORK_STRUCT_DELAYED_BIT, | |
| 40 | 42 | WORK_STRUCT_CWQ = 1 << WORK_STRUCT_CWQ_BIT, |
| 41 | 43 | WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT, |
| 42 | 44 | #ifdef CONFIG_DEBUG_OBJECTS_WORK |
| @@ -59,8 +61,8 @@ enum { · 16 unmodified lines | ||
| 59 | 61 | |
| 60 | 62 | /* |
| 61 | 63 | * Reserve 7 bits off of cwq pointer w/ debugobjects turned |
| 62 | − * off. This makes cwqs aligned to 128 bytes which isn't too | |
| 63 | − * excessive while allowing 15 workqueue flush colors. | |
| 64 | + * off. This makes cwqs aligned to 256 bytes and allows 15 | |
| 65 | + * workqueue flush colors. | |
| 64 | 66 | */ |
| 65 | 67 | WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT + |
| 66 | 68 | WORK_STRUCT_COLOR_BITS, |
| @@ -241,6 +243,8 @@ enum { · 174 unmodified lines | ||
| 241 | 243 | WQ_HIGHPRI = 1 << 4, /* high priority */ |
| 242 | 244 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ |
| 243 | 245 | |
| 246 | + WQ_DYING = 1 << 6, /* internal: workqueue is dying */ | |
| 247 | + | |
| 244 | 248 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ |
| 245 | 249 | WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ |
| 246 | 250 | WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2, |
| @@ -27,11 +27,17 @@ struct cgroup_cls_state · 26 unmodified lines | ||
| 27 | 27 | #ifdef CONFIG_NET_CLS_CGROUP |
| 28 | 28 | static inline u32 task_cls_classid(struct task_struct *p) |
| 29 | 29 | { |
| 30 | + int classid; | |
| 31 | + | |
| 30 | 32 | if (in_interrupt()) |
| 31 | 33 | return 0; |
| 32 | 34 | |
| 33 | − return container_of(task_subsys_state(p, net_cls_subsys_id), | |
| 34 | − struct cgroup_cls_state, css)->classid; | |
| 35 | + rcu_read_lock(); | |
| 36 | + classid = container_of(task_subsys_state(p, net_cls_subsys_id), | |
| 37 | + struct cgroup_cls_state, css)->classid; | |
| 38 | + rcu_read_unlock(); | |
| 39 | + | |
| 40 | + return classid; | |
| 35 | 41 | } |
| 36 | 42 | #else |
| 37 | 43 | extern int net_cls_subsys_id; |
| @@ -955,6 +955,9 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum) · 954 unmodified lines | ||
| 955 | 955 | return csum_partial(diff, sizeof(diff), oldsum); |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | +extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, | |
| 959 | + int outin); | |
| 960 | + | |
| 958 | 961 | #endif /* __KERNEL__ */ |
| 959 | 962 | |
| 960 | 963 | #endif /* _NET_IP_VS_H */ |
| @@ -752,6 +752,7 @@ struct proto { · 751 unmodified lines | ||
| 752 | 752 | /* Keeping track of sk's, looking them up, and port selection methods. */ |
| 753 | 753 | void (*hash)(struct sock *sk); |
| 754 | 754 | void (*unhash)(struct sock *sk); |
| 755 | + void (*rehash)(struct sock *sk); | |
| 755 | 756 | int (*get_port)(struct sock *sk, unsigned short snum); |
| 756 | 757 | |
| 757 | 758 | /* Keeping track of sockets in use */ |
| @@ -268,11 +268,21 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) · 267 unmodified lines | ||
| 268 | 268 | return seq3 - seq2 >= seq1 - seq2; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | −static inline int tcp_too_many_orphans(struct sock *sk, int num) | |
| 271 | +static inline bool tcp_too_many_orphans(struct sock *sk, int shift) | |
| 272 | 272 | { |
| 273 | − return (num > sysctl_tcp_max_orphans) || | |
| 274 | − (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | |
| 275 | − atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); | |
| 273 | + struct percpu_counter *ocp = sk->sk_prot->orphan_count; | |
| 274 | + int orphans = percpu_counter_read_positive(ocp); | |
| 275 | + | |
| 276 | + if (orphans << shift > sysctl_tcp_max_orphans) { | |
| 277 | + orphans = percpu_counter_sum_positive(ocp); | |
| 278 | + if (orphans << shift > sysctl_tcp_max_orphans) | |
| 279 | + return true; | |
| 280 | + } | |
| 281 | + | |
| 282 | + if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | |
| 283 | + atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]) | |
| 284 | + return true; | |
| 285 | + return false; | |
| 276 | 286 | } |
| 277 | 287 | |
| 278 | 288 | /* syncookies: remember time of last synqueue overflow */ |
| @@ -151,6 +151,7 @@ static inline void udp_lib_hash(struct sock *sk) · 150 unmodified lines | ||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | extern void udp_lib_unhash(struct sock *sk); |
| 154 | +extern void udp_lib_rehash(struct sock *sk, u16 new_hash); | |
| 154 | 155 | |
| 155 | 156 | static inline void udp_lib_close(struct sock *sk, long timeout) |
| 156 | 157 | { |
| @@ -1791,19 +1791,20 @@ out: · 1790 unmodified lines | ||
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | 1793 | /** |
| 1794 | − * cgroup_attach_task_current_cg - attach task 'tsk' to current task's cgroup | |
| 1794 | + * cgroup_attach_task_all - attach task 'tsk' to all cgroups of task 'from' | |
| 1795 | + * @from: attach to all cgroups of a given task | |
| 1795 | 1796 | * @tsk: the task to be attached |
| 1796 | 1797 | */ |
| 1797 | −int cgroup_attach_task_current_cg(struct task_struct *tsk) | |
| 1798 | +int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk) | |
| 1798 | 1799 | { |
| 1799 | 1800 | struct cgroupfs_root *root; |
| 1800 | − struct cgroup *cur_cg; | |
| 1801 | 1801 | int retval = 0; |
| 1802 | 1802 | |
| 1803 | 1803 | cgroup_lock(); |
| 1804 | 1804 | for_each_active_root(root) { |
| 1805 | − cur_cg = task_cgroup_from_root(current, root); | |
| 1806 | − retval = cgroup_attach_task(cur_cg, tsk); | |
| 1805 | + struct cgroup *from_cg = task_cgroup_from_root(from, root); | |
| 1806 | + | |
| 1807 | + retval = cgroup_attach_task(from_cg, tsk); | |
| 1807 | 1808 | if (retval) |
| 1808 | 1809 | break; |
| 1809 | 1810 | } |
| @@ -1811,7 +1812,7 @@ int cgroup_attach_task_current_cg(struct task_struct *tsk) · 1 unmodified line | ||
| 1811 | 1812 | |
| 1812 | 1813 | return retval; |
| 1813 | 1814 | } |
| 1814 | −EXPORT_SYMBOL_GPL(cgroup_attach_task_current_cg); | |
| 1815 | +EXPORT_SYMBOL_GPL(cgroup_attach_task_all); | |
| 1815 | 1816 | |
| 1816 | 1817 | /* |
| 1817 | 1818 | * Attach task with pid 'pid' to cgroup 'cgrp'. Call with cgroup_mutex |
| @@ -741,7 +741,7 @@ static struct console kgdbcons = { · 740 unmodified lines | ||
| 741 | 741 | }; |
| 742 | 742 | |
| 743 | 743 | #ifdef CONFIG_MAGIC_SYSRQ |
| 744 | −static void sysrq_handle_dbg(int key, struct tty_struct *tty) | |
| 744 | +static void sysrq_handle_dbg(int key) | |
| 745 | 745 | { |
| 746 | 746 | if (!dbg_io_ops) { |
| 747 | 747 | printk(KERN_CRIT "ERROR: No KGDB I/O module available\n"); |
| @@ -274,7 +274,6 @@ static int kdb_bp(int argc, const char **argv) · 273 unmodified lines | ||
| 274 | 274 | int i, bpno; |
| 275 | 275 | kdb_bp_t *bp, *bp_check; |
| 276 | 276 | int diag; |
| 277 | − int free; | |
| 278 | 277 | char *symname = NULL; |
| 279 | 278 | long offset = 0ul; |
| 280 | 279 | int nextarg; |
| @@ -305,7 +304,6 @@ static int kdb_bp(int argc, const char **argv) · 24 unmodified lines | ||
| 305 | 304 | /* |
| 306 | 305 | * Find an empty bp structure to allocate |
| 307 | 306 | */ |
| 308 | − free = KDB_MAXBPT; | |
| 309 | 307 | for (bpno = 0, bp = kdb_breakpoints; bpno < KDB_MAXBPT; bpno++, bp++) { |
| 310 | 308 | if (bp->bp_free) |
| 311 | 309 | break; |
| @@ -1929,7 +1929,7 @@ static int kdb_sr(int argc, const char **argv) · 1928 unmodified lines | ||
| 1929 | 1929 | if (argc != 1) |
| 1930 | 1930 | return KDB_ARGCOUNT; |
| 1931 | 1931 | kdb_trap_printk++; |
| 1932 | − __handle_sysrq(*argv[1], NULL, 0); | |
| 1932 | + __handle_sysrq(*argv[1], false); | |
| 1933 | 1933 | kdb_trap_printk--; |
| 1934 | 1934 | |
| 1935 | 1935 | return 0; |
| @@ -33,10 +33,11 @@ · 32 unmodified lines | ||
| 33 | 33 | * @children: child nodes |
| 34 | 34 | * @all: list head for list of all nodes |
| 35 | 35 | * @parent: parent node |
| 36 | − * @info: associated profiling data structure if not a directory | |
| 37 | − * @ghost: when an object file containing profiling data is unloaded we keep a | |
| 38 | − * copy of the profiling data here to allow collecting coverage data | |
| 39 | − * for cleanup code. Such a node is called a "ghost". | |
| 36 | + * @loaded_info: array of pointers to profiling data sets for loaded object | |
| 37 | + * files. | |
| 38 | + * @num_loaded: number of profiling data sets for loaded object files. | |
| 39 | + * @unloaded_info: accumulated copy of profiling data sets for unloaded | |
| 40 | + * object files. Used only when gcov_persist=1. | |
| 40 | 41 | * @dentry: main debugfs entry, either a directory or data file |
| 41 | 42 | * @links: associated symbolic links |
| 42 | 43 | * @name: data file basename |
| @@ -51,10 +52,11 @@ struct gcov_node { · 8 unmodified lines | ||
| 51 | 52 | struct list_head children; |
| 52 | 53 | struct list_head all; |
| 53 | 54 | struct gcov_node *parent; |
| 54 | − struct gcov_info *info; | |
| 55 | − struct gcov_info *ghost; | |
| 55 | + struct gcov_info **loaded_info; | |
| 56 | + struct gcov_info *unloaded_info; | |
| 56 | 57 | struct dentry *dentry; |
| 57 | 58 | struct dentry **links; |
| 59 | + int num_loaded; | |
| 58 | 60 | char name[0]; |
| 59 | 61 | }; |
| 60 | 62 | |
| @@ -136,16 +138,37 @@ static const struct seq_operations gcov_seq_ops = { · 75 unmodified lines | ||
| 136 | 138 | }; |
| 137 | 139 | |
| 138 | 140 | /* |
| 139 | − * Return the profiling data set for a given node. This can either be the | |
| 140 | − * original profiling data structure or a duplicate (also called "ghost") | |
| 141 | − * in case the associated object file has been unloaded. | |
| 141 | + * Return a profiling data set associated with the given node. This is | |
| 142 | + * either a data set for a loaded object file or a data set copy in case | |
| 143 | + * all associated object files have been unloaded. | |
| 142 | 144 | */ |
| 143 | 145 | static struct gcov_info *get_node_info(struct gcov_node *node) |
| 144 | 146 | { |
| 145 | − if (node->info) | |
| 146 | − return node->info; | |
| 147 | + if (node->num_loaded > 0) | |
| 148 | + return node->loaded_info[0]; | |
| 147 | 149 | |
| 148 | − return node->ghost; | |
| 150 | + return node->unloaded_info; | |
| 151 | +} | |
| 152 | + | |
| 153 | +/* | |
| 154 | + * Return a newly allocated profiling data set which contains the sum of | |
| 155 | + * all profiling data associated with the given node. | |
| 156 | + */ | |
| 157 | +static struct gcov_info *get_accumulated_info(struct gcov_node *node) | |
| 158 | +{ | |
| 159 | + struct gcov_info *info; | |
| 160 | + int i = 0; | |
| 161 | + | |
| 162 | + if (node->unloaded_info) | |
| 163 | + info = gcov_info_dup(node->unloaded_info); | |
| 164 | + else | |
| 165 | + info = gcov_info_dup(node->loaded_info[i++]); | |
| 166 | + if (!info) | |
| 167 | + return NULL; | |
| 168 | + for (; i < node->num_loaded; i++) | |
| 169 | + gcov_info_add(info, node->loaded_info[i]); | |
| 170 | + | |
| 171 | + return info; | |
| 149 | 172 | } |
| 150 | 173 | |
| 151 | 174 | /* |
| @@ -163,9 +186,10 @@ static int gcov_seq_open(struct inode *inode, struct file *file) · 11 unmodified lines | ||
| 163 | 186 | mutex_lock(&node_lock); |
| 164 | 187 | /* |
| 165 | 188 | * Read from a profiling data copy to minimize reference tracking |
| 166 | − * complexity and concurrent access. | |
| 189 | + * complexity and concurrent access and to keep accumulating multiple | |
| 190 | + * profiling data sets associated with one node simple. | |
| 167 | 191 | */ |
| 168 | − info = gcov_info_dup(get_node_info(node)); | |
| 192 | + info = get_accumulated_info(node); | |
| 169 | 193 | if (!info) |
| 170 | 194 | goto out_unlock; |
| 171 | 195 | iter = gcov_iter_new(info); |
| @@ -225,12 +249,25 @@ static struct gcov_node *get_node_by_name(const char *name) · 53 unmodified lines | ||
| 225 | 249 | return NULL; |
| 226 | 250 | } |
| 227 | 251 | |
| 252 | +/* | |
| 253 | + * Reset all profiling data associated with the specified node. | |
| 254 | + */ | |
| 255 | +static void reset_node(struct gcov_node *node) | |
| 256 | +{ | |
| 257 | + int i; | |
| 258 | + | |
| 259 | + if (node->unloaded_info) | |
| 260 | + gcov_info_reset(node->unloaded_info); | |
| 261 | + for (i = 0; i < node->num_loaded; i++) | |
| 262 | + gcov_info_reset(node->loaded_info[i]); | |
| 263 | +} | |
| 264 | + | |
| 228 | 265 | static void remove_node(struct gcov_node *node); |
| 229 | 266 | |
| 230 | 267 | /* |
| 231 | 268 | * write() implementation for gcov data files. Reset profiling data for the |
| 232 | − * associated file. If the object file has been unloaded (i.e. this is | |
| 233 | − * a "ghost" node), remove the debug fs node as well. | |
| 269 | + * corresponding file. If all associated object files have been unloaded, | |
| 270 | + * remove the debug fs node as well. | |
| 234 | 271 | */ |
| 235 | 272 | static ssize_t gcov_seq_write(struct file *file, const char __user *addr, |
| 236 | 273 | size_t len, loff_t *pos) |
| @@ -245,10 +282,10 @@ static ssize_t gcov_seq_write(struct file *file, const char __user *addr, · 8 unmodified lines | ||
| 245 | 282 | node = get_node_by_name(info->filename); |
| 246 | 283 | if (node) { |
| 247 | 284 | /* Reset counts or remove node for unloaded modules. */ |
| 248 | − if (node->ghost) | |
| 285 | + if (node->num_loaded == 0) | |
| 249 | 286 | remove_node(node); |
| 250 | 287 | else |
| 251 | − gcov_info_reset(node->info); | |
| 288 | + reset_node(node); | |
| 252 | 289 | } |
| 253 | 290 | /* Reset counts for open file. */ |
| 254 | 291 | gcov_info_reset(info); |
| @@ -378,7 +415,10 @@ static void init_node(struct gcov_node *node, struct gcov_info *info, · 123 unmodified lines | ||
| 378 | 415 | INIT_LIST_HEAD(&node->list); |
| 379 | 416 | INIT_LIST_HEAD(&node->children); |
| 380 | 417 | INIT_LIST_HEAD(&node->all); |
| 381 | − node->info = info; | |
| 418 | + if (node->loaded_info) { | |
| 419 | + node->loaded_info[0] = info; | |
| 420 | + node->num_loaded = 1; | |
| 421 | + } | |
| 382 | 422 | node->parent = parent; |
| 383 | 423 | if (name) |
| 384 | 424 | strcpy(node->name, name); |
| @@ -394,9 +434,13 @@ static struct gcov_node *new_node(struct gcov_node *parent, · 9 unmodified lines | ||
| 394 | 434 | struct gcov_node *node; |
| 395 | 435 | |
| 396 | 436 | node = kzalloc(sizeof(struct gcov_node) + strlen(name) + 1, GFP_KERNEL); |
| 397 | − if (!node) { | |
| 398 | − pr_warning("out of memory\n"); | |
| 399 | − return NULL; | |
| 437 | + if (!node) | |
| 438 | + goto err_nomem; | |
| 439 | + if (info) { | |
| 440 | + node->loaded_info = kcalloc(1, sizeof(struct gcov_info *), | |
| 441 | + GFP_KERNEL); | |
| 442 | + if (!node->loaded_info) | |
| 443 | + goto err_nomem; | |
| 400 | 444 | } |
| 401 | 445 | init_node(node, info, name, parent); |
| 402 | 446 | /* Differentiate between gcov data file nodes and directory nodes. */ |
| @@ -416,6 +460,11 @@ static struct gcov_node *new_node(struct gcov_node *parent, · 13 unmodified lines | ||
| 416 | 460 | list_add(&node->all, &all_head); |
| 417 | 461 | |
| 418 | 462 | return node; |
| 463 | + | |
| 464 | +err_nomem: | |
| 465 | + kfree(node); | |
| 466 | + pr_warning("out of memory\n"); | |
| 467 | + return NULL; | |
| 419 | 468 | } |
| 420 | 469 | |
| 421 | 470 | /* Remove symbolic links associated with node. */ |
| @@ -441,8 +490,9 @@ static void release_node(struct gcov_node *node) · 19 unmodified lines | ||
| 441 | 490 | list_del(&node->all); |
| 442 | 491 | debugfs_remove(node->dentry); |
| 443 | 492 | remove_links(node); |
| 444 | − if (node->ghost) | |
| 445 | − gcov_info_free(node->ghost); | |
| 493 | + kfree(node->loaded_info); | |
| 494 | + if (node->unloaded_info) | |
| 495 | + gcov_info_free(node->unloaded_info); | |
| 446 | 496 | kfree(node); |
| 447 | 497 | } |
| 448 | 498 | |
| @@ -477,7 +527,7 @@ static struct gcov_node *get_child_by_name(struct gcov_node *parent, · 28 unmodified lines | ||
| 477 | 527 | |
| 478 | 528 | /* |
| 479 | 529 | * write() implementation for reset file. Reset all profiling data to zero |
| 480 | − * and remove ghost nodes. | |
| 530 | + * and remove nodes for which all associated object files are unloaded. | |
| 481 | 531 | */ |
| 482 | 532 | static ssize_t reset_write(struct file *file, const char __user *addr, |
| 483 | 533 | size_t len, loff_t *pos) |
| @@ -487,8 +537,8 @@ static ssize_t reset_write(struct file *file, const char __user *addr, · 3 unmodified lines | ||
| 487 | 537 | mutex_lock(&node_lock); |
| 488 | 538 | restart: |
| 489 | 539 | list_for_each_entry(node, &all_head, all) { |
| 490 | − if (node->info) | |
| 491 | − gcov_info_reset(node->info); | |
| 540 | + if (node->num_loaded > 0) | |
| 541 | + reset_node(node); | |
| 492 | 542 | else if (list_empty(&node->children)) { |
| 493 | 543 | remove_node(node); |
| 494 | 544 | /* Several nodes may have gone - restart loop. */ |
| @@ -564,37 +614,115 @@ err_remove: · 69 unmodified lines | ||
| 564 | 614 | } |
| 565 | 615 | |
| 566 | 616 | /* |
| 567 | − * The profiling data set associated with this node is being unloaded. Store a | |
| 568 | − * copy of the profiling data and turn this node into a "ghost". | |
| 617 | + * Associate a profiling data set with an existing node. Needs to be called | |
| 618 | + * with node_lock held. | |
| 569 | 619 | */ |
| 570 | −static int ghost_node(struct gcov_node *node) | |
| 620 | +static void add_info(struct gcov_node *node, struct gcov_info *info) | |
| 571 | 621 | { |
| 572 | − node->ghost = gcov_info_dup(node->info); | |
| 573 | − if (!node->ghost) { | |
| 574 | − pr_warning("could not save data for '%s' (out of memory)\n", | |
| 575 | − node->info->filename); | |
| 576 | − return -ENOMEM; | |
| 622 | + struct gcov_info **loaded_info; | |
| 623 | + int num = node->num_loaded; | |
| 624 | + | |
| 625 | + /* | |
| 626 | + * Prepare new array. This is done first to simplify cleanup in | |
| 627 | + * case the new data set is incompatible, the node only contains | |
| 628 | + * unloaded data sets and there's not enough memory for the array. | |
| 629 | + */ | |
| 630 | + loaded_info = kcalloc(num + 1, sizeof(struct gcov_info *), GFP_KERNEL); | |
| 631 | + if (!loaded_info) { | |
| 632 | + pr_warning("could not add '%s' (out of memory)\n", | |
| 633 | + info->filename); | |
| 634 | + return; | |
| 635 | + } | |
| 636 | + memcpy(loaded_info, node->loaded_info, | |
| 637 | + num * sizeof(struct gcov_info *)); | |
| 638 | + loaded_info[num] = info; | |
| 639 | + /* Check if the new data set is compatible. */ | |
| 640 | + if (num == 0) { | |
| 641 | + /* | |
| 642 | + * A module was unloaded, modified and reloaded. The new | |
| 643 | + * data set replaces the copy of the last one. | |
| 644 | + */ | |
| 645 | + if (!gcov_info_is_compatible(node->unloaded_info, info)) { | |
| 646 | + pr_warning("discarding saved data for %s " | |
| 647 | + "(incompatible version)\n", info->filename); | |
| 648 | + gcov_info_free(node->unloaded_info); | |
| 649 | + node->unloaded_info = NULL; | |
| 650 | + } | |
| 651 | + } else { | |
| 652 | + /* | |
| 653 | + * Two different versions of the same object file are loaded. | |
| 654 | + * The initial one takes precedence. | |
| 655 | + */ | |
| 656 | + if (!gcov_info_is_compatible(node->loaded_info[0], info)) { | |
| 657 | + pr_warning("could not add '%s' (incompatible " | |
| 658 | + "version)\n", info->filename); | |
| 659 | + kfree(loaded_info); | |
| 660 | + return; | |
| 661 | + } | |
| 577 | 662 | } |
| 578 | − node->info = NULL; | |
| 663 | + /* Overwrite previous array. */ | |
| 664 | + kfree(node->loaded_info); | |
| 665 | + node->loaded_info = loaded_info; | |
| 666 | + node->num_loaded = num + 1; | |
| 667 | +} | |
| 579 | 668 | |
| 580 | − return 0; | |
| 669 | +/* | |
| 670 | + * Return the index of a profiling data set associated with a node. | |
| 671 | + */ | |
| 672 | +static int get_info_index(struct gcov_node *node, struct gcov_info *info) | |
| 673 | +{ | |
| 674 | + int i; | |
| 675 | + | |
| 676 | + for (i = 0; i < node->num_loaded; i++) { | |
| 677 | + if (node->loaded_info[i] == info) | |
| 678 | + return i; | |
| 679 | + } | |
| 680 | + return -ENOENT; | |
| 581 | 681 | } |
| 582 | 682 | |
| 583 | 683 | /* |
| 584 | − * Profiling data for this node has been loaded again. Add profiling data | |
| 585 | − * from previous instantiation and turn this node into a regular node. | |
| 684 | + * Save the data of a profiling data set which is being unloaded. | |
| 586 | 685 | */ |
| 587 | −static void revive_node(struct gcov_node *node, struct gcov_info *info) | |
| 686 | +static void save_info(struct gcov_node *node, struct gcov_info *info) | |
| 588 | 687 | { |
| 589 | − if (gcov_info_is_compatible(node->ghost, info)) | |
| 590 | − gcov_info_add(info, node->ghost); | |
| 688 | + if (node->unloaded_info) | |
| 689 | + gcov_info_add(node->unloaded_info, info); | |
| 591 | 690 | else { |
| 592 | − pr_warning("discarding saved data for '%s' (version changed)\n", | |
| 691 | + node->unloaded_info = gcov_info_dup(info); | |
| 692 | + if (!node->unloaded_info) { | |
| 693 | + pr_warning("could not save data for '%s' " | |
| 694 | + "(out of memory)\n", info->filename); | |
| 695 | + } | |
| 696 | + } | |
| 697 | +} | |
| 698 | + | |
| 699 | +/* | |
| 700 | + * Disassociate a profiling data set from a node. Needs to be called with | |
| 701 | + * node_lock held. | |
| 702 | + */ | |
| 703 | +static void remove_info(struct gcov_node *node, struct gcov_info *info) | |
| 704 | +{ | |
| 705 | + int i; | |
| 706 | + | |
| 707 | + i = get_info_index(node, info); | |
| 708 | + if (i < 0) { | |
| 709 | + pr_warning("could not remove '%s' (not found)\n", | |
| 593 | 710 | info->filename); |
| 711 | + return; | |
| 594 | 712 | } |
| 595 | − gcov_info_free(node->ghost); | |
| 596 | − node->ghost = NULL; | |
| 597 | − node->info = info; | |
| 713 | + if (gcov_persist) | |
| 714 | + save_info(node, info); | |
| 715 | + /* Shrink array. */ | |
| 716 | + node->loaded_info[i] = node->loaded_info[node->num_loaded - 1]; | |
| 717 | + node->num_loaded--; | |
| 718 | + if (node->num_loaded > 0) | |
| 719 | + return; | |
| 720 | + /* Last loaded data set was removed. */ | |
| 721 | + kfree(node->loaded_info); | |
| 722 | + node->loaded_info = NULL; | |
| 723 | + node->num_loaded = 0; | |
| 724 | + if (!node->unloaded_info) | |
| 725 | + remove_node(node); | |
| 598 | 726 | } |
| 599 | 727 | |
| 600 | 728 | /* |
| @@ -609,30 +737,18 @@ void gcov_event(enum gcov_action action, struct gcov_info *info) · 8 unmodified lines | ||
| 609 | 737 | node = get_node_by_name(info->filename); |
| 610 | 738 | switch (action) { |
| 611 | 739 | case GCOV_ADD: |
| 612 | − /* Add new node or revive ghost. */ | |
| 613 | − if (!node) { | |
| 740 | + if (node) | |
| 741 | + add_info(node, info); | |
| 742 | + else | |
| 614 | 743 | add_node(info); |
| 615 | − break; | |
| 616 | − } | |
| 617 | − if (gcov_persist) | |
| 618 | − revive_node(node, info); | |
| 619 | − else { | |
| 620 | − pr_warning("could not add '%s' (already exists)\n", | |
| 621 | − info->filename); | |
| 622 | − } | |
| 623 | 744 | break; |
| 624 | 745 | case GCOV_REMOVE: |
| 625 | − /* Remove node or turn into ghost. */ | |
| 626 | − if (!node) { | |
| 746 | + if (node) | |
| 747 | + remove_info(node, info); | |
| 748 | + else { | |
| 627 | 749 | pr_warning("could not remove '%s' (not found)\n", |
| 628 | 750 | info->filename); |
| 629 | − break; | |
| 630 | 751 | } |
| 631 | − if (gcov_persist) { | |
| 632 | − if (!ghost_node(node)) | |
| 633 | − break; | |
| 634 | − } | |
| 635 | − remove_node(node); | |
| 636 | 752 | break; |
| 637 | 753 | } |
| 638 | 754 | mutex_unlock(&node_lock); |
| @@ -143,10 +143,9 @@ int groups_search(const struct group_info *group_info, gid_t grp) · 142 unmodified lines | ||
| 143 | 143 | right = group_info->ngroups; |
| 144 | 144 | while (left < right) { |
| 145 | 145 | unsigned int mid = (left+right)/2; |
| 146 | − int cmp = grp - GROUP_AT(group_info, mid); | |
| 147 | − if (cmp > 0) | |
| 146 | + if (grp > GROUP_AT(group_info, mid)) | |
| 148 | 147 | left = mid + 1; |
| 149 | − else if (cmp < 0) | |
| 148 | + else if (grp < GROUP_AT(group_info, mid)) | |
| 150 | 149 | right = mid; |
| 151 | 150 | else |
| 152 | 151 | return 1; |
| @@ -1091,11 +1091,10 @@ EXPORT_SYMBOL_GPL(hrtimer_cancel); · 1090 unmodified lines | ||
| 1091 | 1091 | */ |
| 1092 | 1092 | ktime_t hrtimer_get_remaining(const struct hrtimer *timer) |
| 1093 | 1093 | { |
| 1094 | − struct hrtimer_clock_base *base; | |
| 1095 | 1094 | unsigned long flags; |
| 1096 | 1095 | ktime_t rem; |
| 1097 | 1096 | |
| 1098 | − base = lock_hrtimer_base(timer, &flags); | |
| 1097 | + lock_hrtimer_base(timer, &flags); | |
| 1099 | 1098 | rem = hrtimer_expires_remaining(timer); |
| 1100 | 1099 | unlock_hrtimer_base(timer, &flags); |
| 1101 | 1100 | |
| @@ -36,15 +36,6 @@ · 35 unmodified lines | ||
| 36 | 36 | # include <asm/mutex.h> |
| 37 | 37 | #endif |
| 38 | 38 | |
| 39 | −/*** | |
| 40 | − * mutex_init - initialize the mutex | |
| 41 | − * @lock: the mutex to be initialized | |
| 42 | − * @key: the lock_class_key for the class; used by mutex lock debugging | |
| 43 | − * | |
| 44 | − * Initialize the mutex to unlocked state. | |
| 45 | − * | |
| 46 | − * It is not allowed to initialize an already locked mutex. | |
| 47 | − */ | |
| 48 | 39 | void |
| 49 | 40 | __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) |
| 50 | 41 | { |
| @@ -68,7 +59,7 @@ EXPORT_SYMBOL(__mutex_init); · 17 unmodified lines | ||
| 68 | 59 | static __used noinline void __sched |
| 69 | 60 | __mutex_lock_slowpath(atomic_t *lock_count); |
| 70 | 61 | |
| 71 | −/*** | |
| 62 | +/** | |
| 72 | 63 | * mutex_lock - acquire the mutex |
| 73 | 64 | * @lock: the mutex to be acquired |
| 74 | 65 | * |
| @@ -105,7 +96,7 @@ EXPORT_SYMBOL(mutex_lock); · 30 unmodified lines | ||
| 105 | 96 | |
| 106 | 97 | static __used noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count); |
| 107 | 98 | |
| 108 | −/*** | |
| 99 | +/** | |
| 109 | 100 | * mutex_unlock - release the mutex |
| 110 | 101 | * @lock: the mutex to be released |
| 111 | 102 | * |
| @@ -364,8 +355,8 @@ __mutex_lock_killable_slowpath(atomic_t *lock_count); · 252 unmodified lines | ||
| 364 | 355 | static noinline int __sched |
| 365 | 356 | __mutex_lock_interruptible_slowpath(atomic_t *lock_count); |
| 366 | 357 | |
| 367 | −/*** | |
| 368 | − * mutex_lock_interruptible - acquire the mutex, interruptable | |
| 358 | +/** | |
| 359 | + * mutex_lock_interruptible - acquire the mutex, interruptible | |
| 369 | 360 | * @lock: the mutex to be acquired |
| 370 | 361 | * |
| 371 | 362 | * Lock the mutex like mutex_lock(), and return 0 if the mutex has |
| @@ -456,15 +447,15 @@ static inline int __mutex_trylock_slowpath(atomic_t *lock_count) · 84 unmodified lines | ||
| 456 | 447 | return prev == 1; |
| 457 | 448 | } |
| 458 | 449 | |
| 459 | −/*** | |
| 460 | − * mutex_trylock - try acquire the mutex, without waiting | |
| 450 | +/** | |
| 451 | + * mutex_trylock - try to acquire the mutex, without waiting | |
| 461 | 452 | * @lock: the mutex to be acquired |
| 462 | 453 | * |
| 463 | 454 | * Try to acquire the mutex atomically. Returns 1 if the mutex |
| 464 | 455 | * has been acquired successfully, and 0 on contention. |
| 465 | 456 | * |
| 466 | 457 | * NOTE: this function follows the spin_trylock() convention, so |
| 467 | − * it is negated to the down_trylock() return values! Be careful | |
| 458 | + * it is negated from the down_trylock() return values! Be careful | |
| 468 | 459 | * about this when converting semaphore users to mutexes. |
| 469 | 460 | * |
| 470 | 461 | * This function must not be used in interrupt context. The |
| @@ -212,15 +212,17 @@ EXPORT_SYMBOL_GPL(pm_qos_request_active); · 211 unmodified lines | ||
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * pm_qos_add_request - inserts new qos request into the list |
| 215 | − * @pm_qos_class: identifies which list of qos request to us | |
| 215 | + * @dep: pointer to a preallocated handle | |
| 216 | + * @pm_qos_class: identifies which list of qos request to use | |
| 216 | 217 | * @value: defines the qos request |
| 217 | 218 | * |
| 218 | 219 | * This function inserts a new entry in the pm_qos_class list of requested qos |
| 219 | 220 | * performance characteristics. It recomputes the aggregate QoS expectations |
| 220 | − * for the pm_qos_class of parameters, and returns the pm_qos_request list | |
| 221 | − * element as a handle for use in updating and removal. Call needs to save | |
| 222 | − * this handle for later use. | |
| 221 | + * for the pm_qos_class of parameters and initializes the pm_qos_request_list | |
| 222 | + * handle. Caller needs to save this handle for later use in updates and | |
| 223 | + * removal. | |
| 223 | 224 | */ |
| 225 | + | |
| 224 | 226 | void pm_qos_add_request(struct pm_qos_request_list *dep, |
| 225 | 227 | int pm_qos_class, s32 value) |
| 226 | 228 | { |
| @@ -348,7 +350,7 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp) · 121 unmodified lines | ||
| 348 | 350 | |
| 349 | 351 | pm_qos_class = find_pm_qos_object_by_minor(iminor(inode)); |
| 350 | 352 | if (pm_qos_class >= 0) { |
| 351 | − struct pm_qos_request_list *req = kzalloc(GFP_KERNEL, sizeof(*req)); | |
| 353 | + struct pm_qos_request_list *req = kzalloc(sizeof(*req), GFP_KERNEL); | |
| 352 | 354 | if (!req) |
| 353 | 355 | return -ENOMEM; |
| 354 | 356 | |
| @@ -387,10 +389,12 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, · 32 unmodified lines | ||
| 387 | 389 | } else if (count == 11) { /* len('0x12345678/0') */ |
| 388 | 390 | if (copy_from_user(ascii_value, buf, 11)) |
| 389 | 391 | return -EFAULT; |
| 392 | + if (strlen(ascii_value) != 10) | |
| 393 | + return -EINVAL; | |
| 390 | 394 | x = sscanf(ascii_value, "%x", &value); |
| 391 | 395 | if (x != 1) |
| 392 | 396 | return -EINVAL; |
| 393 | − pr_debug(KERN_ERR "%s, %d, 0x%x\n", ascii_value, x, value); | |
| 397 | + pr_debug("%s, %d, 0x%x\n", ascii_value, x, value); | |
| 394 | 398 | } else |
| 395 | 399 | return -EINVAL; |
| 396 | 400 | |
| @@ -338,7 +338,6 @@ int hibernation_snapshot(int platform_mode) · 337 unmodified lines | ||
| 338 | 338 | goto Close; |
| 339 | 339 | |
| 340 | 340 | suspend_console(); |
| 341 | − hibernation_freeze_swap(); | |
| 342 | 341 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); |
| 343 | 342 | error = dpm_suspend_start(PMSG_FREEZE); |
| 344 | 343 | if (error) |
| @@ -24,7 +24,7 @@ static void do_poweroff(struct work_struct *dummy) · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | static DECLARE_WORK(poweroff_work, do_poweroff); |
| 26 | 26 | |
| 27 | −static void handle_poweroff(int key, struct tty_struct *tty) | |
| 27 | +static void handle_poweroff(int key) | |
| 28 | 28 | { |
| 29 | 29 | /* run sysrq poweroff on boot cpu */ |
| 30 | 30 | schedule_work_on(cpumask_first(cpu_online_mask), &poweroff_work); |
| @@ -1086,7 +1086,6 @@ void swsusp_free(void) · 1085 unmodified lines | ||
| 1086 | 1086 | buffer = NULL; |
| 1087 | 1087 | alloc_normal = 0; |
| 1088 | 1088 | alloc_highmem = 0; |
| 1089 | − hibernation_thaw_swap(); | |
| 1090 | 1089 | } |
| 1091 | 1090 | |
| 1092 | 1091 | /* Helper functions used for the shrinking of memory. */ |
| @@ -1122,9 +1121,19 @@ static unsigned long preallocate_image_pages(unsigned long nr_pages, gfp_t mask) · 29 unmodified lines | ||
| 1122 | 1121 | return nr_alloc; |
| 1123 | 1122 | } |
| 1124 | 1123 | |
| 1125 | −static unsigned long preallocate_image_memory(unsigned long nr_pages) | |
| 1124 | +static unsigned long preallocate_image_memory(unsigned long nr_pages, | |
| 1125 | + unsigned long avail_normal) | |
| 1126 | 1126 | { |
| 1127 | − return preallocate_image_pages(nr_pages, GFP_IMAGE); | |
| 1127 | + unsigned long alloc; | |
| 1128 | + | |
| 1129 | + if (avail_normal <= alloc_normal) | |
| 1130 | + return 0; | |
| 1131 | + | |
| 1132 | + alloc = avail_normal - alloc_normal; | |
| 1133 | + if (nr_pages < alloc) | |
| 1134 | + alloc = nr_pages; | |
| 1135 | + | |
| 1136 | + return preallocate_image_pages(alloc, GFP_IMAGE); | |
| 1128 | 1137 | } |
| 1129 | 1138 | |
| 1130 | 1139 | #ifdef CONFIG_HIGHMEM |
| @@ -1170,15 +1179,22 @@ static inline unsigned long preallocate_highmem_fraction(unsigned long nr_pages, · 39 unmodified lines | ||
| 1170 | 1179 | */ |
| 1171 | 1180 | static void free_unnecessary_pages(void) |
| 1172 | 1181 | { |
| 1173 | − unsigned long save_highmem, to_free_normal, to_free_highmem; | |
| 1182 | + unsigned long save, to_free_normal, to_free_highmem; | |
| 1174 | 1183 | |
| 1175 | − to_free_normal = alloc_normal - count_data_pages(); | |
| 1176 | − save_highmem = count_highmem_pages(); | |
| 1177 | − if (alloc_highmem > save_highmem) { | |
| 1178 | − to_free_highmem = alloc_highmem - save_highmem; | |
| 1184 | + save = count_data_pages(); | |
| 1185 | + if (alloc_normal >= save) { | |
| 1186 | + to_free_normal = alloc_normal - save; | |
| 1187 | + save = 0; | |
| 1188 | + } else { | |
| 1189 | + to_free_normal = 0; | |
| 1190 | + save -= alloc_normal; | |
| 1191 | + } | |
| 1192 | + save += count_highmem_pages(); | |
| 1193 | + if (alloc_highmem >= save) { | |
| 1194 | + to_free_highmem = alloc_highmem - save; | |
| 1179 | 1195 | } else { |
| 1180 | 1196 | to_free_highmem = 0; |
| 1181 | − to_free_normal -= save_highmem - alloc_highmem; | |
| 1197 | + to_free_normal -= save - alloc_highmem; | |
| 1182 | 1198 | } |
| 1183 | 1199 | |
| 1184 | 1200 | memory_bm_position_reset(©_bm); |
| @@ -1259,7 +1275,7 @@ int hibernate_preallocate_memory(void) · 74 unmodified lines | ||
| 1259 | 1275 | { |
| 1260 | 1276 | struct zone *zone; |
| 1261 | 1277 | unsigned long saveable, size, max_size, count, highmem, pages = 0; |
| 1262 | − unsigned long alloc, save_highmem, pages_highmem; | |
| 1278 | + unsigned long alloc, save_highmem, pages_highmem, avail_normal; | |
| 1263 | 1279 | struct timeval start, stop; |
| 1264 | 1280 | int error; |
| 1265 | 1281 | |
| @@ -1296,6 +1312,7 @@ int hibernate_preallocate_memory(void) · 30 unmodified lines | ||
| 1296 | 1312 | else |
| 1297 | 1313 | count += zone_page_state(zone, NR_FREE_PAGES); |
| 1298 | 1314 | } |
| 1315 | + avail_normal = count; | |
| 1299 | 1316 | count += highmem; |
| 1300 | 1317 | count -= totalreserve_pages; |
| 1301 | 1318 | |
| @@ -1310,12 +1327,21 @@ int hibernate_preallocate_memory(void) · 8 unmodified lines | ||
| 1310 | 1327 | */ |
| 1311 | 1328 | if (size >= saveable) { |
| 1312 | 1329 | pages = preallocate_image_highmem(save_highmem); |
| 1313 | − pages += preallocate_image_memory(saveable - pages); | |
| 1330 | + pages += preallocate_image_memory(saveable - pages, avail_normal); | |
| 1314 | 1331 | goto out; |
| 1315 | 1332 | } |
| 1316 | 1333 | |
| 1317 | 1334 | /* Estimate the minimum size of the image. */ |
| 1318 | 1335 | pages = minimum_image_size(saveable); |
| 1336 | + /* | |
| 1337 | + * To avoid excessive pressure on the normal zone, leave room in it to | |
| 1338 | + * accommodate an image of the minimum size (unless it's already too | |
| 1339 | + * small, in which case don't preallocate pages from it at all). | |
| 1340 | + */ | |
| 1341 | + if (avail_normal > pages) | |
| 1342 | + avail_normal -= pages; | |
| 1343 | + else | |
| 1344 | + avail_normal = 0; | |
| 1319 | 1345 | if (size < pages) |
| 1320 | 1346 | size = min_t(unsigned long, pages, max_size); |
| 1321 | 1347 | |
| @@ -1336,16 +1362,34 @@ int hibernate_preallocate_memory(void) · 14 unmodified lines | ||
| 1336 | 1362 | */ |
| 1337 | 1363 | pages_highmem = preallocate_image_highmem(highmem / 2); |
| 1338 | 1364 | alloc = (count - max_size) - pages_highmem; |
| 1339 | − pages = preallocate_image_memory(alloc); | |
| 1340 | − if (pages < alloc) | |
| 1341 | − goto err_out; | |
| 1342 | − size = max_size - size; | |
| 1343 | − alloc = size; | |
| 1344 | − size = preallocate_highmem_fraction(size, highmem, count); | |
| 1345 | − pages_highmem += size; | |
| 1346 | − alloc -= size; | |
| 1347 | − pages += preallocate_image_memory(alloc); | |
| 1348 | − pages += pages_highmem; | |
| 1365 | + pages = preallocate_image_memory(alloc, avail_normal); | |
| 1366 | + if (pages < alloc) { | |
| 1367 | + /* We have exhausted non-highmem pages, try highmem. */ | |
| 1368 | + alloc -= pages; | |
| 1369 | + pages += pages_highmem; | |
| 1370 | + pages_highmem = preallocate_image_highmem(alloc); | |
| 1371 | + if (pages_highmem < alloc) | |
| 1372 | + goto err_out; | |
| 1373 | + pages += pages_highmem; | |
| 1374 | + /* | |
| 1375 | + * size is the desired number of saveable pages to leave in | |
| 1376 | + * memory, so try to preallocate (all memory - size) pages. | |
| 1377 | + */ | |
| 1378 | + alloc = (count - pages) - size; | |
| 1379 | + pages += preallocate_image_highmem(alloc); | |
| 1380 | + } else { | |
| 1381 | + /* | |
| 1382 | + * There are approximately max_size saveable pages at this point | |
| 1383 | + * and we want to reduce this number down to size. | |
| 1384 | + */ | |
| 1385 | + alloc = max_size - size; | |
| 1386 | + size = preallocate_highmem_fraction(alloc, highmem, count); | |
| 1387 | + pages_highmem += size; | |
| 1388 | + alloc -= size; | |
| 1389 | + size = preallocate_image_memory(alloc, avail_normal); | |
| 1390 | + pages_highmem += preallocate_image_highmem(alloc - size); | |
| 1391 | + pages += pages_highmem + size; | |
| 1392 | + } | |
| 1349 | 1393 | |
| 1350 | 1394 | /* |
| 1351 | 1395 | * We only need as many page frames for the image as there are saveable |
| @@ -136,10 +136,10 @@ sector_t alloc_swapdev_block(int swap) · 135 unmodified lines | ||
| 136 | 136 | { |
| 137 | 137 | unsigned long offset; |
| 138 | 138 | |
| 139 | − offset = swp_offset(get_swap_for_hibernation(swap)); | |
| 139 | + offset = swp_offset(get_swap_page_of_type(swap)); | |
| 140 | 140 | if (offset) { |
| 141 | 141 | if (swsusp_extents_insert(offset)) |
| 142 | − swap_free_for_hibernation(swp_entry(swap, offset)); | |
| 142 | + swap_free(swp_entry(swap, offset)); | |
| 143 | 143 | else |
| 144 | 144 | return swapdev_block(swap, offset); |
| 145 | 145 | } |
| @@ -163,7 +163,7 @@ void free_all_swap_pages(int swap) · 17 unmodified lines | ||
| 163 | 163 | ext = container_of(node, struct swsusp_extent, node); |
| 164 | 164 | rb_erase(node, &swsusp_extents); |
| 165 | 165 | for (offset = ext->start; offset <= ext->end; offset++) |
| 166 | − swap_free_for_hibernation(swp_entry(swap, offset)); | |
| 166 | + swap_free(swp_entry(swap, offset)); | |
| 167 | 167 | |
| 168 | 168 | kfree(ext); |
| 169 | 169 | } |
| @@ -1294,6 +1294,10 @@ static void resched_task(struct task_struct *p) · 1293 unmodified lines | ||
| 1294 | 1294 | static void sched_rt_avg_update(struct rq *rq, u64 rt_delta) |
| 1295 | 1295 | { |
| 1296 | 1296 | } |
| 1297 | + | |
| 1298 | +static void sched_avg_update(struct rq *rq) | |
| 1299 | +{ | |
| 1300 | +} | |
| 1297 | 1301 | #endif /* CONFIG_SMP */ |
| 1298 | 1302 | |
| 1299 | 1303 | #if BITS_PER_LONG == 32 |
| @@ -3182,6 +3186,8 @@ static void update_cpu_load(struct rq *this_rq) · 1882 unmodified lines | ||
| 3182 | 3186 | |
| 3183 | 3187 | this_rq->cpu_load[i] = (old_load * (scale - 1) + new_load) >> i; |
| 3184 | 3188 | } |
| 3189 | + | |
| 3190 | + sched_avg_update(this_rq); | |
| 3185 | 3191 | } |
| 3186 | 3192 | |
| 3187 | 3193 | static void update_cpu_load_active(struct rq *this_rq) |
| @@ -54,13 +54,13 @@ enum sched_tunable_scaling sysctl_sched_tunable_scaling · 53 unmodified lines | ||
| 54 | 54 | * Minimal preemption granularity for CPU-bound tasks: |
| 55 | 55 | * (default: 2 msec * (1 + ilog(ncpus)), units: nanoseconds) |
| 56 | 56 | */ |
| 57 | −unsigned int sysctl_sched_min_granularity = 2000000ULL; | |
| 58 | −unsigned int normalized_sysctl_sched_min_granularity = 2000000ULL; | |
| 57 | +unsigned int sysctl_sched_min_granularity = 750000ULL; | |
| 58 | +unsigned int normalized_sysctl_sched_min_granularity = 750000ULL; | |
| 59 | 59 | |
| 60 | 60 | /* |
| 61 | 61 | * is kept at sysctl_sched_latency / sysctl_sched_min_granularity |
| 62 | 62 | */ |
| 63 | −static unsigned int sched_nr_latency = 3; | |
| 63 | +static unsigned int sched_nr_latency = 8; | |
| 64 | 64 | |
| 65 | 65 | /* |
| 66 | 66 | * After fork, child runs first. If set to 0 (default) then |
| @@ -1313,7 +1313,7 @@ static struct sched_group * · 1246 unmodified lines | ||
| 1313 | 1313 | find_idlest_group(struct sched_domain *sd, struct task_struct *p, |
| 1314 | 1314 | int this_cpu, int load_idx) |
| 1315 | 1315 | { |
| 1316 | − struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups; | |
| 1316 | + struct sched_group *idlest = NULL, *group = sd->groups; | |
| 1317 | 1317 | unsigned long min_load = ULONG_MAX, this_load = 0; |
| 1318 | 1318 | int imbalance = 100 + (sd->imbalance_pct-100)/2; |
| 1319 | 1319 | |
| @@ -1348,7 +1348,6 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, · 28 unmodified lines | ||
| 1348 | 1348 | |
| 1349 | 1349 | if (local_group) { |
| 1350 | 1350 | this_load = avg_load; |
| 1351 | − this = group; | |
| 1352 | 1351 | } else if (avg_load < min_load) { |
| 1353 | 1352 | min_load = avg_load; |
| 1354 | 1353 | idlest = group; |
| @@ -2268,8 +2267,6 @@ unsigned long scale_rt_power(int cpu) · 913 unmodified lines | ||
| 2268 | 2267 | struct rq *rq = cpu_rq(cpu); |
| 2269 | 2268 | u64 total, available; |
| 2270 | 2269 | |
| 2271 | − sched_avg_update(rq); | |
| 2272 | − | |
| 2273 | 2270 | total = sched_avg_period() + (rq->clock - rq->age_stamp); |
| 2274 | 2271 | available = total - rq->rt_avg; |
| 2275 | 2272 | |
| @@ -3752,6 +3749,8 @@ static void task_fork_fair(struct task_struct *p) · 1476 unmodified lines | ||
| 3752 | 3749 | |
| 3753 | 3750 | raw_spin_lock_irqsave(&rq->lock, flags); |
| 3754 | 3751 | |
| 3752 | + update_rq_clock(rq); | |
| 3753 | + | |
| 3755 | 3754 | if (unlikely(task_cpu(p) != this_cpu)) |
| 3756 | 3755 | __set_task_cpu(p, this_cpu); |
| 3757 | 3756 | |
| @@ -931,6 +931,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) · 930 unmodified lines | ||
| 931 | 931 | pgid = pid; |
| 932 | 932 | if (pgid < 0) |
| 933 | 933 | return -EINVAL; |
| 934 | + rcu_read_lock(); | |
| 934 | 935 | |
| 935 | 936 | /* From this point forward we keep holding onto the tasklist lock |
| 936 | 937 | * so that our parent does not change from under us. -DaveM |
| @@ -984,6 +985,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) · 47 unmodified lines | ||
| 984 | 985 | out: |
| 985 | 986 | /* All paths lead to here, thus we are safe. -DaveM */ |
| 986 | 987 | write_unlock_irq(&tasklist_lock); |
| 988 | + rcu_read_unlock(); | |
| 987 | 989 | return err; |
| 988 | 990 | } |
| 989 | 991 | |
| @@ -1713,10 +1713,7 @@ static __init int sysctl_init(void) · 1712 unmodified lines | ||
| 1713 | 1713 | { |
| 1714 | 1714 | sysctl_set_parent(NULL, root_table); |
| 1715 | 1715 | #ifdef CONFIG_SYSCTL_SYSCALL_CHECK |
| 1716 | − { | |
| 1717 | − int err; | |
| 1718 | − err = sysctl_check_table(current->nsproxy, root_table); | |
| 1719 | − } | |
| 1716 | + sysctl_check_table(current->nsproxy, root_table); | |
| 1720 | 1717 | #endif |
| 1721 | 1718 | return 0; |
| 1722 | 1719 | } |
| @@ -1358,24 +1358,29 @@ enum { · 1357 unmodified lines | ||
| 1358 | 1358 | #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */ |
| 1359 | 1359 | |
| 1360 | 1360 | struct ftrace_iterator { |
| 1361 | − struct ftrace_page *pg; | |
| 1362 | − int hidx; | |
| 1363 | − int idx; | |
| 1364 | − unsigned flags; | |
| 1365 | − struct trace_parser parser; | |
| 1361 | + loff_t pos; | |
| 1362 | + loff_t func_pos; | |
| 1363 | + struct ftrace_page *pg; | |
| 1364 | + struct dyn_ftrace *func; | |
| 1365 | + struct ftrace_func_probe *probe; | |
| 1366 | + struct trace_parser parser; | |
| 1367 | + int hidx; | |
| 1368 | + int idx; | |
| 1369 | + unsigned flags; | |
| 1366 | 1370 | }; |
| 1367 | 1371 | |
| 1368 | 1372 | static void * |
| 1369 | −t_hash_next(struct seq_file *m, void *v, loff_t *pos) | |
| 1373 | +t_hash_next(struct seq_file *m, loff_t *pos) | |
| 1370 | 1374 | { |
| 1371 | 1375 | struct ftrace_iterator *iter = m->private; |
| 1372 | − struct hlist_node *hnd = v; | |
| 1376 | + struct hlist_node *hnd = NULL; | |
| 1373 | 1377 | struct hlist_head *hhd; |
| 1374 | 1378 | |
| 1375 | − WARN_ON(!(iter->flags & FTRACE_ITER_HASH)); | |
| 1376 | − | |
| 1377 | 1379 | (*pos)++; |
| 1380 | + iter->pos = *pos; | |
| 1378 | 1381 | |
| 1382 | + if (iter->probe) | |
| 1383 | + hnd = &iter->probe->node; | |
| 1379 | 1384 | retry: |
| 1380 | 1385 | if (iter->hidx >= FTRACE_FUNC_HASHSIZE) |
| 1381 | 1386 | return NULL; |
| @@ -1398,7 +1403,12 @@ t_hash_next(struct seq_file *m, void *v, loff_t *pos) · 16 unmodified lines | ||
| 1398 | 1403 | } |
| 1399 | 1404 | } |
| 1400 | 1405 | |
| 1401 | − return hnd; | |
| 1406 | + if (WARN_ON_ONCE(!hnd)) | |
| 1407 | + return NULL; | |
| 1408 | + | |
| 1409 | + iter->probe = hlist_entry(hnd, struct ftrace_func_probe, node); | |
| 1410 | + | |
| 1411 | + return iter; | |
| 1402 | 1412 | } |
| 1403 | 1413 | |
| 1404 | 1414 | static void *t_hash_start(struct seq_file *m, loff_t *pos) |
| @@ -1407,26 +1417,32 @@ static void *t_hash_start(struct seq_file *m, loff_t *pos) · 2 unmodified lines | ||
| 1407 | 1417 | void *p = NULL; |
| 1408 | 1418 | loff_t l; |
| 1409 | 1419 | |
| 1410 | − if (!(iter->flags & FTRACE_ITER_HASH)) | |
| 1411 | − *pos = 0; | |
| 1412 | − | |
| 1413 | − iter->flags |= FTRACE_ITER_HASH; | |
| 1420 | + if (iter->func_pos > *pos) | |
| 1421 | + return NULL; | |
| 1414 | 1422 | |
| 1415 | 1423 | iter->hidx = 0; |
| 1416 | − for (l = 0; l <= *pos; ) { | |
| 1417 | − p = t_hash_next(m, p, &l); | |
| 1424 | + for (l = 0; l <= (*pos - iter->func_pos); ) { | |
| 1425 | + p = t_hash_next(m, &l); | |
| 1418 | 1426 | if (!p) |
| 1419 | 1427 | break; |
| 1420 | 1428 | } |
| 1421 | − return p; | |
| 1429 | + if (!p) | |
| 1430 | + return NULL; | |
| 1431 | + | |
| 1432 | + /* Only set this if we have an item */ | |
| 1433 | + iter->flags |= FTRACE_ITER_HASH; | |
| 1434 | + | |
| 1435 | + return iter; | |
| 1422 | 1436 | } |
| 1423 | 1437 | |
| 1424 | −static int t_hash_show(struct seq_file *m, void *v) | |
| 1438 | +static int | |
| 1439 | +t_hash_show(struct seq_file *m, struct ftrace_iterator *iter) | |
| 1425 | 1440 | { |
| 1426 | 1441 | struct ftrace_func_probe *rec; |
| 1427 | − struct hlist_node *hnd = v; | |
| 1428 | 1442 | |
| 1429 | − rec = hlist_entry(hnd, struct ftrace_func_probe, node); | |
| 1443 | + rec = iter->probe; | |
| 1444 | + if (WARN_ON_ONCE(!rec)) | |
| 1445 | + return -EIO; | |
| 1430 | 1446 | |
| 1431 | 1447 | if (rec->ops->print) |
| 1432 | 1448 | return rec->ops->print(m, rec->ip, rec->ops, rec->data); |
| @@ -1447,12 +1463,13 @@ t_next(struct seq_file *m, void *v, loff_t *pos) · 14 unmodified lines | ||
| 1447 | 1463 | struct dyn_ftrace *rec = NULL; |
| 1448 | 1464 | |
| 1449 | 1465 | if (iter->flags & FTRACE_ITER_HASH) |
| 1450 | − return t_hash_next(m, v, pos); | |
| 1466 | + return t_hash_next(m, pos); | |
| 1451 | 1467 | |
| 1452 | 1468 | (*pos)++; |
| 1469 | + iter->pos = *pos; | |
| 1453 | 1470 | |
| 1454 | 1471 | if (iter->flags & FTRACE_ITER_PRINTALL) |
| 1455 | − return NULL; | |
| 1472 | + return t_hash_start(m, pos); | |
| 1456 | 1473 | |
| 1457 | 1474 | retry: |
| 1458 | 1475 | if (iter->idx >= iter->pg->index) { |
| @@ -1481,7 +1498,20 @@ t_next(struct seq_file *m, void *v, loff_t *pos) · 22 unmodified lines | ||
| 1481 | 1498 | } |
| 1482 | 1499 | } |
| 1483 | 1500 | |
| 1484 | − return rec; | |
| 1501 | + if (!rec) | |
| 1502 | + return t_hash_start(m, pos); | |
| 1503 | + | |
| 1504 | + iter->func_pos = *pos; | |
| 1505 | + iter->func = rec; | |
| 1506 | + | |
| 1507 | + return iter; | |
| 1508 | +} | |
| 1509 | + | |
| 1510 | +static void reset_iter_read(struct ftrace_iterator *iter) | |
| 1511 | +{ | |
| 1512 | + iter->pos = 0; | |
| 1513 | + iter->func_pos = 0; | |
| 1514 | + iter->flags &= ~(FTRACE_ITER_PRINTALL & FTRACE_ITER_HASH); | |
| 1485 | 1515 | } |
| 1486 | 1516 | |
| 1487 | 1517 | static void *t_start(struct seq_file *m, loff_t *pos) |
| @@ -1491,6 +1521,12 @@ static void *t_start(struct seq_file *m, loff_t *pos) · 3 unmodified lines | ||
| 1491 | 1521 | loff_t l; |
| 1492 | 1522 | |
| 1493 | 1523 | mutex_lock(&ftrace_lock); |
| 1524 | + /* | |
| 1525 | + * If an lseek was done, then reset and start from beginning. | |
| 1526 | + */ | |
| 1527 | + if (*pos < iter->pos) | |
| 1528 | + reset_iter_read(iter); | |
| 1529 | + | |
| 1494 | 1530 | /* |
| 1495 | 1531 | * For set_ftrace_filter reading, if we have the filter |
| 1496 | 1532 | * off, we can short cut and just print out that all |
| @@ -1500,12 +1536,19 @@ static void *t_start(struct seq_file *m, loff_t *pos) · 3 unmodified lines | ||
| 1500 | 1536 | if (*pos > 0) |
| 1501 | 1537 | return t_hash_start(m, pos); |
| 1502 | 1538 | iter->flags |= FTRACE_ITER_PRINTALL; |
| 1539 | + /* reset in case of seek/pread */ | |
| 1540 | + iter->flags &= ~FTRACE_ITER_HASH; | |
| 1503 | 1541 | return iter; |
| 1504 | 1542 | } |
| 1505 | 1543 | |
| 1506 | 1544 | if (iter->flags & FTRACE_ITER_HASH) |
| 1507 | 1545 | return t_hash_start(m, pos); |
| 1508 | 1546 | |
| 1547 | + /* | |
| 1548 | + * Unfortunately, we need to restart at ftrace_pages_start | |
| 1549 | + * every time we let go of the ftrace_mutex. This is because | |
| 1550 | + * those pointers can change without the lock. | |
| 1551 | + */ | |
| 1509 | 1552 | iter->pg = ftrace_pages_start; |
| 1510 | 1553 | iter->idx = 0; |
| 1511 | 1554 | for (l = 0; l <= *pos; ) { |
| @@ -1514,10 +1557,14 @@ static void *t_start(struct seq_file *m, loff_t *pos) · 2 unmodified lines | ||
| 1514 | 1557 | break; |
| 1515 | 1558 | } |
| 1516 | 1559 | |
| 1517 | − if (!p && iter->flags & FTRACE_ITER_FILTER) | |
| 1518 | − return t_hash_start(m, pos); | |
| 1560 | + if (!p) { | |
| 1561 | + if (iter->flags & FTRACE_ITER_FILTER) | |
| 1562 | + return t_hash_start(m, pos); | |
| 1519 | 1563 | |
| 1520 | − return p; | |
| 1564 | + return NULL; | |
| 1565 | + } | |
| 1566 | + | |
| 1567 | + return iter; | |
| 1521 | 1568 | } |
| 1522 | 1569 | |
| 1523 | 1570 | static void t_stop(struct seq_file *m, void *p) |
| @@ -1528,16 +1575,18 @@ static void t_stop(struct seq_file *m, void *p) · 4 unmodified lines | ||
| 1528 | 1575 | static int t_show(struct seq_file *m, void *v) |
| 1529 | 1576 | { |
| 1530 | 1577 | struct ftrace_iterator *iter = m->private; |
| 1531 | − struct dyn_ftrace *rec = v; | |
| 1578 | + struct dyn_ftrace *rec; | |
| 1532 | 1579 | |
| 1533 | 1580 | if (iter->flags & FTRACE_ITER_HASH) |
| 1534 | − return t_hash_show(m, v); | |
| 1581 | + return t_hash_show(m, iter); | |
| 1535 | 1582 | |
| 1536 | 1583 | if (iter->flags & FTRACE_ITER_PRINTALL) { |
| 1537 | 1584 | seq_printf(m, "#### all functions enabled ####\n"); |
| 1538 | 1585 | return 0; |
| 1539 | 1586 | } |
| 1540 | 1587 | |
| 1588 | + rec = iter->func; | |
| 1589 | + | |
| 1541 | 1590 | if (!rec) |
| 1542 | 1591 | return 0; |
| 1543 | 1592 | |
| @@ -2406,7 +2455,7 @@ static const struct file_operations ftrace_filter_fops = { · 862 unmodified lines | ||
| 2406 | 2455 | .open = ftrace_filter_open, |
| 2407 | 2456 | .read = seq_read, |
| 2408 | 2457 | .write = ftrace_filter_write, |
| 2409 | − .llseek = no_llseek, | |
| 2458 | + .llseek = ftrace_regex_lseek, | |
| 2410 | 2459 | .release = ftrace_filter_release, |
| 2411 | 2460 | }; |
| 2412 | 2461 | |
| @@ -2994,13 +2994,11 @@ static void rb_advance_reader(struct ring_buffer_per_cpu *cpu_buffer) · 2993 unmodified lines | ||
| 2994 | 2994 | |
| 2995 | 2995 | static void rb_advance_iter(struct ring_buffer_iter *iter) |
| 2996 | 2996 | { |
| 2997 | − struct ring_buffer *buffer; | |
| 2998 | 2997 | struct ring_buffer_per_cpu *cpu_buffer; |
| 2999 | 2998 | struct ring_buffer_event *event; |
| 3000 | 2999 | unsigned length; |
| 3001 | 3000 | |
| 3002 | 3001 | cpu_buffer = iter->cpu_buffer; |
| 3003 | − buffer = cpu_buffer->buffer; | |
| 3004 | 3002 | |
| 3005 | 3003 | /* |
| 3006 | 3004 | * Check if we are at the end of the buffer. |
| @@ -90,7 +90,8 @@ enum { · 89 unmodified lines | ||
| 90 | 90 | /* |
| 91 | 91 | * Structure fields follow one of the following exclusion rules. |
| 92 | 92 | * |
| 93 | − * I: Set during initialization and read-only afterwards. | |
| 93 | + * I: Modifiable by initialization/destruction paths and read-only for | |
| 94 | + * everyone else. | |
| 94 | 95 | * |
| 95 | 96 | * P: Preemption protected. Disabling preemption is enough and should |
| 96 | 97 | * only be modified and accessed from the local cpu. |
| @@ -198,7 +199,7 @@ typedef cpumask_var_t mayday_mask_t; · 101 unmodified lines | ||
| 198 | 199 | cpumask_test_and_set_cpu((cpu), (mask)) |
| 199 | 200 | #define mayday_clear_cpu(cpu, mask) cpumask_clear_cpu((cpu), (mask)) |
| 200 | 201 | #define for_each_mayday_cpu(cpu, mask) for_each_cpu((cpu), (mask)) |
| 201 | −#define alloc_mayday_mask(maskp, gfp) alloc_cpumask_var((maskp), (gfp)) | |
| 202 | +#define alloc_mayday_mask(maskp, gfp) zalloc_cpumask_var((maskp), (gfp)) | |
| 202 | 203 | #define free_mayday_mask(mask) free_cpumask_var((mask)) |
| 203 | 204 | #else |
| 204 | 205 | typedef unsigned long mayday_mask_t; |
| @@ -943,10 +944,14 @@ static void __queue_work(unsigned int cpu, struct workqueue_struct *wq, · 738 unmodified lines | ||
| 943 | 944 | struct global_cwq *gcwq; |
| 944 | 945 | struct cpu_workqueue_struct *cwq; |
| 945 | 946 | struct list_head *worklist; |
| 947 | + unsigned int work_flags; | |
| 946 | 948 | unsigned long flags; |
| 947 | 949 | |
| 948 | 950 | debug_work_activate(work); |
| 949 | 951 | |
| 952 | + if (WARN_ON_ONCE(wq->flags & WQ_DYING)) | |
| 953 | + return; | |
| 954 | + | |
| 950 | 955 | /* determine gcwq to use */ |
| 951 | 956 | if (!(wq->flags & WQ_UNBOUND)) { |
| 952 | 957 | struct global_cwq *last_gcwq; |
| @@ -989,14 +994,17 @@ static void __queue_work(unsigned int cpu, struct workqueue_struct *wq, · 36 unmodified lines | ||
| 989 | 994 | BUG_ON(!list_empty(&work->entry)); |
| 990 | 995 | |
| 991 | 996 | cwq->nr_in_flight[cwq->work_color]++; |
| 997 | + work_flags = work_color_to_flags(cwq->work_color); | |
| 992 | 998 | |
| 993 | 999 | if (likely(cwq->nr_active < cwq->max_active)) { |
| 994 | 1000 | cwq->nr_active++; |
| 995 | 1001 | worklist = gcwq_determine_ins_pos(gcwq, cwq); |
| 996 | − } else | |
| 1002 | + } else { | |
| 1003 | + work_flags |= WORK_STRUCT_DELAYED; | |
| 997 | 1004 | worklist = &cwq->delayed_works; |
| 1005 | + } | |
| 998 | 1006 | |
| 999 | − insert_work(cwq, work, worklist, work_color_to_flags(cwq->work_color)); | |
| 1007 | + insert_work(cwq, work, worklist, work_flags); | |
| 1000 | 1008 | |
| 1001 | 1009 | spin_unlock_irqrestore(&gcwq->lock, flags); |
| 1002 | 1010 | } |
| @@ -1215,6 +1223,7 @@ static void worker_leave_idle(struct worker *worker) · 212 unmodified lines | ||
| 1215 | 1223 | * bound), %false if offline. |
| 1216 | 1224 | */ |
| 1217 | 1225 | static bool worker_maybe_bind_and_lock(struct worker *worker) |
| 1226 | +__acquires(&gcwq->lock) | |
| 1218 | 1227 | { |
| 1219 | 1228 | struct global_cwq *gcwq = worker->gcwq; |
| 1220 | 1229 | struct task_struct *task = worker->task; |
| @@ -1488,6 +1497,8 @@ static void gcwq_mayday_timeout(unsigned long __gcwq) · 267 unmodified lines | ||
| 1488 | 1497 | * otherwise. |
| 1489 | 1498 | */ |
| 1490 | 1499 | static bool maybe_create_worker(struct global_cwq *gcwq) |
| 1500 | +__releases(&gcwq->lock) | |
| 1501 | +__acquires(&gcwq->lock) | |
| 1491 | 1502 | { |
| 1492 | 1503 | if (!need_to_create_worker(gcwq)) |
| 1493 | 1504 | return false; |
| @@ -1662,6 +1673,7 @@ static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq) · 168 unmodified lines | ||
| 1662 | 1673 | struct list_head *pos = gcwq_determine_ins_pos(cwq->gcwq, cwq); |
| 1663 | 1674 | |
| 1664 | 1675 | move_linked_works(work, pos, NULL); |
| 1676 | + __clear_bit(WORK_STRUCT_DELAYED_BIT, work_data_bits(work)); | |
| 1665 | 1677 | cwq->nr_active++; |
| 1666 | 1678 | } |
| 1667 | 1679 | |
| @@ -1669,6 +1681,7 @@ static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq) · 1 unmodified line | ||
| 1669 | 1681 | * cwq_dec_nr_in_flight - decrement cwq's nr_in_flight |
| 1670 | 1682 | * @cwq: cwq of interest |
| 1671 | 1683 | * @color: color of work which left the queue |
| 1684 | + * @delayed: for a delayed work | |
| 1672 | 1685 | * |
| 1673 | 1686 | * A work either has completed or is removed from pending queue, |
| 1674 | 1687 | * decrement nr_in_flight of its cwq and handle workqueue flushing. |
| @@ -1676,19 +1689,22 @@ static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq) · 1 unmodified line | ||
| 1676 | 1689 | * CONTEXT: |
| 1677 | 1690 | * spin_lock_irq(gcwq->lock). |
| 1678 | 1691 | */ |
| 1679 | −static void cwq_dec_nr_in_flight(struct cpu_workqueue_struct *cwq, int color) | |
| 1692 | +static void cwq_dec_nr_in_flight(struct cpu_workqueue_struct *cwq, int color, | |
| 1693 | + bool delayed) | |
| 1680 | 1694 | { |
| 1681 | 1695 | /* ignore uncolored works */ |
| 1682 | 1696 | if (color == WORK_NO_COLOR) |
| 1683 | 1697 | return; |
| 1684 | 1698 | |
| 1685 | 1699 | cwq->nr_in_flight[color]--; |
| 1686 | − cwq->nr_active--; | |
| 1687 | 1700 | |
| 1688 | − if (!list_empty(&cwq->delayed_works)) { | |
| 1689 | − /* one down, submit a delayed one */ | |
| 1690 | − if (cwq->nr_active < cwq->max_active) | |
| 1691 | − cwq_activate_first_delayed(cwq); | |
| 1701 | + if (!delayed) { | |
| 1702 | + cwq->nr_active--; | |
| 1703 | + if (!list_empty(&cwq->delayed_works)) { | |
| 1704 | + /* one down, submit a delayed one */ | |
| 1705 | + if (cwq->nr_active < cwq->max_active) | |
| 1706 | + cwq_activate_first_delayed(cwq); | |
| 1707 | + } | |
| 1692 | 1708 | } |
| 1693 | 1709 | |
| 1694 | 1710 | /* is flush in progress and are we at the flushing tip? */ |
| @@ -1725,6 +1741,8 @@ static void cwq_dec_nr_in_flight(struct cpu_workqueue_struct *cwq, int color) · 30 unmodified lines | ||
| 1725 | 1741 | * spin_lock_irq(gcwq->lock) which is released and regrabbed. |
| 1726 | 1742 | */ |
| 1727 | 1743 | static void process_one_work(struct worker *worker, struct work_struct *work) |
| 1744 | +__releases(&gcwq->lock) | |
| 1745 | +__acquires(&gcwq->lock) | |
| 1728 | 1746 | { |
| 1729 | 1747 | struct cpu_workqueue_struct *cwq = get_work_cwq(work); |
| 1730 | 1748 | struct global_cwq *gcwq = cwq->gcwq; |
| @@ -1823,7 +1841,7 @@ static void process_one_work(struct worker *worker, struct work_struct *work) · 92 unmodified lines | ||
| 1823 | 1841 | hlist_del_init(&worker->hentry); |
| 1824 | 1842 | worker->current_work = NULL; |
| 1825 | 1843 | worker->current_cwq = NULL; |
| 1826 | − cwq_dec_nr_in_flight(cwq, work_color); | |
| 1844 | + cwq_dec_nr_in_flight(cwq, work_color, false); | |
| 1827 | 1845 | } |
| 1828 | 1846 | |
| 1829 | 1847 | /** |
| @@ -2388,7 +2406,8 @@ static int try_to_grab_pending(struct work_struct *work) · 558 unmodified lines | ||
| 2388 | 2406 | debug_work_deactivate(work); |
| 2389 | 2407 | list_del_init(&work->entry); |
| 2390 | 2408 | cwq_dec_nr_in_flight(get_work_cwq(work), |
| 2391 | − get_work_color(work)); | |
| 2409 | + get_work_color(work), | |
| 2410 | + *work_data_bits(work) & WORK_STRUCT_DELAYED); | |
| 2392 | 2411 | ret = 1; |
| 2393 | 2412 | } |
| 2394 | 2413 | } |
| @@ -2791,7 +2810,6 @@ struct workqueue_struct *__alloc_workqueue_key(const char *name, · 396 unmodified lines | ||
| 2791 | 2810 | if (IS_ERR(rescuer->task)) |
| 2792 | 2811 | goto err; |
| 2793 | 2812 | |
| 2794 | − wq->rescuer = rescuer; | |
| 2795 | 2813 | rescuer->task->flags |= PF_THREAD_BOUND; |
| 2796 | 2814 | wake_up_process(rescuer->task); |
| 2797 | 2815 | } |
| @@ -2833,6 +2851,7 @@ void destroy_workqueue(struct workqueue_struct *wq) · 35 unmodified lines | ||
| 2833 | 2851 | { |
| 2834 | 2852 | unsigned int cpu; |
| 2835 | 2853 | |
| 2854 | + wq->flags |= WQ_DYING; | |
| 2836 | 2855 | flush_workqueue(wq); |
| 2837 | 2856 | |
| 2838 | 2857 | /* |
| @@ -2857,6 +2876,7 @@ void destroy_workqueue(struct workqueue_struct *wq) · 18 unmodified lines | ||
| 2857 | 2876 | if (wq->flags & WQ_RESCUER) { |
| 2858 | 2877 | kthread_stop(wq->rescuer->task); |
| 2859 | 2878 | free_mayday_mask(wq->mayday_mask); |
| 2879 | + kfree(wq->rescuer); | |
| 2860 | 2880 | } |
| 2861 | 2881 | |
| 2862 | 2882 | free_cwqs(wq); |
| @@ -3239,6 +3259,8 @@ static int __cpuinit trustee_thread(void *__gcwq) · 376 unmodified lines | ||
| 3239 | 3259 | * multiple times. To be used by cpu_callback. |
| 3240 | 3260 | */ |
| 3241 | 3261 | static void __cpuinit wait_trustee_state(struct global_cwq *gcwq, int state) |
| 3262 | +__releases(&gcwq->lock) | |
| 3263 | +__acquires(&gcwq->lock) | |
| 3242 | 3264 | { |
| 3243 | 3265 | if (!(gcwq->trustee_state == state || |
| 3244 | 3266 | gcwq->trustee_state == TRUSTEE_DONE)) { |
| @@ -3545,8 +3567,7 @@ static int __init init_workqueues(void) · 300 unmodified lines | ||
| 3545 | 3567 | spin_lock_init(&gcwq->lock); |
| 3546 | 3568 | INIT_LIST_HEAD(&gcwq->worklist); |
| 3547 | 3569 | gcwq->cpu = cpu; |
| 3548 | − if (cpu == WORK_CPU_UNBOUND) | |
| 3549 | − gcwq->flags |= GCWQ_DISASSOCIATED; | |
| 3570 | + gcwq->flags |= GCWQ_DISASSOCIATED; | |
| 3550 | 3571 | |
| 3551 | 3572 | INIT_LIST_HEAD(&gcwq->idle_list); |
| 3552 | 3573 | for (i = 0; i < BUSY_WORKER_HASH_SIZE; i++) |
| @@ -3570,6 +3591,8 @@ static int __init init_workqueues(void) · 17 unmodified lines | ||
| 3570 | 3591 | struct global_cwq *gcwq = get_gcwq(cpu); |
| 3571 | 3592 | struct worker *worker; |
| 3572 | 3593 | |
| 3594 | + if (cpu != WORK_CPU_UNBOUND) | |
| 3595 | + gcwq->flags &= ~GCWQ_DISASSOCIATED; | |
| 3573 | 3596 | worker = create_worker(gcwq, true); |
| 3574 | 3597 | BUG_ON(!worker); |
| 3575 | 3598 | spin_lock_irq(&gcwq->lock); |
| @@ -0,0 +1,4 @@ | ||
| 1 | +mktables | |
| 2 | +altivec*.c | |
| 3 | +int*.c | |
| 4 | +tables.c | |
| @@ -248,8 +248,18 @@ int __sg_alloc_table(struct sg_table *table, unsigned int nents, · 247 unmodified lines | ||
| 248 | 248 | left -= sg_size; |
| 249 | 249 | |
| 250 | 250 | sg = alloc_fn(alloc_size, gfp_mask); |
| 251 | − if (unlikely(!sg)) | |
| 252 | − return -ENOMEM; | |
| 251 | + if (unlikely(!sg)) { | |
| 252 | + /* | |
| 253 | + * Adjust entry count to reflect that the last | |
| 254 | + * entry of the previous table won't be used for | |
| 255 | + * linkage. Without this, sg_kfree() may get | |
| 256 | + * confused. | |
| 257 | + */ | |
| 258 | + if (prv) | |
| 259 | + table->nents = ++table->orig_nents; | |
| 260 | + | |
| 261 | + return -ENOMEM; | |
| 262 | + } | |
| 253 | 263 | |
| 254 | 264 | sg_init_table(sg, alloc_size); |
| 255 | 265 | table->nents = table->orig_nents += sg_size; |
| @@ -189,7 +189,7 @@ config COMPACTION · 188 unmodified lines | ||
| 189 | 189 | config MIGRATION |
| 190 | 190 | bool "Page migration" |
| 191 | 191 | def_bool y |
| 192 | − depends on NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE | |
| 192 | + depends on NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION | |
| 193 | 193 | help |
| 194 | 194 | Allows the migration of the physical location of pages of processes |
| 195 | 195 | while the virtual addresses are not changed. This is useful in |
| @@ -445,8 +445,8 @@ static int bdi_forker_thread(void *ptr) · 444 unmodified lines | ||
| 445 | 445 | switch (action) { |
| 446 | 446 | case FORK_THREAD: |
| 447 | 447 | __set_current_state(TASK_RUNNING); |
| 448 | − task = kthread_run(bdi_writeback_thread, &bdi->wb, "flush-%s", | |
| 449 | − dev_name(bdi->dev)); | |
| 448 | + task = kthread_create(bdi_writeback_thread, &bdi->wb, | |
| 449 | + "flush-%s", dev_name(bdi->dev)); | |
| 450 | 450 | if (IS_ERR(task)) { |
| 451 | 451 | /* |
| 452 | 452 | * If thread creation fails, force writeout of |
| @@ -457,10 +457,13 @@ static int bdi_forker_thread(void *ptr) · 4 unmodified lines | ||
| 457 | 457 | /* |
| 458 | 458 | * The spinlock makes sure we do not lose |
| 459 | 459 | * wake-ups when racing with 'bdi_queue_work()'. |
| 460 | + * And as soon as the bdi thread is visible, we | |
| 461 | + * can start it. | |
| 460 | 462 | */ |
| 461 | 463 | spin_lock_bh(&bdi->wb_lock); |
| 462 | 464 | bdi->wb.task = task; |
| 463 | 465 | spin_unlock_bh(&bdi->wb_lock); |
| 466 | + wake_up_process(task); | |
| 464 | 467 | } |
| 465 | 468 | break; |
| 466 | 469 | |
| @@ -116,8 +116,8 @@ static void copy_to_high_bio_irq(struct bio *to, struct bio *from) · 115 unmodified lines | ||
| 116 | 116 | */ |
| 117 | 117 | vfrom = page_address(fromvec->bv_page) + tovec->bv_offset; |
| 118 | 118 | |
| 119 | − flush_dcache_page(tovec->bv_page); | |
| 120 | 119 | bounce_copy_vec(tovec, vfrom); |
| 120 | + flush_dcache_page(tovec->bv_page); | |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| @@ -214,15 +214,16 @@ static void acct_isolated(struct zone *zone, struct compact_control *cc) · 213 unmodified lines | ||
| 214 | 214 | /* Similar to reclaim, but different enough that they don't share logic */ |
| 215 | 215 | static bool too_many_isolated(struct zone *zone) |
| 216 | 216 | { |
| 217 | − | |
| 218 | − unsigned long inactive, isolated; | |
| 217 | + unsigned long active, inactive, isolated; | |
| 219 | 218 | |
| 220 | 219 | inactive = zone_page_state(zone, NR_INACTIVE_FILE) + |
| 221 | 220 | zone_page_state(zone, NR_INACTIVE_ANON); |
| 221 | + active = zone_page_state(zone, NR_ACTIVE_FILE) + | |
| 222 | + zone_page_state(zone, NR_ACTIVE_ANON); | |
| 222 | 223 | isolated = zone_page_state(zone, NR_ISOLATED_FILE) + |
| 223 | 224 | zone_page_state(zone, NR_ISOLATED_ANON); |
| 224 | 225 | |
| 225 | − return isolated > inactive; | |
| 226 | + return isolated > (inactive + active) / 2; | |
| 226 | 227 | } |
| 227 | 228 | |
| 228 | 229 | /* |
| @@ -1504,8 +1504,6 @@ struct page *ksm_does_need_to_copy(struct page *page, · 1503 unmodified lines | ||
| 1504 | 1504 | { |
| 1505 | 1505 | struct page *new_page; |
| 1506 | 1506 | |
| 1507 | − unlock_page(page); /* any racers will COW it, not modify it */ | |
| 1508 | − | |
| 1509 | 1507 | new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address); |
| 1510 | 1508 | if (new_page) { |
| 1511 | 1509 | copy_user_highpage(new_page, page, address, vma); |
| @@ -1521,7 +1519,6 @@ struct page *ksm_does_need_to_copy(struct page *page, · 9 unmodified lines | ||
| 1521 | 1519 | add_page_to_unevictable_list(new_page); |
| 1522 | 1520 | } |
| 1523 | 1521 | |
| 1524 | − page_cache_release(page); | |
| 1525 | 1522 | return new_page; |
| 1526 | 1523 | } |
| 1527 | 1524 | |
| @@ -2623,7 +2623,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, · 2622 unmodified lines | ||
| 2623 | 2623 | unsigned int flags, pte_t orig_pte) |
| 2624 | 2624 | { |
| 2625 | 2625 | spinlock_t *ptl; |
| 2626 | − struct page *page; | |
| 2626 | + struct page *page, *swapcache = NULL; | |
| 2627 | 2627 | swp_entry_t entry; |
| 2628 | 2628 | pte_t pte; |
| 2629 | 2629 | struct mem_cgroup *ptr = NULL; |
| @@ -2679,10 +2679,23 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, · 49 unmodified lines | ||
| 2679 | 2679 | lock_page(page); |
| 2680 | 2680 | delayacct_clear_flag(DELAYACCT_PF_SWAPIN); |
| 2681 | 2681 | |
| 2682 | − page = ksm_might_need_to_copy(page, vma, address); | |
| 2683 | − if (!page) { | |
| 2684 | − ret = VM_FAULT_OOM; | |
| 2685 | − goto out; | |
| 2682 | + /* | |
| 2683 | + * Make sure try_to_free_swap didn't release the swapcache | |
| 2684 | + * from under us. The page pin isn't enough to prevent that. | |
| 2685 | + */ | |
| 2686 | + if (unlikely(!PageSwapCache(page))) | |
| 2687 | + goto out_page; | |
| 2688 | + | |
| 2689 | + if (ksm_might_need_to_copy(page, vma, address)) { | |
| 2690 | + swapcache = page; | |
| 2691 | + page = ksm_does_need_to_copy(page, vma, address); | |
| 2692 | + | |
| 2693 | + if (unlikely(!page)) { | |
| 2694 | + ret = VM_FAULT_OOM; | |
| 2695 | + page = swapcache; | |
| 2696 | + swapcache = NULL; | |
| 2697 | + goto out_page; | |
| 2698 | + } | |
| 2686 | 2699 | } |
| 2687 | 2700 | |
| 2688 | 2701 | if (mem_cgroup_try_charge_swapin(mm, page, GFP_KERNEL, &ptr)) { |
| @@ -2735,6 +2748,18 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, · 46 unmodified lines | ||
| 2735 | 2748 | if (vm_swap_full() || (vma->vm_flags & VM_LOCKED) || PageMlocked(page)) |
| 2736 | 2749 | try_to_free_swap(page); |
| 2737 | 2750 | unlock_page(page); |
| 2751 | + if (swapcache) { | |
| 2752 | + /* | |
| 2753 | + * Hold the lock to avoid the swap entry to be reused | |
| 2754 | + * until we take the PT lock for the pte_same() check | |
| 2755 | + * (to avoid false positives from pte_same). For | |
| 2756 | + * further safety release the lock after the swap_free | |
| 2757 | + * so that the swap count won't change under a | |
| 2758 | + * parallel locked swapcache. | |
| 2759 | + */ | |
| 2760 | + unlock_page(swapcache); | |
| 2761 | + page_cache_release(swapcache); | |
| 2762 | + } | |
| 2738 | 2763 | |
| 2739 | 2764 | if (flags & FAULT_FLAG_WRITE) { |
| 2740 | 2765 | ret |= do_wp_page(mm, vma, address, page_table, pmd, ptl, pte); |
| @@ -2756,6 +2781,10 @@ out_page: · 15 unmodified lines | ||
| 2756 | 2781 | unlock_page(page); |
| 2757 | 2782 | out_release: |
| 2758 | 2783 | page_cache_release(page); |
| 2784 | + if (swapcache) { | |
| 2785 | + unlock_page(swapcache); | |
| 2786 | + page_cache_release(swapcache); | |
| 2787 | + } | |
| 2759 | 2788 | return ret; |
| 2760 | 2789 | } |
| 2761 | 2790 | |
| @@ -584,19 +584,19 @@ static inline int pageblock_free(struct page *page) · 583 unmodified lines | ||
| 584 | 584 | /* Return the start of the next active pageblock after a given page */ |
| 585 | 585 | static struct page *next_active_pageblock(struct page *page) |
| 586 | 586 | { |
| 587 | − int pageblocks_stride; | |
| 588 | − | |
| 589 | 587 | /* Ensure the starting page is pageblock-aligned */ |
| 590 | 588 | BUG_ON(page_to_pfn(page) & (pageblock_nr_pages - 1)); |
| 591 | 589 | |
| 592 | − /* Move forward by at least 1 * pageblock_nr_pages */ | |
| 593 | − pageblocks_stride = 1; | |
| 594 | − | |
| 595 | 590 | /* If the entire pageblock is free, move to the end of free page */ |
| 596 | − if (pageblock_free(page)) | |
| 597 | − pageblocks_stride += page_order(page) - pageblock_order; | |
| 591 | + if (pageblock_free(page)) { | |
| 592 | + int order; | |
| 593 | + /* be careful. we don't have locks, page_order can be changed.*/ | |
| 594 | + order = page_order(page); | |
| 595 | + if ((order < MAX_ORDER) && (order >= pageblock_order)) | |
| 596 | + return page + (1 << order); | |
| 597 | + } | |
| 598 | 598 | |
| 599 | − return page + (pageblocks_stride * pageblock_nr_pages); | |
| 599 | + return page + pageblock_nr_pages; | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /* Checks if this range of memory is likely to be hot-removable. */ |
| @@ -135,12 +135,6 @@ void munlock_vma_page(struct page *page) · 134 unmodified lines | ||
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | −/* Is the vma a continuation of the stack vma above it? */ | |
| 139 | −static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr) | |
| 140 | −{ | |
| 141 | − return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); | |
| 142 | −} | |
| 143 | − | |
| 144 | 138 | static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) |
| 145 | 139 | { |
| 146 | 140 | return (vma->vm_flags & VM_GROWSDOWN) && |
| @@ -87,3 +87,24 @@ int memmap_valid_within(unsigned long pfn, · 86 unmodified lines | ||
| 87 | 87 | return 1; |
| 88 | 88 | } |
| 89 | 89 | #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ |
| 90 | + | |
| 91 | +#ifdef CONFIG_SMP | |
| 92 | +/* Called when a more accurate view of NR_FREE_PAGES is needed */ | |
| 93 | +unsigned long zone_nr_free_pages(struct zone *zone) | |
| 94 | +{ | |
| 95 | + unsigned long nr_free_pages = zone_page_state(zone, NR_FREE_PAGES); | |
| 96 | + | |
| 97 | + /* | |
| 98 | + * While kswapd is awake, it is considered the zone is under some | |
| 99 | + * memory pressure. Under pressure, there is a risk that | |
| 100 | + * per-cpu-counter-drift will allow the min watermark to be breached | |
| 101 | + * potentially causing a live-lock. While kswapd is awake and | |
| 102 | + * free pages are low, get a better estimate for free pages | |
| 103 | + */ | |
| 104 | + if (nr_free_pages < zone->percpu_drift_mark && | |
| 105 | + !waitqueue_active(&zone->zone_pgdat->kswapd_wait)) | |
| 106 | + return zone_page_state_snapshot(zone, NR_FREE_PAGES); | |
| 107 | + | |
| 108 | + return nr_free_pages; | |
| 109 | +} | |
| 110 | +#endif /* CONFIG_SMP */ | |
| @@ -985,22 +985,16 @@ continue_unlock: · 984 unmodified lines | ||
| 985 | 985 | } |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | − if (wbc->nr_to_write > 0) { | |
| 989 | − if (--wbc->nr_to_write == 0 && | |
| 990 | − wbc->sync_mode == WB_SYNC_NONE) { | |
| 991 | − /* | |
| 992 | − * We stop writing back only if we are | |
| 993 | − * not doing integrity sync. In case of | |
| 994 | − * integrity sync we have to keep going | |
| 995 | − * because someone may be concurrently | |
| 996 | − * dirtying pages, and we might have | |
| 997 | − * synced a lot of newly appeared dirty | |
| 998 | − * pages, but have not synced all of the | |
| 999 | − * old dirty pages. | |
| 1000 | − */ | |
| 1001 | − done = 1; | |
| 1002 | − break; | |
| 1003 | − } | |
| 988 | + /* | |
| 989 | + * We stop writing back only if we are not doing | |
| 990 | + * integrity sync. In case of integrity sync we have to | |
| 991 | + * keep going until we have written all the pages | |
| 992 | + * we tagged for writeback prior to entering this loop. | |
| 993 | + */ | |
| 994 | + if (--wbc->nr_to_write <= 0 && | |
| 995 | + wbc->sync_mode == WB_SYNC_NONE) { | |
| 996 | + done = 1; | |
| 997 | + break; | |
| 1004 | 998 | } |
| 1005 | 999 | } |
| 1006 | 1000 | pagevec_release(&pvec); |
| @@ -1132,6 +1126,7 @@ void account_page_dirtied(struct page *page, struct address_space *mapping) · 125 unmodified lines | ||
| 1132 | 1126 | task_io_account_write(PAGE_CACHE_SIZE); |
| 1133 | 1127 | } |
| 1134 | 1128 | } |
| 1129 | +EXPORT_SYMBOL(account_page_dirtied); | |
| 1135 | 1130 | |
| 1136 | 1131 | /* |
| 1137 | 1132 | * For address_spaces which do not use buffers. Just tag the page as dirty in |
| @@ -588,13 +588,13 @@ static void free_pcppages_bulk(struct zone *zone, int count, · 587 unmodified lines | ||
| 588 | 588 | { |
| 589 | 589 | int migratetype = 0; |
| 590 | 590 | int batch_free = 0; |
| 591 | + int to_free = count; | |
| 591 | 592 | |
| 592 | 593 | spin_lock(&zone->lock); |
| 593 | 594 | zone->all_unreclaimable = 0; |
| 594 | 595 | zone->pages_scanned = 0; |
| 595 | 596 | |
| 596 | − __mod_zone_page_state(zone, NR_FREE_PAGES, count); | |
| 597 | − while (count) { | |
| 597 | + while (to_free) { | |
| 598 | 598 | struct page *page; |
| 599 | 599 | struct list_head *list; |
| 600 | 600 | |
| @@ -619,8 +619,9 @@ static void free_pcppages_bulk(struct zone *zone, int count, · 18 unmodified lines | ||
| 619 | 619 | /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ |
| 620 | 620 | __free_one_page(page, zone, 0, page_private(page)); |
| 621 | 621 | trace_mm_page_pcpu_drain(page, 0, page_private(page)); |
| 622 | − } while (--count && --batch_free && !list_empty(list)); | |
| 622 | + } while (--to_free && --batch_free && !list_empty(list)); | |
| 623 | 623 | } |
| 624 | + __mod_zone_page_state(zone, NR_FREE_PAGES, count); | |
| 624 | 625 | spin_unlock(&zone->lock); |
| 625 | 626 | } |
| 626 | 627 | |
| @@ -631,8 +632,8 @@ static void free_one_page(struct zone *zone, struct page *page, int order, · 4 unmodified lines | ||
| 631 | 632 | zone->all_unreclaimable = 0; |
| 632 | 633 | zone->pages_scanned = 0; |
| 633 | 634 | |
| 634 | − __mod_zone_page_state(zone, NR_FREE_PAGES, 1 << order); | |
| 635 | 635 | __free_one_page(page, zone, order, migratetype); |
| 636 | + __mod_zone_page_state(zone, NR_FREE_PAGES, 1 << order); | |
| 636 | 637 | spin_unlock(&zone->lock); |
| 637 | 638 | } |
| 638 | 639 | |
| @@ -1461,7 +1462,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, · 822 unmodified lines | ||
| 1461 | 1462 | { |
| 1462 | 1463 | /* free_pages my go negative - that's OK */ |
| 1463 | 1464 | long min = mark; |
| 1464 | − long free_pages = zone_page_state(z, NR_FREE_PAGES) - (1 << order) + 1; | |
| 1465 | + long free_pages = zone_nr_free_pages(z) - (1 << order) + 1; | |
| 1465 | 1466 | int o; |
| 1466 | 1467 | |
| 1467 | 1468 | if (alloc_flags & ALLOC_HIGH) |
| @@ -1846,6 +1847,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, · 378 unmodified lines | ||
| 1846 | 1847 | struct page *page = NULL; |
| 1847 | 1848 | struct reclaim_state reclaim_state; |
| 1848 | 1849 | struct task_struct *p = current; |
| 1850 | + bool drained = false; | |
| 1849 | 1851 | |
| 1850 | 1852 | cond_resched(); |
| 1851 | 1853 | |
| @@ -1864,14 +1866,25 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, · 12 unmodified lines | ||
| 1864 | 1866 | |
| 1865 | 1867 | cond_resched(); |
| 1866 | 1868 | |
| 1867 | − if (order != 0) | |
| 1868 | − drain_all_pages(); | |
| 1869 | + if (unlikely(!(*did_some_progress))) | |
| 1870 | + return NULL; | |
| 1869 | 1871 | |
| 1870 | − if (likely(*did_some_progress)) | |
| 1871 | − page = get_page_from_freelist(gfp_mask, nodemask, order, | |
| 1872 | +retry: | |
| 1873 | + page = get_page_from_freelist(gfp_mask, nodemask, order, | |
| 1872 | 1874 | zonelist, high_zoneidx, |
| 1873 | 1875 | alloc_flags, preferred_zone, |
| 1874 | 1876 | migratetype); |
| 1877 | + | |
| 1878 | + /* | |
| 1879 | + * If an allocation failed after direct reclaim, it could be because | |
| 1880 | + * pages are pinned on the per-cpu lists. Drain them and try again | |
| 1881 | + */ | |
| 1882 | + if (!page && !drained) { | |
17 more lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 199 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 234 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.