Unified · Split
| @@ -36,6 +36,7 @@ Andrew Morton <akpm@linux-foundation.org> · 35 unmodified lines | |||
| 36 | Andrew Murray <amurray@thegoodpenguin.co.uk> <amurray@embedded-bits.co.uk> | 36 | Andrew Murray <amurray@thegoodpenguin.co.uk> <amurray@embedded-bits.co.uk> |
| 37 | Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com> | 37 | Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com> |
| 38 | Andrew Vasquez <andrew.vasquez@qlogic.com> | 38 | Andrew Vasquez <andrew.vasquez@qlogic.com> |
| 39 | Andrey Konovalov <andreyknvl@gmail.com> <andreyknvl@google.com> | ||
| 39 | Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com> | 40 | Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com> |
| 40 | Andrey Ryabinin <ryabinin.a.a@gmail.com> <aryabinin@virtuozzo.com> | 41 | Andrey Ryabinin <ryabinin.a.a@gmail.com> <aryabinin@virtuozzo.com> |
| 41 | Andy Adamson <andros@citi.umich.edu> | 42 | Andy Adamson <andros@citi.umich.edu> |
| @@ -65,6 +66,8 @@ Changbin Du <changbin.du@intel.com> <changbin.du@gmail.com> · 23 unmodified lines | |||
| 65 | Changbin Du <changbin.du@intel.com> <changbin.du@intel.com> | 66 | Changbin Du <changbin.du@intel.com> <changbin.du@intel.com> |
| 66 | Chao Yu <chao@kernel.org> <chao2.yu@samsung.com> | 67 | Chao Yu <chao@kernel.org> <chao2.yu@samsung.com> |
| 67 | Chao Yu <chao@kernel.org> <yuchao0@huawei.com> | 68 | Chao Yu <chao@kernel.org> <yuchao0@huawei.com> |
| 69 | Chris Chiu <chris.chiu@canonical.com> <chiu@endlessm.com> | ||
| 70 | Chris Chiu <chris.chiu@canonical.com> <chiu@endlessos.org> | ||
| 68 | Christophe Ricard <christophe.ricard@gmail.com> | 71 | Christophe Ricard <christophe.ricard@gmail.com> |
| 69 | Christoph Hellwig <hch@lst.de> | 72 | Christoph Hellwig <hch@lst.de> |
| 70 | Corey Minyard <minyard@acm.org> | 73 | Corey Minyard <minyard@acm.org> |
| @@ -33,7 +33,7 @@ Contact: xfs@oss.sgi.com · 32 unmodified lines | |||
| 33 | Description: | 33 | Description: |
| 34 | The current state of the log write grant head. It | 34 | The current state of the log write grant head. It |
| 35 | represents the total log reservation of all currently | 35 | represents the total log reservation of all currently |
| 36 | oustanding transactions, including regrants due to | 36 | outstanding transactions, including regrants due to |
| 37 | rolling transactions. The grant head is exported in | 37 | rolling transactions. The grant head is exported in |
| 38 | "cycle:bytes" format. | 38 | "cycle:bytes" format. |
| 39 | Users: xfstests | 39 | Users: xfstests |
| @@ -17,12 +17,12 @@ For ACPI on arm64, tables also fall into the following categories: · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | - Recommended: BERT, EINJ, ERST, HEST, PCCT, SSDT | 18 | - Recommended: BERT, EINJ, ERST, HEST, PCCT, SSDT |
| 19 | 19 | ||
| 20 | - Optional: BGRT, CPEP, CSRT, DBG2, DRTM, ECDT, FACS, FPDT, IORT, | 20 | - Optional: BGRT, CPEP, CSRT, DBG2, DRTM, ECDT, FACS, FPDT, IBFT, |
| 21 | MCHI, MPST, MSCT, NFIT, PMTT, RASF, SBST, SLIT, SPMI, SRAT, STAO, | 21 | IORT, MCHI, MPST, MSCT, NFIT, PMTT, RASF, SBST, SLIT, SPMI, SRAT, |
| 22 | TCPA, TPM2, UEFI, XENV | 22 | STAO, TCPA, TPM2, UEFI, XENV |
| 23 | 23 | ||
| 24 | - Not supported: BOOT, DBGP, DMAR, ETDT, HPET, IBFT, IVRS, LPIT, | 24 | - Not supported: BOOT, DBGP, DMAR, ETDT, HPET, IVRS, LPIT, MSDM, OEMx, |
| 25 | MSDM, OEMx, PSDT, RSDT, SLIC, WAET, WDAT, WDRT, WPBT | 25 | PSDT, RSDT, SLIC, WAET, WDAT, WDRT, WPBT |
| 26 | 26 | ||
| 27 | ====== ======================================================================== | 27 | ====== ======================================================================== |
| 28 | Table Usage for ARMv8 Linux | 28 | Table Usage for ARMv8 Linux |
| @@ -130,6 +130,9 @@ stable kernels. · 129 unmodified lines | |||
| 130 | | Marvell | ARM-MMU-500 | #582743 | N/A | | 130 | | Marvell | ARM-MMU-500 | #582743 | N/A | |
| 131 | +----------------+-----------------+-----------------+-----------------------------+ | 131 | +----------------+-----------------+-----------------+-----------------------------+ |
| 132 | +----------------+-----------------+-----------------+-----------------------------+ | 132 | +----------------+-----------------+-----------------+-----------------------------+ |
| 133 | | NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM | | ||
| 134 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 135 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 133 | | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | | 136 | | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | |
| 134 | +----------------+-----------------+-----------------+-----------------------------+ | 137 | +----------------+-----------------+-----------------+-----------------------------+ |
| 135 | +----------------+-----------------+-----------------+-----------------------------+ | 138 | +----------------+-----------------+-----------------+-----------------------------+ |
| @@ -21,6 +21,10 @@ properties: · 20 unmodified lines | |||
| 21 | - fsl,vf610-spdif | 21 | - fsl,vf610-spdif |
| 22 | - fsl,imx6sx-spdif | 22 | - fsl,imx6sx-spdif |
| 23 | - fsl,imx8qm-spdif | 23 | - fsl,imx8qm-spdif |
| 24 | - fsl,imx8qxp-spdif | ||
| 25 | - fsl,imx8mq-spdif | ||
| 26 | - fsl,imx8mm-spdif | ||
| 27 | - fsl,imx8mn-spdif | ||
| 24 | 28 | ||
| 25 | reg: | 29 | reg: |
| 26 | maxItems: 1 | 30 | maxItems: 1 |
| @@ -267,7 +267,7 @@ DATA PATH · 266 unmodified lines | |||
| 267 | Tx | 267 | Tx |
| 268 | -- | 268 | -- |
| 269 | 269 | ||
| 270 | end_start_xmit() is called by the stack. This function does the following: | 270 | ena_start_xmit() is called by the stack. This function does the following: |
| 271 | 271 | ||
| 272 | - Maps data buffers (skb->data and frags). | 272 | - Maps data buffers (skb->data and frags). |
| 273 | - Populates ena_buf for the push buffer (if the driver and device are | 273 | - Populates ena_buf for the push buffer (if the driver and device are |
| @@ -52,7 +52,7 @@ purposes as a standard complementary tool. The system's view from · 51 unmodified lines | |||
| 52 | ``devlink-dpipe`` should change according to the changes done by the | 52 | ``devlink-dpipe`` should change according to the changes done by the |
| 53 | standard configuration tools. | 53 | standard configuration tools. |
| 54 | 54 | ||
| 55 | For example, it’s quiet common to implement Access Control Lists (ACL) | 55 | For example, it’s quite common to implement Access Control Lists (ACL) |
| 56 | using Ternary Content Addressable Memory (TCAM). The TCAM memory can be | 56 | using Ternary Content Addressable Memory (TCAM). The TCAM memory can be |
| 57 | divided into TCAM regions. Complex TC filters can have multiple rules with | 57 | divided into TCAM regions. Complex TC filters can have multiple rules with |
| 58 | different priorities and different lookup keys. On the other hand hardware | 58 | different priorities and different lookup keys. On the other hand hardware |
| @@ -151,7 +151,7 @@ representor netdevice. · 150 unmodified lines | |||
| 151 | ------------- | 151 | ------------- |
| 152 | A subfunction devlink port is created but it is not active yet. That means the | 152 | A subfunction devlink port is created but it is not active yet. That means the |
| 153 | entities are created on devlink side, the e-switch port representor is created, | 153 | entities are created on devlink side, the e-switch port representor is created, |
| 154 | but the subfunction device itself it not created. A user might use e-switch port | 154 | but the subfunction device itself is not created. A user might use e-switch port |
| 155 | representor to do settings, putting it into bridge, adding TC rules, etc. A user | 155 | representor to do settings, putting it into bridge, adding TC rules, etc. A user |
| 156 | might as well configure the hardware address (such as MAC address) of the | 156 | might as well configure the hardware address (such as MAC address) of the |
| 157 | subfunction while subfunction is inactive. | 157 | subfunction while subfunction is inactive. |
| @@ -173,7 +173,7 @@ Terms and Definitions · 15 unmodified lines | |||
| 173 | * - Term | 173 | * - Term |
| 174 | - Definitions | 174 | - Definitions |
| 175 | * - ``PCI device`` | 175 | * - ``PCI device`` |
| 176 | - A physical PCI device having one or more PCI bus consists of one or | 176 | - A physical PCI device having one or more PCI buses consists of one or |
| 177 | more PCI controllers. | 177 | more PCI controllers. |
| 178 | * - ``PCI controller`` | 178 | * - ``PCI controller`` |
| 179 | - A controller consists of potentially multiple physical functions, | 179 | - A controller consists of potentially multiple physical functions, |
| @@ -50,7 +50,7 @@ Callbacks to implement · 49 unmodified lines | |||
| 50 | 50 | ||
| 51 | The NIC driver offering ipsec offload will need to implement these | 51 | The NIC driver offering ipsec offload will need to implement these |
| 52 | callbacks to make the offload available to the network stack's | 52 | callbacks to make the offload available to the network stack's |
| 53 | XFRM subsytem. Additionally, the feature bits NETIF_F_HW_ESP and | 53 | XFRM subsystem. Additionally, the feature bits NETIF_F_HW_ESP and |
| 54 | NETIF_F_HW_ESP_TX_CSUM will signal the availability of the offload. | 54 | NETIF_F_HW_ESP_TX_CSUM will signal the availability of the offload. |
| 55 | 55 | ||
| 56 | 56 | ||
| @@ -1495,7 +1495,8 @@ Fails if any VCPU has already been created. · 1494 unmodified lines | |||
| 1495 | 1495 | ||
| 1496 | Define which vcpu is the Bootstrap Processor (BSP). Values are the same | 1496 | Define which vcpu is the Bootstrap Processor (BSP). Values are the same |
| 1497 | as the vcpu id in KVM_CREATE_VCPU. If this ioctl is not called, the default | 1497 | as the vcpu id in KVM_CREATE_VCPU. If this ioctl is not called, the default |
| 1498 | is vcpu 0. | 1498 | is vcpu 0. This ioctl has to be called before vcpu creation, |
| 1499 | otherwise it will return EBUSY error. | ||
| 1499 | 1500 | ||
| 1500 | 1501 | ||
| 1501 | 4.42 KVM_GET_XSAVE | 1502 | 4.42 KVM_GET_XSAVE |
| @@ -4806,8 +4807,10 @@ If an MSR access is not permitted through the filtering, it generates a · 3304 unmodified lines | |||
| 4806 | allows user space to deflect and potentially handle various MSR accesses | 4807 | allows user space to deflect and potentially handle various MSR accesses |
| 4807 | into user space. | 4808 | into user space. |
| 4808 | 4809 | ||
| 4809 | If a vCPU is in running state while this ioctl is invoked, the vCPU may | 4810 | Note, invoking this ioctl with a vCPU is running is inherently racy. However, |
| 4810 | experience inconsistent filtering behavior on MSR accesses. | 4811 | KVM does guarantee that vCPUs will see either the previous filter or the new |
| 4812 | filter, e.g. MSRs with identical settings in both the old and new filter will | ||
| 4813 | have deterministic behavior. | ||
| 4811 | 4814 | ||
| 4812 | 4.127 KVM_XEN_HVM_SET_ATTR | 4815 | 4.127 KVM_XEN_HVM_SET_ATTR |
| 4813 | -------------------------- | 4816 | -------------------------- |
| @@ -1181,7 +1181,7 @@ M: Joel Fernandes <joel@joelfernandes.org> · 1180 unmodified lines | |||
| 1181 | M: Christian Brauner <christian@brauner.io> | 1181 | M: Christian Brauner <christian@brauner.io> |
| 1182 | M: Hridya Valsaraju <hridya@google.com> | 1182 | M: Hridya Valsaraju <hridya@google.com> |
| 1183 | M: Suren Baghdasaryan <surenb@google.com> | 1183 | M: Suren Baghdasaryan <surenb@google.com> |
| 1184 | L: devel@driverdev.osuosl.org | 1184 | L: linux-kernel@vger.kernel.org |
| 1185 | S: Supported | 1185 | S: Supported |
| 1186 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git | 1186 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git |
| 1187 | F: drivers/android/ | 1187 | F: drivers/android/ |
| @@ -2489,7 +2489,7 @@ N: sc27xx · 1301 unmodified lines | |||
| 2489 | N: sc2731 | 2489 | N: sc2731 |
| 2490 | 2490 | ||
| 2491 | ARM/STI ARCHITECTURE | 2491 | ARM/STI ARCHITECTURE |
| 2492 | M: Patrice Chotard <patrice.chotard@st.com> | 2492 | M: Patrice Chotard <patrice.chotard@foss.st.com> |
| 2493 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 2493 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 2494 | S: Maintained | 2494 | S: Maintained |
| 2495 | W: http://www.stlinux.com | 2495 | W: http://www.stlinux.com |
| @@ -2522,7 +2522,7 @@ F: include/linux/remoteproc/st_slim_rproc.h · 26 unmodified lines | |||
| 2522 | 2522 | ||
| 2523 | ARM/STM32 ARCHITECTURE | 2523 | ARM/STM32 ARCHITECTURE |
| 2524 | M: Maxime Coquelin <mcoquelin.stm32@gmail.com> | 2524 | M: Maxime Coquelin <mcoquelin.stm32@gmail.com> |
| 2525 | M: Alexandre Torgue <alexandre.torgue@st.com> | 2525 | M: Alexandre Torgue <alexandre.torgue@foss.st.com> |
| 2526 | L: linux-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers) | 2526 | L: linux-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers) |
| 2527 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 2527 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 2528 | S: Maintained | 2528 | S: Maintained |
| @@ -3115,7 +3115,7 @@ C: irc://irc.oftc.net/bcache · 586 unmodified lines | |||
| 3115 | F: drivers/md/bcache/ | 3115 | F: drivers/md/bcache/ |
| 3116 | 3116 | ||
| 3117 | BDISP ST MEDIA DRIVER | 3117 | BDISP ST MEDIA DRIVER |
| 3118 | M: Fabien Dessenne <fabien.dessenne@st.com> | 3118 | M: Fabien Dessenne <fabien.dessenne@foss.st.com> |
| 3119 | L: linux-media@vger.kernel.org | 3119 | L: linux-media@vger.kernel.org |
| 3120 | S: Supported | 3120 | S: Supported |
| 3121 | W: https://linuxtv.org | 3121 | W: https://linuxtv.org |
| @@ -3675,7 +3675,7 @@ M: bcm-kernel-feedback-list@broadcom.com · 553 unmodified lines | |||
| 3675 | L: linux-pm@vger.kernel.org | 3675 | L: linux-pm@vger.kernel.org |
| 3676 | S: Maintained | 3676 | S: Maintained |
| 3677 | T: git git://github.com/broadcom/stblinux.git | 3677 | T: git git://github.com/broadcom/stblinux.git |
| 3678 | F: drivers/soc/bcm/bcm-pmb.c | 3678 | F: drivers/soc/bcm/bcm63xx/bcm-pmb.c |
| 3679 | F: include/dt-bindings/soc/bcm-pmb.h | 3679 | F: include/dt-bindings/soc/bcm-pmb.h |
| 3680 | 3680 | ||
| 3681 | BROADCOM SPECIFIC AMBA DRIVER (BCMA) | 3681 | BROADCOM SPECIFIC AMBA DRIVER (BCMA) |
| @@ -5080,7 +5080,7 @@ S: Maintained · 1398 unmodified lines | |||
| 5080 | F: drivers/platform/x86/dell/dell-wmi.c | 5080 | F: drivers/platform/x86/dell/dell-wmi.c |
| 5081 | 5081 | ||
| 5082 | DELTA ST MEDIA DRIVER | 5082 | DELTA ST MEDIA DRIVER |
| 5083 | M: Hugues Fruchet <hugues.fruchet@st.com> | 5083 | M: Hugues Fruchet <hugues.fruchet@foss.st.com> |
| 5084 | L: linux-media@vger.kernel.org | 5084 | L: linux-media@vger.kernel.org |
| 5085 | S: Supported | 5085 | S: Supported |
| 5086 | W: https://linuxtv.org | 5086 | W: https://linuxtv.org |
| @@ -6006,7 +6006,6 @@ F: drivers/gpu/drm/rockchip/ · 919 unmodified lines | |||
| 6006 | 6006 | ||
| 6007 | DRM DRIVERS FOR STI | 6007 | DRM DRIVERS FOR STI |
| 6008 | M: Benjamin Gaignard <benjamin.gaignard@linaro.org> | 6008 | M: Benjamin Gaignard <benjamin.gaignard@linaro.org> |
| 6009 | M: Vincent Abriou <vincent.abriou@st.com> | ||
| 6010 | L: dri-devel@lists.freedesktop.org | 6009 | L: dri-devel@lists.freedesktop.org |
| 6011 | S: Maintained | 6010 | S: Maintained |
| 6012 | T: git git://anongit.freedesktop.org/drm/drm-misc | 6011 | T: git git://anongit.freedesktop.org/drm/drm-misc |
| @@ -6014,10 +6013,9 @@ F: Documentation/devicetree/bindings/display/st,stih4xx.txt · 1 unmodified line | |||
| 6014 | F: drivers/gpu/drm/sti | 6013 | F: drivers/gpu/drm/sti |
| 6015 | 6014 | ||
| 6016 | DRM DRIVERS FOR STM | 6015 | DRM DRIVERS FOR STM |
| 6017 | M: Yannick Fertre <yannick.fertre@st.com> | 6016 | M: Yannick Fertre <yannick.fertre@foss.st.com> |
| 6018 | M: Philippe Cornu <philippe.cornu@st.com> | 6017 | M: Philippe Cornu <philippe.cornu@foss.st.com> |
| 6019 | M: Benjamin Gaignard <benjamin.gaignard@linaro.org> | 6018 | M: Benjamin Gaignard <benjamin.gaignard@linaro.org> |
| 6020 | M: Vincent Abriou <vincent.abriou@st.com> | ||
| 6021 | L: dri-devel@lists.freedesktop.org | 6019 | L: dri-devel@lists.freedesktop.org |
| 6022 | S: Maintained | 6020 | S: Maintained |
| 6023 | T: git git://anongit.freedesktop.org/drm/drm-misc | 6021 | T: git git://anongit.freedesktop.org/drm/drm-misc |
| @@ -8117,7 +8115,6 @@ F: drivers/crypto/hisilicon/sec2/sec_main.c · 2093 unmodified lines | |||
| 8117 | 8115 | ||
| 8118 | HISILICON STAGING DRIVERS FOR HIKEY 960/970 | 8116 | HISILICON STAGING DRIVERS FOR HIKEY 960/970 |
| 8119 | M: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 8117 | M: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
| 8120 | L: devel@driverdev.osuosl.org | ||
| 8121 | S: Maintained | 8118 | S: Maintained |
| 8122 | F: drivers/staging/hikey9xx/ | 8119 | F: drivers/staging/hikey9xx/ |
| 8123 | 8120 | ||
| @@ -8232,7 +8229,7 @@ F: include/linux/hugetlb.h · 108 unmodified lines | |||
| 8232 | F: mm/hugetlb.c | 8229 | F: mm/hugetlb.c |
| 8233 | 8230 | ||
| 8234 | HVA ST MEDIA DRIVER | 8231 | HVA ST MEDIA DRIVER |
| 8235 | M: Jean-Christophe Trotin <jean-christophe.trotin@st.com> | 8232 | M: Jean-Christophe Trotin <jean-christophe.trotin@foss.st.com> |
| 8236 | L: linux-media@vger.kernel.org | 8233 | L: linux-media@vger.kernel.org |
| 8237 | S: Supported | 8234 | S: Supported |
| 8238 | W: https://linuxtv.org | 8235 | W: https://linuxtv.org |
| @@ -8522,6 +8519,7 @@ IBM Power SRIOV Virtual NIC Device Driver · 283 unmodified lines | |||
| 8522 | M: Dany Madden <drt@linux.ibm.com> | 8519 | M: Dany Madden <drt@linux.ibm.com> |
| 8523 | M: Lijun Pan <ljp@linux.ibm.com> | 8520 | M: Lijun Pan <ljp@linux.ibm.com> |
| 8524 | M: Sukadev Bhattiprolu <sukadev@linux.ibm.com> | 8521 | M: Sukadev Bhattiprolu <sukadev@linux.ibm.com> |
| 8522 | R: Thomas Falcon <tlfalcon@linux.ibm.com> | ||
| 8525 | L: netdev@vger.kernel.org | 8523 | L: netdev@vger.kernel.org |
| 8526 | S: Supported | 8524 | S: Supported |
| 8527 | F: drivers/net/ethernet/ibm/ibmvnic.* | 8525 | F: drivers/net/ethernet/ibm/ibmvnic.* |
| @@ -10031,7 +10029,6 @@ F: scripts/leaking_addresses.pl · 1503 unmodified lines | |||
| 10031 | 10029 | ||
| 10032 | LED SUBSYSTEM | 10030 | LED SUBSYSTEM |
| 10033 | M: Pavel Machek <pavel@ucw.cz> | 10031 | M: Pavel Machek <pavel@ucw.cz> |
| 10034 | R: Dan Murphy <dmurphy@ti.com> | ||
| 10035 | L: linux-leds@vger.kernel.org | 10032 | L: linux-leds@vger.kernel.org |
| 10036 | S: Maintained | 10033 | S: Maintained |
| 10037 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git | 10034 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git |
| @@ -10907,7 +10904,6 @@ T: git git://linuxtv.org/media_tree.git · 869 unmodified lines | |||
| 10907 | F: drivers/media/radio/radio-maxiradio* | 10904 | F: drivers/media/radio/radio-maxiradio* |
| 10908 | 10905 | ||
| 10909 | MCAN MMIO DEVICE DRIVER | 10906 | MCAN MMIO DEVICE DRIVER |
| 10910 | M: Dan Murphy <dmurphy@ti.com> | ||
| 10911 | M: Pankaj Sharma <pankj.sharma@samsung.com> | 10907 | M: Pankaj Sharma <pankj.sharma@samsung.com> |
| 10912 | L: linux-can@vger.kernel.org | 10908 | L: linux-can@vger.kernel.org |
| 10913 | S: Maintained | 10909 | S: Maintained |
| @@ -11168,7 +11164,7 @@ T: git git://linuxtv.org/media_tree.git · 254 unmodified lines | |||
| 11168 | F: drivers/media/dvb-frontends/stv6111* | 11164 | F: drivers/media/dvb-frontends/stv6111* |
| 11169 | 11165 | ||
| 11170 | MEDIA DRIVERS FOR STM32 - DCMI | 11166 | MEDIA DRIVERS FOR STM32 - DCMI |
| 11171 | M: Hugues Fruchet <hugues.fruchet@st.com> | 11167 | M: Hugues Fruchet <hugues.fruchet@foss.st.com> |
| 11172 | L: linux-media@vger.kernel.org | 11168 | L: linux-media@vger.kernel.org |
| 11173 | S: Supported | 11169 | S: Supported |
| 11174 | T: git git://linuxtv.org/media_tree.git | 11170 | T: git git://linuxtv.org/media_tree.git |
| @@ -12539,7 +12535,7 @@ NETWORKING [MPTCP] · 1364 unmodified lines | |||
| 12539 | M: Mat Martineau <mathew.j.martineau@linux.intel.com> | 12535 | M: Mat Martineau <mathew.j.martineau@linux.intel.com> |
| 12540 | M: Matthieu Baerts <matthieu.baerts@tessares.net> | 12536 | M: Matthieu Baerts <matthieu.baerts@tessares.net> |
| 12541 | L: netdev@vger.kernel.org | 12537 | L: netdev@vger.kernel.org |
| 12542 | L: mptcp@lists.01.org | 12538 | L: mptcp@lists.linux.dev |
| 12543 | S: Maintained | 12539 | S: Maintained |
| 12544 | W: https://github.com/multipath-tcp/mptcp_net-next/wiki | 12540 | W: https://github.com/multipath-tcp/mptcp_net-next/wiki |
| 12545 | B: https://github.com/multipath-tcp/mptcp_net-next/issues | 12541 | B: https://github.com/multipath-tcp/mptcp_net-next/issues |
| @@ -14710,15 +14706,11 @@ F: drivers/net/ethernet/qlogic/qlcnic/ · 2164 unmodified lines | |||
| 14710 | QLOGIC QLGE 10Gb ETHERNET DRIVER | 14706 | QLOGIC QLGE 10Gb ETHERNET DRIVER |
| 14711 | M: Manish Chopra <manishc@marvell.com> | 14707 | M: Manish Chopra <manishc@marvell.com> |
| 14712 | M: GR-Linux-NIC-Dev@marvell.com | 14708 | M: GR-Linux-NIC-Dev@marvell.com |
| 14713 | L: netdev@vger.kernel.org | ||
| 14714 | S: Supported | ||
| 14715 | F: drivers/staging/qlge/ | ||
| 14716 | |||
| 14717 | QLOGIC QLGE 10Gb ETHERNET DRIVER | ||
| 14718 | M: Coiby Xu <coiby.xu@gmail.com> | 14709 | M: Coiby Xu <coiby.xu@gmail.com> |
| 14719 | L: netdev@vger.kernel.org | 14710 | L: netdev@vger.kernel.org |
| 14720 | S: Maintained | 14711 | S: Supported |
| 14721 | F: Documentation/networking/device_drivers/qlogic/qlge.rst | 14712 | F: Documentation/networking/device_drivers/qlogic/qlge.rst |
| 14713 | F: drivers/staging/qlge/ | ||
| 14722 | 14714 | ||
| 14723 | QM1D1B0004 MEDIA DRIVER | 14715 | QM1D1B0004 MEDIA DRIVER |
| 14724 | M: Akihiro Tsukada <tskd08@gmail.com> | 14716 | M: Akihiro Tsukada <tskd08@gmail.com> |
| @@ -16888,8 +16880,10 @@ F: tools/spi/ · 2163 unmodified lines | |||
| 16888 | 16880 | ||
| 16889 | SPIDERNET NETWORK DRIVER for CELL | 16881 | SPIDERNET NETWORK DRIVER for CELL |
| 16890 | M: Ishizaki Kou <kou.ishizaki@toshiba.co.jp> | 16882 | M: Ishizaki Kou <kou.ishizaki@toshiba.co.jp> |
| 16883 | M: Geoff Levand <geoff@infradead.org> | ||
| 16891 | L: netdev@vger.kernel.org | 16884 | L: netdev@vger.kernel.org |
| 16892 | S: Supported | 16885 | L: linuxppc-dev@lists.ozlabs.org |
| 16886 | S: Maintained | ||
| 16893 | F: Documentation/networking/device_drivers/ethernet/toshiba/spider_net.rst | 16887 | F: Documentation/networking/device_drivers/ethernet/toshiba/spider_net.rst |
| 16894 | F: drivers/net/ethernet/toshiba/spider_net* | 16888 | F: drivers/net/ethernet/toshiba/spider_net* |
| 16895 | 16889 | ||
| @@ -16943,7 +16937,8 @@ F: Documentation/devicetree/bindings/media/i2c/st,st-mipid02.txt · 47 unmodified lines | |||
| 16943 | F: drivers/media/i2c/st-mipid02.c | 16937 | F: drivers/media/i2c/st-mipid02.c |
| 16944 | 16938 | ||
| 16945 | ST STM32 I2C/SMBUS DRIVER | 16939 | ST STM32 I2C/SMBUS DRIVER |
| 16946 | M: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> | 16940 | M: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com> |
| 16941 | M: Alain Volmat <alain.volmat@foss.st.com> | ||
| 16947 | L: linux-i2c@vger.kernel.org | 16942 | L: linux-i2c@vger.kernel.org |
| 16948 | S: Maintained | 16943 | S: Maintained |
| 16949 | F: drivers/i2c/busses/i2c-stm32* | 16944 | F: drivers/i2c/busses/i2c-stm32* |
| @@ -17041,7 +17036,7 @@ F: drivers/staging/vt665?/ · 91 unmodified lines | |||
| 17041 | 17036 | ||
| 17042 | STAGING SUBSYSTEM | 17037 | STAGING SUBSYSTEM |
| 17043 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 17038 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| 17044 | L: devel@driverdev.osuosl.org | 17039 | L: linux-staging@lists.linux.dev |
| 17045 | S: Supported | 17040 | S: Supported |
| 17046 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git | 17041 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git |
| 17047 | F: drivers/staging/ | 17042 | F: drivers/staging/ |
| @@ -17068,7 +17063,7 @@ F: kernel/jump_label.c · 20 unmodified lines | |||
| 17068 | F: kernel/static_call.c | 17063 | F: kernel/static_call.c |
| 17069 | 17064 | ||
| 17070 | STI AUDIO (ASoC) DRIVERS | 17065 | STI AUDIO (ASoC) DRIVERS |
| 17071 | M: Arnaud Pouliquen <arnaud.pouliquen@st.com> | 17066 | M: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
| 17072 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 17067 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| 17073 | S: Maintained | 17068 | S: Maintained |
| 17074 | F: Documentation/devicetree/bindings/sound/st,sti-asoc-card.txt | 17069 | F: Documentation/devicetree/bindings/sound/st,sti-asoc-card.txt |
| @@ -17088,15 +17083,15 @@ T: git git://linuxtv.org/media_tree.git · 13 unmodified lines | |||
| 17088 | F: drivers/media/usb/stk1160/ | 17083 | F: drivers/media/usb/stk1160/ |
| 17089 | 17084 | ||
| 17090 | STM32 AUDIO (ASoC) DRIVERS | 17085 | STM32 AUDIO (ASoC) DRIVERS |
| 17091 | M: Olivier Moysan <olivier.moysan@st.com> | 17086 | M: Olivier Moysan <olivier.moysan@foss.st.com> |
| 17092 | M: Arnaud Pouliquen <arnaud.pouliquen@st.com> | 17087 | M: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
| 17093 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 17088 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| 17094 | S: Maintained | 17089 | S: Maintained |
| 17095 | F: Documentation/devicetree/bindings/iio/adc/st,stm32-*.yaml | 17090 | F: Documentation/devicetree/bindings/iio/adc/st,stm32-*.yaml |
| 17096 | F: sound/soc/stm/ | 17091 | F: sound/soc/stm/ |
| 17097 | 17092 | ||
| 17098 | STM32 TIMER/LPTIMER DRIVERS | 17093 | STM32 TIMER/LPTIMER DRIVERS |
| 17099 | M: Fabrice Gasnier <fabrice.gasnier@st.com> | 17094 | M: Fabrice Gasnier <fabrice.gasnier@foss.st.com> |
| 17100 | S: Maintained | 17095 | S: Maintained |
| 17101 | F: Documentation/ABI/testing/*timer-stm32 | 17096 | F: Documentation/ABI/testing/*timer-stm32 |
| 17102 | F: Documentation/devicetree/bindings/*/*stm32-*timer* | 17097 | F: Documentation/devicetree/bindings/*/*stm32-*timer* |
| @@ -17106,7 +17101,7 @@ F: include/linux/*/stm32-*tim* · 3 unmodified lines | |||
| 17106 | 17101 | ||
| 17107 | STMMAC ETHERNET DRIVER | 17102 | STMMAC ETHERNET DRIVER |
| 17108 | M: Giuseppe Cavallaro <peppe.cavallaro@st.com> | 17103 | M: Giuseppe Cavallaro <peppe.cavallaro@st.com> |
| 17109 | M: Alexandre Torgue <alexandre.torgue@st.com> | 17104 | M: Alexandre Torgue <alexandre.torgue@foss.st.com> |
| 17110 | M: Jose Abreu <joabreu@synopsys.com> | 17105 | M: Jose Abreu <joabreu@synopsys.com> |
| 17111 | L: netdev@vger.kernel.org | 17106 | L: netdev@vger.kernel.org |
| 17112 | S: Supported | 17107 | S: Supported |
| @@ -17848,7 +17843,6 @@ S: Maintained · 735 unmodified lines | |||
| 17848 | F: drivers/thermal/ti-soc-thermal/ | 17843 | F: drivers/thermal/ti-soc-thermal/ |
| 17849 | 17844 | ||
| 17850 | TI BQ27XXX POWER SUPPLY DRIVER | 17845 | TI BQ27XXX POWER SUPPLY DRIVER |
| 17851 | R: Dan Murphy <dmurphy@ti.com> | ||
| 17852 | F: drivers/power/supply/bq27xxx_battery.c | 17846 | F: drivers/power/supply/bq27xxx_battery.c |
| 17853 | F: drivers/power/supply/bq27xxx_battery_i2c.c | 17847 | F: drivers/power/supply/bq27xxx_battery_i2c.c |
| 17854 | F: include/linux/power/bq27xxx_battery.h | 17848 | F: include/linux/power/bq27xxx_battery.h |
| @@ -17983,7 +17977,6 @@ S: Odd Fixes · 128 unmodified lines | |||
| 17983 | F: sound/soc/codecs/tas571x* | 17977 | F: sound/soc/codecs/tas571x* |
| 17984 | 17978 | ||
| 17985 | TI TCAN4X5X DEVICE DRIVER | 17979 | TI TCAN4X5X DEVICE DRIVER |
| 17986 | M: Dan Murphy <dmurphy@ti.com> | ||
| 17987 | L: linux-can@vger.kernel.org | 17980 | L: linux-can@vger.kernel.org |
| 17988 | S: Maintained | 17981 | S: Maintained |
| 17989 | F: Documentation/devicetree/bindings/net/can/tcan4x5x.txt | 17982 | F: Documentation/devicetree/bindings/net/can/tcan4x5x.txt |
| @@ -19136,7 +19129,7 @@ VME SUBSYSTEM · 1146 unmodified lines | |||
| 19136 | M: Martyn Welch <martyn@welchs.me.uk> | 19129 | M: Martyn Welch <martyn@welchs.me.uk> |
| 19137 | M: Manohar Vanga <manohar.vanga@gmail.com> | 19130 | M: Manohar Vanga <manohar.vanga@gmail.com> |
| 19138 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 19131 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| 19139 | L: devel@driverdev.osuosl.org | 19132 | L: linux-kernel@vger.kernel.org |
| 19140 | S: Maintained | 19133 | S: Maintained |
| 19141 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git | 19134 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git |
| 19142 | F: Documentation/driver-api/vme.rst | 19135 | F: Documentation/driver-api/vme.rst |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 12 | 3 | PATCHLEVEL = 12 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc3 | 5 | EXTRAVERSION = -rc5 |
| 6 | NAME = Frozen Wasteland | 6 | NAME = Frozen Wasteland |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -40,6 +40,9 @@ · 39 unmodified lines | |||
| 40 | ethernet1 = &cpsw_emac1; | 40 | ethernet1 = &cpsw_emac1; |
| 41 | spi0 = &spi0; | 41 | spi0 = &spi0; |
| 42 | spi1 = &spi1; | 42 | spi1 = &spi1; |
| 43 | mmc0 = &mmc1; | ||
| 44 | mmc1 = &mmc2; | ||
| 45 | mmc2 = &mmc3; | ||
| 43 | }; | 46 | }; |
| 44 | 47 | ||
| 45 | cpus { | 48 | cpus { |
| @@ -334,14 +334,6 @@ · 333 unmodified lines | |||
| 334 | }; | 334 | }; |
| 335 | 335 | ||
| 336 | &pinctrl { | 336 | &pinctrl { |
| 337 | atmel,mux-mask = < | ||
| 338 | /* A B C */ | ||
| 339 | 0xFFFFFE7F 0xC0E0397F 0xEF00019D /* pioA */ | ||
| 340 | 0x03FFFFFF 0x02FC7E68 0x00780000 /* pioB */ | ||
| 341 | 0xffffffff 0xF83FFFFF 0xB800F3FC /* pioC */ | ||
| 342 | 0x003FFFFF 0x003F8000 0x00000000 /* pioD */ | ||
| 343 | >; | ||
| 344 | |||
| 345 | adc { | 337 | adc { |
| 346 | pinctrl_adc_default: adc_default { | 338 | pinctrl_adc_default: adc_default { |
| 347 | atmel,pins = <AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE>; | 339 | atmel,pins = <AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE>; |
| @@ -84,8 +84,8 @@ · 83 unmodified lines | |||
| 84 | pinctrl-0 = <&pinctrl_macb0_default>; | 84 | pinctrl-0 = <&pinctrl_macb0_default>; |
| 85 | phy-mode = "rmii"; | 85 | phy-mode = "rmii"; |
| 86 | 86 | ||
| 87 | ethernet-phy@0 { | 87 | ethernet-phy@7 { |
| 88 | reg = <0x0>; | 88 | reg = <0x7>; |
| 89 | interrupt-parent = <&pioA>; | 89 | interrupt-parent = <&pioA>; |
| 90 | interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>; | 90 | interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>; |
| 91 | pinctrl-names = "default"; | 91 | pinctrl-names = "default"; |
| @@ -210,9 +210,6 @@ · 209 unmodified lines | |||
| 210 | micrel,led-mode = <1>; | 210 | micrel,led-mode = <1>; |
| 211 | clocks = <&clks IMX6UL_CLK_ENET_REF>; | 211 | clocks = <&clks IMX6UL_CLK_ENET_REF>; |
| 212 | clock-names = "rmii-ref"; | 212 | clock-names = "rmii-ref"; |
| 213 | reset-gpios = <&gpio_spi 1 GPIO_ACTIVE_LOW>; | ||
| 214 | reset-assert-us = <10000>; | ||
| 215 | reset-deassert-us = <100>; | ||
| 216 | 213 | ||
| 217 | }; | 214 | }; |
| 218 | 215 | ||
| @@ -222,9 +219,6 @@ · 3 unmodified lines | |||
| 222 | micrel,led-mode = <1>; | 219 | micrel,led-mode = <1>; |
| 223 | clocks = <&clks IMX6UL_CLK_ENET2_REF>; | 220 | clocks = <&clks IMX6UL_CLK_ENET2_REF>; |
| 224 | clock-names = "rmii-ref"; | 221 | clock-names = "rmii-ref"; |
| 225 | reset-gpios = <&gpio_spi 2 GPIO_ACTIVE_LOW>; | ||
| 226 | reset-assert-us = <10000>; | ||
| 227 | reset-deassert-us = <100>; | ||
| 228 | }; | 222 | }; |
| 229 | }; | 223 | }; |
| 230 | }; | 224 | }; |
| @@ -243,6 +237,22 @@ · 12 unmodified lines | |||
| 243 | status = "okay"; | 237 | status = "okay"; |
| 244 | }; | 238 | }; |
| 245 | 239 | ||
| 240 | &gpio_spi { | ||
| 241 | eth0-phy-hog { | ||
| 242 | gpio-hog; | ||
| 243 | gpios = <1 GPIO_ACTIVE_HIGH>; | ||
| 244 | output-high; | ||
| 245 | line-name = "eth0-phy"; | ||
| 246 | }; | ||
| 247 | |||
| 248 | eth1-phy-hog { | ||
| 249 | gpio-hog; | ||
| 250 | gpios = <2 GPIO_ACTIVE_HIGH>; | ||
| 251 | output-high; | ||
| 252 | line-name = "eth1-phy"; | ||
| 253 | }; | ||
| 254 | }; | ||
| 255 | |||
| 246 | &i2c1 { | 256 | &i2c1 { |
| 247 | clock-frequency = <100000>; | 257 | clock-frequency = <100000>; |
| 248 | pinctrl-names = "default"; | 258 | pinctrl-names = "default"; |
| @@ -14,5 +14,6 @@ · 13 unmodified lines | |||
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | &gpmi { | 16 | &gpmi { |
| 17 | fsl,use-minimum-ecc; | ||
| 17 | status = "okay"; | 18 | status = "okay"; |
| 18 | }; | 19 | }; |
| @@ -606,6 +606,15 @@ · 605 unmodified lines | |||
| 606 | compatible = "microchip,sam9x60-pinctrl", "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus"; | 606 | compatible = "microchip,sam9x60-pinctrl", "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus"; |
| 607 | ranges = <0xfffff400 0xfffff400 0x800>; | 607 | ranges = <0xfffff400 0xfffff400 0x800>; |
| 608 | 608 | ||
| 609 | /* mux-mask corresponding to sam9x60 SoC in TFBGA228L package */ | ||
| 610 | atmel,mux-mask = < | ||
| 611 | /* A B C */ | ||
| 612 | 0xffffffff 0xffe03fff 0xef00019d /* pioA */ | ||
| 613 | 0x03ffffff 0x02fc7e7f 0x00780000 /* pioB */ | ||
| 614 | 0xffffffff 0xffffffff 0xf83fffff /* pioC */ | ||
| 615 | 0x003fffff 0x003f8000 0x00000000 /* pioD */ | ||
| 616 | >; | ||
| 617 | |||
| 609 | pioA: gpio@fffff400 { | 618 | pioA: gpio@fffff400 { |
| 610 | compatible = "microchip,sam9x60-gpio", "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; | 619 | compatible = "microchip,sam9x60-gpio", "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; |
| 611 | reg = <0xfffff400 0x200>; | 620 | reg = <0xfffff400 0x200>; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
| 8 | #include <linux/irq.h> | 8 | #include <linux/irq.h> |
| 9 | #include <linux/irqdomain.h> | 9 | #include <linux/irqdomain.h> |
| 10 | #include <linux/irqchip.h> | ||
| 10 | #include <linux/io.h> | 11 | #include <linux/io.h> |
| 11 | #include <linux/of.h> | 12 | #include <linux/of.h> |
| 12 | #include <linux/of_address.h> | 13 | #include <linux/of_address.h> |
| @@ -162,7 +163,7 @@ static void __exception_irq_entry avic_handle_irq(struct pt_regs *regs) · 149 unmodified lines | |||
| 162 | * interrupts. It registers the interrupt enable and disable functions | 163 | * interrupts. It registers the interrupt enable and disable functions |
| 163 | * to the kernel for each interrupt source. | 164 | * to the kernel for each interrupt source. |
| 164 | */ | 165 | */ |
| 165 | void __init mxc_init_irq(void __iomem *irqbase) | 166 | static void __init mxc_init_irq(void __iomem *irqbase) |
| 166 | { | 167 | { |
| 167 | struct device_node *np; | 168 | struct device_node *np; |
| 168 | int irq_base; | 169 | int irq_base; |
| @@ -220,3 +221,16 @@ void __init mxc_init_irq(void __iomem *irqbase) · 51 unmodified lines | |||
| 220 | 221 | ||
| 221 | printk(KERN_INFO "MXC IRQ initialized\n"); | 222 | printk(KERN_INFO "MXC IRQ initialized\n"); |
| 222 | } | 223 | } |
| 224 | |||
| 225 | static int __init imx_avic_init(struct device_node *node, | ||
| 226 | struct device_node *parent) | ||
| 227 | { | ||
| 228 | void __iomem *avic_base; | ||
| 229 | |||
| 230 | avic_base = of_iomap(node, 0); | ||
| 231 | BUG_ON(!avic_base); | ||
| 232 | mxc_init_irq(avic_base); | ||
| 233 | return 0; | ||
| 234 | } | ||
| 235 | |||
| 236 | IRQCHIP_DECLARE(imx_avic, "fsl,avic", imx_avic_init); | ||
| @@ -22,7 +22,6 @@ void mx35_map_io(void); · 21 unmodified lines | |||
| 22 | void imx21_init_early(void); | 22 | void imx21_init_early(void); |
| 23 | void imx31_init_early(void); | 23 | void imx31_init_early(void); |
| 24 | void imx35_init_early(void); | 24 | void imx35_init_early(void); |
| 25 | void mxc_init_irq(void __iomem *); | ||
| 26 | void mx31_init_irq(void); | 25 | void mx31_init_irq(void); |
| 27 | void mx35_init_irq(void); | 26 | void mx35_init_irq(void); |
| 28 | void mxc_set_cpu_type(unsigned int type); | 27 | void mxc_set_cpu_type(unsigned int type); |
| @@ -17,16 +17,6 @@ static void __init imx1_init_early(void) · 16 unmodified lines | |||
| 17 | mxc_set_cpu_type(MXC_CPU_MX1); | 17 | mxc_set_cpu_type(MXC_CPU_MX1); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | static void __init imx1_init_irq(void) | ||
| 21 | { | ||
| 22 | void __iomem *avic_addr; | ||
| 23 | |||
| 24 | avic_addr = ioremap(MX1_AVIC_ADDR, SZ_4K); | ||
| 25 | WARN_ON(!avic_addr); | ||
| 26 | |||
| 27 | mxc_init_irq(avic_addr); | ||
| 28 | } | ||
| 29 | |||
| 30 | static const char * const imx1_dt_board_compat[] __initconst = { | 20 | static const char * const imx1_dt_board_compat[] __initconst = { |
| 31 | "fsl,imx1", | 21 | "fsl,imx1", |
| 32 | NULL | 22 | NULL |
| @@ -34,7 +24,6 @@ static const char * const imx1_dt_board_compat[] __initconst = { · 1 unmodified line | |||
| 34 | 24 | ||
| 35 | DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)") | 25 | DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)") |
| 36 | .init_early = imx1_init_early, | 26 | .init_early = imx1_init_early, |
| 37 | .init_irq = imx1_init_irq, | ||
| 38 | .dt_compat = imx1_dt_board_compat, | 27 | .dt_compat = imx1_dt_board_compat, |
| 39 | .restart = mxc_restart, | 28 | .restart = mxc_restart, |
| 40 | MACHINE_END | 29 | MACHINE_END |
| @@ -22,17 +22,6 @@ static void __init imx25_dt_init(void) · 21 unmodified lines | |||
| 22 | imx_aips_allow_unprivileged_access("fsl,imx25-aips"); | 22 | imx_aips_allow_unprivileged_access("fsl,imx25-aips"); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | static void __init mx25_init_irq(void) | ||
| 26 | { | ||
| 27 | struct device_node *np; | ||
| 28 | void __iomem *avic_base; | ||
| 29 | |||
| 30 | np = of_find_compatible_node(NULL, NULL, "fsl,avic"); | ||
| 31 | avic_base = of_iomap(np, 0); | ||
| 32 | BUG_ON(!avic_base); | ||
| 33 | mxc_init_irq(avic_base); | ||
| 34 | } | ||
| 35 | |||
| 36 | static const char * const imx25_dt_board_compat[] __initconst = { | 25 | static const char * const imx25_dt_board_compat[] __initconst = { |
| 37 | "fsl,imx25", | 26 | "fsl,imx25", |
| 38 | NULL | 27 | NULL |
| @@ -42,6 +31,5 @@ DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") · 3 unmodified lines | |||
| 42 | .init_early = imx25_init_early, | 31 | .init_early = imx25_init_early, |
| 43 | .init_machine = imx25_dt_init, | 32 | .init_machine = imx25_dt_init, |
| 44 | .init_late = imx25_pm_init, | 33 | .init_late = imx25_pm_init, |
| 45 | .init_irq = mx25_init_irq, | ||
| 46 | .dt_compat = imx25_dt_board_compat, | 34 | .dt_compat = imx25_dt_board_compat, |
| 47 | MACHINE_END | 35 | MACHINE_END |
| @@ -56,17 +56,6 @@ static void __init imx27_init_early(void) · 55 unmodified lines | |||
| 56 | mxc_set_cpu_type(MXC_CPU_MX27); | 56 | mxc_set_cpu_type(MXC_CPU_MX27); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static void __init mx27_init_irq(void) | ||
| 60 | { | ||
| 61 | void __iomem *avic_base; | ||
| 62 | struct device_node *np; | ||
| 63 | |||
| 64 | np = of_find_compatible_node(NULL, NULL, "fsl,avic"); | ||
| 65 | avic_base = of_iomap(np, 0); | ||
| 66 | BUG_ON(!avic_base); | ||
| 67 | mxc_init_irq(avic_base); | ||
| 68 | } | ||
| 69 | |||
| 70 | static const char * const imx27_dt_board_compat[] __initconst = { | 59 | static const char * const imx27_dt_board_compat[] __initconst = { |
| 71 | "fsl,imx27", | 60 | "fsl,imx27", |
| 72 | NULL | 61 | NULL |
| @@ -75,7 +64,6 @@ static const char * const imx27_dt_board_compat[] __initconst = { · 2 unmodified lines | |||
| 75 | DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)") | 64 | DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)") |
| 76 | .map_io = mx27_map_io, | 65 | .map_io = mx27_map_io, |
| 77 | .init_early = imx27_init_early, | 66 | .init_early = imx27_init_early, |
| 78 | .init_irq = mx27_init_irq, | ||
| 79 | .init_late = imx27_pm_init, | 67 | .init_late = imx27_pm_init, |
| 80 | .dt_compat = imx27_dt_board_compat, | 68 | .dt_compat = imx27_dt_board_compat, |
| 81 | MACHINE_END | 69 | MACHINE_END |
| @@ -14,6 +14,5 @@ static const char * const imx31_dt_board_compat[] __initconst = { · 13 unmodified lines | |||
| 14 | DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)") | 14 | DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)") |
| 15 | .map_io = mx31_map_io, | 15 | .map_io = mx31_map_io, |
| 16 | .init_early = imx31_init_early, | 16 | .init_early = imx31_init_early, |
| 17 | .init_irq = mx31_init_irq, | ||
| 18 | .dt_compat = imx31_dt_board_compat, | 17 | .dt_compat = imx31_dt_board_compat, |
| 19 | MACHINE_END | 18 | MACHINE_END |
| @@ -27,6 +27,5 @@ DT_MACHINE_START(IMX35_DT, "Freescale i.MX35 (Device Tree Support)") · 26 unmodified lines | |||
| 27 | .l2c_aux_mask = ~0, | 27 | .l2c_aux_mask = ~0, |
| 28 | .map_io = mx35_map_io, | 28 | .map_io = mx35_map_io, |
| 29 | .init_early = imx35_init_early, | 29 | .init_early = imx35_init_early, |
| 30 | .init_irq = mx35_init_irq, | ||
| 31 | .dt_compat = imx35_dt_board_compat, | 30 | .dt_compat = imx35_dt_board_compat, |
| 32 | MACHINE_END | 31 | MACHINE_END |
| @@ -109,18 +109,6 @@ void __init imx31_init_early(void) · 108 unmodified lines | |||
| 109 | mx3_ccm_base = of_iomap(np, 0); | 109 | mx3_ccm_base = of_iomap(np, 0); |
| 110 | BUG_ON(!mx3_ccm_base); | 110 | BUG_ON(!mx3_ccm_base); |
| 111 | } | 111 | } |
| 112 | |||
| 113 | void __init mx31_init_irq(void) | ||
| 114 | { | ||
| 115 | void __iomem *avic_base; | ||
| 116 | struct device_node *np; | ||
| 117 | |||
| 118 | np = of_find_compatible_node(NULL, NULL, "fsl,imx31-avic"); | ||
| 119 | avic_base = of_iomap(np, 0); | ||
| 120 | BUG_ON(!avic_base); | ||
| 121 | |||
| 122 | mxc_init_irq(avic_base); | ||
| 123 | } | ||
| 124 | #endif /* ifdef CONFIG_SOC_IMX31 */ | 112 | #endif /* ifdef CONFIG_SOC_IMX31 */ |
| 125 | 113 | ||
| 126 | #ifdef CONFIG_SOC_IMX35 | 114 | #ifdef CONFIG_SOC_IMX35 |
| @@ -158,16 +146,4 @@ void __init imx35_init_early(void) · 31 unmodified lines | |||
| 158 | mx3_ccm_base = of_iomap(np, 0); | 146 | mx3_ccm_base = of_iomap(np, 0); |
| 159 | BUG_ON(!mx3_ccm_base); | 147 | BUG_ON(!mx3_ccm_base); |
| 160 | } | 148 | } |
| 161 | |||
| 162 | void __init mx35_init_irq(void) | ||
| 163 | { | ||
| 164 | void __iomem *avic_base; | ||
| 165 | struct device_node *np; | ||
| 166 | |||
| 167 | np = of_find_compatible_node(NULL, NULL, "fsl,imx35-avic"); | ||
| 168 | avic_base = of_iomap(np, 0); | ||
| 169 | BUG_ON(!avic_base); | ||
| 170 | |||
| 171 | mxc_init_irq(avic_base); | ||
| 172 | } | ||
| 173 | #endif /* ifdef CONFIG_SOC_IMX35 */ | 149 | #endif /* ifdef CONFIG_SOC_IMX35 */ |
| @@ -88,34 +88,26 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, · 87 unmodified lines | |||
| 88 | 88 | ||
| 89 | extern struct omap_sr_data omap_sr_pdata[]; | 89 | extern struct omap_sr_data omap_sr_pdata[]; |
| 90 | 90 | ||
| 91 | static int __init sr_dev_init(struct omap_hwmod *oh, void *user) | 91 | static int __init sr_init_by_name(const char *name, const char *voltdm) |
| 92 | { | 92 | { |
| 93 | struct omap_sr_data *sr_data = NULL; | 93 | struct omap_sr_data *sr_data = NULL; |
| 94 | struct omap_volt_data *volt_data; | 94 | struct omap_volt_data *volt_data; |
| 95 | struct omap_smartreflex_dev_attr *sr_dev_attr; | ||
| 96 | static int i; | 95 | static int i; |
| 97 | 96 | ||
| 98 | if (!strncmp(oh->name, "smartreflex_mpu_iva", 20) || | 97 | if (!strncmp(name, "smartreflex_mpu_iva", 20) || |
| 99 | !strncmp(oh->name, "smartreflex_mpu", 16)) | 98 | !strncmp(name, "smartreflex_mpu", 16)) |
| 100 | sr_data = &omap_sr_pdata[OMAP_SR_MPU]; | 99 | sr_data = &omap_sr_pdata[OMAP_SR_MPU]; |
| 101 | else if (!strncmp(oh->name, "smartreflex_core", 17)) | 100 | else if (!strncmp(name, "smartreflex_core", 17)) |
| 102 | sr_data = &omap_sr_pdata[OMAP_SR_CORE]; | 101 | sr_data = &omap_sr_pdata[OMAP_SR_CORE]; |
| 103 | else if (!strncmp(oh->name, "smartreflex_iva", 16)) | 102 | else if (!strncmp(name, "smartreflex_iva", 16)) |
| 104 | sr_data = &omap_sr_pdata[OMAP_SR_IVA]; | 103 | sr_data = &omap_sr_pdata[OMAP_SR_IVA]; |
| 105 | 104 | ||
| 106 | if (!sr_data) { | 105 | if (!sr_data) { |
| 107 | pr_err("%s: Unknown instance %s\n", __func__, oh->name); | 106 | pr_err("%s: Unknown instance %s\n", __func__, name); |
| 108 | return -EINVAL; | 107 | return -EINVAL; |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr; | 110 | sr_data->name = name; |
| 112 | if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) { | ||
| 113 | pr_err("%s: No voltage domain specified for %s. Cannot initialize\n", | ||
| 114 | __func__, oh->name); | ||
| 115 | goto exit; | ||
| 116 | } | ||
| 117 | |||
| 118 | sr_data->name = oh->name; | ||
| 119 | if (cpu_is_omap343x()) | 111 | if (cpu_is_omap343x()) |
| 120 | sr_data->ip_type = 1; | 112 | sr_data->ip_type = 1; |
| 121 | else | 113 | else |
| @@ -136,10 +128,10 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) · 14 unmodified lines | |||
| 136 | } | 128 | } |
| 137 | } | 129 | } |
| 138 | 130 | ||
| 139 | sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); | 131 | sr_data->voltdm = voltdm_lookup(voltdm); |
| 140 | if (!sr_data->voltdm) { | 132 | if (!sr_data->voltdm) { |
| 141 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", | 133 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", |
| 142 | __func__, sr_dev_attr->sensor_voltdm_name); | 134 | __func__, voltdm); |
| 143 | goto exit; | 135 | goto exit; |
| 144 | } | 136 | } |
| 145 | 137 | ||
| @@ -160,6 +152,20 @@ exit: · 14 unmodified lines | |||
| 160 | return 0; | 152 | return 0; |
| 161 | } | 153 | } |
| 162 | 154 | ||
| 155 | static int __init sr_dev_init(struct omap_hwmod *oh, void *user) | ||
| 156 | { | ||
| 157 | struct omap_smartreflex_dev_attr *sr_dev_attr; | ||
| 158 | |||
| 159 | sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr; | ||
| 160 | if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) { | ||
| 161 | pr_err("%s: No voltage domain specified for %s. Cannot initialize\n", | ||
| 162 | __func__, oh->name); | ||
| 163 | return 0; | ||
| 164 | } | ||
| 165 | |||
| 166 | return sr_init_by_name(oh->name, sr_dev_attr->sensor_voltdm_name); | ||
| 167 | } | ||
| 168 | |||
| 163 | /* | 169 | /* |
| 164 | * API to be called from board files to enable smartreflex | 170 | * API to be called from board files to enable smartreflex |
| 165 | * autocompensation at init. | 171 | * autocompensation at init. |
| @@ -169,7 +175,42 @@ void __init omap_enable_smartreflex_on_init(void) · 3 unmodified lines | |||
| 169 | sr_enable_on_init = true; | 175 | sr_enable_on_init = true; |
| 170 | } | 176 | } |
| 171 | 177 | ||
| 178 | static const char * const omap4_sr_instances[] = { | ||
| 179 | "mpu", | ||
| 180 | "iva", | ||
| 181 | "core", | ||
| 182 | }; | ||
| 183 | |||
| 184 | static const char * const dra7_sr_instances[] = { | ||
| 185 | "mpu", | ||
| 186 | "core", | ||
| 187 | }; | ||
| 188 | |||
| 172 | int __init omap_devinit_smartreflex(void) | 189 | int __init omap_devinit_smartreflex(void) |
| 173 | { | 190 | { |
| 191 | const char * const *sr_inst; | ||
| 192 | int i, nr_sr = 0; | ||
| 193 | |||
| 194 | if (soc_is_omap44xx()) { | ||
| 195 | sr_inst = omap4_sr_instances; | ||
| 196 | nr_sr = ARRAY_SIZE(omap4_sr_instances); | ||
| 197 | |||
| 198 | } else if (soc_is_dra7xx()) { | ||
| 199 | sr_inst = dra7_sr_instances; | ||
| 200 | nr_sr = ARRAY_SIZE(dra7_sr_instances); | ||
| 201 | } | ||
| 202 | |||
| 203 | if (nr_sr) { | ||
| 204 | const char *name, *voltdm; | ||
| 205 | |||
| 206 | for (i = 0; i < nr_sr; i++) { | ||
| 207 | name = kasprintf(GFP_KERNEL, "smartreflex_%s", sr_inst[i]); | ||
| 208 | voltdm = sr_inst[i]; | ||
| 209 | sr_init_by_name(name, voltdm); | ||
| 210 | } | ||
| 211 | |||
| 212 | return 0; | ||
| 213 | } | ||
| 214 | |||
| 174 | return omap_hwmod_for_each_by_class("smartreflex", sr_dev_init, NULL); | 215 | return omap_hwmod_for_each_by_class("smartreflex", sr_dev_init, NULL); |
| 175 | } | 216 | } |
| @@ -810,6 +810,16 @@ config QCOM_FALKOR_ERRATUM_E1041 · 809 unmodified lines | |||
| 810 | 810 | ||
| 811 | If unsure, say Y. | 811 | If unsure, say Y. |
| 812 | 812 | ||
| 813 | config NVIDIA_CARMEL_CNP_ERRATUM | ||
| 814 | bool "NVIDIA Carmel CNP: CNP on Carmel semantically different than ARM cores" | ||
| 815 | default y | ||
| 816 | help | ||
| 817 | If CNP is enabled on Carmel cores, non-sharable TLBIs on a core will not | ||
| 818 | invalidate shared TLB entries installed by a different core, as it would | ||
| 819 | on standard ARM cores. | ||
| 820 | |||
| 821 | If unsure, say Y. | ||
| 822 | |||
| 813 | config SOCIONEXT_SYNQUACER_PREITS | 823 | config SOCIONEXT_SYNQUACER_PREITS |
| 814 | bool "Socionext Synquacer: Workaround for GICv3 pre-ITS" | 824 | bool "Socionext Synquacer: Workaround for GICv3 pre-ITS" |
| 815 | default y | 825 | default y |
| @@ -198,6 +198,7 @@ · 197 unmodified lines | |||
| 198 | ranges = <0x0 0x00 0x1700000 0x100000>; | 198 | ranges = <0x0 0x00 0x1700000 0x100000>; |
| 199 | reg = <0x00 0x1700000 0x0 0x100000>; | 199 | reg = <0x00 0x1700000 0x0 0x100000>; |
| 200 | interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; | 200 | interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; |
| 201 | dma-coherent; | ||
| 201 | 202 | ||
| 202 | sec_jr0: jr@10000 { | 203 | sec_jr0: jr@10000 { |
| 203 | compatible = "fsl,sec-v5.4-job-ring", | 204 | compatible = "fsl,sec-v5.4-job-ring", |
| @@ -348,6 +348,7 @@ · 347 unmodified lines | |||
| 348 | ranges = <0x0 0x00 0x1700000 0x100000>; | 348 | ranges = <0x0 0x00 0x1700000 0x100000>; |
| 349 | reg = <0x00 0x1700000 0x0 0x100000>; | 349 | reg = <0x00 0x1700000 0x0 0x100000>; |
| 350 | interrupts = <0 75 0x4>; | 350 | interrupts = <0 75 0x4>; |
| 351 | dma-coherent; | ||
| 351 | 352 | ||
| 352 | sec_jr0: jr@10000 { | 353 | sec_jr0: jr@10000 { |
| 353 | compatible = "fsl,sec-v5.4-job-ring", | 354 | compatible = "fsl,sec-v5.4-job-ring", |
| @@ -354,6 +354,7 @@ · 353 unmodified lines | |||
| 354 | ranges = <0x0 0x00 0x1700000 0x100000>; | 354 | ranges = <0x0 0x00 0x1700000 0x100000>; |
| 355 | reg = <0x00 0x1700000 0x0 0x100000>; | 355 | reg = <0x00 0x1700000 0x0 0x100000>; |
| 356 | interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; | 356 | interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; |
| 357 | dma-coherent; | ||
| 357 | 358 | ||
| 358 | sec_jr0: jr@10000 { | 359 | sec_jr0: jr@10000 { |
| 359 | compatible = "fsl,sec-v5.4-job-ring", | 360 | compatible = "fsl,sec-v5.4-job-ring", |
| @@ -35,7 +35,7 @@ · 34 unmodified lines | |||
| 35 | 35 | ||
| 36 | &i2c2 { | 36 | &i2c2 { |
| 37 | clock-frequency = <400000>; | 37 | clock-frequency = <400000>; |
| 38 | pinctrl-names = "default"; | 38 | pinctrl-names = "default", "gpio"; |
| 39 | pinctrl-0 = <&pinctrl_i2c2>; | 39 | pinctrl-0 = <&pinctrl_i2c2>; |
| 40 | pinctrl-1 = <&pinctrl_i2c2_gpio>; | 40 | pinctrl-1 = <&pinctrl_i2c2_gpio>; |
| 41 | sda-gpios = <&gpio5 17 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; | 41 | sda-gpios = <&gpio5 17 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; |
| @@ -67,7 +67,7 @@ · 66 unmodified lines | |||
| 67 | 67 | ||
| 68 | &i2c1 { | 68 | &i2c1 { |
| 69 | clock-frequency = <400000>; | 69 | clock-frequency = <400000>; |
| 70 | pinctrl-names = "default"; | 70 | pinctrl-names = "default", "gpio"; |
| 71 | pinctrl-0 = <&pinctrl_i2c1>; | 71 | pinctrl-0 = <&pinctrl_i2c1>; |
| 72 | pinctrl-1 = <&pinctrl_i2c1_gpio>; | 72 | pinctrl-1 = <&pinctrl_i2c1_gpio>; |
| 73 | sda-gpios = <&gpio5 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; | 73 | sda-gpios = <&gpio5 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; |
| @@ -37,7 +37,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) · 36 unmodified lines | |||
| 37 | } while (--n > 0); | 37 | } while (--n > 0); |
| 38 | 38 | ||
| 39 | sum += ((sum >> 32) | (sum << 32)); | 39 | sum += ((sum >> 32) | (sum << 32)); |
| 40 | return csum_fold((__force u32)(sum >> 32)); | 40 | return csum_fold((__force __wsum)(sum >> 32)); |
| 41 | } | 41 | } |
| 42 | #define ip_fast_csum ip_fast_csum | 42 | #define ip_fast_csum ip_fast_csum |
| 43 | 43 | ||
| @@ -66,7 +66,8 @@ · 65 unmodified lines | |||
| 66 | #define ARM64_WORKAROUND_1508412 58 | 66 | #define ARM64_WORKAROUND_1508412 58 |
| 67 | #define ARM64_HAS_LDAPR 59 | 67 | #define ARM64_HAS_LDAPR 59 |
| 68 | #define ARM64_KVM_PROTECTED_MODE 60 | 68 | #define ARM64_KVM_PROTECTED_MODE 60 |
| 69 | #define ARM64_WORKAROUND_NVIDIA_CARMEL_CNP 61 | ||
| 69 | 70 | ||
| 70 | #define ARM64_NCAPS 61 | 71 | #define ARM64_NCAPS 62 |
| 71 | 72 | ||
| 72 | #endif /* __ASM_CPUCAPS_H */ | 73 | #endif /* __ASM_CPUCAPS_H */ |
| @@ -251,6 +251,8 @@ unsigned long get_wchan(struct task_struct *p); · 250 unmodified lines | |||
| 251 | extern struct task_struct *cpu_switch_to(struct task_struct *prev, | 251 | extern struct task_struct *cpu_switch_to(struct task_struct *prev, |
| 252 | struct task_struct *next); | 252 | struct task_struct *next); |
| 253 | 253 | ||
| 254 | asmlinkage void arm64_preempt_schedule_irq(void); | ||
| 255 | |||
| 254 | #define task_pt_regs(p) \ | 256 | #define task_pt_regs(p) \ |
| 255 | ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1) | 257 | ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1) |
| 256 | 258 | ||
| @@ -55,6 +55,8 @@ void arch_setup_new_exec(void); · 54 unmodified lines | |||
| 55 | #define arch_setup_new_exec arch_setup_new_exec | 55 | #define arch_setup_new_exec arch_setup_new_exec |
| 56 | 56 | ||
| 57 | void arch_release_task_struct(struct task_struct *tsk); | 57 | void arch_release_task_struct(struct task_struct *tsk); |
| 58 | int arch_dup_task_struct(struct task_struct *dst, | ||
| 59 | struct task_struct *src); | ||
| 58 | 60 | ||
| 59 | #endif | 61 | #endif |
| 60 | 62 | ||
| @@ -525,6 +525,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 524 unmodified lines | |||
| 525 | 0, 0, | 525 | 0, 0, |
| 526 | 1, 0), | 526 | 1, 0), |
| 527 | }, | 527 | }, |
| 528 | #endif | ||
| 529 | #ifdef CONFIG_NVIDIA_CARMEL_CNP_ERRATUM | ||
| 530 | { | ||
| 531 | /* NVIDIA Carmel */ | ||
| 532 | .desc = "NVIDIA Carmel CNP erratum", | ||
| 533 | .capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP, | ||
| 534 | ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL), | ||
| 535 | }, | ||
| 528 | #endif | 536 | #endif |
| 529 | { | 537 | { |
| 530 | } | 538 | } |
| @@ -1321,7 +1321,10 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope) · 1320 unmodified lines | |||
| 1321 | * may share TLB entries with a CPU stuck in the crashed | 1321 | * may share TLB entries with a CPU stuck in the crashed |
| 1322 | * kernel. | 1322 | * kernel. |
| 1323 | */ | 1323 | */ |
| 1324 | if (is_kdump_kernel()) | 1324 | if (is_kdump_kernel()) |
| 1325 | return false; | ||
| 1326 | |||
| 1327 | if (cpus_have_const_cap(ARM64_WORKAROUND_NVIDIA_CARMEL_CNP)) | ||
| 1325 | return false; | 1328 | return false; |
| 1326 | 1329 | ||
| 1327 | return has_cpuid_feature(entry, scope); | 1330 | return has_cpuid_feature(entry, scope); |
| @@ -353,7 +353,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) · 352 unmodified lines | |||
| 353 | * with the CLIDR_EL1 fields to avoid triggering false warnings | 353 | * with the CLIDR_EL1 fields to avoid triggering false warnings |
| 354 | * when there is a mismatch across the CPUs. Keep track of the | 354 | * when there is a mismatch across the CPUs. Keep track of the |
| 355 | * effective value of the CTR_EL0 in our internal records for | 355 | * effective value of the CTR_EL0 in our internal records for |
| 356 | * acurate sanity check and feature enablement. | 356 | * accurate sanity check and feature enablement. |
| 357 | */ | 357 | */ |
| 358 | info->reg_ctr = read_cpuid_effective_cachetype(); | 358 | info->reg_ctr = read_cpuid_effective_cachetype(); |
| 359 | info->reg_dczid = read_cpuid(DCZID_EL0); | 359 | info->reg_dczid = read_cpuid(DCZID_EL0); |
| @@ -64,5 +64,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, · 63 unmodified lines | |||
| 64 | ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos) | 64 | ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos) |
| 65 | { | 65 | { |
| 66 | memcpy(buf, phys_to_virt((phys_addr_t)*ppos), count); | 66 | memcpy(buf, phys_to_virt((phys_addr_t)*ppos), count); |
| 67 | *ppos += count; | ||
| 68 | |||
| 67 | return count; | 69 | return count; |
| 68 | } | 70 | } |
| @@ -57,6 +57,8 @@ · 56 unmodified lines | |||
| 57 | #include <asm/processor.h> | 57 | #include <asm/processor.h> |
| 58 | #include <asm/pointer_auth.h> | 58 | #include <asm/pointer_auth.h> |
| 59 | #include <asm/stacktrace.h> | 59 | #include <asm/stacktrace.h> |
| 60 | #include <asm/switch_to.h> | ||
| 61 | #include <asm/system_misc.h> | ||
| 60 | 62 | ||
| 61 | #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) | 63 | #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) |
| 62 | #include <linux/stackprotector.h> | 64 | #include <linux/stackprotector.h> |
| @@ -194,8 +194,9 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl) · 193 unmodified lines | |||
| 194 | 194 | ||
| 195 | #ifdef CONFIG_STACKTRACE | 195 | #ifdef CONFIG_STACKTRACE |
| 196 | 196 | ||
| 197 | void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, | 197 | noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, |
| 198 | struct task_struct *task, struct pt_regs *regs) | 198 | void *cookie, struct task_struct *task, |
| 199 | struct pt_regs *regs) | ||
| 199 | { | 200 | { |
| 200 | struct stackframe frame; | 201 | struct stackframe frame; |
| 201 | 202 | ||
| @@ -203,8 +204,8 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, · 1 unmodified line | |||
| 203 | start_backtrace(&frame, regs->regs[29], regs->pc); | 204 | start_backtrace(&frame, regs->regs[29], regs->pc); |
| 204 | else if (task == current) | 205 | else if (task == current) |
| 205 | start_backtrace(&frame, | 206 | start_backtrace(&frame, |
| 206 | (unsigned long)__builtin_frame_address(0), | 207 | (unsigned long)__builtin_frame_address(1), |
| 207 | (unsigned long)arch_stack_walk); | 208 | (unsigned long)__builtin_return_address(0)); |
| 208 | else | 209 | else |
| 209 | start_backtrace(&frame, thread_saved_fp(task), | 210 | start_backtrace(&frame, thread_saved_fp(task), |
| 210 | thread_saved_pc(task)); | 211 | thread_saved_pc(task)); |
| @@ -1448,6 +1448,22 @@ static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size) · 1447 unmodified lines | |||
| 1448 | struct range arch_get_mappable_range(void) | 1448 | struct range arch_get_mappable_range(void) |
| 1449 | { | 1449 | { |
| 1450 | struct range mhp_range; | 1450 | struct range mhp_range; |
| 1451 | u64 start_linear_pa = __pa(_PAGE_OFFSET(vabits_actual)); | ||
| 1452 | u64 end_linear_pa = __pa(PAGE_END - 1); | ||
| 1453 | |||
| 1454 | if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { | ||
| 1455 | /* | ||
| 1456 | * Check for a wrap, it is possible because of randomized linear | ||
| 1457 | * mapping the start physical address is actually bigger than | ||
| 1458 | * the end physical address. In this case set start to zero | ||
| 1459 | * because [0, end_linear_pa] range must still be able to cover | ||
| 1460 | * all addressable physical addresses. | ||
| 1461 | */ | ||
| 1462 | if (start_linear_pa > end_linear_pa) | ||
| 1463 | start_linear_pa = 0; | ||
| 1464 | } | ||
| 1465 | |||
| 1466 | WARN_ON(start_linear_pa > end_linear_pa); | ||
| 1451 | 1467 | ||
| 1452 | /* | 1468 | /* |
| 1453 | * Linear mapping region is the range [PAGE_OFFSET..(PAGE_END - 1)] | 1469 | * Linear mapping region is the range [PAGE_OFFSET..(PAGE_END - 1)] |
| @@ -1455,8 +1471,9 @@ struct range arch_get_mappable_range(void) · 1 unmodified line | |||
| 1455 | * range which can be mapped inside this linear mapping range, must | 1471 | * range which can be mapped inside this linear mapping range, must |
| 1456 | * also be derived from its end points. | 1472 | * also be derived from its end points. |
| 1457 | */ | 1473 | */ |
| 1458 | mhp_range.start = __pa(_PAGE_OFFSET(vabits_actual)); | 1474 | mhp_range.start = start_linear_pa; |
| 1459 | mhp_range.end = __pa(PAGE_END - 1); | 1475 | mhp_range.end = end_linear_pa; |
| 1476 | |||
| 1460 | return mhp_range; | 1477 | return mhp_range; |
| 1461 | } | 1478 | } |
| 1462 | 1479 | ||
| @@ -9,7 +9,7 @@ int arch_check_ftrace_location(struct kprobe *p) · 8 unmodified lines | |||
| 9 | return 0; | 9 | return 0; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | /* Ftrace callback handler for kprobes -- called under preepmt disabed */ | 12 | /* Ftrace callback handler for kprobes -- called under preepmt disabled */ |
| 13 | void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, | 13 | void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, |
| 14 | struct ftrace_ops *ops, struct ftrace_regs *fregs) | 14 | struct ftrace_ops *ops, struct ftrace_regs *fregs) |
| 15 | { | 15 | { |
| @@ -59,7 +59,7 @@ show_##name(struct device *dev, struct device_attribute *attr, \ · 58 unmodified lines | |||
| 59 | char *buf) \ | 59 | char *buf) \ |
| 60 | { \ | 60 | { \ |
| 61 | u32 cpu=dev->id; \ | 61 | u32 cpu=dev->id; \ |
| 62 | return sprintf(buf, "%lx\n", name[cpu]); \ | 62 | return sprintf(buf, "%llx\n", name[cpu]); \ |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #define store(name) \ | 65 | #define store(name) \ |
| @@ -86,9 +86,9 @@ store_call_start(struct device *dev, struct device_attribute *attr, · 20 unmodified lines | |||
| 86 | 86 | ||
| 87 | #ifdef ERR_INJ_DEBUG | 87 | #ifdef ERR_INJ_DEBUG |
| 88 | printk(KERN_DEBUG "pal_mc_err_inject for cpu%d:\n", cpu); | 88 | printk(KERN_DEBUG "pal_mc_err_inject for cpu%d:\n", cpu); |
| 89 | printk(KERN_DEBUG "err_type_info=%lx,\n", err_type_info[cpu]); | 89 | printk(KERN_DEBUG "err_type_info=%llx,\n", err_type_info[cpu]); |
| 90 | printk(KERN_DEBUG "err_struct_info=%lx,\n", err_struct_info[cpu]); | 90 | printk(KERN_DEBUG "err_struct_info=%llx,\n", err_struct_info[cpu]); |
| 91 | printk(KERN_DEBUG "err_data_buffer=%lx, %lx, %lx.\n", | 91 | printk(KERN_DEBUG "err_data_buffer=%llx, %llx, %llx.\n", |
| 92 | err_data_buffer[cpu].data1, | 92 | err_data_buffer[cpu].data1, |
| 93 | err_data_buffer[cpu].data2, | 93 | err_data_buffer[cpu].data2, |
| 94 | err_data_buffer[cpu].data3); | 94 | err_data_buffer[cpu].data3); |
| @@ -117,8 +117,8 @@ store_call_start(struct device *dev, struct device_attribute *attr, · 22 unmodified lines | |||
| 117 | 117 | ||
| 118 | #ifdef ERR_INJ_DEBUG | 118 | #ifdef ERR_INJ_DEBUG |
| 119 | printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]); | 119 | printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]); |
| 120 | printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]); | 120 | printk(KERN_DEBUG "capabilities=%llx,\n", capabilities[cpu]); |
| 121 | printk(KERN_DEBUG "resources=%lx\n", resources[cpu]); | 121 | printk(KERN_DEBUG "resources=%llx\n", resources[cpu]); |
| 122 | #endif | 122 | #endif |
| 123 | return size; | 123 | return size; |
| 124 | } | 124 | } |
| @@ -131,7 +131,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr, · 6 unmodified lines | |||
| 131 | char *buf) | 131 | char *buf) |
| 132 | { | 132 | { |
| 133 | unsigned int cpu=dev->id; | 133 | unsigned int cpu=dev->id; |
| 134 | return sprintf(buf, "%lx\n", phys_addr[cpu]); | 134 | return sprintf(buf, "%llx\n", phys_addr[cpu]); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | static ssize_t | 137 | static ssize_t |
| @@ -145,7 +145,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr, · 7 unmodified lines | |||
| 145 | ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL); | 145 | ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL); |
| 146 | if (ret<=0) { | 146 | if (ret<=0) { |
| 147 | #ifdef ERR_INJ_DEBUG | 147 | #ifdef ERR_INJ_DEBUG |
| 148 | printk("Virtual address %lx is not existing.\n",virt_addr); | 148 | printk("Virtual address %llx is not existing.\n", virt_addr); |
| 149 | #endif | 149 | #endif |
| 150 | return -EINVAL; | 150 | return -EINVAL; |
| 151 | } | 151 | } |
| @@ -163,7 +163,7 @@ show_err_data_buffer(struct device *dev, · 11 unmodified lines | |||
| 163 | { | 163 | { |
| 164 | unsigned int cpu=dev->id; | 164 | unsigned int cpu=dev->id; |
| 165 | 165 | ||
| 166 | return sprintf(buf, "%lx, %lx, %lx\n", | 166 | return sprintf(buf, "%llx, %llx, %llx\n", |
| 167 | err_data_buffer[cpu].data1, | 167 | err_data_buffer[cpu].data1, |
| 168 | err_data_buffer[cpu].data2, | 168 | err_data_buffer[cpu].data2, |
| 169 | err_data_buffer[cpu].data3); | 169 | err_data_buffer[cpu].data3); |
| @@ -178,13 +178,13 @@ store_err_data_buffer(struct device *dev, · 8 unmodified lines | |||
| 178 | int ret; | 178 | int ret; |
| 179 | 179 | ||
| 180 | #ifdef ERR_INJ_DEBUG | 180 | #ifdef ERR_INJ_DEBUG |
| 181 | printk("write err_data_buffer=[%lx,%lx,%lx] on cpu%d\n", | 181 | printk("write err_data_buffer=[%llx,%llx,%llx] on cpu%d\n", |
| 182 | err_data_buffer[cpu].data1, | 182 | err_data_buffer[cpu].data1, |
| 183 | err_data_buffer[cpu].data2, | 183 | err_data_buffer[cpu].data2, |
| 184 | err_data_buffer[cpu].data3, | 184 | err_data_buffer[cpu].data3, |
| 185 | cpu); | 185 | cpu); |
| 186 | #endif | 186 | #endif |
| 187 | ret=sscanf(buf, "%lx, %lx, %lx", | 187 | ret = sscanf(buf, "%llx, %llx, %llx", |
| 188 | &err_data_buffer[cpu].data1, | 188 | &err_data_buffer[cpu].data1, |
| 189 | &err_data_buffer[cpu].data2, | 189 | &err_data_buffer[cpu].data2, |
| 190 | &err_data_buffer[cpu].data3); | 190 | &err_data_buffer[cpu].data3); |
| @@ -1824,7 +1824,7 @@ ia64_mca_cpu_init(void *cpu_data) · 1823 unmodified lines | |||
| 1824 | data = mca_bootmem(); | 1824 | data = mca_bootmem(); |
| 1825 | first_time = 0; | 1825 | first_time = 0; |
| 1826 | } else | 1826 | } else |
| 1827 | data = (void *)__get_free_pages(GFP_KERNEL, | 1827 | data = (void *)__get_free_pages(GFP_ATOMIC, |
| 1828 | get_order(sz)); | 1828 | get_order(sz)); |
| 1829 | if (!data) | 1829 | if (!data) |
| 1830 | panic("Could not allocate MCA memory for cpu %d\n", | 1830 | panic("Could not allocate MCA memory for cpu %d\n", |
| @@ -176,7 +176,7 @@ SECTIONS · 175 unmodified lines | |||
| 176 | .fill : { | 176 | .fill : { |
| 177 | FILL(0); | 177 | FILL(0); |
| 178 | BYTE(0); | 178 | BYTE(0); |
| 179 | . = ALIGN(8); | 179 | STRUCT_ALIGN(); |
| 180 | } | 180 | } |
| 181 | __appended_dtb = .; | 181 | __appended_dtb = .; |
| 182 | /* leave space for appended DTB */ | 182 | /* leave space for appended DTB */ |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include <linux/bug.h> | 7 | #include <linux/bug.h> |
| 8 | #include <asm/cputable.h> | 8 | #include <asm/cputable.h> |
| 9 | 9 | ||
| 10 | static inline bool early_cpu_has_feature(unsigned long feature) | 10 | static __always_inline bool early_cpu_has_feature(unsigned long feature) |
| 11 | { | 11 | { |
| 12 | return !!((CPU_FTRS_ALWAYS & feature) || | 12 | return !!((CPU_FTRS_ALWAYS & feature) || |
| 13 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); | 13 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); |
| @@ -46,7 +46,7 @@ static __always_inline bool cpu_has_feature(unsigned long feature) · 32 unmodified lines | |||
| 46 | return static_branch_likely(&cpu_feature_keys[i]); | 46 | return static_branch_likely(&cpu_feature_keys[i]); |
| 47 | } | 47 | } |
| 48 | #else | 48 | #else |
| 49 | static inline bool cpu_has_feature(unsigned long feature) | 49 | static __always_inline bool cpu_has_feature(unsigned long feature) |
| 50 | { | 50 | { |
| 51 | return early_cpu_has_feature(feature); | 51 | return early_cpu_has_feature(feature); |
| 52 | } | 52 | } |
| @@ -65,3 +65,14 @@ V_FUNCTION_END(__kernel_clock_getres) · 64 unmodified lines | |||
| 65 | V_FUNCTION_BEGIN(__kernel_time) | 65 | V_FUNCTION_BEGIN(__kernel_time) |
| 66 | cvdso_call_time __c_kernel_time | 66 | cvdso_call_time __c_kernel_time |
| 67 | V_FUNCTION_END(__kernel_time) | 67 | V_FUNCTION_END(__kernel_time) |
| 68 | |||
| 69 | /* Routines for restoring integer registers, called by the compiler. */ | ||
| 70 | /* Called with r11 pointing to the stack header word of the caller of the */ | ||
| 71 | /* function, just beyond the end of the integer restore area. */ | ||
| 72 | _GLOBAL(_restgpr_31_x) | ||
| 73 | _GLOBAL(_rest32gpr_31_x) | ||
| 74 | lwz r0,4(r11) | ||
| 75 | lwz r31,-4(r11) | ||
| 76 | mtlr r0 | ||
| 77 | mr r1,r11 | ||
| 78 | blr | ||
| @@ -93,7 +93,6 @@ config RISCV · 92 unmodified lines | |||
| 93 | select PCI_MSI if PCI | 93 | select PCI_MSI if PCI |
| 94 | select RISCV_INTC | 94 | select RISCV_INTC |
| 95 | select RISCV_TIMER if RISCV_SBI | 95 | select RISCV_TIMER if RISCV_SBI |
| 96 | select SPARSEMEM_STATIC if 32BIT | ||
| 97 | select SPARSE_IRQ | 96 | select SPARSE_IRQ |
| 98 | select SYSCTL_EXCEPTION_TRACE | 97 | select SYSCTL_EXCEPTION_TRACE |
| 99 | select THREAD_INFO_IN_TASK | 98 | select THREAD_INFO_IN_TASK |
| @@ -154,7 +153,8 @@ config ARCH_FLATMEM_ENABLE · 54 unmodified lines | |||
| 154 | config ARCH_SPARSEMEM_ENABLE | 153 | config ARCH_SPARSEMEM_ENABLE |
| 155 | def_bool y | 154 | def_bool y |
| 156 | depends on MMU | 155 | depends on MMU |
| 157 | select SPARSEMEM_VMEMMAP_ENABLE | 156 | select SPARSEMEM_STATIC if 32BIT && SPARSMEM |
| 157 | select SPARSEMEM_VMEMMAP_ENABLE if 64BIT | ||
| 158 | 158 | ||
| 159 | config ARCH_SELECT_MEMORY_MODEL | 159 | config ARCH_SELECT_MEMORY_MODEL |
| 160 | def_bool ARCH_SPARSEMEM_ENABLE | 160 | def_bool ARCH_SPARSEMEM_ENABLE |
| @@ -31,6 +31,8 @@ config SOC_CANAAN · 30 unmodified lines | |||
| 31 | select SIFIVE_PLIC | 31 | select SIFIVE_PLIC |
| 32 | select ARCH_HAS_RESET_CONTROLLER | 32 | select ARCH_HAS_RESET_CONTROLLER |
| 33 | select PINCTRL | 33 | select PINCTRL |
| 34 | select COMMON_CLK | ||
| 35 | select COMMON_CLK_K210 | ||
| 34 | help | 36 | help |
| 35 | This enables support for Canaan Kendryte K210 SoC platform hardware. | 37 | This enables support for Canaan Kendryte K210 SoC platform hardware. |
| 36 | 38 | ||
| @@ -9,4 +9,20 @@ long long __lshrti3(long long a, int b); · 8 unmodified lines | |||
| 9 | long long __ashrti3(long long a, int b); | 9 | long long __ashrti3(long long a, int b); |
| 10 | long long __ashlti3(long long a, int b); | 10 | long long __ashlti3(long long a, int b); |
| 11 | 11 | ||
| 12 | |||
| 13 | #define DECLARE_DO_ERROR_INFO(name) asmlinkage void name(struct pt_regs *regs) | ||
| 14 | |||
| 15 | DECLARE_DO_ERROR_INFO(do_trap_unknown); | ||
| 16 | DECLARE_DO_ERROR_INFO(do_trap_insn_misaligned); | ||
| 17 | DECLARE_DO_ERROR_INFO(do_trap_insn_fault); | ||
| 18 | DECLARE_DO_ERROR_INFO(do_trap_insn_illegal); | ||
| 19 | DECLARE_DO_ERROR_INFO(do_trap_load_fault); | ||
| 20 | DECLARE_DO_ERROR_INFO(do_trap_load_misaligned); | ||
| 21 | DECLARE_DO_ERROR_INFO(do_trap_store_misaligned); | ||
| 22 | DECLARE_DO_ERROR_INFO(do_trap_store_fault); | ||
| 23 | DECLARE_DO_ERROR_INFO(do_trap_ecall_u); | ||
| 24 | DECLARE_DO_ERROR_INFO(do_trap_ecall_s); | ||
| 25 | DECLARE_DO_ERROR_INFO(do_trap_ecall_m); | ||
| 26 | DECLARE_DO_ERROR_INFO(do_trap_break); | ||
| 27 | |||
| 12 | #endif /* _ASM_RISCV_PROTOTYPES_H */ | 28 | #endif /* _ASM_RISCV_PROTOTYPES_H */ |
| @@ -12,4 +12,6 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include <asm-generic/irq.h> | 13 | #include <asm-generic/irq.h> |
| 14 | 14 | ||
| 15 | extern void __init init_IRQ(void); | ||
| 16 | |||
| 15 | #endif /* _ASM_RISCV_IRQ_H */ | 17 | #endif /* _ASM_RISCV_IRQ_H */ |
| @@ -71,6 +71,7 @@ int riscv_of_processor_hartid(struct device_node *node); · 70 unmodified lines | |||
| 71 | int riscv_of_parent_hartid(struct device_node *node); | 71 | int riscv_of_parent_hartid(struct device_node *node); |
| 72 | 72 | ||
| 73 | extern void riscv_fill_hwcap(void); | 73 | extern void riscv_fill_hwcap(void); |
| 74 | extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); | ||
| 74 | 75 | ||
| 75 | #endif /* __ASSEMBLY__ */ | 76 | #endif /* __ASSEMBLY__ */ |
| 76 | 77 | ||
| @@ -119,6 +119,11 @@ extern int regs_query_register_offset(const char *name); · 118 unmodified lines | |||
| 119 | extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, | 119 | extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, |
| 120 | unsigned int n); | 120 | unsigned int n); |
| 121 | 121 | ||
| 122 | void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, | ||
| 123 | unsigned long frame_pointer); | ||
| 124 | int do_syscall_trace_enter(struct pt_regs *regs); | ||
| 125 | void do_syscall_trace_exit(struct pt_regs *regs); | ||
| 126 | |||
| 122 | /** | 127 | /** |
| 123 | * regs_get_register() - get register value from its offset | 128 | * regs_get_register() - get register value from its offset |
| 124 | * @regs: pt_regs from which register value is gotten | 129 | * @regs: pt_regs from which register value is gotten |
| @@ -51,10 +51,10 @@ enum sbi_ext_rfence_fid { · 50 unmodified lines | |||
| 51 | SBI_EXT_RFENCE_REMOTE_FENCE_I = 0, | 51 | SBI_EXT_RFENCE_REMOTE_FENCE_I = 0, |
| 52 | SBI_EXT_RFENCE_REMOTE_SFENCE_VMA, | 52 | SBI_EXT_RFENCE_REMOTE_SFENCE_VMA, |
| 53 | SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID, | 53 | SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID, |
| 54 | SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA, | ||
| 55 | SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID, | 54 | SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID, |
| 56 | SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA, | 55 | SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA, |
| 57 | SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID, | 56 | SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID, |
| 57 | SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA, | ||
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | enum sbi_ext_hsm_fid { | 60 | enum sbi_ext_hsm_fid { |
| @@ -88,4 +88,6 @@ static inline int read_current_timer(unsigned long *timer_val) · 87 unmodified lines | |||
| 88 | return 0; | 88 | return 0; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | extern void time_init(void); | ||
| 92 | |||
| 91 | #endif /* _ASM_RISCV_TIMEX_H */ | 93 | #endif /* _ASM_RISCV_TIMEX_H */ |
| @@ -8,6 +8,7 @@ CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) · 7 unmodified lines | |||
| 8 | CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE) | 8 | CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE) |
| 9 | CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) | 9 | CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) |
| 10 | endif | 10 | endif |
| 11 | CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,) | ||
| 11 | 12 | ||
| 12 | extra-y += head.o | 13 | extra-y += head.o |
| 13 | extra-y += vmlinux.lds | 14 | extra-y += vmlinux.lds |
| @@ -2,39 +2,41 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | #include <linux/kprobes.h> | 3 | #include <linux/kprobes.h> |
| 4 | 4 | ||
| 5 | /* Ftrace callback handler for kprobes -- called under preepmt disabed */ | 5 | /* Ftrace callback handler for kprobes -- called under preepmt disabled */ |
| 6 | void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, | 6 | void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, |
| 7 | struct ftrace_ops *ops, struct ftrace_regs *regs) | 7 | struct ftrace_ops *ops, struct ftrace_regs *fregs) |
| 8 | { | 8 | { |
| 9 | struct kprobe *p; | 9 | struct kprobe *p; |
| 10 | struct pt_regs *regs; | ||
| 10 | struct kprobe_ctlblk *kcb; | 11 | struct kprobe_ctlblk *kcb; |
| 11 | 12 | ||
| 12 | p = get_kprobe((kprobe_opcode_t *)ip); | 13 | p = get_kprobe((kprobe_opcode_t *)ip); |
| 13 | if (unlikely(!p) || kprobe_disabled(p)) | 14 | if (unlikely(!p) || kprobe_disabled(p)) |
| 14 | return; | 15 | return; |
| 15 | 16 | ||
| 17 | regs = ftrace_get_regs(fregs); | ||
| 16 | kcb = get_kprobe_ctlblk(); | 18 | kcb = get_kprobe_ctlblk(); |
| 17 | if (kprobe_running()) { | 19 | if (kprobe_running()) { |
| 18 | kprobes_inc_nmissed_count(p); | 20 | kprobes_inc_nmissed_count(p); |
| 19 | } else { | 21 | } else { |
| 20 | unsigned long orig_ip = instruction_pointer(&(regs->regs)); | 22 | unsigned long orig_ip = instruction_pointer(regs); |
| 21 | 23 | ||
| 22 | instruction_pointer_set(&(regs->regs), ip); | 24 | instruction_pointer_set(regs, ip); |
| 23 | 25 | ||
| 24 | __this_cpu_write(current_kprobe, p); | 26 | __this_cpu_write(current_kprobe, p); |
| 25 | kcb->kprobe_status = KPROBE_HIT_ACTIVE; | 27 | kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
| 26 | if (!p->pre_handler || !p->pre_handler(p, &(regs->regs))) { | 28 | if (!p->pre_handler || !p->pre_handler(p, regs)) { |
| 27 | /* | 29 | /* |
| 28 | * Emulate singlestep (and also recover regs->pc) | 30 | * Emulate singlestep (and also recover regs->pc) |
| 29 | * as if there is a nop | 31 | * as if there is a nop |
| 30 | */ | 32 | */ |
| 31 | instruction_pointer_set(&(regs->regs), | 33 | instruction_pointer_set(regs, |
| 32 | (unsigned long)p->addr + MCOUNT_INSN_SIZE); | 34 | (unsigned long)p->addr + MCOUNT_INSN_SIZE); |
| 33 | if (unlikely(p->post_handler)) { | 35 | if (unlikely(p->post_handler)) { |
| 34 | kcb->kprobe_status = KPROBE_HIT_SSDONE; | 36 | kcb->kprobe_status = KPROBE_HIT_SSDONE; |
| 35 | p->post_handler(p, &(regs->regs), 0); | 37 | p->post_handler(p, regs, 0); |
| 36 | } | 38 | } |
| 37 | instruction_pointer_set(&(regs->regs), orig_ip); | 39 | instruction_pointer_set(regs, orig_ip); |
| 38 | } | 40 | } |
| 39 | 41 | ||
| 40 | /* | 42 | /* |
| @@ -256,8 +256,7 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr) · 255 unmodified lines | |||
| 256 | * normal page fault. | 256 | * normal page fault. |
| 257 | */ | 257 | */ |
| 258 | regs->epc = (unsigned long) cur->addr; | 258 | regs->epc = (unsigned long) cur->addr; |
| 259 | if (!instruction_pointer(regs)) | 259 | BUG_ON(!instruction_pointer(regs)); |
| 260 | BUG(); | ||
| 261 | 260 | ||
| 262 | if (kcb->kprobe_status == KPROBE_REENTER) | 261 | if (kcb->kprobe_status == KPROBE_REENTER) |
| 263 | restore_previous_kprobe(kcb); | 262 | restore_previous_kprobe(kcb); |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | #include <linux/cpu.h> | 10 | #include <linux/cpu.h> |
| 11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
| 13 | #include <linux/sched/debug.h> | ||
| 13 | #include <linux/sched/task_stack.h> | 14 | #include <linux/sched/task_stack.h> |
| 14 | #include <linux/tick.h> | 15 | #include <linux/tick.h> |
| 15 | #include <linux/ptrace.h> | 16 | #include <linux/ptrace.h> |
| @@ -116,7 +116,7 @@ void sbi_clear_ipi(void) · 115 unmodified lines | |||
| 116 | EXPORT_SYMBOL(sbi_clear_ipi); | 116 | EXPORT_SYMBOL(sbi_clear_ipi); |
| 117 | 117 | ||
| 118 | /** | 118 | /** |
| 119 | * sbi_set_timer_v01() - Program the timer for next timer event. | 119 | * __sbi_set_timer_v01() - Program the timer for next timer event. |
| 120 | * @stime_value: The value after which next timer event should fire. | 120 | * @stime_value: The value after which next timer event should fire. |
| 121 | * | 121 | * |
| 122 | * Return: None | 122 | * Return: None |
| @@ -147,7 +147,8 @@ static void __init init_resources(void) · 146 unmodified lines | |||
| 147 | bss_res.end = __pa_symbol(__bss_stop) - 1; | 147 | bss_res.end = __pa_symbol(__bss_stop) - 1; |
| 148 | bss_res.flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; | 148 | bss_res.flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; |
| 149 | 149 | ||
| 150 | mem_res_sz = (memblock.memory.cnt + memblock.reserved.cnt) * sizeof(*mem_res); | 150 | /* + 1 as memblock_alloc() might increase memblock.reserved.cnt */ |
| 151 | mem_res_sz = (memblock.memory.cnt + memblock.reserved.cnt + 1) * sizeof(*mem_res); | ||
| 151 | mem_res = memblock_alloc(mem_res_sz, SMP_CACHE_BYTES); | 152 | mem_res = memblock_alloc(mem_res_sz, SMP_CACHE_BYTES); |
| 152 | if (!mem_res) | 153 | if (!mem_res) |
| 153 | panic("%s: Failed to allocate %zu bytes\n", __func__, mem_res_sz); | 154 | panic("%s: Failed to allocate %zu bytes\n", __func__, mem_res_sz); |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
| 10 | #include <asm/sbi.h> | 10 | #include <asm/sbi.h> |
| 11 | #include <asm/processor.h> | 11 | #include <asm/processor.h> |
| 12 | #include <asm/timex.h> | ||
| 12 | 13 | ||
| 13 | unsigned long riscv_timebase; | 14 | unsigned long riscv_timebase; |
| 14 | EXPORT_SYMBOL_GPL(riscv_timebase); | 15 | EXPORT_SYMBOL_GPL(riscv_timebase); |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
| 19 | 19 | ||
| 20 | #include <asm/asm-prototypes.h> | ||
| 20 | #include <asm/bug.h> | 21 | #include <asm/bug.h> |
| 21 | #include <asm/processor.h> | 22 | #include <asm/processor.h> |
| 22 | #include <asm/ptrace.h> | 23 | #include <asm/ptrace.h> |
| @@ -155,7 +155,7 @@ static void __init kasan_populate(void *start, void *end) · 154 unmodified lines | |||
| 155 | memset(start, KASAN_SHADOW_INIT, end - start); | 155 | memset(start, KASAN_SHADOW_INIT, end - start); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | void __init kasan_shallow_populate(void *start, void *end) | 158 | static void __init kasan_shallow_populate(void *start, void *end) |
| 159 | { | 159 | { |
| 160 | unsigned long vaddr = (unsigned long)start & PAGE_MASK; | 160 | unsigned long vaddr = (unsigned long)start & PAGE_MASK; |
| 161 | unsigned long vend = PAGE_ALIGN((unsigned long)end); | 161 | unsigned long vend = PAGE_ALIGN((unsigned long)end); |
| @@ -187,6 +187,8 @@ void __init kasan_shallow_populate(void *start, void *end) · 25 unmodified lines | |||
| 187 | } | 187 | } |
| 188 | vaddr += PAGE_SIZE; | 188 | vaddr += PAGE_SIZE; |
| 189 | } | 189 | } |
| 190 | |||
| 191 | local_flush_tlb_all(); | ||
| 190 | } | 192 | } |
| 191 | 193 | ||
| 192 | void __init kasan_init(void) | 194 | void __init kasan_init(void) |
| @@ -202,7 +202,7 @@ extern unsigned int s390_pci_no_rid; · 201 unmodified lines | |||
| 202 | ----------------------------------------------------------------------------- */ | 202 | ----------------------------------------------------------------------------- */ |
| 203 | /* Base stuff */ | 203 | /* Base stuff */ |
| 204 | int zpci_create_device(u32 fid, u32 fh, enum zpci_state state); | 204 | int zpci_create_device(u32 fid, u32 fh, enum zpci_state state); |
| 205 | void zpci_remove_device(struct zpci_dev *zdev); | 205 | void zpci_remove_device(struct zpci_dev *zdev, bool set_error); |
| 206 | int zpci_enable_device(struct zpci_dev *); | 206 | int zpci_enable_device(struct zpci_dev *); |
| 207 | int zpci_disable_device(struct zpci_dev *); | 207 | int zpci_disable_device(struct zpci_dev *); |
| 208 | int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); | 208 | int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); |
| @@ -968,7 +968,7 @@ static int cf_diag_all_start(void) · 967 unmodified lines | |||
| 968 | */ | 968 | */ |
| 969 | static size_t cf_diag_needspace(unsigned int sets) | 969 | static size_t cf_diag_needspace(unsigned int sets) |
| 970 | { | 970 | { |
| 971 | struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); | 971 | struct cpu_cf_events *cpuhw = get_cpu_ptr(&cpu_cf_events); |
| 972 | size_t bytes = 0; | 972 | size_t bytes = 0; |
| 973 | int i; | 973 | int i; |
| 974 | 974 | ||
| @@ -984,6 +984,7 @@ static size_t cf_diag_needspace(unsigned int sets) · 9 unmodified lines | |||
| 984 | sizeof(((struct s390_ctrset_cpudata *)0)->no_sets)); | 984 | sizeof(((struct s390_ctrset_cpudata *)0)->no_sets)); |
| 985 | debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__, | 985 | debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__, |
| 986 | bytes); | 986 | bytes); |
| 987 | put_cpu_ptr(&cpu_cf_events); | ||
| 987 | return bytes; | 988 | return bytes; |
| 988 | } | 989 | } |
| 989 | 990 | ||
| @@ -214,7 +214,7 @@ void vtime_flush(struct task_struct *tsk) · 213 unmodified lines | |||
| 214 | avg_steal = S390_lowcore.avg_steal_timer / 2; | 214 | avg_steal = S390_lowcore.avg_steal_timer / 2; |
| 215 | if ((s64) steal > 0) { | 215 | if ((s64) steal > 0) { |
| 216 | S390_lowcore.steal_timer = 0; | 216 | S390_lowcore.steal_timer = 0; |
| 217 | account_steal_time(steal); | 217 | account_steal_time(cputime_to_nsecs(steal)); |
| 218 | avg_steal += steal; | 218 | avg_steal += steal; |
| 219 | } | 219 | } |
| 220 | S390_lowcore.avg_steal_timer = avg_steal; | 220 | S390_lowcore.avg_steal_timer = avg_steal; |
| @@ -682,16 +682,36 @@ int zpci_disable_device(struct zpci_dev *zdev) · 681 unmodified lines | |||
| 682 | } | 682 | } |
| 683 | EXPORT_SYMBOL_GPL(zpci_disable_device); | 683 | EXPORT_SYMBOL_GPL(zpci_disable_device); |
| 684 | 684 | ||
| 685 | void zpci_remove_device(struct zpci_dev *zdev) | 685 | /* zpci_remove_device - Removes the given zdev from the PCI core |
| 686 | * @zdev: the zdev to be removed from the PCI core | ||
| 687 | * @set_error: if true the device's error state is set to permanent failure | ||
| 688 | * | ||
| 689 | * Sets a zPCI device to a configured but offline state; the zPCI | ||
| 690 | * device is still accessible through its hotplug slot and the zPCI | ||
| 691 | * API but is removed from the common code PCI bus, making it | ||
| 692 | * no longer available to drivers. | ||
| 693 | */ | ||
| 694 | void zpci_remove_device(struct zpci_dev *zdev, bool set_error) | ||
| 686 | { | 695 | { |
| 687 | struct zpci_bus *zbus = zdev->zbus; | 696 | struct zpci_bus *zbus = zdev->zbus; |
| 688 | struct pci_dev *pdev; | 697 | struct pci_dev *pdev; |
| 689 | 698 | ||
| 699 | if (!zdev->zbus->bus) | ||
| 700 | return; | ||
| 701 | |||
| 690 | pdev = pci_get_slot(zbus->bus, zdev->devfn); | 702 | pdev = pci_get_slot(zbus->bus, zdev->devfn); |
| 691 | if (pdev) { | 703 | if (pdev) { |
| 692 | if (pdev->is_virtfn) | 704 | if (set_error) |
| 693 | return zpci_iov_remove_virtfn(pdev, zdev->vfn); | 705 | pdev->error_state = pci_channel_io_perm_failure; |
| 706 | if (pdev->is_virtfn) { | ||
| 707 | zpci_iov_remove_virtfn(pdev, zdev->vfn); | ||
| 708 | /* balance pci_get_slot */ | ||
| 709 | pci_dev_put(pdev); | ||
| 710 | return; | ||
| 711 | } | ||
| 694 | pci_stop_and_remove_bus_device_locked(pdev); | 712 | pci_stop_and_remove_bus_device_locked(pdev); |
| 713 | /* balance pci_get_slot */ | ||
| 714 | pci_dev_put(pdev); | ||
| 695 | } | 715 | } |
| 696 | } | 716 | } |
| 697 | 717 | ||
| @@ -765,7 +785,7 @@ void zpci_release_device(struct kref *kref) · 67 unmodified lines | |||
| 765 | struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); | 785 | struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); |
| 766 | 786 | ||
| 767 | if (zdev->zbus->bus) | 787 | if (zdev->zbus->bus) |
| 768 | zpci_remove_device(zdev); | 788 | zpci_remove_device(zdev, false); |
| 769 | 789 | ||
| 770 | switch (zdev->state) { | 790 | switch (zdev->state) { |
| 771 | case ZPCI_FN_STATE_ONLINE: | 791 | case ZPCI_FN_STATE_ONLINE: |
| @@ -76,13 +76,10 @@ void zpci_event_error(void *data) · 75 unmodified lines | |||
| 76 | static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) | 76 | static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) |
| 77 | { | 77 | { |
| 78 | struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); | 78 | struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); |
| 79 | struct pci_dev *pdev = NULL; | ||
| 80 | enum zpci_state state; | 79 | enum zpci_state state; |
| 80 | struct pci_dev *pdev; | ||
| 81 | int ret; | 81 | int ret; |
| 82 | 82 | ||
| 83 | if (zdev && zdev->zbus->bus) | ||
| 84 | pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); | ||
| 85 | |||
| 86 | zpci_err("avail CCDF:\n"); | 83 | zpci_err("avail CCDF:\n"); |
| 87 | zpci_err_hex(ccdf, sizeof(*ccdf)); | 84 | zpci_err_hex(ccdf, sizeof(*ccdf)); |
| 88 | 85 | ||
| @@ -124,8 +121,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 35 unmodified lines | |||
| 124 | case 0x0303: /* Deconfiguration requested */ | 121 | case 0x0303: /* Deconfiguration requested */ |
| 125 | if (!zdev) | 122 | if (!zdev) |
| 126 | break; | 123 | break; |
| 127 | if (pdev) | 124 | zpci_remove_device(zdev, false); |
| 128 | zpci_remove_device(zdev); | ||
| 129 | 125 | ||
| 130 | ret = zpci_disable_device(zdev); | 126 | ret = zpci_disable_device(zdev); |
| 131 | if (ret) | 127 | if (ret) |
| @@ -140,12 +136,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 8 unmodified lines | |||
| 140 | case 0x0304: /* Configured -> Standby|Reserved */ | 136 | case 0x0304: /* Configured -> Standby|Reserved */ |
| 141 | if (!zdev) | 137 | if (!zdev) |
| 142 | break; | 138 | break; |
| 143 | if (pdev) { | 139 | /* Give the driver a hint that the function is |
| 144 | /* Give the driver a hint that the function is | 140 | * already unusable. |
| 145 | * already unusable. */ | 141 | */ |
| 146 | pdev->error_state = pci_channel_io_perm_failure; | 142 | zpci_remove_device(zdev, true); |
| 147 | zpci_remove_device(zdev); | ||
| 148 | } | ||
| 149 | 143 | ||
| 150 | zdev->fh = ccdf->fh; | 144 | zdev->fh = ccdf->fh; |
| 151 | zpci_disable_device(zdev); | 145 | zpci_disable_device(zdev); |
| @@ -27,7 +27,7 @@ endif · 26 unmodified lines | |||
| 27 | REALMODE_CFLAGS := -m16 -g -Os -DDISABLE_BRANCH_PROFILING \ | 27 | REALMODE_CFLAGS := -m16 -g -Os -DDISABLE_BRANCH_PROFILING \ |
| 28 | -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ | 28 | -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ |
| 29 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ | 29 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ |
| 30 | -mno-mmx -mno-sse | 30 | -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none) |
| 31 | 31 | ||
| 32 | REALMODE_CFLAGS += -ffreestanding | 32 | REALMODE_CFLAGS += -ffreestanding |
| 33 | REALMODE_CFLAGS += -fno-stack-protector | 33 | REALMODE_CFLAGS += -fno-stack-protector |
| @@ -3659,6 +3659,9 @@ static int intel_pmu_hw_config(struct perf_event *event) · 3658 unmodified lines | |||
| 3659 | return ret; | 3659 | return ret; |
| 3660 | 3660 | ||
| 3661 | if (event->attr.precise_ip) { | 3661 | if (event->attr.precise_ip) { |
| 3662 | if ((event->attr.config & INTEL_ARCH_EVENT_MASK) == INTEL_FIXED_VLBR_EVENT) | ||
| 3663 | return -EINVAL; | ||
| 3664 | |||
| 3662 | if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) { | 3665 | if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) { |
| 3663 | event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; | 3666 | event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; |
| 3664 | if (!(event->attr.sample_type & | 3667 | if (!(event->attr.sample_type & |
| @@ -2010,7 +2010,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, struct perf_sample_d · 2009 unmodified lines | |||
| 2010 | */ | 2010 | */ |
| 2011 | if (!pebs_status && cpuc->pebs_enabled && | 2011 | if (!pebs_status && cpuc->pebs_enabled && |
| 2012 | !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1))) | 2012 | !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1))) |
| 2013 | pebs_status = cpuc->pebs_enabled; | 2013 | pebs_status = p->status = cpuc->pebs_enabled; |
| 2014 | 2014 | ||
| 2015 | bit = find_first_bit((unsigned long *)&pebs_status, | 2015 | bit = find_first_bit((unsigned long *)&pebs_status, |
| 2016 | x86_pmu.max_pebs_events); | 2016 | x86_pmu.max_pebs_events); |
| @@ -884,12 +884,29 @@ struct kvm_hv_syndbg { · 883 unmodified lines | |||
| 884 | u64 options; | 884 | u64 options; |
| 885 | }; | 885 | }; |
| 886 | 886 | ||
| 887 | /* Current state of Hyper-V TSC page clocksource */ | ||
| 888 | enum hv_tsc_page_status { | ||
| 889 | /* TSC page was not set up or disabled */ | ||
| 890 | HV_TSC_PAGE_UNSET = 0, | ||
| 891 | /* TSC page MSR was written by the guest, update pending */ | ||
| 892 | HV_TSC_PAGE_GUEST_CHANGED, | ||
| 893 | /* TSC page MSR was written by KVM userspace, update pending */ | ||
| 894 | HV_TSC_PAGE_HOST_CHANGED, | ||
| 895 | /* TSC page was properly set up and is currently active */ | ||
| 896 | HV_TSC_PAGE_SET, | ||
| 897 | /* TSC page is currently being updated and therefore is inactive */ | ||
| 898 | HV_TSC_PAGE_UPDATING, | ||
| 899 | /* TSC page was set up with an inaccessible GPA */ | ||
| 900 | HV_TSC_PAGE_BROKEN, | ||
| 901 | }; | ||
| 902 | |||
| 887 | /* Hyper-V emulation context */ | 903 | /* Hyper-V emulation context */ |
| 888 | struct kvm_hv { | 904 | struct kvm_hv { |
| 889 | struct mutex hv_lock; | 905 | struct mutex hv_lock; |
| 890 | u64 hv_guest_os_id; | 906 | u64 hv_guest_os_id; |
| 891 | u64 hv_hypercall; | 907 | u64 hv_hypercall; |
| 892 | u64 hv_tsc_page; | 908 | u64 hv_tsc_page; |
| 909 | enum hv_tsc_page_status hv_tsc_page_status; | ||
| 893 | 910 | ||
| 894 | /* Hyper-v based guest crash (NT kernel bugcheck) parameters */ | 911 | /* Hyper-v based guest crash (NT kernel bugcheck) parameters */ |
| 895 | u64 hv_crash_param[HV_X64_MSR_CRASH_PARAMS]; | 912 | u64 hv_crash_param[HV_X64_MSR_CRASH_PARAMS]; |
| @@ -931,6 +948,12 @@ enum kvm_irqchip_mode { · 35 unmodified lines | |||
| 931 | KVM_IRQCHIP_SPLIT, /* created with KVM_CAP_SPLIT_IRQCHIP */ | 948 | KVM_IRQCHIP_SPLIT, /* created with KVM_CAP_SPLIT_IRQCHIP */ |
| 932 | }; | 949 | }; |
| 933 | 950 | ||
| 951 | struct kvm_x86_msr_filter { | ||
| 952 | u8 count; | ||
| 953 | bool default_allow:1; | ||
| 954 | struct msr_bitmap_range ranges[16]; | ||
| 955 | }; | ||
| 956 | |||
| 934 | #define APICV_INHIBIT_REASON_DISABLE 0 | 957 | #define APICV_INHIBIT_REASON_DISABLE 0 |
| 935 | #define APICV_INHIBIT_REASON_HYPERV 1 | 958 | #define APICV_INHIBIT_REASON_HYPERV 1 |
| 936 | #define APICV_INHIBIT_REASON_NESTED 2 | 959 | #define APICV_INHIBIT_REASON_NESTED 2 |
| @@ -1025,16 +1048,11 @@ struct kvm_arch { · 88 unmodified lines | |||
| 1025 | bool guest_can_read_msr_platform_info; | 1048 | bool guest_can_read_msr_platform_info; |
| 1026 | bool exception_payload_enabled; | 1049 | bool exception_payload_enabled; |
| 1027 | 1050 | ||
| 1051 | bool bus_lock_detection_enabled; | ||
| 1052 | |||
| 1028 | /* Deflect RDMSR and WRMSR to user space when they trigger a #GP */ | 1053 | /* Deflect RDMSR and WRMSR to user space when they trigger a #GP */ |
| 1029 | u32 user_space_msr_mask; | 1054 | u32 user_space_msr_mask; |
| 1030 | 1055 | struct kvm_x86_msr_filter __rcu *msr_filter; | |
| 1031 | struct { | ||
| 1032 | u8 count; | ||
| 1033 | bool default_allow:1; | ||
| 1034 | struct msr_bitmap_range ranges[16]; | ||
| 1035 | } msr_filter; | ||
| 1036 | |||
| 1037 | bool bus_lock_detection_enabled; | ||
| 1038 | 1056 | ||
| 1039 | struct kvm_pmu_event_filter __rcu *pmu_event_filter; | 1057 | struct kvm_pmu_event_filter __rcu *pmu_event_filter; |
| 1040 | struct task_struct *nx_lpage_recovery_thread; | 1058 | struct task_struct *nx_lpage_recovery_thread; |
| @@ -551,15 +551,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, · 550 unmodified lines | |||
| 551 | *size = fpu_kernel_xstate_size; | 551 | *size = fpu_kernel_xstate_size; |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | /* | ||
| 555 | * Thread-synchronous status. | ||
| 556 | * | ||
| 557 | * This is different from the flags in that nobody else | ||
| 558 | * ever touches our thread-synchronous status, so we don't | ||
| 559 | * have to worry about atomic accesses. | ||
| 560 | */ | ||
| 561 | #define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/ | ||
| 562 | |||
| 563 | static inline void | 554 | static inline void |
| 564 | native_load_sp0(unsigned long sp0) | 555 | native_load_sp0(unsigned long sp0) |
| 565 | { | 556 | { |
| @@ -205,10 +205,23 @@ static inline int arch_within_stack_frames(const void * const stack, · 204 unmodified lines | |||
| 205 | 205 | ||
| 206 | #endif | 206 | #endif |
| 207 | 207 | ||
| 208 | /* | ||
| 209 | * Thread-synchronous status. | ||
| 210 | * | ||
| 211 | * This is different from the flags in that nobody else | ||
| 212 | * ever touches our thread-synchronous status, so we don't | ||
| 213 | * have to worry about atomic accesses. | ||
| 214 | */ | ||
| 215 | #define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/ | ||
| 216 | |||
| 217 | #ifndef __ASSEMBLY__ | ||
| 208 | #ifdef CONFIG_COMPAT | 218 | #ifdef CONFIG_COMPAT |
| 209 | #define TS_I386_REGS_POKED 0x0004 /* regs poked by 32-bit ptracer */ | 219 | #define TS_I386_REGS_POKED 0x0004 /* regs poked by 32-bit ptracer */ |
| 220 | |||
| 221 | #define arch_set_restart_data(restart) \ | ||
| 222 | do { restart->arch_data = current_thread_info()->status; } while (0) | ||
| 223 | |||
| 210 | #endif | 224 | #endif |
| 211 | #ifndef __ASSEMBLY__ | ||
| 212 | 225 | ||
| 213 | #ifdef CONFIG_X86_32 | 226 | #ifdef CONFIG_X86_32 |
| 214 | #define in_ia32_syscall() true | 227 | #define in_ia32_syscall() true |
| @@ -86,18 +86,6 @@ clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, · 85 unmodified lines | |||
| 86 | } | 86 | } |
| 87 | #endif | 87 | #endif |
| 88 | 88 | ||
| 89 | /* | ||
| 90 | * The maximum amount of extra memory compared to the base size. The | ||
| 91 | * main scaling factor is the size of struct page. At extreme ratios | ||
| 92 | * of base:extra, all the base memory can be filled with page | ||
| 93 | * structures for the extra memory, leaving no space for anything | ||
| 94 | * else. | ||
| 95 | * | ||
| 96 | * 10x seems like a reasonable balance between scaling flexibility and | ||
| 97 | * leaving a practically usable system. | ||
| 98 | */ | ||
| 99 | #define XEN_EXTRA_MEM_RATIO (10) | ||
| 100 | |||
| 101 | /* | 89 | /* |
| 102 | * Helper functions to write or read unsigned long values to/from | 90 | * Helper functions to write or read unsigned long values to/from |
| 103 | * memory, when the access may fault. | 91 | * memory, when the access may fault. |
| @@ -2342,6 +2342,11 @@ static int cpuid_to_apicid[] = { · 2341 unmodified lines | |||
| 2342 | [0 ... NR_CPUS - 1] = -1, | 2342 | [0 ... NR_CPUS - 1] = -1, |
| 2343 | }; | 2343 | }; |
| 2344 | 2344 | ||
| 2345 | bool arch_match_cpu_phys_id(int cpu, u64 phys_id) | ||
| 2346 | { | ||
| 2347 | return phys_id == cpuid_to_apicid[cpu]; | ||
| 2348 | } | ||
| 2349 | |||
| 2345 | #ifdef CONFIG_SMP | 2350 | #ifdef CONFIG_SMP |
| 2346 | /** | 2351 | /** |
| 2347 | * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread | 2352 | * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread |
| @@ -1032,6 +1032,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, · 1031 unmodified lines | |||
| 1032 | if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) { | 1032 | if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) { |
| 1033 | irq = mp_irqs[idx].srcbusirq; | 1033 | irq = mp_irqs[idx].srcbusirq; |
| 1034 | legacy = mp_is_legacy_irq(irq); | 1034 | legacy = mp_is_legacy_irq(irq); |
| 1035 | /* | ||
| 1036 | * IRQ2 is unusable for historical reasons on systems which | ||
| 1037 | * have a legacy PIC. See the comment vs. IRQ2 further down. | ||
| 1038 | * | ||
| 1039 | * If this gets removed at some point then the related code | ||
| 1040 | * in lapic_assign_system_vectors() needs to be adjusted as | ||
| 1041 | * well. | ||
| 1042 | */ | ||
| 1043 | if (legacy && irq == PIC_CASCADE_IR) | ||
| 1044 | return -EINVAL; | ||
| 1035 | } | 1045 | } |
| 1036 | 1046 | ||
| 1037 | mutex_lock(&ioapic_mutex); | 1047 | mutex_lock(&ioapic_mutex); |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include "common.h" | 13 | #include "common.h" |
| 14 | 14 | ||
| 15 | /* Ftrace callback handler for kprobes -- called under preepmt disabed */ | 15 | /* Ftrace callback handler for kprobes -- called under preepmt disabled */ |
| 16 | void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, | 16 | void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, |
| 17 | struct ftrace_ops *ops, struct ftrace_regs *fregs) | 17 | struct ftrace_ops *ops, struct ftrace_regs *fregs) |
| 18 | { | 18 | { |
| @@ -836,28 +836,25 @@ static void kvm_kick_cpu(int cpu) · 835 unmodified lines | |||
| 836 | 836 | ||
| 837 | static void kvm_wait(u8 *ptr, u8 val) | 837 | static void kvm_wait(u8 *ptr, u8 val) |
| 838 | { | 838 | { |
| 839 | unsigned long flags; | ||
| 840 | |||
| 841 | if (in_nmi()) | 839 | if (in_nmi()) |
| 842 | return; | 840 | return; |
| 843 | 841 | ||
| 844 | local_irq_save(flags); | ||
| 845 | |||
| 846 | if (READ_ONCE(*ptr) != val) | ||
| 847 | goto out; | ||
| 848 | |||
| 849 | /* | 842 | /* |
| 850 | * halt until it's our turn and kicked. Note that we do safe halt | 843 | * halt until it's our turn and kicked. Note that we do safe halt |
| 851 | * for irq enabled case to avoid hang when lock info is overwritten | 844 | * for irq enabled case to avoid hang when lock info is overwritten |
| 852 | * in irq spinlock slowpath and no spurious interrupt occur to save us. | 845 | * in irq spinlock slowpath and no spurious interrupt occur to save us. |
| 853 | */ | 846 | */ |
| 854 | if (arch_irqs_disabled_flags(flags)) | 847 | if (irqs_disabled()) { |
| 855 | halt(); | 848 | if (READ_ONCE(*ptr) == val) |
| 856 | else | 849 | halt(); |
| 857 | safe_halt(); | 850 | } else { |
| 851 | local_irq_disable(); | ||
| 858 | 852 | ||
| 859 | out: | 853 | if (READ_ONCE(*ptr) == val) |
| 860 | local_irq_restore(flags); | 854 | safe_halt(); |
| 855 | |||
| 856 | local_irq_enable(); | ||
| 857 | } | ||
| 861 | } | 858 | } |
| 862 | 859 | ||
| 863 | #ifdef CONFIG_X86_32 | 860 | #ifdef CONFIG_X86_32 |
| @@ -766,30 +766,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) · 765 unmodified lines | |||
| 766 | 766 | ||
| 767 | static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs) | 767 | static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs) |
| 768 | { | 768 | { |
| 769 | /* | ||
| 770 | * This function is fundamentally broken as currently | ||
| 771 | * implemented. | ||
| 772 | * | ||
| 773 | * The idea is that we want to trigger a call to the | ||
| 774 | * restart_block() syscall and that we want in_ia32_syscall(), | ||
| 775 | * in_x32_syscall(), etc. to match whatever they were in the | ||
| 776 | * syscall being restarted. We assume that the syscall | ||
| 777 | * instruction at (regs->ip - 2) matches whatever syscall | ||
| 778 | * instruction we used to enter in the first place. | ||
| 779 | * | ||
| 780 | * The problem is that we can get here when ptrace pokes | ||
| 781 | * syscall-like values into regs even if we're not in a syscall | ||
| 782 | * at all. | ||
| 783 | * | ||
| 784 | * For now, we maintain historical behavior and guess based on | ||
| 785 | * stored state. We could do better by saving the actual | ||
| 786 | * syscall arch in restart_block or (with caveats on x32) by | ||
| 787 | * checking if regs->ip points to 'int $0x80'. The current | ||
| 788 | * behavior is incorrect if a tracer has a different bitness | ||
| 789 | * than the tracee. | ||
| 790 | */ | ||
| 791 | #ifdef CONFIG_IA32_EMULATION | 769 | #ifdef CONFIG_IA32_EMULATION |
| 792 | if (current_thread_info()->status & (TS_COMPAT|TS_I386_REGS_POKED)) | 770 | if (current->restart_block.arch_data & TS_COMPAT) |
| 793 | return __NR_ia32_restart_syscall; | 771 | return __NR_ia32_restart_syscall; |
| 794 | #endif | 772 | #endif |
| 795 | #ifdef CONFIG_X86_X32_ABI | 773 | #ifdef CONFIG_X86_X32_ABI |
| @@ -520,10 +520,10 @@ static u64 get_time_ref_counter(struct kvm *kvm) · 519 unmodified lines | |||
| 520 | u64 tsc; | 520 | u64 tsc; |
| 521 | 521 | ||
| 522 | /* | 522 | /* |
| 523 | * The guest has not set up the TSC page or the clock isn't | 523 | * Fall back to get_kvmclock_ns() when TSC page hasn't been set up, |
| 524 | * stable, fall back to get_kvmclock_ns. | 524 | * is broken, disabled or being updated. |
| 525 | */ | 525 | */ |
| 526 | if (!hv->tsc_ref.tsc_sequence) | 526 | if (hv->hv_tsc_page_status != HV_TSC_PAGE_SET) |
| 527 | return div_u64(get_kvmclock_ns(kvm), 100); | 527 | return div_u64(get_kvmclock_ns(kvm), 100); |
| 528 | 528 | ||
| 529 | vcpu = kvm_get_vcpu(kvm, 0); | 529 | vcpu = kvm_get_vcpu(kvm, 0); |
| @@ -1077,6 +1077,21 @@ static bool compute_tsc_page_parameters(struct pvclock_vcpu_time_info *hv_clock, · 547 unmodified lines | |||
| 1077 | return true; | 1077 | return true; |
| 1078 | } | 1078 | } |
| 1079 | 1079 | ||
| 1080 | /* | ||
| 1081 | * Don't touch TSC page values if the guest has opted for TSC emulation after | ||
| 1082 | * migration. KVM doesn't fully support reenlightenment notifications and TSC | ||
| 1083 | * access emulation and Hyper-V is known to expect the values in TSC page to | ||
| 1084 | * stay constant before TSC access emulation is disabled from guest side | ||
| 1085 | * (HV_X64_MSR_TSC_EMULATION_STATUS). KVM userspace is expected to preserve TSC | ||
| 1086 | * frequency and guest visible TSC value across migration (and prevent it when | ||
| 1087 | * TSC scaling is unsupported). | ||
| 1088 | */ | ||
| 1089 | static inline bool tsc_page_update_unsafe(struct kvm_hv *hv) | ||
| 1090 | { | ||
| 1091 | return (hv->hv_tsc_page_status != HV_TSC_PAGE_GUEST_CHANGED) && | ||
| 1092 | hv->hv_tsc_emulation_control; | ||
| 1093 | } | ||
| 1094 | |||
| 1080 | void kvm_hv_setup_tsc_page(struct kvm *kvm, | 1095 | void kvm_hv_setup_tsc_page(struct kvm *kvm, |
| 1081 | struct pvclock_vcpu_time_info *hv_clock) | 1096 | struct pvclock_vcpu_time_info *hv_clock) |
| 1082 | { | 1097 | { |
| @@ -1087,7 +1102,8 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 4 unmodified lines | |||
| 1087 | BUILD_BUG_ON(sizeof(tsc_seq) != sizeof(hv->tsc_ref.tsc_sequence)); | 1102 | BUILD_BUG_ON(sizeof(tsc_seq) != sizeof(hv->tsc_ref.tsc_sequence)); |
| 1088 | BUILD_BUG_ON(offsetof(struct ms_hyperv_tsc_page, tsc_sequence) != 0); | 1103 | BUILD_BUG_ON(offsetof(struct ms_hyperv_tsc_page, tsc_sequence) != 0); |
| 1089 | 1104 | ||
| 1090 | if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE)) | 1105 | if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN || |
| 1106 | hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET) | ||
| 1091 | return; | 1107 | return; |
| 1092 | 1108 | ||
| 1093 | mutex_lock(&hv->hv_lock); | 1109 | mutex_lock(&hv->hv_lock); |
| @@ -1101,7 +1117,15 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 7 unmodified lines | |||
| 1101 | */ | 1117 | */ |
| 1102 | if (unlikely(kvm_read_guest(kvm, gfn_to_gpa(gfn), | 1118 | if (unlikely(kvm_read_guest(kvm, gfn_to_gpa(gfn), |
| 1103 | &tsc_seq, sizeof(tsc_seq)))) | 1119 | &tsc_seq, sizeof(tsc_seq)))) |
| 1120 | goto out_err; | ||
| 1121 | |||
| 1122 | if (tsc_seq && tsc_page_update_unsafe(hv)) { | ||
| 1123 | if (kvm_read_guest(kvm, gfn_to_gpa(gfn), &hv->tsc_ref, sizeof(hv->tsc_ref))) | ||
| 1124 | goto out_err; | ||
| 1125 | |||
| 1126 | hv->hv_tsc_page_status = HV_TSC_PAGE_SET; | ||
| 1104 | goto out_unlock; | 1127 | goto out_unlock; |
| 1128 | } | ||
| 1105 | 1129 | ||
| 1106 | /* | 1130 | /* |
| 1107 | * While we're computing and writing the parameters, force the | 1131 | * While we're computing and writing the parameters, force the |
| @@ -1110,15 +1134,15 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 2 unmodified lines | |||
| 1110 | hv->tsc_ref.tsc_sequence = 0; | 1134 | hv->tsc_ref.tsc_sequence = 0; |
| 1111 | if (kvm_write_guest(kvm, gfn_to_gpa(gfn), | 1135 | if (kvm_write_guest(kvm, gfn_to_gpa(gfn), |
| 1112 | &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence))) | 1136 | &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence))) |
| 1113 | goto out_unlock; | 1137 | goto out_err; |
| 1114 | 1138 | ||
| 1115 | if (!compute_tsc_page_parameters(hv_clock, &hv->tsc_ref)) | 1139 | if (!compute_tsc_page_parameters(hv_clock, &hv->tsc_ref)) |
| 1116 | goto out_unlock; | 1140 | goto out_err; |
| 1117 | 1141 | ||
| 1118 | /* Ensure sequence is zero before writing the rest of the struct. */ | 1142 | /* Ensure sequence is zero before writing the rest of the struct. */ |
| 1119 | smp_wmb(); | 1143 | smp_wmb(); |
| 1120 | if (kvm_write_guest(kvm, gfn_to_gpa(gfn), &hv->tsc_ref, sizeof(hv->tsc_ref))) | 1144 | if (kvm_write_guest(kvm, gfn_to_gpa(gfn), &hv->tsc_ref, sizeof(hv->tsc_ref))) |
| 1121 | goto out_unlock; | 1145 | goto out_err; |
| 1122 | 1146 | ||
| 1123 | /* | 1147 | /* |
| 1124 | * Now switch to the TSC page mechanism by writing the sequence. | 1148 | * Now switch to the TSC page mechanism by writing the sequence. |
| @@ -1131,8 +1155,45 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 6 unmodified lines | |||
| 1131 | smp_wmb(); | 1155 | smp_wmb(); |
| 1132 | 1156 | ||
| 1133 | hv->tsc_ref.tsc_sequence = tsc_seq; | 1157 | hv->tsc_ref.tsc_sequence = tsc_seq; |
| 1134 | kvm_write_guest(kvm, gfn_to_gpa(gfn), | 1158 | if (kvm_write_guest(kvm, gfn_to_gpa(gfn), |
| 1135 | &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence)); | 1159 | &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence))) |
| 1160 | goto out_err; | ||
| 1161 | |||
| 1162 | hv->hv_tsc_page_status = HV_TSC_PAGE_SET; | ||
| 1163 | goto out_unlock; | ||
| 1164 | |||
| 1165 | out_err: | ||
| 1166 | hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN; | ||
| 1167 | out_unlock: | ||
| 1168 | mutex_unlock(&hv->hv_lock); | ||
| 1169 | } | ||
| 1170 | |||
| 1171 | void kvm_hv_invalidate_tsc_page(struct kvm *kvm) | ||
| 1172 | { | ||
| 1173 | struct kvm_hv *hv = to_kvm_hv(kvm); | ||
| 1174 | u64 gfn; | ||
| 1175 | |||
| 1176 | if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN || | ||
| 1177 | hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET || | ||
| 1178 | tsc_page_update_unsafe(hv)) | ||
| 1179 | return; | ||
| 1180 | |||
| 1181 | mutex_lock(&hv->hv_lock); | ||
| 1182 | |||
| 1183 | if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE)) | ||
| 1184 | goto out_unlock; | ||
| 1185 | |||
| 1186 | /* Preserve HV_TSC_PAGE_GUEST_CHANGED/HV_TSC_PAGE_HOST_CHANGED states */ | ||
| 1187 | if (hv->hv_tsc_page_status == HV_TSC_PAGE_SET) | ||
| 1188 | hv->hv_tsc_page_status = HV_TSC_PAGE_UPDATING; | ||
| 1189 | |||
| 1190 | gfn = hv->hv_tsc_page >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; | ||
| 1191 | |||
| 1192 | hv->tsc_ref.tsc_sequence = 0; | ||
| 1193 | if (kvm_write_guest(kvm, gfn_to_gpa(gfn), | ||
| 1194 | &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence))) | ||
| 1195 | hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN; | ||
| 1196 | |||
| 1136 | out_unlock: | 1197 | out_unlock: |
| 1137 | mutex_unlock(&hv->hv_lock); | 1198 | mutex_unlock(&hv->hv_lock); |
| 1138 | } | 1199 | } |
| @@ -1193,8 +1254,15 @@ static int kvm_hv_set_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data, · 54 unmodified lines | |||
| 1193 | } | 1254 | } |
| 1194 | case HV_X64_MSR_REFERENCE_TSC: | 1255 | case HV_X64_MSR_REFERENCE_TSC: |
| 1195 | hv->hv_tsc_page = data; | 1256 | hv->hv_tsc_page = data; |
| 1196 | if (hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE) | 1257 | if (hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE) { |
| 1258 | if (!host) | ||
| 1259 | hv->hv_tsc_page_status = HV_TSC_PAGE_GUEST_CHANGED; | ||
| 1260 | else | ||
| 1261 | hv->hv_tsc_page_status = HV_TSC_PAGE_HOST_CHANGED; | ||
| 1197 | kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); | 1262 | kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); |
| 1263 | } else { | ||
| 1264 | hv->hv_tsc_page_status = HV_TSC_PAGE_UNSET; | ||
| 1265 | } | ||
| 1198 | break; | 1266 | break; |
| 1199 | case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4: | 1267 | case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4: |
| 1200 | return kvm_hv_msr_set_crash_data(kvm, | 1268 | return kvm_hv_msr_set_crash_data(kvm, |
| @@ -1229,6 +1297,9 @@ static int kvm_hv_set_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data, · 28 unmodified lines | |||
| 1229 | hv->hv_tsc_emulation_control = data; | 1297 | hv->hv_tsc_emulation_control = data; |
| 1230 | break; | 1298 | break; |
| 1231 | case HV_X64_MSR_TSC_EMULATION_STATUS: | 1299 | case HV_X64_MSR_TSC_EMULATION_STATUS: |
| 1300 | if (data && !host) | ||
| 1301 | return 1; | ||
| 1302 | |||
| 1232 | hv->hv_tsc_emulation_status = data; | 1303 | hv->hv_tsc_emulation_status = data; |
| 1233 | break; | 1304 | break; |
| 1234 | case HV_X64_MSR_TIME_REF_COUNT: | 1305 | case HV_X64_MSR_TIME_REF_COUNT: |
| @@ -133,6 +133,7 @@ void kvm_hv_process_stimers(struct kvm_vcpu *vcpu); · 132 unmodified lines | |||
| 133 | 133 | ||
| 134 | void kvm_hv_setup_tsc_page(struct kvm *kvm, | 134 | void kvm_hv_setup_tsc_page(struct kvm *kvm, |
| 135 | struct pvclock_vcpu_time_info *hv_clock); | 135 | struct pvclock_vcpu_time_info *hv_clock); |
| 136 | void kvm_hv_invalidate_tsc_page(struct kvm *kvm); | ||
| 136 | 137 | ||
| 137 | void kvm_hv_init_vm(struct kvm *kvm); | 138 | void kvm_hv_init_vm(struct kvm *kvm); |
| 138 | void kvm_hv_destroy_vm(struct kvm *kvm); | 139 | void kvm_hv_destroy_vm(struct kvm *kvm); |
| @@ -78,6 +78,11 @@ static inline struct kvm_mmu_page *sptep_to_sp(u64 *sptep) · 77 unmodified lines | |||
| 78 | return to_shadow_page(__pa(sptep)); | 78 | return to_shadow_page(__pa(sptep)); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static inline int kvm_mmu_page_as_id(struct kvm_mmu_page *sp) | ||
| 82 | { | ||
| 83 | return sp->role.smm ? 1 : 0; | ||
| 84 | } | ||
| 85 | |||
| 81 | static inline bool kvm_vcpu_ad_need_write_protect(struct kvm_vcpu *vcpu) | 86 | static inline bool kvm_vcpu_ad_need_write_protect(struct kvm_vcpu *vcpu) |
| 82 | { | 87 | { |
| 83 | /* | 88 | /* |
| @@ -20,6 +20,21 @@ static gfn_t round_gfn_for_level(gfn_t gfn, int level) · 19 unmodified lines | |||
| 20 | return gfn & -KVM_PAGES_PER_HPAGE(level); | 20 | return gfn & -KVM_PAGES_PER_HPAGE(level); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | /* | ||
| 24 | * Return the TDP iterator to the root PT and allow it to continue its | ||
| 25 | * traversal over the paging structure from there. | ||
| 26 | */ | ||
| 27 | void tdp_iter_restart(struct tdp_iter *iter) | ||
| 28 | { | ||
| 29 | iter->yielded_gfn = iter->next_last_level_gfn; | ||
| 30 | iter->level = iter->root_level; | ||
| 31 | |||
| 32 | iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); | ||
| 33 | tdp_iter_refresh_sptep(iter); | ||
| 34 | |||
| 35 | iter->valid = true; | ||
| 36 | } | ||
| 37 | |||
| 23 | /* | 38 | /* |
| 24 | * Sets a TDP iterator to walk a pre-order traversal of the paging structure | 39 | * Sets a TDP iterator to walk a pre-order traversal of the paging structure |
| 25 | * rooted at root_pt, starting with the walk to translate next_last_level_gfn. | 40 | * rooted at root_pt, starting with the walk to translate next_last_level_gfn. |
| @@ -31,16 +46,12 @@ void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, · 5 unmodified lines | |||
| 31 | WARN_ON(root_level > PT64_ROOT_MAX_LEVEL); | 46 | WARN_ON(root_level > PT64_ROOT_MAX_LEVEL); |
| 32 | 47 | ||
| 33 | iter->next_last_level_gfn = next_last_level_gfn; | 48 | iter->next_last_level_gfn = next_last_level_gfn; |
| 34 | iter->yielded_gfn = iter->next_last_level_gfn; | ||
| 35 | iter->root_level = root_level; | 49 | iter->root_level = root_level; |
| 36 | iter->min_level = min_level; | 50 | iter->min_level = min_level; |
| 37 | iter->level = root_level; | 51 | iter->pt_path[iter->root_level - 1] = (tdp_ptep_t)root_pt; |
| 38 | iter->pt_path[iter->level - 1] = (tdp_ptep_t)root_pt; | 52 | iter->as_id = kvm_mmu_page_as_id(sptep_to_sp(root_pt)); |
| 39 | |||
| 40 | iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); | ||
| 41 | tdp_iter_refresh_sptep(iter); | ||
| 42 | 53 | ||
| 43 | iter->valid = true; | 54 | tdp_iter_restart(iter); |
| 44 | } | 55 | } |
| 45 | 56 | ||
| 46 | /* | 57 | /* |
| @@ -159,8 +170,3 @@ void tdp_iter_next(struct tdp_iter *iter) · 112 unmodified lines | |||
| 159 | iter->valid = false; | 170 | iter->valid = false; |
| 160 | } | 171 | } |
| 161 | 172 | ||
| 162 | tdp_ptep_t tdp_iter_root_pt(struct tdp_iter *iter) | ||
| 163 | { | ||
| 164 | return iter->pt_path[iter->root_level - 1]; | ||
| 165 | } | ||
| 166 | |||
| @@ -36,6 +36,8 @@ struct tdp_iter { · 35 unmodified lines | |||
| 36 | int min_level; | 36 | int min_level; |
| 37 | /* The iterator's current level within the paging structure */ | 37 | /* The iterator's current level within the paging structure */ |
| 38 | int level; | 38 | int level; |
| 39 | /* The address space ID, i.e. SMM vs. regular. */ | ||
| 40 | int as_id; | ||
| 39 | /* A snapshot of the value at sptep */ | 41 | /* A snapshot of the value at sptep */ |
| 40 | u64 old_spte; | 42 | u64 old_spte; |
| 41 | /* | 43 | /* |
| @@ -62,6 +64,6 @@ tdp_ptep_t spte_to_child_pt(u64 pte, int level); · 20 unmodified lines | |||
| 62 | void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, | 64 | void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, |
| 63 | int min_level, gfn_t next_last_level_gfn); | 65 | int min_level, gfn_t next_last_level_gfn); |
| 64 | void tdp_iter_next(struct tdp_iter *iter); | 66 | void tdp_iter_next(struct tdp_iter *iter); |
| 65 | tdp_ptep_t tdp_iter_root_pt(struct tdp_iter *iter); | 67 | void tdp_iter_restart(struct tdp_iter *iter); |
| 66 | 68 | ||
| 67 | #endif /* __KVM_X86_MMU_TDP_ITER_H */ | 69 | #endif /* __KVM_X86_MMU_TDP_ITER_H */ |
| @@ -203,11 +203,6 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn, · 202 unmodified lines | |||
| 203 | u64 old_spte, u64 new_spte, int level, | 203 | u64 old_spte, u64 new_spte, int level, |
| 204 | bool shared); | 204 | bool shared); |
| 205 | 205 | ||
| 206 | static int kvm_mmu_page_as_id(struct kvm_mmu_page *sp) | ||
| 207 | { | ||
| 208 | return sp->role.smm ? 1 : 0; | ||
| 209 | } | ||
| 210 | |||
| 211 | static void handle_changed_spte_acc_track(u64 old_spte, u64 new_spte, int level) | 206 | static void handle_changed_spte_acc_track(u64 old_spte, u64 new_spte, int level) |
| 212 | { | 207 | { |
| 213 | bool pfn_changed = spte_to_pfn(old_spte) != spte_to_pfn(new_spte); | 208 | bool pfn_changed = spte_to_pfn(old_spte) != spte_to_pfn(new_spte); |
| @@ -301,11 +296,16 @@ static void tdp_mmu_unlink_page(struct kvm *kvm, struct kvm_mmu_page *sp, · 87 unmodified lines | |||
| 301 | * | 296 | * |
| 302 | * Given a page table that has been removed from the TDP paging structure, | 297 | * Given a page table that has been removed from the TDP paging structure, |
| 303 | * iterates through the page table to clear SPTEs and free child page tables. | 298 | * iterates through the page table to clear SPTEs and free child page tables. |
| 299 | * | ||
| 300 | * Note that pt is passed in as a tdp_ptep_t, but it does not need RCU | ||
| 301 | * protection. Since this thread removed it from the paging structure, | ||
| 302 | * this thread will be responsible for ensuring the page is freed. Hence the | ||
| 303 | * early rcu_dereferences in the function. | ||
| 304 | */ | 304 | */ |
| 305 | static void handle_removed_tdp_mmu_page(struct kvm *kvm, u64 *pt, | 305 | static void handle_removed_tdp_mmu_page(struct kvm *kvm, tdp_ptep_t pt, |
| 306 | bool shared) | 306 | bool shared) |
| 307 | { | 307 | { |
| 308 | struct kvm_mmu_page *sp = sptep_to_sp(pt); | 308 | struct kvm_mmu_page *sp = sptep_to_sp(rcu_dereference(pt)); |
| 309 | int level = sp->role.level; | 309 | int level = sp->role.level; |
| 310 | gfn_t base_gfn = sp->gfn; | 310 | gfn_t base_gfn = sp->gfn; |
| 311 | u64 old_child_spte; | 311 | u64 old_child_spte; |
| @@ -318,7 +318,7 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, u64 *pt, · 6 unmodified lines | |||
| 318 | tdp_mmu_unlink_page(kvm, sp, shared); | 318 | tdp_mmu_unlink_page(kvm, sp, shared); |
| 319 | 319 | ||
| 320 | for (i = 0; i < PT64_ENT_PER_PAGE; i++) { | 320 | for (i = 0; i < PT64_ENT_PER_PAGE; i++) { |
| 321 | sptep = pt + i; | 321 | sptep = rcu_dereference(pt) + i; |
| 322 | gfn = base_gfn + (i * KVM_PAGES_PER_HPAGE(level - 1)); | 322 | gfn = base_gfn + (i * KVM_PAGES_PER_HPAGE(level - 1)); |
| 323 | 323 | ||
| 324 | if (shared) { | 324 | if (shared) { |
| @@ -492,10 +492,6 @@ static inline bool tdp_mmu_set_spte_atomic(struct kvm *kvm, · 167 unmodified lines | |||
| 492 | struct tdp_iter *iter, | 492 | struct tdp_iter *iter, |
| 493 | u64 new_spte) | 493 | u64 new_spte) |
| 494 | { | 494 | { |
| 495 | u64 *root_pt = tdp_iter_root_pt(iter); | ||
| 496 | struct kvm_mmu_page *root = sptep_to_sp(root_pt); | ||
| 497 | int as_id = kvm_mmu_page_as_id(root); | ||
| 498 | |||
| 499 | lockdep_assert_held_read(&kvm->mmu_lock); | 495 | lockdep_assert_held_read(&kvm->mmu_lock); |
| 500 | 496 | ||
| 501 | /* | 497 | /* |
| @@ -509,8 +505,8 @@ static inline bool tdp_mmu_set_spte_atomic(struct kvm *kvm, · 7 unmodified lines | |||
| 509 | new_spte) != iter->old_spte) | 505 | new_spte) != iter->old_spte) |
| 510 | return false; | 506 | return false; |
| 511 | 507 | ||
| 512 | handle_changed_spte(kvm, as_id, iter->gfn, iter->old_spte, new_spte, | 508 | handle_changed_spte(kvm, iter->as_id, iter->gfn, iter->old_spte, |
| 513 | iter->level, true); | 509 | new_spte, iter->level, true); |
| 514 | 510 | ||
| 515 | return true; | 511 | return true; |
| 516 | } | 512 | } |
| @@ -538,7 +534,7 @@ static inline bool tdp_mmu_zap_spte_atomic(struct kvm *kvm, · 21 unmodified lines | |||
| 538 | * here since the SPTE is going from non-present | 534 | * here since the SPTE is going from non-present |
| 539 | * to non-present. | 535 | * to non-present. |
| 540 | */ | 536 | */ |
| 541 | WRITE_ONCE(*iter->sptep, 0); | 537 | WRITE_ONCE(*rcu_dereference(iter->sptep), 0); |
| 542 | 538 | ||
| 543 | return true; | 539 | return true; |
| 544 | } | 540 | } |
| @@ -564,10 +560,6 @@ static inline void __tdp_mmu_set_spte(struct kvm *kvm, struct tdp_iter *iter, · 19 unmodified lines | |||
| 564 | u64 new_spte, bool record_acc_track, | 560 | u64 new_spte, bool record_acc_track, |
| 565 | bool record_dirty_log) | 561 | bool record_dirty_log) |
| 566 | { | 562 | { |
| 567 | tdp_ptep_t root_pt = tdp_iter_root_pt(iter); | ||
| 568 | struct kvm_mmu_page *root = sptep_to_sp(root_pt); | ||
| 569 | int as_id = kvm_mmu_page_as_id(root); | ||
| 570 | |||
| 571 | lockdep_assert_held_write(&kvm->mmu_lock); | 563 | lockdep_assert_held_write(&kvm->mmu_lock); |
| 572 | 564 | ||
| 573 | /* | 565 | /* |
| @@ -581,13 +573,13 @@ static inline void __tdp_mmu_set_spte(struct kvm *kvm, struct tdp_iter *iter, · 7 unmodified lines | |||
| 581 | 573 | ||
| 582 | WRITE_ONCE(*rcu_dereference(iter->sptep), new_spte); | 574 | WRITE_ONCE(*rcu_dereference(iter->sptep), new_spte); |
| 583 | 575 | ||
| 584 | __handle_changed_spte(kvm, as_id, iter->gfn, iter->old_spte, new_spte, | 576 | __handle_changed_spte(kvm, iter->as_id, iter->gfn, iter->old_spte, |
| 585 | iter->level, false); | 577 | new_spte, iter->level, false); |
| 586 | if (record_acc_track) | 578 | if (record_acc_track) |
| 587 | handle_changed_spte_acc_track(iter->old_spte, new_spte, | 579 | handle_changed_spte_acc_track(iter->old_spte, new_spte, |
| 588 | iter->level); | 580 | iter->level); |
| 589 | if (record_dirty_log) | 581 | if (record_dirty_log) |
| 590 | handle_changed_spte_dirty_log(kvm, as_id, iter->gfn, | 582 | handle_changed_spte_dirty_log(kvm, iter->as_id, iter->gfn, |
| 591 | iter->old_spte, new_spte, | 583 | iter->old_spte, new_spte, |
| 592 | iter->level); | 584 | iter->level); |
| 593 | } | 585 | } |
| @@ -659,9 +651,7 @@ static inline bool tdp_mmu_iter_cond_resched(struct kvm *kvm, · 65 unmodified lines | |||
| 659 | 651 | ||
| 660 | WARN_ON(iter->gfn > iter->next_last_level_gfn); | 652 | WARN_ON(iter->gfn > iter->next_last_level_gfn); |
| 661 | 653 | ||
| 662 | tdp_iter_start(iter, iter->pt_path[iter->root_level - 1], | 654 | tdp_iter_restart(iter); |
| 663 | iter->root_level, iter->min_level, | ||
| 664 | iter->next_last_level_gfn); | ||
| 665 | 655 | ||
| 666 | return true; | 656 | return true; |
| 667 | } | 657 | } |
| @@ -1526,35 +1526,44 @@ EXPORT_SYMBOL_GPL(kvm_enable_efer_bits); · 1525 unmodified lines | |||
| 1526 | 1526 | ||
| 1527 | bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type) | 1527 | bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type) |
| 1528 | { | 1528 | { |
| 1529 | struct kvm_x86_msr_filter *msr_filter; | ||
| 1530 | struct msr_bitmap_range *ranges; | ||
| 1529 | struct kvm *kvm = vcpu->kvm; | 1531 | struct kvm *kvm = vcpu->kvm; |
| 1530 | struct msr_bitmap_range *ranges = kvm->arch.msr_filter.ranges; | 1532 | bool allowed; |
| 1531 | u32 count = kvm->arch.msr_filter.count; | ||
| 1532 | u32 i; | ||
| 1533 | bool r = kvm->arch.msr_filter.default_allow; | ||
| 1534 | int idx; | 1533 | int idx; |
| 1534 | u32 i; | ||
| 1535 | 1535 | ||
| 1536 | /* MSR filtering not set up or x2APIC enabled, allow everything */ | 1536 | /* x2APIC MSRs do not support filtering. */ |
| 1537 | if (!count || (index >= 0x800 && index <= 0x8ff)) | 1537 | if (index >= 0x800 && index <= 0x8ff) |
| 1538 | return true; | 1538 | return true; |
| 1539 | 1539 | ||
| 1540 | /* Prevent collision with set_msr_filter */ | ||
| 1541 | idx = srcu_read_lock(&kvm->srcu); | 1540 | idx = srcu_read_lock(&kvm->srcu); |
| 1542 | 1541 | ||
| 1543 | for (i = 0; i < count; i++) { | 1542 | msr_filter = srcu_dereference(kvm->arch.msr_filter, &kvm->srcu); |
| 1543 | if (!msr_filter) { | ||
| 1544 | allowed = true; | ||
| 1545 | goto out; | ||
| 1546 | } | ||
| 1547 | |||
| 1548 | allowed = msr_filter->default_allow; | ||
| 1549 | ranges = msr_filter->ranges; | ||
| 1550 | |||
| 1551 | for (i = 0; i < msr_filter->count; i++) { | ||
| 1544 | u32 start = ranges[i].base; | 1552 | u32 start = ranges[i].base; |
| 1545 | u32 end = start + ranges[i].nmsrs; | 1553 | u32 end = start + ranges[i].nmsrs; |
| 1546 | u32 flags = ranges[i].flags; | 1554 | u32 flags = ranges[i].flags; |
| 1547 | unsigned long *bitmap = ranges[i].bitmap; | 1555 | unsigned long *bitmap = ranges[i].bitmap; |
| 1548 | 1556 | ||
| 1549 | if ((index >= start) && (index < end) && (flags & type)) { | 1557 | if ((index >= start) && (index < end) && (flags & type)) { |
| 1550 | r = !!test_bit(index - start, bitmap); | 1558 | allowed = !!test_bit(index - start, bitmap); |
| 1551 | break; | 1559 | break; |
| 1552 | } | 1560 | } |
| 1553 | } | 1561 | } |
| 1554 | 1562 | ||
| 1563 | out: | ||
| 1555 | srcu_read_unlock(&kvm->srcu, idx); | 1564 | srcu_read_unlock(&kvm->srcu, idx); |
| 1556 | 1565 | ||
| 1557 | return r; | 1566 | return allowed; |
| 1558 | } | 1567 | } |
| 1559 | EXPORT_SYMBOL_GPL(kvm_msr_allowed); | 1568 | EXPORT_SYMBOL_GPL(kvm_msr_allowed); |
| 1560 | 1569 | ||
| @@ -2551,6 +2560,8 @@ static void kvm_gen_update_masterclock(struct kvm *kvm) · 990 unmodified lines | |||
| 2551 | struct kvm_vcpu *vcpu; | 2560 | struct kvm_vcpu *vcpu; |
| 2552 | struct kvm_arch *ka = &kvm->arch; | 2561 | struct kvm_arch *ka = &kvm->arch; |
| 2553 | 2562 | ||
| 2563 | kvm_hv_invalidate_tsc_page(kvm); | ||
| 2564 | |||
| 2554 | spin_lock(&ka->pvclock_gtod_sync_lock); | 2565 | spin_lock(&ka->pvclock_gtod_sync_lock); |
| 2555 | kvm_make_mclock_inprogress_request(kvm); | 2566 | kvm_make_mclock_inprogress_request(kvm); |
| 2556 | /* no guest entries from this point */ | 2567 | /* no guest entries from this point */ |
| @@ -5352,25 +5363,34 @@ split_irqchip_unlock: · 2795 unmodified lines | |||
| 5352 | return r; | 5363 | return r; |
| 5353 | } | 5364 | } |
| 5354 | 5365 | ||
| 5355 | static void kvm_clear_msr_filter(struct kvm *kvm) | 5366 | static struct kvm_x86_msr_filter *kvm_alloc_msr_filter(bool default_allow) |
| 5367 | { | ||
| 5368 | struct kvm_x86_msr_filter *msr_filter; | ||
| 5369 | |||
| 5370 | msr_filter = kzalloc(sizeof(*msr_filter), GFP_KERNEL_ACCOUNT); | ||
| 5371 | if (!msr_filter) | ||
| 5372 | return NULL; | ||
| 5373 | |||
| 5374 | msr_filter->default_allow = default_allow; | ||
| 5375 | return msr_filter; | ||
| 5376 | } | ||
| 5377 | |||
| 5378 | static void kvm_free_msr_filter(struct kvm_x86_msr_filter *msr_filter) | ||
| 5356 | { | 5379 | { |
| 5357 | u32 i; | 5380 | u32 i; |
| 5358 | u32 count = kvm->arch.msr_filter.count; | ||
| 5359 | struct msr_bitmap_range ranges[16]; | ||
| 5360 | 5381 | ||
| 5361 | mutex_lock(&kvm->lock); | 5382 | if (!msr_filter) |
| 5362 | kvm->arch.msr_filter.count = 0; | 5383 | return; |
| 5363 | memcpy(ranges, kvm->arch.msr_filter.ranges, count * sizeof(ranges[0])); | ||
| 5364 | mutex_unlock(&kvm->lock); | ||
| 5365 | synchronize_srcu(&kvm->srcu); | ||
| 5366 | 5384 | ||
| 5367 | for (i = 0; i < count; i++) | 5385 | for (i = 0; i < msr_filter->count; i++) |
| 5368 | kfree(ranges[i].bitmap); | 5386 | kfree(msr_filter->ranges[i].bitmap); |
| 5387 | |||
| 5388 | kfree(msr_filter); | ||
| 5369 | } | 5389 | } |
| 5370 | 5390 | ||
| 5371 | static int kvm_add_msr_filter(struct kvm *kvm, struct kvm_msr_filter_range *user_range) | 5391 | static int kvm_add_msr_filter(struct kvm_x86_msr_filter *msr_filter, |
| 5392 | struct kvm_msr_filter_range *user_range) | ||
| 5372 | { | 5393 | { |
| 5373 | struct msr_bitmap_range *ranges = kvm->arch.msr_filter.ranges; | ||
| 5374 | struct msr_bitmap_range range; | 5394 | struct msr_bitmap_range range; |
| 5375 | unsigned long *bitmap = NULL; | 5395 | unsigned long *bitmap = NULL; |
| 5376 | size_t bitmap_size; | 5396 | size_t bitmap_size; |
| @@ -5404,11 +5424,9 @@ static int kvm_add_msr_filter(struct kvm *kvm, struct kvm_msr_filter_range *user · 27 unmodified lines | |||
| 5404 | goto err; | 5424 | goto err; |
| 5405 | } | 5425 | } |
| 5406 | 5426 | ||
| 5407 | /* Everything ok, add this range identifier to our global pool */ | 5427 | /* Everything ok, add this range identifier. */ |
| 5408 | ranges[kvm->arch.msr_filter.count] = range; | 5428 | msr_filter->ranges[msr_filter->count] = range; |
| 5409 | /* Make sure we filled the array before we tell anyone to walk it */ | 5429 | msr_filter->count++; |
| 5410 | smp_wmb(); | ||
| 5411 | kvm->arch.msr_filter.count++; | ||
| 5412 | 5430 | ||
| 5413 | return 0; | 5431 | return 0; |
| 5414 | err: | 5432 | err: |
| @@ -5419,10 +5437,11 @@ err: · 4 unmodified lines | |||
| 5419 | static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) | 5437 | static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) |
| 5420 | { | 5438 | { |
| 5421 | struct kvm_msr_filter __user *user_msr_filter = argp; | 5439 | struct kvm_msr_filter __user *user_msr_filter = argp; |
| 5440 | struct kvm_x86_msr_filter *new_filter, *old_filter; | ||
| 5422 | struct kvm_msr_filter filter; | 5441 | struct kvm_msr_filter filter; |
| 5423 | bool default_allow; | 5442 | bool default_allow; |
| 5424 | int r = 0; | ||
| 5425 | bool empty = true; | 5443 | bool empty = true; |
| 5444 | int r = 0; | ||
| 5426 | u32 i; | 5445 | u32 i; |
| 5427 | 5446 | ||
| 5428 | if (copy_from_user(&filter, user_msr_filter, sizeof(filter))) | 5447 | if (copy_from_user(&filter, user_msr_filter, sizeof(filter))) |
| @@ -5435,25 +5454,32 @@ static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) · 6 unmodified lines | |||
| 5435 | if (empty && !default_allow) | 5454 | if (empty && !default_allow) |
| 5436 | return -EINVAL; | 5455 | return -EINVAL; |
| 5437 | 5456 | ||
| 5438 | kvm_clear_msr_filter(kvm); | 5457 | new_filter = kvm_alloc_msr_filter(default_allow); |
| 5439 | 5458 | if (!new_filter) | |
| 5440 | kvm->arch.msr_filter.default_allow = default_allow; | 5459 | return -ENOMEM; |
| 5441 | 5460 | ||
| 5442 | /* | ||
| 5443 | * Protect from concurrent calls to this function that could trigger | ||
| 5444 | * a TOCTOU violation on kvm->arch.msr_filter.count. | ||
| 5445 | */ | ||
| 5446 | mutex_lock(&kvm->lock); | ||
| 5447 | for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) { | 5461 | for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) { |
| 5448 | r = kvm_add_msr_filter(kvm, &filter.ranges[i]); | 5462 | r = kvm_add_msr_filter(new_filter, &filter.ranges[i]); |
| 5449 | if (r) | 5463 | if (r) { |
| 5450 | break; | 5464 | kvm_free_msr_filter(new_filter); |
| 5465 | return r; | ||
| 5466 | } | ||
| 5451 | } | 5467 | } |
| 5452 | 5468 | ||
| 5469 | mutex_lock(&kvm->lock); | ||
| 5470 | |||
| 5471 | /* The per-VM filter is protected by kvm->lock... */ | ||
| 5472 | old_filter = srcu_dereference_check(kvm->arch.msr_filter, &kvm->srcu, 1); | ||
| 5473 | |||
| 5474 | rcu_assign_pointer(kvm->arch.msr_filter, new_filter); | ||
| 5475 | synchronize_srcu(&kvm->srcu); | ||
| 5476 | |||
| 5477 | kvm_free_msr_filter(old_filter); | ||
| 5478 | |||
| 5453 | kvm_make_all_cpus_request(kvm, KVM_REQ_MSR_FILTER_CHANGED); | 5479 | kvm_make_all_cpus_request(kvm, KVM_REQ_MSR_FILTER_CHANGED); |
| 5454 | mutex_unlock(&kvm->lock); | 5480 | mutex_unlock(&kvm->lock); |
| 5455 | 5481 | ||
| 5456 | return r; | 5482 | return 0; |
| 5457 | } | 5483 | } |
| 5458 | 5484 | ||
| 5459 | long kvm_arch_vm_ioctl(struct file *filp, | 5485 | long kvm_arch_vm_ioctl(struct file *filp, |
| @@ -6603,7 +6629,7 @@ static int kvm_emulate_wbinvd_noskip(struct kvm_vcpu *vcpu) · 1143 unmodified lines | |||
| 6603 | int cpu = get_cpu(); | 6629 | int cpu = get_cpu(); |
| 6604 | 6630 | ||
| 6605 | cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask); | 6631 | cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask); |
| 6606 | smp_call_function_many(vcpu->arch.wbinvd_dirty_mask, | 6632 | on_each_cpu_mask(vcpu->arch.wbinvd_dirty_mask, |
| 6607 | wbinvd_ipi, NULL, 1); | 6633 | wbinvd_ipi, NULL, 1); |
| 6608 | put_cpu(); | 6634 | put_cpu(); |
| 6609 | cpumask_clear(vcpu->arch.wbinvd_dirty_mask); | 6635 | cpumask_clear(vcpu->arch.wbinvd_dirty_mask); |
| @@ -10634,8 +10660,6 @@ void kvm_arch_pre_destroy_vm(struct kvm *kvm) · 4024 unmodified lines | |||
| 10634 | 10660 | ||
| 10635 | void kvm_arch_destroy_vm(struct kvm *kvm) | 10661 | void kvm_arch_destroy_vm(struct kvm *kvm) |
| 10636 | { | 10662 | { |
| 10637 | u32 i; | ||
| 10638 | |||
| 10639 | if (current->mm == kvm->mm) { | 10663 | if (current->mm == kvm->mm) { |
| 10640 | /* | 10664 | /* |
| 10641 | * Free memory regions allocated on behalf of userspace, | 10665 | * Free memory regions allocated on behalf of userspace, |
| @@ -10651,8 +10675,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm) · 9 unmodified lines | |||
| 10651 | mutex_unlock(&kvm->slots_lock); | 10675 | mutex_unlock(&kvm->slots_lock); |
| 10652 | } | 10676 | } |
| 10653 | static_call_cond(kvm_x86_vm_destroy)(kvm); | 10677 | static_call_cond(kvm_x86_vm_destroy)(kvm); |
| 10654 | for (i = 0; i < kvm->arch.msr_filter.count; i++) | 10678 | kvm_free_msr_filter(srcu_dereference_check(kvm->arch.msr_filter, &kvm->srcu, 1)); |
| 10655 | kfree(kvm->arch.msr_filter.ranges[i].bitmap); | ||
| 10656 | kvm_pic_destroy(kvm); | 10679 | kvm_pic_destroy(kvm); |
| 10657 | kvm_ioapic_destroy(kvm); | 10680 | kvm_ioapic_destroy(kvm); |
| 10658 | kvm_free_vcpus(kvm); | 10681 | kvm_free_vcpus(kvm); |
| @@ -262,7 +262,7 @@ static void __init __set_clr_pte_enc(pte_t *kpte, int level, bool enc) · 261 unmodified lines | |||
| 262 | if (pgprot_val(old_prot) == pgprot_val(new_prot)) | 262 | if (pgprot_val(old_prot) == pgprot_val(new_prot)) |
| 263 | return; | 263 | return; |
| 264 | 264 | ||
| 265 | pa = pfn << page_level_shift(level); | 265 | pa = pfn << PAGE_SHIFT; |
| 266 | size = page_level_size(level); | 266 | size = page_level_size(level); |
| 267 | 267 | ||
| 268 | /* | 268 | /* |
| @@ -1936,7 +1936,7 @@ static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, · 1935 unmodified lines | |||
| 1936 | * add rsp, 8 // skip eth_type_trans's frame | 1936 | * add rsp, 8 // skip eth_type_trans's frame |
| 1937 | * ret // return to its caller | 1937 | * ret // return to its caller |
| 1938 | */ | 1938 | */ |
| 1939 | int arch_prepare_bpf_trampoline(void *image, void *image_end, | 1939 | int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end, |
| 1940 | const struct btf_func_model *m, u32 flags, | 1940 | const struct btf_func_model *m, u32 flags, |
| 1941 | struct bpf_tramp_progs *tprogs, | 1941 | struct bpf_tramp_progs *tprogs, |
| 1942 | void *orig_call) | 1942 | void *orig_call) |
| @@ -1975,6 +1975,15 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 32 unmodified lines | |||
| 1975 | 1975 | ||
| 1976 | save_regs(m, &prog, nr_args, stack_size); | 1976 | save_regs(m, &prog, nr_args, stack_size); |
| 1977 | 1977 | ||
| 1978 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | ||
| 1979 | /* arg1: mov rdi, im */ | ||
| 1980 | emit_mov_imm64(&prog, BPF_REG_1, (long) im >> 32, (u32) (long) im); | ||
| 1981 | if (emit_call(&prog, __bpf_tramp_enter, prog)) { | ||
| 1982 | ret = -EINVAL; | ||
| 1983 | goto cleanup; | ||
| 1984 | } | ||
| 1985 | } | ||
| 1986 | |||
| 1978 | if (fentry->nr_progs) | 1987 | if (fentry->nr_progs) |
| 1979 | if (invoke_bpf(m, &prog, fentry, stack_size)) | 1988 | if (invoke_bpf(m, &prog, fentry, stack_size)) |
| 1980 | return -EINVAL; | 1989 | return -EINVAL; |
| @@ -1993,8 +2002,7 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 12 unmodified lines | |||
| 1993 | } | 2002 | } |
| 1994 | 2003 | ||
| 1995 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | 2004 | if (flags & BPF_TRAMP_F_CALL_ORIG) { |
| 1996 | if (fentry->nr_progs || fmod_ret->nr_progs) | 2005 | restore_regs(m, &prog, nr_args, stack_size); |
| 1997 | restore_regs(m, &prog, nr_args, stack_size); | ||
| 1998 | 2006 | ||
| 1999 | /* call original function */ | 2007 | /* call original function */ |
| 2000 | if (emit_call(&prog, orig_call, prog)) { | 2008 | if (emit_call(&prog, orig_call, prog)) { |
| @@ -2003,6 +2011,9 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 2 unmodified lines | |||
| 2003 | } | 2011 | } |
| 2004 | /* remember return value in a stack for bpf prog to access */ | 2012 | /* remember return value in a stack for bpf prog to access */ |
| 2005 | emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); | 2013 | emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); |
| 2014 | im->ip_after_call = prog; | ||
| 2015 | memcpy(prog, ideal_nops[NOP_ATOMIC5], X86_PATCH_SIZE); | ||
| 2016 | prog += X86_PATCH_SIZE; | ||
| 2006 | } | 2017 | } |
| 2007 | 2018 | ||
| 2008 | if (fmod_ret->nr_progs) { | 2019 | if (fmod_ret->nr_progs) { |
| @@ -2033,9 +2044,17 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 24 unmodified lines | |||
| 2033 | * the return value is only updated on the stack and still needs to be | 2044 | * the return value is only updated on the stack and still needs to be |
| 2034 | * restored to R0. | 2045 | * restored to R0. |
| 2035 | */ | 2046 | */ |
| 2036 | if (flags & BPF_TRAMP_F_CALL_ORIG) | 2047 | if (flags & BPF_TRAMP_F_CALL_ORIG) { |
| 2048 | im->ip_epilogue = prog; | ||
| 2049 | /* arg1: mov rdi, im */ | ||
| 2050 | emit_mov_imm64(&prog, BPF_REG_1, (long) im >> 32, (u32) (long) im); | ||
| 2051 | if (emit_call(&prog, __bpf_tramp_exit, prog)) { | ||
| 2052 | ret = -EINVAL; | ||
| 2053 | goto cleanup; | ||
| 2054 | } | ||
| 2037 | /* restore original return value back into RAX */ | 2055 | /* restore original return value back into RAX */ |
| 2038 | emit_ldx(&prog, BPF_DW, BPF_REG_0, BPF_REG_FP, -8); | 2056 | emit_ldx(&prog, BPF_DW, BPF_REG_0, BPF_REG_FP, -8); |
| 2057 | } | ||
| 2039 | 2058 | ||
| 2040 | EMIT1(0x5B); /* pop rbx */ | 2059 | EMIT1(0x5B); /* pop rbx */ |
| 2041 | EMIT1(0xC9); /* leave */ | 2060 | EMIT1(0xC9); /* leave */ |
| @@ -2225,7 +2244,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) · 183 unmodified lines | |||
| 2225 | padding = true; | 2244 | padding = true; |
| 2226 | goto skip_init_addrs; | 2245 | goto skip_init_addrs; |
| 2227 | } | 2246 | } |
| 2228 | addrs = kmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL); | 2247 | addrs = kvmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL); |
| 2229 | if (!addrs) { | 2248 | if (!addrs) { |
| 2230 | prog = orig_prog; | 2249 | prog = orig_prog; |
| 2231 | goto out_addrs; | 2250 | goto out_addrs; |
| @@ -2317,7 +2336,7 @@ out_image: · 85 unmodified lines | |||
| 2317 | if (image) | 2336 | if (image) |
| 2318 | bpf_prog_fill_jited_linfo(prog, addrs + 1); | 2337 | bpf_prog_fill_jited_linfo(prog, addrs + 1); |
| 2319 | out_addrs: | 2338 | out_addrs: |
| 2320 | kfree(addrs); | 2339 | kvfree(addrs); |
| 2321 | kfree(jit_data); | 2340 | kfree(jit_data); |
| 2322 | prog->aux->jit_data = NULL; | 2341 | prog->aux->jit_data = NULL; |
| 2323 | } | 2342 | } |
| @@ -27,7 +27,6 @@ · 26 unmodified lines | |||
| 27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
| 28 | MODULE_AUTHOR("Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>"); | 28 | MODULE_AUTHOR("Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>"); |
| 29 | MODULE_DESCRIPTION("A power_off handler for Iris devices from EuroBraille"); | 29 | MODULE_DESCRIPTION("A power_off handler for Iris devices from EuroBraille"); |
| 30 | MODULE_SUPPORTED_DEVICE("Eurobraille/Iris"); | ||
| 31 | 30 | ||
| 32 | static bool force; | 31 | static bool force; |
| 33 | 32 | ||
| @@ -98,8 +98,8 @@ EXPORT_SYMBOL_GPL(xen_p2m_size); · 97 unmodified lines | |||
| 98 | unsigned long xen_max_p2m_pfn __read_mostly; | 98 | unsigned long xen_max_p2m_pfn __read_mostly; |
| 99 | EXPORT_SYMBOL_GPL(xen_max_p2m_pfn); | 99 | EXPORT_SYMBOL_GPL(xen_max_p2m_pfn); |
| 100 | 100 | ||
| 101 | #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG_LIMIT | 101 | #ifdef CONFIG_XEN_MEMORY_HOTPLUG_LIMIT |
| 102 | #define P2M_LIMIT CONFIG_XEN_BALLOON_MEMORY_HOTPLUG_LIMIT | 102 | #define P2M_LIMIT CONFIG_XEN_MEMORY_HOTPLUG_LIMIT |
| 103 | #else | 103 | #else |
| 104 | #define P2M_LIMIT 0 | 104 | #define P2M_LIMIT 0 |
| 105 | #endif | 105 | #endif |
| @@ -416,9 +416,6 @@ void __init xen_vmalloc_p2m_tree(void) · 310 unmodified lines | |||
| 416 | xen_p2m_last_pfn = xen_max_p2m_pfn; | 416 | xen_p2m_last_pfn = xen_max_p2m_pfn; |
| 417 | 417 | ||
| 418 | p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE; | 418 | p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE; |
| 419 | if (!p2m_limit && IS_ENABLED(CONFIG_XEN_UNPOPULATED_ALLOC)) | ||
| 420 | p2m_limit = xen_start_info->nr_pages * XEN_EXTRA_MEM_RATIO; | ||
| 421 | |||
| 422 | vm.flags = VM_ALLOC; | 419 | vm.flags = VM_ALLOC; |
| 423 | vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit), | 420 | vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit), |
| 424 | PMD_SIZE * PMDS_PER_MID_PAGE); | 421 | PMD_SIZE * PMDS_PER_MID_PAGE); |
| @@ -59,6 +59,18 @@ static struct { · 58 unmodified lines | |||
| 59 | } xen_remap_buf __initdata __aligned(PAGE_SIZE); | 59 | } xen_remap_buf __initdata __aligned(PAGE_SIZE); |
| 60 | static unsigned long xen_remap_mfn __initdata = INVALID_P2M_ENTRY; | 60 | static unsigned long xen_remap_mfn __initdata = INVALID_P2M_ENTRY; |
| 61 | 61 | ||
| 62 | /* | ||
| 63 | * The maximum amount of extra memory compared to the base size. The | ||
| 64 | * main scaling factor is the size of struct page. At extreme ratios | ||
| 65 | * of base:extra, all the base memory can be filled with page | ||
| 66 | * structures for the extra memory, leaving no space for anything | ||
| 67 | * else. | ||
| 68 | * | ||
| 69 | * 10x seems like a reasonable balance between scaling flexibility and | ||
| 70 | * leaving a practically usable system. | ||
| 71 | */ | ||
| 72 | #define EXTRA_MEM_RATIO (10) | ||
| 73 | |||
| 62 | static bool xen_512gb_limit __initdata = IS_ENABLED(CONFIG_XEN_512GB); | 74 | static bool xen_512gb_limit __initdata = IS_ENABLED(CONFIG_XEN_512GB); |
| 63 | 75 | ||
| 64 | static void __init xen_parse_512gb(void) | 76 | static void __init xen_parse_512gb(void) |
| @@ -778,13 +790,13 @@ char * __init xen_memory_setup(void) · 713 unmodified lines | |||
| 778 | extra_pages += max_pages - max_pfn; | 790 | extra_pages += max_pages - max_pfn; |
| 779 | 791 | ||
| 780 | /* | 792 | /* |
| 781 | * Clamp the amount of extra memory to a XEN_EXTRA_MEM_RATIO | 793 | * Clamp the amount of extra memory to a EXTRA_MEM_RATIO |
| 782 | * factor the base size. | 794 | * factor the base size. |
| 783 | * | 795 | * |
| 784 | * Make sure we have no memory above max_pages, as this area | 796 | * Make sure we have no memory above max_pages, as this area |
| 785 | * isn't handled by the p2m management. | 797 | * isn't handled by the p2m management. |
| 786 | */ | 798 | */ |
| 787 | extra_pages = min3(XEN_EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)), | 799 | extra_pages = min3(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)), |
| 788 | extra_pages, max_pages - max_pfn); | 800 | extra_pages, max_pages - max_pfn); |
| 789 | i = 0; | 801 | i = 0; |
| 790 | addr = xen_e820_table.entries[0].addr; | 802 | addr = xen_e820_table.entries[0].addr; |
| @@ -949,7 +949,7 @@ void bio_release_pages(struct bio *bio, bool mark_dirty) · 948 unmodified lines | |||
| 949 | } | 949 | } |
| 950 | EXPORT_SYMBOL_GPL(bio_release_pages); | 950 | EXPORT_SYMBOL_GPL(bio_release_pages); |
| 951 | 951 | ||
| 952 | static int bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter) | 952 | static void __bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter) |
| 953 | { | 953 | { |
| 954 | WARN_ON_ONCE(bio->bi_max_vecs); | 954 | WARN_ON_ONCE(bio->bi_max_vecs); |
| 955 | 955 | ||
| @@ -959,11 +959,26 @@ static int bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter) · 3 unmodified lines | |||
| 959 | bio->bi_iter.bi_size = iter->count; | 959 | bio->bi_iter.bi_size = iter->count; |
| 960 | bio_set_flag(bio, BIO_NO_PAGE_REF); | 960 | bio_set_flag(bio, BIO_NO_PAGE_REF); |
| 961 | bio_set_flag(bio, BIO_CLONED); | 961 | bio_set_flag(bio, BIO_CLONED); |
| 962 | } | ||
| 962 | 963 | ||
| 964 | static int bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter) | ||
| 965 | { | ||
| 966 | __bio_iov_bvec_set(bio, iter); | ||
| 963 | iov_iter_advance(iter, iter->count); | 967 | iov_iter_advance(iter, iter->count); |
| 964 | return 0; | 968 | return 0; |
| 965 | } | 969 | } |
| 966 | 970 | ||
| 971 | static int bio_iov_bvec_set_append(struct bio *bio, struct iov_iter *iter) | ||
| 972 | { | ||
| 973 | struct request_queue *q = bio->bi_bdev->bd_disk->queue; | ||
| 974 | struct iov_iter i = *iter; | ||
| 975 | |||
| 976 | iov_iter_truncate(&i, queue_max_zone_append_sectors(q) << 9); | ||
| 977 | __bio_iov_bvec_set(bio, &i); | ||
| 978 | iov_iter_advance(iter, i.count); | ||
| 979 | return 0; | ||
| 980 | } | ||
| 981 | |||
| 967 | #define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *)) | 982 | #define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *)) |
| 968 | 983 | ||
| 969 | /** | 984 | /** |
| @@ -1094,8 +1109,8 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) · 124 unmodified lines | |||
| 1094 | int ret = 0; | 1109 | int ret = 0; |
| 1095 | 1110 | ||
| 1096 | if (iov_iter_is_bvec(iter)) { | 1111 | if (iov_iter_is_bvec(iter)) { |
| 1097 | if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND)) | 1112 | if (bio_op(bio) == REQ_OP_ZONE_APPEND) |
| 1098 | return -EINVAL; | 1113 | return bio_iov_bvec_set_append(bio, iter); |
| 1099 | return bio_iov_bvec_set(bio, iter); | 1114 | return bio_iov_bvec_set(bio, iter); |
| 1100 | } | 1115 | } |
| 1101 | 1116 | ||
| @@ -382,6 +382,14 @@ unsigned int blk_recalc_rq_segments(struct request *rq) · 381 unmodified lines | |||
| 382 | switch (bio_op(rq->bio)) { | 382 | switch (bio_op(rq->bio)) { |
| 383 | case REQ_OP_DISCARD: | 383 | case REQ_OP_DISCARD: |
| 384 | case REQ_OP_SECURE_ERASE: | 384 | case REQ_OP_SECURE_ERASE: |
| 385 | if (queue_max_discard_segments(rq->q) > 1) { | ||
| 386 | struct bio *bio = rq->bio; | ||
| 387 | |||
| 388 | for_each_bio(bio) | ||
| 389 | nr_phys_segs++; | ||
| 390 | return nr_phys_segs; | ||
| 391 | } | ||
| 392 | return 1; | ||
| 385 | case REQ_OP_WRITE_ZEROES: | 393 | case REQ_OP_WRITE_ZEROES: |
| 386 | return 0; | 394 | return 0; |
| 387 | case REQ_OP_WRITE_SAME: | 395 | case REQ_OP_WRITE_SAME: |
| @@ -322,6 +322,13 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, · 321 unmodified lines | |||
| 322 | const char *dname; | 322 | const char *dname; |
| 323 | int err; | 323 | int err; |
| 324 | 324 | ||
| 325 | /* | ||
| 326 | * disk_max_parts() won't be zero, either GENHD_FL_EXT_DEVT is set | ||
| 327 | * or 'minors' is passed to alloc_disk(). | ||
| 328 | */ | ||
| 329 | if (partno >= disk_max_parts(disk)) | ||
| 330 | return ERR_PTR(-EINVAL); | ||
| 331 | |||
| 325 | /* | 332 | /* |
| 326 | * Partitions are not supported on zoned block devices that are used as | 333 | * Partitions are not supported on zoned block devices that are used as |
| 327 | * such. | 334 | * such. |
| @@ -99,13 +99,12 @@ acpi_status acpi_ns_root_initialize(void) · 98 unmodified lines | |||
| 99 | * just create and link the new node(s) here. | 99 | * just create and link the new node(s) here. |
| 100 | */ | 100 | */ |
| 101 | new_node = | 101 | new_node = |
| 102 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node)); | 102 | acpi_ns_create_node(*ACPI_CAST_PTR(u32, init_val->name)); |
| 103 | if (!new_node) { | 103 | if (!new_node) { |
| 104 | status = AE_NO_MEMORY; | 104 | status = AE_NO_MEMORY; |
| 105 | goto unlock_and_exit; | 105 | goto unlock_and_exit; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | ACPI_COPY_NAMESEG(new_node->name.ascii, init_val->name); | ||
| 109 | new_node->descriptor_type = ACPI_DESC_TYPE_NAMED; | 108 | new_node->descriptor_type = ACPI_DESC_TYPE_NAMED; |
| 110 | new_node->type = init_val->type; | 109 | new_node->type = init_val->type; |
| 111 | 110 | ||
| @@ -9,6 +9,8 @@ · 8 unmodified lines | |||
| 9 | #ifndef _ACPI_INTERNAL_H_ | 9 | #ifndef _ACPI_INTERNAL_H_ |
| 10 | #define _ACPI_INTERNAL_H_ | 10 | #define _ACPI_INTERNAL_H_ |
| 11 | 11 | ||
| 12 | #include <linux/idr.h> | ||
| 13 | |||
| 12 | #define PREFIX "ACPI: " | 14 | #define PREFIX "ACPI: " |
| 13 | 15 | ||
| 14 | int early_acpi_osi_init(void); | 16 | int early_acpi_osi_init(void); |
| @@ -96,9 +98,11 @@ void acpi_scan_table_handler(u32 event, void *table, void *context); · 81 unmodified lines | |||
| 96 | 98 | ||
| 97 | extern struct list_head acpi_bus_id_list; | 99 | extern struct list_head acpi_bus_id_list; |
| 98 | 100 | ||
| 101 | #define ACPI_MAX_DEVICE_INSTANCES 4096 | ||
| 102 | |||
| 99 | struct acpi_device_bus_id { | 103 | struct acpi_device_bus_id { |
| 100 | const char *bus_id; | 104 | const char *bus_id; |
| 101 | unsigned int instance_no; | 105 | struct ida instance_ida; |
| 102 | struct list_head node; | 106 | struct list_head node; |
| 103 | }; | 107 | }; |
| 104 | 108 | ||
| @@ -479,9 +479,8 @@ static void acpi_device_del(struct acpi_device *device) · 478 unmodified lines | |||
| 479 | list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) | 479 | list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) |
| 480 | if (!strcmp(acpi_device_bus_id->bus_id, | 480 | if (!strcmp(acpi_device_bus_id->bus_id, |
| 481 | acpi_device_hid(device))) { | 481 | acpi_device_hid(device))) { |
| 482 | if (acpi_device_bus_id->instance_no > 0) | 482 | ida_simple_remove(&acpi_device_bus_id->instance_ida, device->pnp.instance_no); |
| 483 | acpi_device_bus_id->instance_no--; | 483 | if (ida_is_empty(&acpi_device_bus_id->instance_ida)) { |
| 484 | else { | ||
| 485 | list_del(&acpi_device_bus_id->node); | 484 | list_del(&acpi_device_bus_id->node); |
| 486 | kfree_const(acpi_device_bus_id->bus_id); | 485 | kfree_const(acpi_device_bus_id->bus_id); |
| 487 | kfree(acpi_device_bus_id); | 486 | kfree(acpi_device_bus_id); |
| @@ -631,6 +630,21 @@ static struct acpi_device_bus_id *acpi_device_bus_id_match(const char *dev_id) · 143 unmodified lines | |||
| 631 | return NULL; | 630 | return NULL; |
| 632 | } | 631 | } |
| 633 | 632 | ||
| 633 | static int acpi_device_set_name(struct acpi_device *device, | ||
| 634 | struct acpi_device_bus_id *acpi_device_bus_id) | ||
| 635 | { | ||
| 636 | struct ida *instance_ida = &acpi_device_bus_id->instance_ida; | ||
| 637 | int result; | ||
| 638 | |||
| 639 | result = ida_simple_get(instance_ida, 0, ACPI_MAX_DEVICE_INSTANCES, GFP_KERNEL); | ||
| 640 | if (result < 0) | ||
| 641 | return result; | ||
| 642 | |||
| 643 | device->pnp.instance_no = result; | ||
| 644 | dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, result); | ||
| 645 | return 0; | ||
| 646 | } | ||
| 647 | |||
| 634 | int acpi_device_add(struct acpi_device *device, | 648 | int acpi_device_add(struct acpi_device *device, |
| 635 | void (*release)(struct device *)) | 649 | void (*release)(struct device *)) |
| 636 | { | 650 | { |
| @@ -665,7 +679,9 @@ int acpi_device_add(struct acpi_device *device, · 28 unmodified lines | |||
| 665 | 679 | ||
| 666 | acpi_device_bus_id = acpi_device_bus_id_match(acpi_device_hid(device)); | 680 | acpi_device_bus_id = acpi_device_bus_id_match(acpi_device_hid(device)); |
| 667 | if (acpi_device_bus_id) { | 681 | if (acpi_device_bus_id) { |
| 668 | acpi_device_bus_id->instance_no++; | 682 | result = acpi_device_set_name(device, acpi_device_bus_id); |
| 683 | if (result) | ||
| 684 | goto err_unlock; | ||
| 669 | } else { | 685 | } else { |
| 670 | acpi_device_bus_id = kzalloc(sizeof(*acpi_device_bus_id), | 686 | acpi_device_bus_id = kzalloc(sizeof(*acpi_device_bus_id), |
| 671 | GFP_KERNEL); | 687 | GFP_KERNEL); |
| @@ -681,9 +697,16 @@ int acpi_device_add(struct acpi_device *device, · 9 unmodified lines | |||
| 681 | goto err_unlock; | 697 | goto err_unlock; |
| 682 | } | 698 | } |
| 683 | 699 | ||
| 700 | ida_init(&acpi_device_bus_id->instance_ida); | ||
| 701 | |||
| 702 | result = acpi_device_set_name(device, acpi_device_bus_id); | ||
| 703 | if (result) { | ||
| 704 | kfree(acpi_device_bus_id); | ||
| 705 | goto err_unlock; | ||
| 706 | } | ||
| 707 | |||
| 684 | list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); | 708 | list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); |
| 685 | } | 709 | } |
| 686 | dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); | ||
| 687 | 710 | ||
| 688 | if (device->parent) | 711 | if (device->parent) |
| 689 | list_add_tail(&device->node, &device->parent->children); | 712 | list_add_tail(&device->node, &device->parent->children); |
| @@ -147,6 +147,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 146 unmodified lines | |||
| 147 | }, | 147 | }, |
| 148 | }, | 148 | }, |
| 149 | { | 149 | { |
| 150 | .callback = video_detect_force_vendor, | ||
| 150 | .ident = "Sony VPCEH3U1E", | 151 | .ident = "Sony VPCEH3U1E", |
| 151 | .matches = { | 152 | .matches = { |
| 152 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | 153 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
| @@ -100,8 +100,6 @@ static LIST_HEAD(fore200e_boards); · 99 unmodified lines | |||
| 100 | 100 | ||
| 101 | MODULE_AUTHOR("Christophe Lizzi - credits to Uwe Dannowski and Heikki Vatiainen"); | 101 | MODULE_AUTHOR("Christophe Lizzi - credits to Uwe Dannowski and Heikki Vatiainen"); |
| 102 | MODULE_DESCRIPTION("FORE Systems 200E-series ATM driver - version " FORE200E_VERSION); | 102 | MODULE_DESCRIPTION("FORE Systems 200E-series ATM driver - version " FORE200E_VERSION); |
| 103 | MODULE_SUPPORTED_DEVICE("PCA-200E, SBA-200E"); | ||
| 104 | |||
| 105 | 103 | ||
| 106 | static const int fore200e_rx_buf_nbr[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ] = { | 104 | static const int fore200e_rx_buf_nbr[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ] = { |
| 107 | { BUFFER_S1_NBR, BUFFER_L1_NBR }, | 105 | { BUFFER_S1_NBR, BUFFER_L1_NBR }, |
| @@ -470,12 +470,14 @@ static ssize_t charlcd_write(struct file *file, const char __user *buf, · 469 unmodified lines | |||
| 470 | char c; | 470 | char c; |
| 471 | 471 | ||
| 472 | for (; count-- > 0; (*ppos)++, tmp++) { | 472 | for (; count-- > 0; (*ppos)++, tmp++) { |
| 473 | if (!in_interrupt() && (((count + 1) & 0x1f) == 0)) | 473 | if (((count + 1) & 0x1f) == 0) { |
| 474 | /* | 474 | /* |
| 475 | * let's be a little nice with other processes | 475 | * charlcd_write() is invoked as a VFS->write() callback |
| 476 | * that need some CPU | 476 | * and as such it is always invoked from preemptible |
| 477 | * context and may sleep. | ||
| 477 | */ | 478 | */ |
| 478 | schedule(); | 479 | cond_resched(); |
| 480 | } | ||
| 479 | 481 | ||
| 480 | if (get_user(c, tmp)) | 482 | if (get_user(c, tmp)) |
| 481 | return -EFAULT; | 483 | return -EFAULT; |
| @@ -537,12 +539,8 @@ static void charlcd_puts(struct charlcd *lcd, const char *s) · 55 unmodified lines | |||
| 537 | int count = strlen(s); | 539 | int count = strlen(s); |
| 538 | 540 | ||
| 539 | for (; count-- > 0; tmp++) { | 541 | for (; count-- > 0; tmp++) { |
| 540 | if (!in_interrupt() && (((count + 1) & 0x1f) == 0)) | 542 | if (((count + 1) & 0x1f) == 0) |
| 541 | /* | 543 | cond_resched(); |
| 542 | * let's be a little nice with other processes | ||
| 543 | * that need some CPU | ||
| 544 | */ | ||
| 545 | schedule(); | ||
| 546 | 544 | ||
| 547 | charlcd_write_char(lcd, *tmp); | 545 | charlcd_write_char(lcd, *tmp); |
| 548 | } | 546 | } |
| @@ -305,7 +305,7 @@ static int rpm_get_suppliers(struct device *dev) · 304 unmodified lines | |||
| 305 | return 0; | 305 | return 0; |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | static void rpm_put_suppliers(struct device *dev) | 308 | static void __rpm_put_suppliers(struct device *dev, bool try_to_suspend) |
| 309 | { | 309 | { |
| 310 | struct device_link *link; | 310 | struct device_link *link; |
| 311 | 311 | ||
| @@ -313,10 +313,30 @@ static void rpm_put_suppliers(struct device *dev) · 1 unmodified line | |||
| 313 | device_links_read_lock_held()) { | 313 | device_links_read_lock_held()) { |
| 314 | 314 | ||
| 315 | while (refcount_dec_not_one(&link->rpm_active)) | 315 | while (refcount_dec_not_one(&link->rpm_active)) |
| 316 | pm_runtime_put(link->supplier); | 316 | pm_runtime_put_noidle(link->supplier); |
| 317 | |||
| 318 | if (try_to_suspend) | ||
| 319 | pm_request_idle(link->supplier); | ||
| 317 | } | 320 | } |
| 318 | } | 321 | } |
| 319 | 322 | ||
| 323 | static void rpm_put_suppliers(struct device *dev) | ||
| 324 | { | ||
| 325 | __rpm_put_suppliers(dev, true); | ||
| 326 | } | ||
| 327 | |||
| 328 | static void rpm_suspend_suppliers(struct device *dev) | ||
| 329 | { | ||
| 330 | struct device_link *link; | ||
| 331 | int idx = device_links_read_lock(); | ||
| 332 | |||
| 333 | list_for_each_entry_rcu(link, &dev->links.suppliers, c_node, | ||
| 334 | device_links_read_lock_held()) | ||
| 335 | pm_request_idle(link->supplier); | ||
| 336 | |||
| 337 | device_links_read_unlock(idx); | ||
| 338 | } | ||
| 339 | |||
| 320 | /** | 340 | /** |
| 321 | * __rpm_callback - Run a given runtime PM callback for a given device. | 341 | * __rpm_callback - Run a given runtime PM callback for a given device. |
| 322 | * @cb: Runtime PM callback to run. | 342 | * @cb: Runtime PM callback to run. |
| @@ -325,27 +345,29 @@ static void rpm_put_suppliers(struct device *dev) · 2 unmodified lines | |||
| 325 | static int __rpm_callback(int (*cb)(struct device *), struct device *dev) | 345 | static int __rpm_callback(int (*cb)(struct device *), struct device *dev) |
| 326 | __releases(&dev->power.lock) __acquires(&dev->power.lock) | 346 | __releases(&dev->power.lock) __acquires(&dev->power.lock) |
| 327 | { | 347 | { |
| 328 | bool use_links = dev->power.links_count > 0; | ||
| 329 | bool get = false; | ||
| 330 | int retval, idx; | 348 | int retval, idx; |
| 331 | bool put; | 349 | bool use_links = dev->power.links_count > 0; |
| 332 | 350 | ||
| 333 | if (dev->power.irq_safe) { | 351 | if (dev->power.irq_safe) { |
| 334 | spin_unlock(&dev->power.lock); | 352 | spin_unlock(&dev->power.lock); |
| 335 | } else if (!use_links) { | ||
| 336 | spin_unlock_irq(&dev->power.lock); | ||
| 337 | } else { | 353 | } else { |
| 338 | get = dev->power.runtime_status == RPM_RESUMING; | ||
| 339 | |||
| 340 | spin_unlock_irq(&dev->power.lock); | 354 | spin_unlock_irq(&dev->power.lock); |
| 341 | 355 | ||
| 342 | /* Resume suppliers if necessary. */ | 356 | /* |
| 343 | if (get) { | 357 | * Resume suppliers if necessary. |
| 358 | * | ||
| 359 | * The device's runtime PM status cannot change until this | ||
| 360 | * routine returns, so it is safe to read the status outside of | ||
| 361 | * the lock. | ||
| 362 | */ | ||
| 363 | if (use_links && dev->power.runtime_status == RPM_RESUMING) { | ||
| 344 | idx = device_links_read_lock(); | 364 | idx = device_links_read_lock(); |
| 345 | 365 | ||
| 346 | retval = rpm_get_suppliers(dev); | 366 | retval = rpm_get_suppliers(dev); |
| 347 | if (retval) | 367 | if (retval) { |
| 368 | rpm_put_suppliers(dev); | ||
| 348 | goto fail; | 369 | goto fail; |
| 370 | } | ||
| 349 | 371 | ||
| 350 | device_links_read_unlock(idx); | 372 | device_links_read_unlock(idx); |
| 351 | } | 373 | } |
| @@ -355,36 +377,24 @@ static int __rpm_callback(int (*cb)(struct device *), struct device *dev) · 3 unmodified lines | |||
| 355 | 377 | ||
| 356 | if (dev->power.irq_safe) { | 378 | if (dev->power.irq_safe) { |
| 357 | spin_lock(&dev->power.lock); | 379 | spin_lock(&dev->power.lock); |
| 358 | return retval; | 380 | } else { |
| 359 | } | 381 | /* |
| 360 | 382 | * If the device is suspending and the callback has returned | |
| 361 | spin_lock_irq(&dev->power.lock); | 383 | * success, drop the usage counters of the suppliers that have |
| 362 | 384 | * been reference counted on its resume. | |
| 363 | if (!use_links) | 385 | * |
| 364 | return retval; | 386 | * Do that if resume fails too. |
| 365 | 387 | */ | |
| 366 | /* | 388 | if (use_links |
| 367 | * If the device is suspending and the callback has returned success, | 389 | && ((dev->power.runtime_status == RPM_SUSPENDING && !retval) |
| 368 | * drop the usage counters of the suppliers that have been reference | 390 | || (dev->power.runtime_status == RPM_RESUMING && retval))) { |
| 369 | * counted on its resume. | 391 | idx = device_links_read_lock(); |
| 370 | * | ||
| 371 | * Do that if the resume fails too. | ||
| 372 | */ | ||
| 373 | put = dev->power.runtime_status == RPM_SUSPENDING && !retval; | ||
| 374 | if (put) | ||
| 375 | __update_runtime_status(dev, RPM_SUSPENDED); | ||
| 376 | else | ||
| 377 | put = get && retval; | ||
| 378 | |||
| 379 | if (put) { | ||
| 380 | spin_unlock_irq(&dev->power.lock); | ||
| 381 | 392 | ||
| 382 | idx = device_links_read_lock(); | 393 | __rpm_put_suppliers(dev, false); |
| 383 | 394 | ||
| 384 | fail: | 395 | fail: |
| 385 | rpm_put_suppliers(dev); | 396 | device_links_read_unlock(idx); |
| 386 | 397 | } | |
| 387 | device_links_read_unlock(idx); | ||
| 388 | 398 | ||
| 389 | spin_lock_irq(&dev->power.lock); | 399 | spin_lock_irq(&dev->power.lock); |
| 390 | } | 400 | } |
| @@ -654,8 +664,11 @@ static int rpm_suspend(struct device *dev, int rpmflags) · 263 unmodified lines | |||
| 654 | goto out; | 664 | goto out; |
| 655 | } | 665 | } |
| 656 | 666 | ||
| 667 | if (dev->power.irq_safe) | ||
| 668 | goto out; | ||
| 669 | |||
| 657 | /* Maybe the parent is now able to suspend. */ | 670 | /* Maybe the parent is now able to suspend. */ |
| 658 | if (parent && !parent->power.ignore_children && !dev->power.irq_safe) { | 671 | if (parent && !parent->power.ignore_children) { |
| 659 | spin_unlock(&dev->power.lock); | 672 | spin_unlock(&dev->power.lock); |
| 660 | 673 | ||
| 661 | spin_lock(&parent->power.lock); | 674 | spin_lock(&parent->power.lock); |
| @@ -664,6 +677,14 @@ static int rpm_suspend(struct device *dev, int rpmflags) · 2 unmodified lines | |||
| 664 | 677 | ||
| 665 | spin_lock(&dev->power.lock); | 678 | spin_lock(&dev->power.lock); |
| 666 | } | 679 | } |
| 680 | /* Maybe the suppliers are now able to suspend. */ | ||
| 681 | if (dev->power.links_count > 0) { | ||
| 682 | spin_unlock_irq(&dev->power.lock); | ||
| 683 | |||
| 684 | rpm_suspend_suppliers(dev); | ||
| 685 | |||
| 686 | spin_lock_irq(&dev->power.lock); | ||
| 687 | } | ||
| 667 | 688 | ||
| 668 | out: | 689 | out: |
| 669 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); | 690 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); |
| @@ -5091,7 +5091,6 @@ module_param(floppy, charp, 0); · 5090 unmodified lines | |||
| 5091 | module_param(FLOPPY_IRQ, int, 0); | 5091 | module_param(FLOPPY_IRQ, int, 0); |
| 5092 | module_param(FLOPPY_DMA, int, 0); | 5092 | module_param(FLOPPY_DMA, int, 0); |
| 5093 | MODULE_AUTHOR("Alain L. Knaff"); | 5093 | MODULE_AUTHOR("Alain L. Knaff"); |
| 5094 | MODULE_SUPPORTED_DEVICE("fd"); | ||
| 5095 | MODULE_LICENSE("GPL"); | 5094 | MODULE_LICENSE("GPL"); |
| 5096 | 5095 | ||
| 5097 | /* This doesn't actually get used other than for module information */ | 5096 | /* This doesn't actually get used other than for module information */ |
| @@ -194,5 +194,4 @@ module_init(rsi_91x_bt_module_init); · 193 unmodified lines | |||
| 194 | module_exit(rsi_91x_bt_module_exit); | 194 | module_exit(rsi_91x_bt_module_exit); |
| 195 | MODULE_AUTHOR("Redpine Signals Inc"); | 195 | MODULE_AUTHOR("Redpine Signals Inc"); |
| 196 | MODULE_DESCRIPTION("RSI BT driver"); | 196 | MODULE_DESCRIPTION("RSI BT driver"); |
| 197 | MODULE_SUPPORTED_DEVICE("RSI-BT"); | ||
| 198 | MODULE_LICENSE("Dual BSD/GPL"); | 197 | MODULE_LICENSE("Dual BSD/GPL"); |
| @@ -285,7 +285,7 @@ static int omap_l3_probe(struct platform_device *pdev) · 284 unmodified lines | |||
| 285 | */ | 285 | */ |
| 286 | l3->debug_irq = platform_get_irq(pdev, 0); | 286 | l3->debug_irq = platform_get_irq(pdev, 0); |
| 287 | ret = devm_request_irq(l3->dev, l3->debug_irq, l3_interrupt_handler, | 287 | ret = devm_request_irq(l3->dev, l3->debug_irq, l3_interrupt_handler, |
| 288 | 0x0, "l3-dbg-irq", l3); | 288 | IRQF_NO_THREAD, "l3-dbg-irq", l3); |
| 289 | if (ret) { | 289 | if (ret) { |
| 290 | dev_err(l3->dev, "request_irq failed for %d\n", | 290 | dev_err(l3->dev, "request_irq failed for %d\n", |
| 291 | l3->debug_irq); | 291 | l3->debug_irq); |
| @@ -294,7 +294,7 @@ static int omap_l3_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 294 | 294 | ||
| 295 | l3->app_irq = platform_get_irq(pdev, 1); | 295 | l3->app_irq = platform_get_irq(pdev, 1); |
| 296 | ret = devm_request_irq(l3->dev, l3->app_irq, l3_interrupt_handler, | 296 | ret = devm_request_irq(l3->dev, l3->app_irq, l3_interrupt_handler, |
| 297 | 0x0, "l3-app-irq", l3); | 297 | IRQF_NO_THREAD, "l3-app-irq", l3); |
| 298 | if (ret) | 298 | if (ret) |
| 299 | dev_err(l3->dev, "request_irq failed for %d\n", l3->app_irq); | 299 | dev_err(l3->dev, "request_irq failed for %d\n", l3->app_irq); |
| 300 | 300 | ||
| @@ -3053,7 +3053,9 @@ static int sysc_remove(struct platform_device *pdev) · 3052 unmodified lines | |||
| 3053 | 3053 | ||
| 3054 | pm_runtime_put_sync(&pdev->dev); | 3054 | pm_runtime_put_sync(&pdev->dev); |
| 3055 | pm_runtime_disable(&pdev->dev); | 3055 | pm_runtime_disable(&pdev->dev); |
| 3056 | reset_control_assert(ddata->rsts); | 3056 | |
| 3057 | if (!reset_control_status(ddata->rsts)) | ||
| 3058 | reset_control_assert(ddata->rsts); | ||
| 3057 | 3059 | ||
| 3058 | unprepare: | 3060 | unprepare: |
| 3059 | sysc_unprepare(ddata); | 3061 | sysc_unprepare(ddata); |
| @@ -81,9 +81,6 @@ MODULE_DESCRIPTION("Driver for Applicom Profibus card"); · 80 unmodified lines | |||
| 81 | MODULE_LICENSE("GPL"); | 81 | MODULE_LICENSE("GPL"); |
| 82 | MODULE_ALIAS_MISCDEV(AC_MINOR); | 82 | MODULE_ALIAS_MISCDEV(AC_MINOR); |
| 83 | 83 | ||
| 84 | MODULE_SUPPORTED_DEVICE("ac"); | ||
| 85 | |||
| 86 | |||
| 87 | static struct applicom_board { | 84 | static struct applicom_board { |
| 88 | unsigned long PhysIO; | 85 | unsigned long PhysIO; |
| 89 | void __iomem *RamIO; | 86 | void __iomem *RamIO; |
| @@ -64,7 +64,6 @@ · 63 unmodified lines | |||
| 64 | MODULE_LICENSE("GPL"); | 64 | MODULE_LICENSE("GPL"); |
| 65 | MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>"); | 65 | MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>"); |
| 66 | MODULE_DESCRIPTION("Toshiba laptop SMM driver"); | 66 | MODULE_DESCRIPTION("Toshiba laptop SMM driver"); |
| 67 | MODULE_SUPPORTED_DEVICE("toshiba"); | ||
| 68 | 67 | ||
| 69 | static DEFINE_MUTEX(tosh_mutex); | 68 | static DEFINE_MUTEX(tosh_mutex); |
| 70 | static int tosh_fn; | 69 | static int tosh_fn; |
| @@ -730,7 +730,8 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 729 unmodified lines | |||
| 730 | struct clk_rate_request parent_req = { }; | 730 | struct clk_rate_request parent_req = { }; |
| 731 | struct clk_rcg2_gfx3d *cgfx = to_clk_rcg2_gfx3d(hw); | 731 | struct clk_rcg2_gfx3d *cgfx = to_clk_rcg2_gfx3d(hw); |
| 732 | struct clk_hw *xo, *p0, *p1, *p2; | 732 | struct clk_hw *xo, *p0, *p1, *p2; |
| 733 | unsigned long request, p0_rate; | 733 | unsigned long p0_rate; |
| 734 | u8 mux_div = cgfx->div; | ||
| 734 | int ret; | 735 | int ret; |
| 735 | 736 | ||
| 736 | p0 = cgfx->hws[0]; | 737 | p0 = cgfx->hws[0]; |
| @@ -750,14 +751,15 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 13 unmodified lines | |||
| 750 | return 0; | 751 | return 0; |
| 751 | } | 752 | } |
| 752 | 753 | ||
| 753 | request = req->rate; | 754 | if (mux_div == 0) |
| 754 | if (cgfx->div > 1) | 755 | mux_div = 1; |
| 755 | parent_req.rate = request = request * cgfx->div; | 756 | |
| 757 | parent_req.rate = req->rate * mux_div; | ||
| 756 | 758 | ||
| 757 | /* This has to be a fixed rate PLL */ | 759 | /* This has to be a fixed rate PLL */ |
| 758 | p0_rate = clk_hw_get_rate(p0); | 760 | p0_rate = clk_hw_get_rate(p0); |
| 759 | 761 | ||
| 760 | if (request == p0_rate) { | 762 | if (parent_req.rate == p0_rate) { |
| 761 | req->rate = req->best_parent_rate = p0_rate; | 763 | req->rate = req->best_parent_rate = p0_rate; |
| 762 | req->best_parent_hw = p0; | 764 | req->best_parent_hw = p0; |
| 763 | return 0; | 765 | return 0; |
| @@ -765,7 +767,7 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 1 unmodified line | |||
| 765 | 767 | ||
| 766 | if (req->best_parent_hw == p0) { | 768 | if (req->best_parent_hw == p0) { |
| 767 | /* Are we going back to a previously used rate? */ | 769 | /* Are we going back to a previously used rate? */ |
| 768 | if (clk_hw_get_rate(p2) == request) | 770 | if (clk_hw_get_rate(p2) == parent_req.rate) |
| 769 | req->best_parent_hw = p2; | 771 | req->best_parent_hw = p2; |
| 770 | else | 772 | else |
| 771 | req->best_parent_hw = p1; | 773 | req->best_parent_hw = p1; |
| @@ -780,8 +782,7 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 8 unmodified lines | |||
| 780 | return ret; | 782 | return ret; |
| 781 | 783 | ||
| 782 | req->rate = req->best_parent_rate = parent_req.rate; | 784 | req->rate = req->best_parent_rate = parent_req.rate; |
| 783 | if (cgfx->div > 1) | 785 | req->rate /= mux_div; |
| 784 | req->rate /= cgfx->div; | ||
| 785 | 786 | ||
| 786 | return 0; | 787 | return 0; |
| 787 | } | 788 | } |
| @@ -510,9 +510,12 @@ static const struct clk_rpmh_desc clk_rpmh_sm8350 = { · 509 unmodified lines | |||
| 510 | .num_clks = ARRAY_SIZE(sm8350_rpmh_clocks), | 510 | .num_clks = ARRAY_SIZE(sm8350_rpmh_clocks), |
| 511 | }; | 511 | }; |
| 512 | 512 | ||
| 513 | /* Resource name must match resource id present in cmd-db */ | ||
| 514 | DEFINE_CLK_RPMH_ARC(sc7280, bi_tcxo, bi_tcxo_ao, "xo.lvl", 0x3, 4); | ||
| 515 | |||
| 513 | static struct clk_hw *sc7280_rpmh_clocks[] = { | 516 | static struct clk_hw *sc7280_rpmh_clocks[] = { |
| 514 | [RPMH_CXO_CLK] = &sdm845_bi_tcxo.hw, | 517 | [RPMH_CXO_CLK] = &sc7280_bi_tcxo.hw, |
| 515 | [RPMH_CXO_CLK_A] = &sdm845_bi_tcxo_ao.hw, | 518 | [RPMH_CXO_CLK_A] = &sc7280_bi_tcxo_ao.hw, |
| 516 | [RPMH_LN_BB_CLK2] = &sdm845_ln_bb_clk2.hw, | 519 | [RPMH_LN_BB_CLK2] = &sdm845_ln_bb_clk2.hw, |
| 517 | [RPMH_LN_BB_CLK2_A] = &sdm845_ln_bb_clk2_ao.hw, | 520 | [RPMH_LN_BB_CLK2_A] = &sdm845_ln_bb_clk2_ao.hw, |
| 518 | [RPMH_RF_CLK1] = &sdm845_rf_clk1.hw, | 521 | [RPMH_RF_CLK1] = &sdm845_rf_clk1.hw, |
| @@ -620,7 +620,7 @@ static struct clk_rcg2 gcc_sdcc1_apps_clk_src = { · 619 unmodified lines | |||
| 620 | .name = "gcc_sdcc1_apps_clk_src", | 620 | .name = "gcc_sdcc1_apps_clk_src", |
| 621 | .parent_data = gcc_parent_data_1, | 621 | .parent_data = gcc_parent_data_1, |
| 622 | .num_parents = 5, | 622 | .num_parents = 5, |
| 623 | .ops = &clk_rcg2_ops, | 623 | .ops = &clk_rcg2_floor_ops, |
| 624 | }, | 624 | }, |
| 625 | }; | 625 | }; |
| 626 | 626 | ||
| @@ -642,7 +642,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { · 15 unmodified lines | |||
| 642 | .name = "gcc_sdcc1_ice_core_clk_src", | 642 | .name = "gcc_sdcc1_ice_core_clk_src", |
| 643 | .parent_data = gcc_parent_data_0, | 643 | .parent_data = gcc_parent_data_0, |
| 644 | .num_parents = 4, | 644 | .num_parents = 4, |
| 645 | .ops = &clk_rcg2_floor_ops, | 645 | .ops = &clk_rcg2_ops, |
| 646 | }, | 646 | }, |
| 647 | }; | 647 | }; |
| 648 | 648 | ||
| @@ -31,7 +31,7 @@ struct stm32_timer_cnt { · 30 unmodified lines | |||
| 31 | struct counter_device counter; | 31 | struct counter_device counter; |
| 32 | struct regmap *regmap; | 32 | struct regmap *regmap; |
| 33 | struct clk *clk; | 33 | struct clk *clk; |
| 34 | u32 ceiling; | 34 | u32 max_arr; |
| 35 | bool enabled; | 35 | bool enabled; |
| 36 | struct stm32_timer_regs bak; | 36 | struct stm32_timer_regs bak; |
| 37 | }; | 37 | }; |
| @@ -44,13 +44,14 @@ struct stm32_timer_cnt { · 6 unmodified lines | |||
| 44 | * @STM32_COUNT_ENCODER_MODE_3: counts on both TI1FP1 and TI2FP2 edges | 44 | * @STM32_COUNT_ENCODER_MODE_3: counts on both TI1FP1 and TI2FP2 edges |
| 45 | */ | 45 | */ |
| 46 | enum stm32_count_function { | 46 | enum stm32_count_function { |
| 47 | STM32_COUNT_SLAVE_MODE_DISABLED = -1, | 47 | STM32_COUNT_SLAVE_MODE_DISABLED, |
| 48 | STM32_COUNT_ENCODER_MODE_1, | 48 | STM32_COUNT_ENCODER_MODE_1, |
| 49 | STM32_COUNT_ENCODER_MODE_2, | 49 | STM32_COUNT_ENCODER_MODE_2, |
| 50 | STM32_COUNT_ENCODER_MODE_3, | 50 | STM32_COUNT_ENCODER_MODE_3, |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | static enum counter_count_function stm32_count_functions[] = { | 53 | static enum counter_count_function stm32_count_functions[] = { |
| 54 | [STM32_COUNT_SLAVE_MODE_DISABLED] = COUNTER_COUNT_FUNCTION_INCREASE, | ||
| 54 | [STM32_COUNT_ENCODER_MODE_1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A, | 55 | [STM32_COUNT_ENCODER_MODE_1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A, |
| 55 | [STM32_COUNT_ENCODER_MODE_2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B, | 56 | [STM32_COUNT_ENCODER_MODE_2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B, |
| 56 | [STM32_COUNT_ENCODER_MODE_3] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4, | 57 | [STM32_COUNT_ENCODER_MODE_3] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4, |
| @@ -73,8 +74,10 @@ static int stm32_count_write(struct counter_device *counter, · 16 unmodified lines | |||
| 73 | const unsigned long val) | 74 | const unsigned long val) |
| 74 | { | 75 | { |
| 75 | struct stm32_timer_cnt *const priv = counter->priv; | 76 | struct stm32_timer_cnt *const priv = counter->priv; |
| 77 | u32 ceiling; | ||
| 76 | 78 | ||
| 77 | if (val > priv->ceiling) | 79 | regmap_read(priv->regmap, TIM_ARR, &ceiling); |
| 80 | if (val > ceiling) | ||
| 78 | return -EINVAL; | 81 | return -EINVAL; |
| 79 | 82 | ||
| 80 | return regmap_write(priv->regmap, TIM_CNT, val); | 83 | return regmap_write(priv->regmap, TIM_CNT, val); |
| @@ -90,6 +93,9 @@ static int stm32_count_function_get(struct counter_device *counter, · 9 unmodified lines | |||
| 90 | regmap_read(priv->regmap, TIM_SMCR, &smcr); | 93 | regmap_read(priv->regmap, TIM_SMCR, &smcr); |
| 91 | 94 | ||
| 92 | switch (smcr & TIM_SMCR_SMS) { | 95 | switch (smcr & TIM_SMCR_SMS) { |
| 96 | case 0: | ||
| 97 | *function = STM32_COUNT_SLAVE_MODE_DISABLED; | ||
| 98 | return 0; | ||
| 93 | case 1: | 99 | case 1: |
| 94 | *function = STM32_COUNT_ENCODER_MODE_1; | 100 | *function = STM32_COUNT_ENCODER_MODE_1; |
| 95 | return 0; | 101 | return 0; |
| @@ -99,9 +105,9 @@ static int stm32_count_function_get(struct counter_device *counter, · 3 unmodified lines | |||
| 99 | case 3: | 105 | case 3: |
| 100 | *function = STM32_COUNT_ENCODER_MODE_3; | 106 | *function = STM32_COUNT_ENCODER_MODE_3; |
| 101 | return 0; | 107 | return 0; |
| 108 | default: | ||
| 109 | return -EINVAL; | ||
| 102 | } | 110 | } |
| 103 | |||
| 104 | return -EINVAL; | ||
| 105 | } | 111 | } |
| 106 | 112 | ||
| 107 | static int stm32_count_function_set(struct counter_device *counter, | 113 | static int stm32_count_function_set(struct counter_device *counter, |
| @@ -112,6 +118,9 @@ static int stm32_count_function_set(struct counter_device *counter, · 4 unmodified lines | |||
| 112 | u32 cr1, sms; | 118 | u32 cr1, sms; |
| 113 | 119 | ||
| 114 | switch (function) { | 120 | switch (function) { |
| 121 | case STM32_COUNT_SLAVE_MODE_DISABLED: | ||
| 122 | sms = 0; | ||
| 123 | break; | ||
| 115 | case STM32_COUNT_ENCODER_MODE_1: | 124 | case STM32_COUNT_ENCODER_MODE_1: |
| 116 | sms = 1; | 125 | sms = 1; |
| 117 | break; | 126 | break; |
| @@ -122,8 +131,7 @@ static int stm32_count_function_set(struct counter_device *counter, · 4 unmodified lines | |||
| 122 | sms = 3; | 131 | sms = 3; |
| 123 | break; | 132 | break; |
| 124 | default: | 133 | default: |
| 125 | sms = 0; | 134 | return -EINVAL; |
| 126 | break; | ||
| 127 | } | 135 | } |
| 128 | 136 | ||
| 129 | /* Store enable status */ | 137 | /* Store enable status */ |
| @@ -131,10 +139,6 @@ static int stm32_count_function_set(struct counter_device *counter, · 1 unmodified line | |||
| 131 | 139 | ||
| 132 | regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0); | 140 | regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0); |
| 133 | 141 | ||
| 134 | /* TIMx_ARR register shouldn't be buffered (ARPE=0) */ | ||
| 135 | regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0); | ||
| 136 | regmap_write(priv->regmap, TIM_ARR, priv->ceiling); | ||
| 137 | |||
| 138 | regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, sms); | 142 | regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, sms); |
| 139 | 143 | ||
| 140 | /* Make sure that registers are updated */ | 144 | /* Make sure that registers are updated */ |
| @@ -185,11 +189,13 @@ static ssize_t stm32_count_ceiling_write(struct counter_device *counter, · 44 unmodified lines | |||
| 185 | if (ret) | 189 | if (ret) |
| 186 | return ret; | 190 | return ret; |
| 187 | 191 | ||
| 192 | if (ceiling > priv->max_arr) | ||
| 193 | return -ERANGE; | ||
| 194 | |||
| 188 | /* TIMx_ARR register shouldn't be buffered (ARPE=0) */ | 195 | /* TIMx_ARR register shouldn't be buffered (ARPE=0) */ |
| 189 | regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0); | 196 | regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0); |
| 190 | regmap_write(priv->regmap, TIM_ARR, ceiling); | 197 | regmap_write(priv->regmap, TIM_ARR, ceiling); |
| 191 | 198 | ||
| 192 | priv->ceiling = ceiling; | ||
| 193 | return len; | 199 | return len; |
| 194 | } | 200 | } |
| 195 | 201 | ||
| @@ -274,31 +280,36 @@ static int stm32_action_get(struct counter_device *counter, · 78 unmodified lines | |||
| 274 | size_t function; | 280 | size_t function; |
| 275 | int err; | 281 | int err; |
| 276 | 282 | ||
| 277 | /* Default action mode (e.g. STM32_COUNT_SLAVE_MODE_DISABLED) */ | ||
| 278 | *action = STM32_SYNAPSE_ACTION_NONE; | ||
| 279 | |||
| 280 | err = stm32_count_function_get(counter, count, &function); | 283 | err = stm32_count_function_get(counter, count, &function); |
| 281 | if (err) | 284 | if (err) |
| 282 | return 0; | 285 | return err; |
| 283 | 286 | ||
| 284 | switch (function) { | 287 | switch (function) { |
| 288 | case STM32_COUNT_SLAVE_MODE_DISABLED: | ||
| 289 | /* counts on internal clock when CEN=1 */ | ||
| 290 | *action = STM32_SYNAPSE_ACTION_NONE; | ||
| 291 | return 0; | ||
| 285 | case STM32_COUNT_ENCODER_MODE_1: | 292 | case STM32_COUNT_ENCODER_MODE_1: |
| 286 | /* counts up/down on TI1FP1 edge depending on TI2FP2 level */ | 293 | /* counts up/down on TI1FP1 edge depending on TI2FP2 level */ |
| 287 | if (synapse->signal->id == count->synapses[0].signal->id) | 294 | if (synapse->signal->id == count->synapses[0].signal->id) |
| 288 | *action = STM32_SYNAPSE_ACTION_BOTH_EDGES; | 295 | *action = STM32_SYNAPSE_ACTION_BOTH_EDGES; |
| 289 | break; | 296 | else |
| 297 | *action = STM32_SYNAPSE_ACTION_NONE; | ||
| 298 | return 0; | ||
| 290 | case STM32_COUNT_ENCODER_MODE_2: | 299 | case STM32_COUNT_ENCODER_MODE_2: |
| 291 | /* counts up/down on TI2FP2 edge depending on TI1FP1 level */ | 300 | /* counts up/down on TI2FP2 edge depending on TI1FP1 level */ |
| 292 | if (synapse->signal->id == count->synapses[1].signal->id) | 301 | if (synapse->signal->id == count->synapses[1].signal->id) |
| 293 | *action = STM32_SYNAPSE_ACTION_BOTH_EDGES; | 302 | *action = STM32_SYNAPSE_ACTION_BOTH_EDGES; |
| 294 | break; | 303 | else |
| 304 | *action = STM32_SYNAPSE_ACTION_NONE; | ||
| 305 | return 0; | ||
| 295 | case STM32_COUNT_ENCODER_MODE_3: | 306 | case STM32_COUNT_ENCODER_MODE_3: |
| 296 | /* counts up/down on both TI1FP1 and TI2FP2 edges */ | 307 | /* counts up/down on both TI1FP1 and TI2FP2 edges */ |
| 297 | *action = STM32_SYNAPSE_ACTION_BOTH_EDGES; | 308 | *action = STM32_SYNAPSE_ACTION_BOTH_EDGES; |
| 298 | break; | 309 | return 0; |
| 310 | default: | ||
| 311 | return -EINVAL; | ||
| 299 | } | 312 | } |
| 300 | |||
| 301 | return 0; | ||
| 302 | } | 313 | } |
| 303 | 314 | ||
| 304 | static const struct counter_ops stm32_timer_cnt_ops = { | 315 | static const struct counter_ops stm32_timer_cnt_ops = { |
| @@ -359,7 +370,7 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev) · 54 unmodified lines | |||
| 359 | 370 | ||
| 360 | priv->regmap = ddata->regmap; | 371 | priv->regmap = ddata->regmap; |
| 361 | priv->clk = ddata->clk; | 372 | priv->clk = ddata->clk; |
| 362 | priv->ceiling = ddata->max_arr; | 373 | priv->max_arr = ddata->max_arr; |
| 363 | 374 | ||
| 364 | priv->counter.name = dev_name(dev); | 375 | priv->counter.name = dev_name(dev); |
| 365 | priv->counter.parent = dev; | 376 | priv->counter.parent = dev; |
| @@ -927,7 +927,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 926 unmodified lines | |||
| 927 | } | 927 | } |
| 928 | 928 | ||
| 929 | /* first try to find a slot in an existing linked list entry */ | 929 | /* first try to find a slot in an existing linked list entry */ |
| 930 | for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) { | 930 | for (prsv = efi_memreserve_root->next; prsv; ) { |
| 931 | rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB); | 931 | rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB); |
| 932 | index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size); | 932 | index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size); |
| 933 | if (index < rsv->size) { | 933 | if (index < rsv->size) { |
| @@ -937,6 +937,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 3 unmodified lines | |||
| 937 | memunmap(rsv); | 937 | memunmap(rsv); |
| 938 | return efi_mem_reserve_iomem(addr, size); | 938 | return efi_mem_reserve_iomem(addr, size); |
| 939 | } | 939 | } |
| 940 | prsv = rsv->next; | ||
| 940 | memunmap(rsv); | 941 | memunmap(rsv); |
| 941 | } | 942 | } |
| 942 | 943 | ||
| @@ -484,6 +484,10 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), · 483 unmodified lines | |||
| 484 | } | 484 | } |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | break; | ||
| 488 | case EFI_UNSUPPORTED: | ||
| 489 | err = -EOPNOTSUPP; | ||
| 490 | status = EFI_NOT_FOUND; | ||
| 487 | break; | 491 | break; |
| 488 | case EFI_NOT_FOUND: | 492 | case EFI_NOT_FOUND: |
| 489 | break; | 493 | break; |
| @@ -571,6 +571,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 570 unmodified lines | |||
| 571 | struct lock_class_key *lock_key, | 571 | struct lock_class_key *lock_key, |
| 572 | struct lock_class_key *request_key) | 572 | struct lock_class_key *request_key) |
| 573 | { | 573 | { |
| 574 | struct fwnode_handle *fwnode = gc->parent ? dev_fwnode(gc->parent) : NULL; | ||
| 574 | unsigned long flags; | 575 | unsigned long flags; |
| 575 | int ret = 0; | 576 | int ret = 0; |
| 576 | unsigned i; | 577 | unsigned i; |
| @@ -594,6 +595,12 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 17 unmodified lines | |||
| 594 | 595 | ||
| 595 | of_gpio_dev_init(gc, gdev); | 596 | of_gpio_dev_init(gc, gdev); |
| 596 | 597 | ||
| 598 | /* | ||
| 599 | * Assign fwnode depending on the result of the previous calls, | ||
| 600 | * if none of them succeed, assign it to the parent's one. | ||
| 601 | */ | ||
| 602 | gdev->dev.fwnode = dev_fwnode(&gdev->dev) ?: fwnode; | ||
| 603 | |||
| 597 | gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL); | 604 | gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL); |
| 598 | if (gdev->id < 0) { | 605 | if (gdev->id < 0) { |
| 599 | ret = gdev->id; | 606 | ret = gdev->id; |
| @@ -4256,7 +4263,8 @@ static int __init gpiolib_dev_init(void) · 3656 unmodified lines | |||
| 4256 | return ret; | 4263 | return ret; |
| 4257 | } | 4264 | } |
| 4258 | 4265 | ||
| 4259 | if (driver_register(&gpio_stub_drv) < 0) { | 4266 | ret = driver_register(&gpio_stub_drv); |
| 4267 | if (ret < 0) { | ||
| 4260 | pr_err("gpiolib: could not register GPIO stub driver\n"); | 4268 | pr_err("gpiolib: could not register GPIO stub driver\n"); |
| 4261 | bus_unregister(&gpio_bus_type); | 4269 | bus_unregister(&gpio_bus_type); |
| 4262 | return ret; | 4270 | return ret; |
| @@ -1007,13 +1007,9 @@ struct amdgpu_device { · 1006 unmodified lines | |||
| 1007 | 1007 | ||
| 1008 | /* s3/s4 mask */ | 1008 | /* s3/s4 mask */ |
| 1009 | bool in_suspend; | 1009 | bool in_suspend; |
| 1010 | bool in_hibernate; | 1010 | bool in_s3; |
| 1011 | 1011 | bool in_s4; | |
| 1012 | /* | 1012 | bool in_s0ix; |
| 1013 | * The combination flag in_poweroff_reboot_com used to identify the poweroff | ||
| 1014 | * and reboot opt in the s0i3 system-wide suspend. | ||
| 1015 | */ | ||
| 1016 | bool in_poweroff_reboot_com; | ||
| 1017 | 1013 | ||
| 1018 | atomic_t in_gpu_reset; | 1014 | atomic_t in_gpu_reset; |
| 1019 | enum pp_mp1_state mp1_state; | 1015 | enum pp_mp1_state mp1_state; |
| @@ -2371,6 +2371,10 @@ static int amdgpu_device_set_cg_state(struct amdgpu_device *adev, · 2370 unmodified lines | |||
| 2371 | i = state == AMD_CG_STATE_GATE ? j : adev->num_ip_blocks - j - 1; | 2371 | i = state == AMD_CG_STATE_GATE ? j : adev->num_ip_blocks - j - 1; |
| 2372 | if (!adev->ip_blocks[i].status.late_initialized) | 2372 | if (!adev->ip_blocks[i].status.late_initialized) |
| 2373 | continue; | 2373 | continue; |
| 2374 | /* skip CG for GFX on S0ix */ | ||
| 2375 | if (adev->in_s0ix && | ||
| 2376 | adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX) | ||
| 2377 | continue; | ||
| 2374 | /* skip CG for VCE/UVD, it's handled specially */ | 2378 | /* skip CG for VCE/UVD, it's handled specially */ |
| 2375 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && | 2379 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && |
| 2376 | adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE && | 2380 | adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE && |
| @@ -2402,6 +2406,10 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power · 25 unmodified lines | |||
| 2402 | i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1; | 2406 | i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1; |
| 2403 | if (!adev->ip_blocks[i].status.late_initialized) | 2407 | if (!adev->ip_blocks[i].status.late_initialized) |
| 2404 | continue; | 2408 | continue; |
| 2409 | /* skip PG for GFX on S0ix */ | ||
| 2410 | if (adev->in_s0ix && | ||
| 2411 | adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX) | ||
| 2412 | continue; | ||
| 2405 | /* skip CG for VCE/UVD, it's handled specially */ | 2413 | /* skip CG for VCE/UVD, it's handled specially */ |
| 2406 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && | 2414 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && |
| 2407 | adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE && | 2415 | adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE && |
| @@ -2678,11 +2686,8 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) · 270 unmodified lines | |||
| 2678 | { | 2686 | { |
| 2679 | int i, r; | 2687 | int i, r; |
| 2680 | 2688 | ||
| 2681 | if (adev->in_poweroff_reboot_com || | 2689 | amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); |
| 2682 | !amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) { | 2690 | amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); |
| 2683 | amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); | ||
| 2684 | amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); | ||
| 2685 | } | ||
| 2686 | 2691 | ||
| 2687 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { | 2692 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { |
| 2688 | if (!adev->ip_blocks[i].status.valid) | 2693 | if (!adev->ip_blocks[i].status.valid) |
| @@ -2722,6 +2727,9 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · 33 unmodified lines | |||
| 2722 | { | 2727 | { |
| 2723 | int i, r; | 2728 | int i, r; |
| 2724 | 2729 | ||
| 2730 | if (adev->in_s0ix) | ||
| 2731 | amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry); | ||
| 2732 | |||
| 2725 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { | 2733 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { |
| 2726 | if (!adev->ip_blocks[i].status.valid) | 2734 | if (!adev->ip_blocks[i].status.valid) |
| 2727 | continue; | 2735 | continue; |
| @@ -2734,6 +2742,17 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · 6 unmodified lines | |||
| 2734 | adev->ip_blocks[i].status.hw = false; | 2742 | adev->ip_blocks[i].status.hw = false; |
| 2735 | continue; | 2743 | continue; |
| 2736 | } | 2744 | } |
| 2745 | |||
| 2746 | /* skip suspend of gfx and psp for S0ix | ||
| 2747 | * gfx is in gfxoff state, so on resume it will exit gfxoff just | ||
| 2748 | * like at runtime. PSP is also part of the always on hardware | ||
| 2749 | * so no need to suspend it. | ||
| 2750 | */ | ||
| 2751 | if (adev->in_s0ix && | ||
| 2752 | (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP || | ||
| 2753 | adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX)) | ||
| 2754 | continue; | ||
| 2755 | |||
| 2737 | /* XXX handle errors */ | 2756 | /* XXX handle errors */ |
| 2738 | r = adev->ip_blocks[i].version->funcs->suspend(adev); | 2757 | r = adev->ip_blocks[i].version->funcs->suspend(adev); |
| 2739 | /* XXX handle errors */ | 2758 | /* XXX handle errors */ |
| @@ -3673,14 +3692,9 @@ void amdgpu_device_fini(struct amdgpu_device *adev) · 933 unmodified lines | |||
| 3673 | */ | 3692 | */ |
| 3674 | int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) | 3693 | int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) |
| 3675 | { | 3694 | { |
| 3676 | struct amdgpu_device *adev; | 3695 | struct amdgpu_device *adev = drm_to_adev(dev); |
| 3677 | struct drm_crtc *crtc; | ||
| 3678 | struct drm_connector *connector; | ||
| 3679 | struct drm_connector_list_iter iter; | ||
| 3680 | int r; | 3696 | int r; |
| 3681 | 3697 | ||
| 3682 | adev = drm_to_adev(dev); | ||
| 3683 | |||
| 3684 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 3698 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
| 3685 | return 0; | 3699 | return 0; |
| 3686 | 3700 | ||
| @@ -3692,61 +3706,19 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) · 5 unmodified lines | |||
| 3692 | 3706 | ||
| 3693 | cancel_delayed_work_sync(&adev->delayed_init_work); | 3707 | cancel_delayed_work_sync(&adev->delayed_init_work); |
| 3694 | 3708 | ||
| 3695 | if (!amdgpu_device_has_dc_support(adev)) { | ||
| 3696 | /* turn off display hw */ | ||
| 3697 | drm_modeset_lock_all(dev); | ||
| 3698 | drm_connector_list_iter_begin(dev, &iter); | ||
| 3699 | drm_for_each_connector_iter(connector, &iter) | ||
| 3700 | drm_helper_connector_dpms(connector, | ||
| 3701 | DRM_MODE_DPMS_OFF); | ||
| 3702 | drm_connector_list_iter_end(&iter); | ||
| 3703 | drm_modeset_unlock_all(dev); | ||
| 3704 | /* unpin the front buffers and cursors */ | ||
| 3705 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
| 3706 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
| 3707 | struct drm_framebuffer *fb = crtc->primary->fb; | ||
| 3708 | struct amdgpu_bo *robj; | ||
| 3709 | |||
| 3710 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { | ||
| 3711 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | ||
| 3712 | r = amdgpu_bo_reserve(aobj, true); | ||
| 3713 | if (r == 0) { | ||
| 3714 | amdgpu_bo_unpin(aobj); | ||
| 3715 | amdgpu_bo_unreserve(aobj); | ||
| 3716 | } | ||
| 3717 | } | ||
| 3718 | |||
| 3719 | if (fb == NULL || fb->obj[0] == NULL) { | ||
| 3720 | continue; | ||
| 3721 | } | ||
| 3722 | robj = gem_to_amdgpu_bo(fb->obj[0]); | ||
| 3723 | /* don't unpin kernel fb objects */ | ||
| 3724 | if (!amdgpu_fbdev_robj_is_fb(adev, robj)) { | ||
| 3725 | r = amdgpu_bo_reserve(robj, true); | ||
| 3726 | if (r == 0) { | ||
| 3727 | amdgpu_bo_unpin(robj); | ||
| 3728 | amdgpu_bo_unreserve(robj); | ||
| 3729 | } | ||
| 3730 | } | ||
| 3731 | } | ||
| 3732 | } | ||
| 3733 | |||
| 3734 | amdgpu_ras_suspend(adev); | 3709 | amdgpu_ras_suspend(adev); |
| 3735 | 3710 | ||
| 3736 | r = amdgpu_device_ip_suspend_phase1(adev); | 3711 | r = amdgpu_device_ip_suspend_phase1(adev); |
| 3737 | 3712 | ||
| 3738 | amdgpu_amdkfd_suspend(adev, adev->in_runpm); | 3713 | if (!adev->in_s0ix) |
| 3714 | amdgpu_amdkfd_suspend(adev, adev->in_runpm); | ||
| 3739 | 3715 | ||
| 3740 | /* evict vram memory */ | 3716 | /* evict vram memory */ |
| 3741 | amdgpu_bo_evict_vram(adev); | 3717 | amdgpu_bo_evict_vram(adev); |
| 3742 | 3718 | ||
| 3743 | amdgpu_fence_driver_suspend(adev); | 3719 | amdgpu_fence_driver_suspend(adev); |
| 3744 | 3720 | ||
| 3745 | if (adev->in_poweroff_reboot_com || | 3721 | r = amdgpu_device_ip_suspend_phase2(adev); |
| 3746 | !amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) | ||
| 3747 | r = amdgpu_device_ip_suspend_phase2(adev); | ||
| 3748 | else | ||
| 3749 | amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry); | ||
| 3750 | /* evict remaining vram memory | 3722 | /* evict remaining vram memory |
| 3751 | * This second call to evict vram is to evict the gart page table | 3723 | * This second call to evict vram is to evict the gart page table |
| 3752 | * using the CPU. | 3724 | * using the CPU. |
| @@ -3768,16 +3740,13 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) · 15 unmodified lines | |||
| 3768 | */ | 3740 | */ |
| 3769 | int amdgpu_device_resume(struct drm_device *dev, bool fbcon) | 3741 | int amdgpu_device_resume(struct drm_device *dev, bool fbcon) |
| 3770 | { | 3742 | { |
| 3771 | struct drm_connector *connector; | ||
| 3772 | struct drm_connector_list_iter iter; | ||
| 3773 | struct amdgpu_device *adev = drm_to_adev(dev); | 3743 | struct amdgpu_device *adev = drm_to_adev(dev); |
| 3774 | struct drm_crtc *crtc; | ||
| 3775 | int r = 0; | 3744 | int r = 0; |
| 3776 | 3745 | ||
| 3777 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 3746 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
| 3778 | return 0; | 3747 | return 0; |
| 3779 | 3748 | ||
| 3780 | if (amdgpu_acpi_is_s0ix_supported(adev)) | 3749 | if (adev->in_s0ix) |
| 3781 | amdgpu_gfx_state_change_set(adev, sGpuChangeState_D0Entry); | 3750 | amdgpu_gfx_state_change_set(adev, sGpuChangeState_D0Entry); |
| 3782 | 3751 | ||
| 3783 | /* post card */ | 3752 | /* post card */ |
| @@ -3802,50 +3771,17 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · 18 unmodified lines | |||
| 3802 | queue_delayed_work(system_wq, &adev->delayed_init_work, | 3771 | queue_delayed_work(system_wq, &adev->delayed_init_work, |
| 3803 | msecs_to_jiffies(AMDGPU_RESUME_MS)); | 3772 | msecs_to_jiffies(AMDGPU_RESUME_MS)); |
| 3804 | 3773 | ||
| 3805 | if (!amdgpu_device_has_dc_support(adev)) { | 3774 | if (!adev->in_s0ix) { |
| 3806 | /* pin cursors */ | 3775 | r = amdgpu_amdkfd_resume(adev, adev->in_runpm); |
| 3807 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 3776 | if (r) |
| 3808 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 3777 | return r; |
| 3809 | |||
| 3810 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { | ||
| 3811 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | ||
| 3812 | r = amdgpu_bo_reserve(aobj, true); | ||
| 3813 | if (r == 0) { | ||
| 3814 | r = amdgpu_bo_pin(aobj, AMDGPU_GEM_DOMAIN_VRAM); | ||
| 3815 | if (r != 0) | ||
| 3816 | dev_err(adev->dev, "Failed to pin cursor BO (%d)\n", r); | ||
| 3817 | amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj); | ||
| 3818 | amdgpu_bo_unreserve(aobj); | ||
| 3819 | } | ||
| 3820 | } | ||
| 3821 | } | ||
| 3822 | } | 3778 | } |
| 3823 | r = amdgpu_amdkfd_resume(adev, adev->in_runpm); | ||
| 3824 | if (r) | ||
| 3825 | return r; | ||
| 3826 | 3779 | ||
| 3827 | /* Make sure IB tests flushed */ | 3780 | /* Make sure IB tests flushed */ |
| 3828 | flush_delayed_work(&adev->delayed_init_work); | 3781 | flush_delayed_work(&adev->delayed_init_work); |
| 3829 | 3782 | ||
| 3830 | /* blat the mode back in */ | 3783 | if (fbcon) |
| 3831 | if (fbcon) { | ||
| 3832 | if (!amdgpu_device_has_dc_support(adev)) { | ||
| 3833 | /* pre DCE11 */ | ||
| 3834 | drm_helper_resume_force_mode(dev); | ||
| 3835 | |||
| 3836 | /* turn on display hw */ | ||
| 3837 | drm_modeset_lock_all(dev); | ||
| 3838 | |||
| 3839 | drm_connector_list_iter_begin(dev, &iter); | ||
| 3840 | drm_for_each_connector_iter(connector, &iter) | ||
| 3841 | drm_helper_connector_dpms(connector, | ||
| 3842 | DRM_MODE_DPMS_ON); | ||
| 3843 | drm_connector_list_iter_end(&iter); | ||
| 3844 | |||
| 3845 | drm_modeset_unlock_all(dev); | ||
| 3846 | } | ||
| 3847 | amdgpu_fbdev_set_suspend(adev, 0); | 3784 | amdgpu_fbdev_set_suspend(adev, 0); |
| 3848 | } | ||
| 3849 | 3785 | ||
| 3850 | drm_kms_helper_poll_enable(dev); | 3786 | drm_kms_helper_poll_enable(dev); |
| 3851 | 3787 | ||
| @@ -1310,3 +1310,92 @@ bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc, · 1309 unmodified lines | |||
| 1310 | return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos, | 1310 | return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos, |
| 1311 | stime, etime, mode); | 1311 | stime, etime, mode); |
| 1312 | } | 1312 | } |
| 1313 | |||
| 1314 | int amdgpu_display_suspend_helper(struct amdgpu_device *adev) | ||
| 1315 | { | ||
| 1316 | struct drm_device *dev = adev_to_drm(adev); | ||
| 1317 | struct drm_crtc *crtc; | ||
| 1318 | struct drm_connector *connector; | ||
| 1319 | struct drm_connector_list_iter iter; | ||
| 1320 | int r; | ||
| 1321 | |||
| 1322 | /* turn off display hw */ | ||
| 1323 | drm_modeset_lock_all(dev); | ||
| 1324 | drm_connector_list_iter_begin(dev, &iter); | ||
| 1325 | drm_for_each_connector_iter(connector, &iter) | ||
| 1326 | drm_helper_connector_dpms(connector, | ||
| 1327 | DRM_MODE_DPMS_OFF); | ||
| 1328 | drm_connector_list_iter_end(&iter); | ||
| 1329 | drm_modeset_unlock_all(dev); | ||
| 1330 | /* unpin the front buffers and cursors */ | ||
| 1331 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
| 1332 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
| 1333 | struct drm_framebuffer *fb = crtc->primary->fb; | ||
| 1334 | struct amdgpu_bo *robj; | ||
| 1335 | |||
| 1336 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { | ||
| 1337 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | ||
| 1338 | r = amdgpu_bo_reserve(aobj, true); | ||
| 1339 | if (r == 0) { | ||
| 1340 | amdgpu_bo_unpin(aobj); | ||
| 1341 | amdgpu_bo_unreserve(aobj); | ||
| 1342 | } | ||
| 1343 | } | ||
| 1344 | |||
| 1345 | if (fb == NULL || fb->obj[0] == NULL) { | ||
| 1346 | continue; | ||
| 1347 | } | ||
| 1348 | robj = gem_to_amdgpu_bo(fb->obj[0]); | ||
| 1349 | /* don't unpin kernel fb objects */ | ||
| 1350 | if (!amdgpu_fbdev_robj_is_fb(adev, robj)) { | ||
| 1351 | r = amdgpu_bo_reserve(robj, true); | ||
| 1352 | if (r == 0) { | ||
| 1353 | amdgpu_bo_unpin(robj); | ||
| 1354 | amdgpu_bo_unreserve(robj); | ||
| 1355 | } | ||
| 1356 | } | ||
| 1357 | } | ||
| 1358 | return r; | ||
| 1359 | } | ||
| 1360 | |||
| 1361 | int amdgpu_display_resume_helper(struct amdgpu_device *adev) | ||
| 1362 | { | ||
| 1363 | struct drm_device *dev = adev_to_drm(adev); | ||
| 1364 | struct drm_connector *connector; | ||
| 1365 | struct drm_connector_list_iter iter; | ||
| 1366 | struct drm_crtc *crtc; | ||
| 1367 | int r; | ||
| 1368 | |||
| 1369 | /* pin cursors */ | ||
| 1370 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
| 1371 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
| 1372 | |||
| 1373 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { | ||
| 1374 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | ||
| 1375 | r = amdgpu_bo_reserve(aobj, true); | ||
| 1376 | if (r == 0) { | ||
| 1377 | r = amdgpu_bo_pin(aobj, AMDGPU_GEM_DOMAIN_VRAM); | ||
| 1378 | if (r != 0) | ||
| 1379 | dev_err(adev->dev, "Failed to pin cursor BO (%d)\n", r); | ||
| 1380 | amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj); | ||
| 1381 | amdgpu_bo_unreserve(aobj); | ||
| 1382 | } | ||
| 1383 | } | ||
| 1384 | } | ||
| 1385 | |||
| 1386 | drm_helper_resume_force_mode(dev); | ||
| 1387 | |||
| 1388 | /* turn on display hw */ | ||
| 1389 | drm_modeset_lock_all(dev); | ||
| 1390 | |||
| 1391 | drm_connector_list_iter_begin(dev, &iter); | ||
| 1392 | drm_for_each_connector_iter(connector, &iter) | ||
| 1393 | drm_helper_connector_dpms(connector, | ||
| 1394 | DRM_MODE_DPMS_ON); | ||
| 1395 | drm_connector_list_iter_end(&iter); | ||
| 1396 | |||
| 1397 | drm_modeset_unlock_all(dev); | ||
| 1398 | |||
| 1399 | return 0; | ||
| 1400 | } | ||
| 1401 | |||
| @@ -47,4 +47,7 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, · 46 unmodified lines | |||
| 47 | const struct drm_format_info * | 47 | const struct drm_format_info * |
| 48 | amdgpu_lookup_format_info(u32 format, uint64_t modifier); | 48 | amdgpu_lookup_format_info(u32 format, uint64_t modifier); |
| 49 | 49 | ||
| 50 | int amdgpu_display_suspend_helper(struct amdgpu_device *adev); | ||
| 51 | int amdgpu_display_resume_helper(struct amdgpu_device *adev); | ||
| 52 | |||
| 50 | #endif | 53 | #endif |
| @@ -1107,6 +1107,7 @@ static const struct pci_device_id pciidlist[] = { · 1106 unmodified lines | |||
| 1107 | {0x1002, 0x73A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, | 1107 | {0x1002, 0x73A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, |
| 1108 | {0x1002, 0x73AB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, | 1108 | {0x1002, 0x73AB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, |
| 1109 | {0x1002, 0x73AE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, | 1109 | {0x1002, 0x73AE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, |
| 1110 | {0x1002, 0x73AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, | ||
| 1110 | {0x1002, 0x73BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, | 1111 | {0x1002, 0x73BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID}, |
| 1111 | 1112 | ||
| 1112 | /* Van Gogh */ | 1113 | /* Van Gogh */ |
| @@ -1274,24 +1275,35 @@ amdgpu_pci_shutdown(struct pci_dev *pdev) · 161 unmodified lines | |||
| 1274 | */ | 1275 | */ |
| 1275 | if (!amdgpu_passthrough(adev)) | 1276 | if (!amdgpu_passthrough(adev)) |
| 1276 | adev->mp1_state = PP_MP1_STATE_UNLOAD; | 1277 | adev->mp1_state = PP_MP1_STATE_UNLOAD; |
| 1277 | adev->in_poweroff_reboot_com = true; | ||
| 1278 | amdgpu_device_ip_suspend(adev); | 1278 | amdgpu_device_ip_suspend(adev); |
| 1279 | adev->in_poweroff_reboot_com = false; | ||
| 1280 | adev->mp1_state = PP_MP1_STATE_NONE; | 1279 | adev->mp1_state = PP_MP1_STATE_NONE; |
| 1281 | } | 1280 | } |
| 1282 | 1281 | ||
| 1283 | static int amdgpu_pmops_suspend(struct device *dev) | 1282 | static int amdgpu_pmops_suspend(struct device *dev) |
| 1284 | { | 1283 | { |
| 1285 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 1284 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
| 1285 | struct amdgpu_device *adev = drm_to_adev(drm_dev); | ||
| 1286 | int r; | ||
| 1286 | 1287 | ||
| 1287 | return amdgpu_device_suspend(drm_dev, true); | 1288 | if (amdgpu_acpi_is_s0ix_supported(adev)) |
| 1289 | adev->in_s0ix = true; | ||
| 1290 | adev->in_s3 = true; | ||
| 1291 | r = amdgpu_device_suspend(drm_dev, true); | ||
| 1292 | adev->in_s3 = false; | ||
| 1293 | |||
| 1294 | return r; | ||
| 1288 | } | 1295 | } |
| 1289 | 1296 | ||
| 1290 | static int amdgpu_pmops_resume(struct device *dev) | 1297 | static int amdgpu_pmops_resume(struct device *dev) |
| 1291 | { | 1298 | { |
| 1292 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 1299 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
| 1300 | struct amdgpu_device *adev = drm_to_adev(drm_dev); | ||
| 1301 | int r; | ||
| 1293 | 1302 | ||
| 1294 | return amdgpu_device_resume(drm_dev, true); | 1303 | r = amdgpu_device_resume(drm_dev, true); |
| 1304 | if (amdgpu_acpi_is_s0ix_supported(adev)) | ||
| 1305 | adev->in_s0ix = false; | ||
| 1306 | return r; | ||
| 1295 | } | 1307 | } |
| 1296 | 1308 | ||
| 1297 | static int amdgpu_pmops_freeze(struct device *dev) | 1309 | static int amdgpu_pmops_freeze(struct device *dev) |
| @@ -1300,9 +1312,9 @@ static int amdgpu_pmops_freeze(struct device *dev) · 2 unmodified lines | |||
| 1300 | struct amdgpu_device *adev = drm_to_adev(drm_dev); | 1312 | struct amdgpu_device *adev = drm_to_adev(drm_dev); |
| 1301 | int r; | 1313 | int r; |
| 1302 | 1314 | ||
| 1303 | adev->in_hibernate = true; | 1315 | adev->in_s4 = true; |
| 1304 | r = amdgpu_device_suspend(drm_dev, true); | 1316 | r = amdgpu_device_suspend(drm_dev, true); |
| 1305 | adev->in_hibernate = false; | 1317 | adev->in_s4 = false; |
| 1306 | if (r) | 1318 | if (r) |
| 1307 | return r; | 1319 | return r; |
| 1308 | return amdgpu_asic_reset(adev); | 1320 | return amdgpu_asic_reset(adev); |
| @@ -1318,13 +1330,8 @@ static int amdgpu_pmops_thaw(struct device *dev) · 9 unmodified lines | |||
| 1318 | static int amdgpu_pmops_poweroff(struct device *dev) | 1330 | static int amdgpu_pmops_poweroff(struct device *dev) |
| 1319 | { | 1331 | { |
| 1320 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 1332 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
| 1321 | struct amdgpu_device *adev = drm_to_adev(drm_dev); | ||
| 1322 | int r; | ||
| 1323 | 1333 | ||
| 1324 | adev->in_poweroff_reboot_com = true; | 1334 | return amdgpu_device_suspend(drm_dev, true); |
| 1325 | r = amdgpu_device_suspend(drm_dev, true); | ||
| 1326 | adev->in_poweroff_reboot_com = false; | ||
| 1327 | return r; | ||
| 1328 | } | 1335 | } |
| 1329 | 1336 | ||
| 1330 | static int amdgpu_pmops_restore(struct device *dev) | 1337 | static int amdgpu_pmops_restore(struct device *dev) |
| @@ -1028,13 +1028,10 @@ int amdgpu_bo_evict_vram(struct amdgpu_device *adev) · 1027 unmodified lines | |||
| 1028 | { | 1028 | { |
| 1029 | struct ttm_resource_manager *man; | 1029 | struct ttm_resource_manager *man; |
| 1030 | 1030 | ||
| 1031 | /* late 2.6.33 fix IGP hibernate - we need pm ops to do this correct */ | 1031 | if (adev->in_s3 && (adev->flags & AMD_IS_APU)) { |
| 1032 | #ifndef CONFIG_HIBERNATION | 1032 | /* No need to evict vram on APUs for suspend to ram */ |
| 1033 | if (adev->flags & AMD_IS_APU) { | ||
| 1034 | /* Useless to evict on IGP chips */ | ||
| 1035 | return 0; | 1033 | return 0; |
| 1036 | } | 1034 | } |
| 1037 | #endif | ||
| 1038 | 1035 | ||
| 1039 | man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM); | 1036 | man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM); |
| 1040 | return ttm_resource_manager_evict_all(&adev->mman.bdev, man); | 1037 | return ttm_resource_manager_evict_all(&adev->mman.bdev, man); |
| @@ -2897,6 +2897,11 @@ static int dce_v10_0_hw_fini(void *handle) · 2896 unmodified lines | |||
| 2897 | static int dce_v10_0_suspend(void *handle) | 2897 | static int dce_v10_0_suspend(void *handle) |
| 2898 | { | 2898 | { |
| 2899 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 2899 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 2900 | int r; | ||
| 2901 | |||
| 2902 | r = amdgpu_display_suspend_helper(adev); | ||
| 2903 | if (r) | ||
| 2904 | return r; | ||
| 2900 | 2905 | ||
| 2901 | adev->mode_info.bl_level = | 2906 | adev->mode_info.bl_level = |
| 2902 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); | 2907 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); |
| @@ -2921,8 +2926,10 @@ static int dce_v10_0_resume(void *handle) · 18 unmodified lines | |||
| 2921 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, | 2926 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, |
| 2922 | bl_level); | 2927 | bl_level); |
| 2923 | } | 2928 | } |
| 2929 | if (ret) | ||
| 2930 | return ret; | ||
| 2924 | 2931 | ||
| 2925 | return ret; | 2932 | return amdgpu_display_resume_helper(adev); |
| 2926 | } | 2933 | } |
| 2927 | 2934 | ||
| 2928 | static bool dce_v10_0_is_idle(void *handle) | 2935 | static bool dce_v10_0_is_idle(void *handle) |
| @@ -3027,6 +3027,11 @@ static int dce_v11_0_hw_fini(void *handle) · 3026 unmodified lines | |||
| 3027 | static int dce_v11_0_suspend(void *handle) | 3027 | static int dce_v11_0_suspend(void *handle) |
| 3028 | { | 3028 | { |
| 3029 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 3029 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 3030 | int r; | ||
| 3031 | |||
| 3032 | r = amdgpu_display_suspend_helper(adev); | ||
| 3033 | if (r) | ||
| 3034 | return r; | ||
| 3030 | 3035 | ||
| 3031 | adev->mode_info.bl_level = | 3036 | adev->mode_info.bl_level = |
| 3032 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); | 3037 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); |
| @@ -3051,8 +3056,10 @@ static int dce_v11_0_resume(void *handle) · 18 unmodified lines | |||
| 3051 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, | 3056 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, |
| 3052 | bl_level); | 3057 | bl_level); |
| 3053 | } | 3058 | } |
| 3059 | if (ret) | ||
| 3060 | return ret; | ||
| 3054 | 3061 | ||
| 3055 | return ret; | 3062 | return amdgpu_display_resume_helper(adev); |
| 3056 | } | 3063 | } |
| 3057 | 3064 | ||
| 3058 | static bool dce_v11_0_is_idle(void *handle) | 3065 | static bool dce_v11_0_is_idle(void *handle) |
| @@ -2770,7 +2770,11 @@ static int dce_v6_0_hw_fini(void *handle) · 2769 unmodified lines | |||
| 2770 | static int dce_v6_0_suspend(void *handle) | 2770 | static int dce_v6_0_suspend(void *handle) |
| 2771 | { | 2771 | { |
| 2772 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 2772 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 2773 | int r; | ||
| 2773 | 2774 | ||
| 2775 | r = amdgpu_display_suspend_helper(adev); | ||
| 2776 | if (r) | ||
| 2777 | return r; | ||
| 2774 | adev->mode_info.bl_level = | 2778 | adev->mode_info.bl_level = |
| 2775 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); | 2779 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); |
| 2776 | 2780 | ||
| @@ -2794,8 +2798,10 @@ static int dce_v6_0_resume(void *handle) · 17 unmodified lines | |||
| 2794 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, | 2798 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, |
| 2795 | bl_level); | 2799 | bl_level); |
| 2796 | } | 2800 | } |
| 2801 | if (ret) | ||
| 2802 | return ret; | ||
| 2797 | 2803 | ||
| 2798 | return ret; | 2804 | return amdgpu_display_resume_helper(adev); |
| 2799 | } | 2805 | } |
| 2800 | 2806 | ||
| 2801 | static bool dce_v6_0_is_idle(void *handle) | 2807 | static bool dce_v6_0_is_idle(void *handle) |
| @@ -2796,6 +2796,11 @@ static int dce_v8_0_hw_fini(void *handle) · 2795 unmodified lines | |||
| 2796 | static int dce_v8_0_suspend(void *handle) | 2796 | static int dce_v8_0_suspend(void *handle) |
| 2797 | { | 2797 | { |
| 2798 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 2798 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 2799 | int r; | ||
| 2800 | |||
| 2801 | r = amdgpu_display_suspend_helper(adev); | ||
| 2802 | if (r) | ||
| 2803 | return r; | ||
| 2799 | 2804 | ||
| 2800 | adev->mode_info.bl_level = | 2805 | adev->mode_info.bl_level = |
| 2801 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); | 2806 | amdgpu_atombios_encoder_get_backlight_level_from_reg(adev); |
| @@ -2820,8 +2825,10 @@ static int dce_v8_0_resume(void *handle) · 18 unmodified lines | |||
| 2820 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, | 2825 | amdgpu_display_backlight_set_level(adev, adev->mode_info.bl_encoder, |
| 2821 | bl_level); | 2826 | bl_level); |
| 2822 | } | 2827 | } |
| 2828 | if (ret) | ||
| 2829 | return ret; | ||
| 2823 | 2830 | ||
| 2824 | return ret; | 2831 | return amdgpu_display_resume_helper(adev); |
| 2825 | } | 2832 | } |
| 2826 | 2833 | ||
| 2827 | static bool dce_v8_0_is_idle(void *handle) | 2834 | static bool dce_v8_0_is_idle(void *handle) |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | |||
| 39 | #include "dce_v11_0.h" | 39 | #include "dce_v11_0.h" |
| 40 | #include "dce_virtual.h" | 40 | #include "dce_virtual.h" |
| 41 | #include "ivsrcid/ivsrcid_vislands30.h" | 41 | #include "ivsrcid/ivsrcid_vislands30.h" |
| 42 | #include "amdgpu_display.h" | ||
| 42 | 43 | ||
| 43 | #define DCE_VIRTUAL_VBLANK_PERIOD 16666666 | 44 | #define DCE_VIRTUAL_VBLANK_PERIOD 16666666 |
| 44 | 45 | ||
| @@ -491,12 +492,24 @@ static int dce_virtual_hw_fini(void *handle) · 446 unmodified lines | |||
| 491 | 492 | ||
| 492 | static int dce_virtual_suspend(void *handle) | 493 | static int dce_virtual_suspend(void *handle) |
| 493 | { | 494 | { |
| 495 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | ||
| 496 | int r; | ||
| 497 | |||
| 498 | r = amdgpu_display_suspend_helper(adev); | ||
| 499 | if (r) | ||
| 500 | return r; | ||
| 494 | return dce_virtual_hw_fini(handle); | 501 | return dce_virtual_hw_fini(handle); |
| 495 | } | 502 | } |
| 496 | 503 | ||
| 497 | static int dce_virtual_resume(void *handle) | 504 | static int dce_virtual_resume(void *handle) |
| 498 | { | 505 | { |
| 499 | return dce_virtual_hw_init(handle); | 506 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 507 | int r; | ||
| 508 | |||
| 509 | r = dce_virtual_hw_init(handle); | ||
| 510 | if (r) | ||
| 511 | return r; | ||
| 512 | return amdgpu_display_resume_helper(adev); | ||
| 500 | } | 513 | } |
| 501 | 514 | ||
| 502 | static bool dce_virtual_is_idle(void *handle) | 515 | static bool dce_virtual_is_idle(void *handle) |
| @@ -1507,38 +1507,8 @@ static void dcn20_update_dchubp_dpp( · 1506 unmodified lines | |||
| 1507 | if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed | 1507 | if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed |
| 1508 | || pipe_ctx->stream->update_flags.bits.gamut_remap | 1508 | || pipe_ctx->stream->update_flags.bits.gamut_remap |
| 1509 | || pipe_ctx->stream->update_flags.bits.out_csc) { | 1509 | || pipe_ctx->stream->update_flags.bits.out_csc) { |
| 1510 | struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc; | 1510 | /* dpp/cm gamut remap*/ |
| 1511 | 1511 | dc->hwss.program_gamut_remap(pipe_ctx); | |
| 1512 | if (mpc->funcs->set_gamut_remap) { | ||
| 1513 | int i; | ||
| 1514 | int mpcc_id = hubp->inst; | ||
| 1515 | struct mpc_grph_gamut_adjustment adjust; | ||
| 1516 | bool enable_remap_dpp = false; | ||
| 1517 | |||
| 1518 | memset(&adjust, 0, sizeof(adjust)); | ||
| 1519 | adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS; | ||
| 1520 | |||
| 1521 | /* save the enablement of gamut remap for dpp */ | ||
| 1522 | enable_remap_dpp = pipe_ctx->stream->gamut_remap_matrix.enable_remap; | ||
| 1523 | |||
| 1524 | /* force bypass gamut remap for dpp/cm */ | ||
| 1525 | pipe_ctx->stream->gamut_remap_matrix.enable_remap = false; | ||
| 1526 | dc->hwss.program_gamut_remap(pipe_ctx); | ||
| 1527 | |||
| 1528 | /* restore gamut remap flag and use this remap into mpc */ | ||
| 1529 | pipe_ctx->stream->gamut_remap_matrix.enable_remap = enable_remap_dpp; | ||
| 1530 | |||
| 1531 | /* build remap matrix for top plane if enabled */ | ||
| 1532 | if (enable_remap_dpp && pipe_ctx->top_pipe == NULL) { | ||
| 1533 | adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW; | ||
| 1534 | for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++) | ||
| 1535 | adjust.temperature_matrix[i] = | ||
| 1536 | pipe_ctx->stream->gamut_remap_matrix.matrix[i]; | ||
| 1537 | } | ||
| 1538 | mpc->funcs->set_gamut_remap(mpc, mpcc_id, &adjust); | ||
| 1539 | } else | ||
| 1540 | /* dpp/cm gamut remap*/ | ||
| 1541 | dc->hwss.program_gamut_remap(pipe_ctx); | ||
| 1542 | 1512 | ||
| 1543 | /*call the dcn2 method which uses mpc csc*/ | 1513 | /*call the dcn2 method which uses mpc csc*/ |
| 1544 | dc->hwss.program_output_csc(dc, | 1514 | dc->hwss.program_output_csc(dc, |
| @@ -341,8 +341,7 @@ void enc2_hw_init(struct link_encoder *enc) · 340 unmodified lines | |||
| 341 | } else { | 341 | } else { |
| 342 | AUX_REG_WRITE(AUX_DPHY_RX_CONTROL0, 0x103d1110); | 342 | AUX_REG_WRITE(AUX_DPHY_RX_CONTROL0, 0x103d1110); |
| 343 | 343 | ||
| 344 | AUX_REG_WRITE(AUX_DPHY_TX_CONTROL, 0x21c4d); | 344 | AUX_REG_WRITE(AUX_DPHY_TX_CONTROL, 0x21c7a); |
| 345 | |||
| 346 | } | 345 | } |
| 347 | 346 | ||
| 348 | //AUX_DPHY_TX_REF_CONTROL'AUX_TX_REF_DIV HW default is 0x32; | 347 | //AUX_DPHY_TX_REF_CONTROL'AUX_TX_REF_DIV HW default is 0x32; |
| @@ -1595,6 +1595,11 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param · 1594 unmodified lines | |||
| 1595 | dcn2_1_soc.num_chans = bw_params->num_channels; | 1595 | dcn2_1_soc.num_chans = bw_params->num_channels; |
| 1596 | 1596 | ||
| 1597 | ASSERT(clk_table->num_entries); | 1597 | ASSERT(clk_table->num_entries); |
| 1598 | /* Copy dcn2_1_soc.clock_limits to clock_limits to avoid copying over null states later */ | ||
| 1599 | for (i = 0; i < dcn2_1_soc.num_states + 1; i++) { | ||
| 1600 | clock_limits[i] = dcn2_1_soc.clock_limits[i]; | ||
| 1601 | } | ||
| 1602 | |||
| 1598 | for (i = 0; i < clk_table->num_entries; i++) { | 1603 | for (i = 0; i < clk_table->num_entries; i++) { |
| 1599 | /* loop backwards*/ | 1604 | /* loop backwards*/ |
| 1600 | for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) { | 1605 | for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) { |
| @@ -113,6 +113,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 112 unmodified lines | |||
| 113 | struct pwl_result_data *rgb_resulted; | 113 | struct pwl_result_data *rgb_resulted; |
| 114 | struct pwl_result_data *rgb; | 114 | struct pwl_result_data *rgb; |
| 115 | struct pwl_result_data *rgb_plus_1; | 115 | struct pwl_result_data *rgb_plus_1; |
| 116 | struct pwl_result_data *rgb_minus_1; | ||
| 116 | struct fixed31_32 end_value; | 117 | struct fixed31_32 end_value; |
| 117 | 118 | ||
| 118 | int32_t region_start, region_end; | 119 | int32_t region_start, region_end; |
| @@ -140,7 +141,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 21 unmodified lines | |||
| 140 | region_start = -MAX_LOW_POINT; | 141 | region_start = -MAX_LOW_POINT; |
| 141 | region_end = NUMBER_REGIONS - MAX_LOW_POINT; | 142 | region_end = NUMBER_REGIONS - MAX_LOW_POINT; |
| 142 | } else { | 143 | } else { |
| 143 | /* 10 segments | 144 | /* 11 segments |
| 144 | * segment is from 2^-10 to 2^0 | 145 | * segment is from 2^-10 to 2^0 |
| 145 | * There are less than 256 points, for optimization | 146 | * There are less than 256 points, for optimization |
| 146 | */ | 147 | */ |
| @@ -154,9 +155,10 @@ bool cm3_helper_translate_curve_to_hw_format( · 7 unmodified lines | |||
| 154 | seg_distr[7] = 4; | 155 | seg_distr[7] = 4; |
| 155 | seg_distr[8] = 4; | 156 | seg_distr[8] = 4; |
| 156 | seg_distr[9] = 4; | 157 | seg_distr[9] = 4; |
| 158 | seg_distr[10] = 1; | ||
| 157 | 159 | ||
| 158 | region_start = -10; | 160 | region_start = -10; |
| 159 | region_end = 0; | 161 | region_end = 1; |
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++) | 164 | for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++) |
| @@ -189,6 +191,10 @@ bool cm3_helper_translate_curve_to_hw_format( · 26 unmodified lines | |||
| 189 | rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index]; | 191 | rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index]; |
| 190 | rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index]; | 192 | rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index]; |
| 191 | 193 | ||
| 194 | rgb_resulted[hw_points].red = rgb_resulted[hw_points - 1].red; | ||
| 195 | rgb_resulted[hw_points].green = rgb_resulted[hw_points - 1].green; | ||
| 196 | rgb_resulted[hw_points].blue = rgb_resulted[hw_points - 1].blue; | ||
| 197 | |||
| 192 | // All 3 color channels have same x | 198 | // All 3 color channels have same x |
| 193 | corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2), | 199 | corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2), |
| 194 | dc_fixpt_from_int(region_start)); | 200 | dc_fixpt_from_int(region_start)); |
| @@ -259,15 +265,18 @@ bool cm3_helper_translate_curve_to_hw_format( · 64 unmodified lines | |||
| 259 | 265 | ||
| 260 | rgb = rgb_resulted; | 266 | rgb = rgb_resulted; |
| 261 | rgb_plus_1 = rgb_resulted + 1; | 267 | rgb_plus_1 = rgb_resulted + 1; |
| 268 | rgb_minus_1 = rgb; | ||
| 262 | 269 | ||
| 263 | i = 1; | 270 | i = 1; |
| 264 | while (i != hw_points + 1) { | 271 | while (i != hw_points + 1) { |
| 265 | if (dc_fixpt_lt(rgb_plus_1->red, rgb->red)) | 272 | if (i >= hw_points - 1) { |
| 266 | rgb_plus_1->red = rgb->red; | 273 | if (dc_fixpt_lt(rgb_plus_1->red, rgb->red)) |
| 267 | if (dc_fixpt_lt(rgb_plus_1->green, rgb->green)) | 274 | rgb_plus_1->red = dc_fixpt_add(rgb->red, rgb_minus_1->delta_red); |
| 268 | rgb_plus_1->green = rgb->green; | 275 | if (dc_fixpt_lt(rgb_plus_1->green, rgb->green)) |
| 269 | if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue)) | 276 | rgb_plus_1->green = dc_fixpt_add(rgb->green, rgb_minus_1->delta_green); |
| 270 | rgb_plus_1->blue = rgb->blue; | 277 | if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue)) |
| 278 | rgb_plus_1->blue = dc_fixpt_add(rgb->blue, rgb_minus_1->delta_blue); | ||
| 279 | } | ||
| 271 | 280 | ||
| 272 | rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red); | 281 | rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red); |
| 273 | rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green); | 282 | rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green); |
| @@ -283,6 +292,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 9 unmodified lines | |||
| 283 | } | 292 | } |
| 284 | 293 | ||
| 285 | ++rgb_plus_1; | 294 | ++rgb_plus_1; |
| 295 | rgb_minus_1 = rgb; | ||
| 286 | ++rgb; | 296 | ++rgb; |
| 287 | ++i; | 297 | ++i; |
| 288 | } | 298 | } |
| @@ -587,6 +587,48 @@ static int smu7_force_switch_to_arbf0(struct pp_hwmgr *hwmgr) · 586 unmodified lines | |||
| 587 | tmp, MC_CG_ARB_FREQ_F0); | 587 | tmp, MC_CG_ARB_FREQ_F0); |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | static uint16_t smu7_override_pcie_speed(struct pp_hwmgr *hwmgr) | ||
| 591 | { | ||
| 592 | struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); | ||
| 593 | uint16_t pcie_gen = 0; | ||
| 594 | |||
| 595 | if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4 && | ||
| 596 | adev->pm.pcie_gen_mask & CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN4) | ||
| 597 | pcie_gen = 3; | ||
| 598 | else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 && | ||
| 599 | adev->pm.pcie_gen_mask & CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3) | ||
| 600 | pcie_gen = 2; | ||
| 601 | else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 && | ||
| 602 | adev->pm.pcie_gen_mask & CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2) | ||
| 603 | pcie_gen = 1; | ||
| 604 | else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1 && | ||
| 605 | adev->pm.pcie_gen_mask & CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1) | ||
| 606 | pcie_gen = 0; | ||
| 607 | |||
| 608 | return pcie_gen; | ||
| 609 | } | ||
| 610 | |||
| 611 | static uint16_t smu7_override_pcie_width(struct pp_hwmgr *hwmgr) | ||
| 612 | { | ||
| 613 | struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); | ||
| 614 | uint16_t pcie_width = 0; | ||
| 615 | |||
| 616 | if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16) | ||
| 617 | pcie_width = 16; | ||
| 618 | else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12) | ||
| 619 | pcie_width = 12; | ||
| 620 | else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8) | ||
| 621 | pcie_width = 8; | ||
| 622 | else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4) | ||
| 623 | pcie_width = 4; | ||
| 624 | else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2) | ||
| 625 | pcie_width = 2; | ||
| 626 | else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1) | ||
| 627 | pcie_width = 1; | ||
| 628 | |||
| 629 | return pcie_width; | ||
| 630 | } | ||
| 631 | |||
| 590 | static int smu7_setup_default_pcie_table(struct pp_hwmgr *hwmgr) | 632 | static int smu7_setup_default_pcie_table(struct pp_hwmgr *hwmgr) |
| 591 | { | 633 | { |
| 592 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | 634 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); |
| @@ -683,6 +725,11 @@ static int smu7_setup_default_pcie_table(struct pp_hwmgr *hwmgr) · 90 unmodified lines | |||
| 683 | PP_Min_PCIEGen), | 725 | PP_Min_PCIEGen), |
| 684 | get_pcie_lane_support(data->pcie_lane_cap, | 726 | get_pcie_lane_support(data->pcie_lane_cap, |
| 685 | PP_Max_PCIELane)); | 727 | PP_Max_PCIELane)); |
| 728 | |||
| 729 | if (data->pcie_dpm_key_disabled) | ||
| 730 | phm_setup_pcie_table_entry(&data->dpm_table.pcie_speed_table, | ||
| 731 | data->dpm_table.pcie_speed_table.count, | ||
| 732 | smu7_override_pcie_speed(hwmgr), smu7_override_pcie_width(hwmgr)); | ||
| 686 | } | 733 | } |
| 687 | return 0; | 734 | return 0; |
| 688 | } | 735 | } |
| @@ -1248,6 +1295,13 @@ static int smu7_start_dpm(struct pp_hwmgr *hwmgr) · 559 unmodified lines | |||
| 1248 | NULL)), | 1295 | NULL)), |
| 1249 | "Failed to enable pcie DPM during DPM Start Function!", | 1296 | "Failed to enable pcie DPM during DPM Start Function!", |
| 1250 | return -EINVAL); | 1297 | return -EINVAL); |
| 1298 | } else { | ||
| 1299 | PP_ASSERT_WITH_CODE( | ||
| 1300 | (0 == smum_send_msg_to_smc(hwmgr, | ||
| 1301 | PPSMC_MSG_PCIeDPM_Disable, | ||
| 1302 | NULL)), | ||
| 1303 | "Failed to disble pcie DPM during DPM Start Function!", | ||
| 1304 | return -EINVAL); | ||
| 1251 | } | 1305 | } |
| 1252 | 1306 | ||
| 1253 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 1307 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
| @@ -54,6 +54,9 @@ · 53 unmodified lines | |||
| 54 | #include "smuio/smuio_9_0_offset.h" | 54 | #include "smuio/smuio_9_0_offset.h" |
| 55 | #include "smuio/smuio_9_0_sh_mask.h" | 55 | #include "smuio/smuio_9_0_sh_mask.h" |
| 56 | 56 | ||
| 57 | #define smnPCIE_LC_SPEED_CNTL 0x11140290 | ||
| 58 | #define smnPCIE_LC_LINK_WIDTH_CNTL 0x11140288 | ||
| 59 | |||
| 57 | #define HBM_MEMORY_CHANNEL_WIDTH 128 | 60 | #define HBM_MEMORY_CHANNEL_WIDTH 128 |
| 58 | 61 | ||
| 59 | static const uint32_t channel_number[] = {1, 2, 0, 4, 0, 8, 0, 16, 2}; | 62 | static const uint32_t channel_number[] = {1, 2, 0, 4, 0, 8, 0, 16, 2}; |
| @@ -443,8 +446,7 @@ static void vega10_init_dpm_defaults(struct pp_hwmgr *hwmgr) · 383 unmodified lines | |||
| 443 | if (PP_CAP(PHM_PlatformCaps_VCEDPM)) | 446 | if (PP_CAP(PHM_PlatformCaps_VCEDPM)) |
| 444 | data->smu_features[GNLD_DPM_VCE].supported = true; | 447 | data->smu_features[GNLD_DPM_VCE].supported = true; |
| 445 | 448 | ||
| 446 | if (!data->registry_data.pcie_dpm_key_disabled) | 449 | data->smu_features[GNLD_DPM_LINK].supported = true; |
| 447 | data->smu_features[GNLD_DPM_LINK].supported = true; | ||
| 448 | 450 | ||
| 449 | if (!data->registry_data.dcefclk_dpm_key_disabled) | 451 | if (!data->registry_data.dcefclk_dpm_key_disabled) |
| 450 | data->smu_features[GNLD_DPM_DCEFCLK].supported = true; | 452 | data->smu_features[GNLD_DPM_DCEFCLK].supported = true; |
| @@ -1544,6 +1546,13 @@ static int vega10_override_pcie_parameters(struct pp_hwmgr *hwmgr) · 1093 unmodified lines | |||
| 1544 | pp_table->PcieLaneCount[i] = pcie_width; | 1546 | pp_table->PcieLaneCount[i] = pcie_width; |
| 1545 | } | 1547 | } |
| 1546 | 1548 | ||
| 1549 | if (data->registry_data.pcie_dpm_key_disabled) { | ||
| 1550 | for (i = 0; i < NUM_LINK_LEVELS; i++) { | ||
| 1551 | pp_table->PcieGenSpeed[i] = pcie_gen; | ||
| 1552 | pp_table->PcieLaneCount[i] = pcie_width; | ||
| 1553 | } | ||
| 1554 | } | ||
| 1555 | |||
| 1547 | return 0; | 1556 | return 0; |
| 1548 | } | 1557 | } |
| 1549 | 1558 | ||
| @@ -2966,6 +2975,14 @@ static int vega10_start_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap) · 1416 unmodified lines | |||
| 2966 | } | 2975 | } |
| 2967 | } | 2976 | } |
| 2968 | 2977 | ||
| 2978 | if (data->registry_data.pcie_dpm_key_disabled) { | ||
| 2979 | PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr, | ||
| 2980 | false, data->smu_features[GNLD_DPM_LINK].smu_feature_bitmap), | ||
| 2981 | "Attempt to Disable Link DPM feature Failed!", return -EINVAL); | ||
| 2982 | data->smu_features[GNLD_DPM_LINK].enabled = false; | ||
| 2983 | data->smu_features[GNLD_DPM_LINK].supported = false; | ||
| 2984 | } | ||
| 2985 | |||
| 2969 | return 0; | 2986 | return 0; |
| 2970 | } | 2987 | } |
| 2971 | 2988 | ||
| @@ -4584,6 +4601,24 @@ static int vega10_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe · 1612 unmodified lines | |||
| 4584 | return 0; | 4601 | return 0; |
| 4585 | } | 4602 | } |
| 4586 | 4603 | ||
| 4604 | static int vega10_get_current_pcie_link_width_level(struct pp_hwmgr *hwmgr) | ||
| 4605 | { | ||
| 4606 | struct amdgpu_device *adev = hwmgr->adev; | ||
| 4607 | |||
| 4608 | return (RREG32_PCIE(smnPCIE_LC_LINK_WIDTH_CNTL) & | ||
| 4609 | PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD_MASK) | ||
| 4610 | >> PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD__SHIFT; | ||
| 4611 | } | ||
| 4612 | |||
| 4613 | static int vega10_get_current_pcie_link_speed_level(struct pp_hwmgr *hwmgr) | ||
| 4614 | { | ||
| 4615 | struct amdgpu_device *adev = hwmgr->adev; | ||
| 4616 | |||
| 4617 | return (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) & | ||
| 4618 | PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK) | ||
| 4619 | >> PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE__SHIFT; | ||
| 4620 | } | ||
| 4621 | |||
| 4587 | static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr, | 4622 | static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr, |
| 4588 | enum pp_clock_type type, char *buf) | 4623 | enum pp_clock_type type, char *buf) |
| 4589 | { | 4624 | { |
| @@ -4592,8 +4627,9 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr, · 2 unmodified lines | |||
| 4592 | struct vega10_single_dpm_table *mclk_table = &(data->dpm_table.mem_table); | 4627 | struct vega10_single_dpm_table *mclk_table = &(data->dpm_table.mem_table); |
| 4593 | struct vega10_single_dpm_table *soc_table = &(data->dpm_table.soc_table); | 4628 | struct vega10_single_dpm_table *soc_table = &(data->dpm_table.soc_table); |
| 4594 | struct vega10_single_dpm_table *dcef_table = &(data->dpm_table.dcef_table); | 4629 | struct vega10_single_dpm_table *dcef_table = &(data->dpm_table.dcef_table); |
| 4595 | struct vega10_pcie_table *pcie_table = &(data->dpm_table.pcie_table); | ||
| 4596 | struct vega10_odn_clock_voltage_dependency_table *podn_vdd_dep = NULL; | 4630 | struct vega10_odn_clock_voltage_dependency_table *podn_vdd_dep = NULL; |
| 4631 | uint32_t gen_speed, lane_width, current_gen_speed, current_lane_width; | ||
| 4632 | PPTable_t *pptable = &(data->smc_state_table.pp_table); | ||
| 4597 | 4633 | ||
| 4598 | int i, now, size = 0, count = 0; | 4634 | int i, now, size = 0, count = 0; |
| 4599 | 4635 | ||
| @@ -4650,15 +4686,31 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr, · 50 unmodified lines | |||
| 4650 | "*" : ""); | 4686 | "*" : ""); |
| 4651 | break; | 4687 | break; |
| 4652 | case PP_PCIE: | 4688 | case PP_PCIE: |
| 4653 | smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetCurrentLinkIndex, &now); | 4689 | current_gen_speed = |
| 4654 | 4690 | vega10_get_current_pcie_link_speed_level(hwmgr); | |
| 4655 | for (i = 0; i < pcie_table->count; i++) | 4691 | current_lane_width = |
| 4656 | size += sprintf(buf + size, "%d: %s %s\n", i, | 4692 | vega10_get_current_pcie_link_width_level(hwmgr); |
| 4657 | (pcie_table->pcie_gen[i] == 0) ? "2.5GT/s, x1" : | 4693 | for (i = 0; i < NUM_LINK_LEVELS; i++) { |
| 4658 | (pcie_table->pcie_gen[i] == 1) ? "5.0GT/s, x16" : | 4694 | gen_speed = pptable->PcieGenSpeed[i]; |
| 4659 | (pcie_table->pcie_gen[i] == 2) ? "8.0GT/s, x16" : "", | 4695 | lane_width = pptable->PcieLaneCount[i]; |
| 4660 | (i == now) ? "*" : ""); | 4696 | |
| 4697 | size += sprintf(buf + size, "%d: %s %s %s\n", i, | ||
| 4698 | (gen_speed == 0) ? "2.5GT/s," : | ||
| 4699 | (gen_speed == 1) ? "5.0GT/s," : | ||
| 4700 | (gen_speed == 2) ? "8.0GT/s," : | ||
| 4701 | (gen_speed == 3) ? "16.0GT/s," : "", | ||
| 4702 | (lane_width == 1) ? "x1" : | ||
| 4703 | (lane_width == 2) ? "x2" : | ||
| 4704 | (lane_width == 3) ? "x4" : | ||
| 4705 | (lane_width == 4) ? "x8" : | ||
| 4706 | (lane_width == 5) ? "x12" : | ||
| 4707 | (lane_width == 6) ? "x16" : "", | ||
| 4708 | (current_gen_speed == gen_speed) && | ||
| 4709 | (current_lane_width == lane_width) ? | ||
| 4710 | "*" : ""); | ||
| 4711 | } | ||
| 4661 | break; | 4712 | break; |
| 4713 | |||
| 4662 | case OD_SCLK: | 4714 | case OD_SCLK: |
| 4663 | if (hwmgr->od_enabled) { | 4715 | if (hwmgr->od_enabled) { |
| 4664 | size = sprintf(buf, "%s:\n", "OD_SCLK"); | 4716 | size = sprintf(buf, "%s:\n", "OD_SCLK"); |
| @@ -133,6 +133,7 @@ static void vega12_set_default_registry_data(struct pp_hwmgr *hwmgr) · 132 unmodified lines | |||
| 133 | data->registry_data.auto_wattman_debug = 0; | 133 | data->registry_data.auto_wattman_debug = 0; |
| 134 | data->registry_data.auto_wattman_sample_period = 100; | 134 | data->registry_data.auto_wattman_sample_period = 100; |
| 135 | data->registry_data.auto_wattman_threshold = 50; | 135 | data->registry_data.auto_wattman_threshold = 50; |
| 136 | data->registry_data.pcie_dpm_key_disabled = !(hwmgr->feature_mask & PP_PCIE_DPM_MASK); | ||
| 136 | } | 137 | } |
| 137 | 138 | ||
| 138 | static int vega12_set_features_platform_caps(struct pp_hwmgr *hwmgr) | 139 | static int vega12_set_features_platform_caps(struct pp_hwmgr *hwmgr) |
| @@ -539,6 +540,29 @@ static int vega12_override_pcie_parameters(struct pp_hwmgr *hwmgr) · 400 unmodified lines | |||
| 539 | pp_table->PcieLaneCount[i] = pcie_width_arg; | 540 | pp_table->PcieLaneCount[i] = pcie_width_arg; |
| 540 | } | 541 | } |
| 541 | 542 | ||
| 543 | /* override to the highest if it's disabled from ppfeaturmask */ | ||
| 544 | if (data->registry_data.pcie_dpm_key_disabled) { | ||
| 545 | for (i = 0; i < NUM_LINK_LEVELS; i++) { | ||
| 546 | smu_pcie_arg = (i << 16) | (pcie_gen << 8) | pcie_width; | ||
| 547 | ret = smum_send_msg_to_smc_with_parameter(hwmgr, | ||
| 548 | PPSMC_MSG_OverridePcieParameters, smu_pcie_arg, | ||
| 549 | NULL); | ||
| 550 | PP_ASSERT_WITH_CODE(!ret, | ||
| 551 | "[OverridePcieParameters] Attempt to override pcie params failed!", | ||
| 552 | return ret); | ||
| 553 | |||
| 554 | pp_table->PcieGenSpeed[i] = pcie_gen; | ||
| 555 | pp_table->PcieLaneCount[i] = pcie_width; | ||
| 556 | } | ||
| 557 | ret = vega12_enable_smc_features(hwmgr, | ||
| 558 | false, | ||
| 559 | data->smu_features[GNLD_DPM_LINK].smu_feature_bitmap); | ||
| 560 | PP_ASSERT_WITH_CODE(!ret, | ||
| 561 | "Attempt to Disable DPM LINK Failed!", | ||
| 562 | return ret); | ||
| 563 | data->smu_features[GNLD_DPM_LINK].enabled = false; | ||
| 564 | data->smu_features[GNLD_DPM_LINK].supported = false; | ||
| 565 | } | ||
| 542 | return 0; | 566 | return 0; |
| 543 | } | 567 | } |
| 544 | 568 | ||
| @@ -171,6 +171,7 @@ static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr) · 170 unmodified lines | |||
| 171 | data->registry_data.gfxoff_controlled_by_driver = 1; | 171 | data->registry_data.gfxoff_controlled_by_driver = 1; |
| 172 | data->gfxoff_allowed = false; | 172 | data->gfxoff_allowed = false; |
| 173 | data->counter_gfxoff = 0; | 173 | data->counter_gfxoff = 0; |
| 174 | data->registry_data.pcie_dpm_key_disabled = !(hwmgr->feature_mask & PP_PCIE_DPM_MASK); | ||
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | static int vega20_set_features_platform_caps(struct pp_hwmgr *hwmgr) | 177 | static int vega20_set_features_platform_caps(struct pp_hwmgr *hwmgr) |
| @@ -884,6 +885,30 @@ static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr) · 707 unmodified lines | |||
| 884 | pp_table->PcieLaneCount[i] = pcie_width_arg; | 885 | pp_table->PcieLaneCount[i] = pcie_width_arg; |
| 885 | } | 886 | } |
| 886 | 887 | ||
| 888 | /* override to the highest if it's disabled from ppfeaturmask */ | ||
| 889 | if (data->registry_data.pcie_dpm_key_disabled) { | ||
| 890 | for (i = 0; i < NUM_LINK_LEVELS; i++) { | ||
| 891 | smu_pcie_arg = (i << 16) | (pcie_gen << 8) | pcie_width; | ||
| 892 | ret = smum_send_msg_to_smc_with_parameter(hwmgr, | ||
| 893 | PPSMC_MSG_OverridePcieParameters, smu_pcie_arg, | ||
| 894 | NULL); | ||
| 895 | PP_ASSERT_WITH_CODE(!ret, | ||
| 896 | "[OverridePcieParameters] Attempt to override pcie params failed!", | ||
| 897 | return ret); | ||
| 898 | |||
| 899 | pp_table->PcieGenSpeed[i] = pcie_gen; | ||
| 900 | pp_table->PcieLaneCount[i] = pcie_width; | ||
| 901 | } | ||
| 902 | ret = vega20_enable_smc_features(hwmgr, | ||
| 903 | false, | ||
| 904 | data->smu_features[GNLD_DPM_LINK].smu_feature_bitmap); | ||
| 905 | PP_ASSERT_WITH_CODE(!ret, | ||
| 906 | "Attempt to Disable DPM LINK Failed!", | ||
| 907 | return ret); | ||
| 908 | data->smu_features[GNLD_DPM_LINK].enabled = false; | ||
| 909 | data->smu_features[GNLD_DPM_LINK].supported = false; | ||
| 910 | } | ||
| 911 | |||
| 887 | return 0; | 912 | return 0; |
| 888 | } | 913 | } |
| 889 | 914 | ||
| @@ -1294,7 +1294,7 @@ static int smu_disable_dpms(struct smu_context *smu) · 1293 unmodified lines | |||
| 1294 | bool use_baco = !smu->is_apu && | 1294 | bool use_baco = !smu->is_apu && |
| 1295 | ((amdgpu_in_reset(adev) && | 1295 | ((amdgpu_in_reset(adev) && |
| 1296 | (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) || | 1296 | (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) || |
| 1297 | ((adev->in_runpm || adev->in_hibernate) && amdgpu_asic_supports_baco(adev))); | 1297 | ((adev->in_runpm || adev->in_s4) && amdgpu_asic_supports_baco(adev))); |
| 1298 | 1298 | ||
| 1299 | /* | 1299 | /* |
| 1300 | * For custom pptable uploading, skip the DPM features | 1300 | * For custom pptable uploading, skip the DPM features |
| @@ -1431,7 +1431,8 @@ static int smu_suspend(void *handle) · 130 unmodified lines | |||
| 1431 | 1431 | ||
| 1432 | smu->watermarks_bitmap &= ~(WATERMARKS_LOADED); | 1432 | smu->watermarks_bitmap &= ~(WATERMARKS_LOADED); |
| 1433 | 1433 | ||
| 1434 | if (smu->is_apu) | 1434 | /* skip CGPG when in S0ix */ |
| 1435 | if (smu->is_apu && !adev->in_s0ix) | ||
| 1435 | smu_set_gfx_cgpg(&adev->smu, false); | 1436 | smu_set_gfx_cgpg(&adev->smu, false); |
| 1436 | 1437 | ||
| 1437 | return 0; | 1438 | return 0; |
| @@ -689,7 +689,8 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj) · 688 unmodified lines | |||
| 689 | struct page **pages = pvec + pinned; | 689 | struct page **pages = pvec + pinned; |
| 690 | 690 | ||
| 691 | ret = pin_user_pages_fast(ptr, num_pages, | 691 | ret = pin_user_pages_fast(ptr, num_pages, |
| 692 | !userptr->ro ? FOLL_WRITE : 0, pages); | 692 | FOLL_WRITE | FOLL_FORCE | FOLL_LONGTERM, |
| 693 | pages); | ||
| 693 | if (ret < 0) { | 694 | if (ret < 0) { |
| 694 | unpin_user_pages(pvec, pinned); | 695 | unpin_user_pages(pvec, pinned); |
| 695 | kvfree(pvec); | 696 | kvfree(pvec); |
| @@ -317,12 +317,13 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_ · 316 unmodified lines | |||
| 317 | if (!new_plane_state->hw.crtc && !old_plane_state->hw.crtc) | 317 | if (!new_plane_state->hw.crtc && !old_plane_state->hw.crtc) |
| 318 | return 0; | 318 | return 0; |
| 319 | 319 | ||
| 320 | new_crtc_state->enabled_planes |= BIT(plane->id); | ||
| 321 | |||
| 322 | ret = plane->check_plane(new_crtc_state, new_plane_state); | 320 | ret = plane->check_plane(new_crtc_state, new_plane_state); |
| 323 | if (ret) | 321 | if (ret) |
| 324 | return ret; | 322 | return ret; |
| 325 | 323 | ||
| 324 | if (fb) | ||
| 325 | new_crtc_state->enabled_planes |= BIT(plane->id); | ||
| 326 | |||
| 326 | /* FIXME pre-g4x don't work like this */ | 327 | /* FIXME pre-g4x don't work like this */ |
| 327 | if (new_plane_state->uapi.visible) | 328 | if (new_plane_state->uapi.visible) |
| 328 | new_crtc_state->active_planes |= BIT(plane->id); | 329 | new_crtc_state->active_planes |= BIT(plane->id); |
| @@ -3619,9 +3619,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) · 3618 unmodified lines | |||
| 3619 | { | 3619 | { |
| 3620 | int ret; | 3620 | int ret; |
| 3621 | 3621 | ||
| 3622 | intel_dp_lttpr_init(intel_dp); | 3622 | if (intel_dp_init_lttpr_and_dprx_caps(intel_dp) < 0) |
| 3623 | |||
| 3624 | if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd)) | ||
| 3625 | return false; | 3623 | return false; |
| 3626 | 3624 | ||
| 3627 | /* | 3625 | /* |
| @@ -133,6 +133,7 @@ static u32 g4x_get_aux_send_ctl(struct intel_dp *intel_dp, · 132 unmodified lines | |||
| 133 | else | 133 | else |
| 134 | precharge = 5; | 134 | precharge = 5; |
| 135 | 135 | ||
| 136 | /* Max timeout value on G4x-BDW: 1.6ms */ | ||
| 136 | if (IS_BROADWELL(dev_priv)) | 137 | if (IS_BROADWELL(dev_priv)) |
| 137 | timeout = DP_AUX_CH_CTL_TIME_OUT_600us; | 138 | timeout = DP_AUX_CH_CTL_TIME_OUT_600us; |
| 138 | else | 139 | else |
| @@ -159,6 +160,12 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp, · 20 unmodified lines | |||
| 159 | enum phy phy = intel_port_to_phy(i915, dig_port->base.port); | 160 | enum phy phy = intel_port_to_phy(i915, dig_port->base.port); |
| 160 | u32 ret; | 161 | u32 ret; |
| 161 | 162 | ||
| 163 | /* | ||
| 164 | * Max timeout values: | ||
| 165 | * SKL-GLK: 1.6ms | ||
| 166 | * CNL: 3.2ms | ||
| 167 | * ICL+: 4ms | ||
| 168 | */ | ||
| 162 | ret = DP_AUX_CH_CTL_SEND_BUSY | | 169 | ret = DP_AUX_CH_CTL_SEND_BUSY | |
| 163 | DP_AUX_CH_CTL_DONE | | 170 | DP_AUX_CH_CTL_DONE | |
| 164 | DP_AUX_CH_CTL_INTERRUPT | | 171 | DP_AUX_CH_CTL_INTERRUPT | |
| @@ -34,6 +34,11 @@ intel_dp_dump_link_status(const u8 link_status[DP_LINK_STATUS_SIZE]) · 33 unmodified lines | |||
| 34 | link_status[3], link_status[4], link_status[5]); | 34 | link_status[3], link_status[4], link_status[5]); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static void intel_dp_reset_lttpr_common_caps(struct intel_dp *intel_dp) | ||
| 38 | { | ||
| 39 | memset(&intel_dp->lttpr_common_caps, 0, sizeof(intel_dp->lttpr_common_caps)); | ||
| 40 | } | ||
| 41 | |||
| 37 | static void intel_dp_reset_lttpr_count(struct intel_dp *intel_dp) | 42 | static void intel_dp_reset_lttpr_count(struct intel_dp *intel_dp) |
| 38 | { | 43 | { |
| 39 | intel_dp->lttpr_common_caps[DP_PHY_REPEATER_CNT - | 44 | intel_dp->lttpr_common_caps[DP_PHY_REPEATER_CNT - |
| @@ -81,19 +86,36 @@ static void intel_dp_read_lttpr_phy_caps(struct intel_dp *intel_dp, · 41 unmodified lines | |||
| 81 | 86 | ||
| 82 | static bool intel_dp_read_lttpr_common_caps(struct intel_dp *intel_dp) | 87 | static bool intel_dp_read_lttpr_common_caps(struct intel_dp *intel_dp) |
| 83 | { | 88 | { |
| 84 | if (drm_dp_read_lttpr_common_caps(&intel_dp->aux, | 89 | struct drm_i915_private *i915 = dp_to_i915(intel_dp); |
| 85 | intel_dp->lttpr_common_caps) < 0) { | 90 | |
| 86 | memset(intel_dp->lttpr_common_caps, 0, | 91 | if (intel_dp_is_edp(intel_dp)) |
| 87 | sizeof(intel_dp->lttpr_common_caps)); | ||
| 88 | return false; | 92 | return false; |
| 89 | } | 93 | |
| 94 | /* | ||
| 95 | * Detecting LTTPRs must be avoided on platforms with an AUX timeout | ||
| 96 | * period < 3.2ms. (see DP Standard v2.0, 2.11.2, 3.6.6.1). | ||
| 97 | */ | ||
| 98 | if (INTEL_GEN(i915) < 10) | ||
| 99 | return false; | ||
| 100 | |||
| 101 | if (drm_dp_read_lttpr_common_caps(&intel_dp->aux, | ||
| 102 | intel_dp->lttpr_common_caps) < 0) | ||
| 103 | goto reset_caps; | ||
| 90 | 104 | ||
| 91 | drm_dbg_kms(&dp_to_i915(intel_dp)->drm, | 105 | drm_dbg_kms(&dp_to_i915(intel_dp)->drm, |
| 92 | "LTTPR common capabilities: %*ph\n", | 106 | "LTTPR common capabilities: %*ph\n", |
| 93 | (int)sizeof(intel_dp->lttpr_common_caps), | 107 | (int)sizeof(intel_dp->lttpr_common_caps), |
| 94 | intel_dp->lttpr_common_caps); | 108 | intel_dp->lttpr_common_caps); |
| 95 | 109 | ||
| 110 | /* The minimum value of LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV is 1.4 */ | ||
| 111 | if (intel_dp->lttpr_common_caps[0] < 0x14) | ||
| 112 | goto reset_caps; | ||
| 113 | |||
| 96 | return true; | 114 | return true; |
| 115 | |||
| 116 | reset_caps: | ||
| 117 | intel_dp_reset_lttpr_common_caps(intel_dp); | ||
| 118 | return false; | ||
| 97 | } | 119 | } |
| 98 | 120 | ||
| 99 | static bool | 121 | static bool |
| @@ -106,33 +128,49 @@ intel_dp_set_lttpr_transparent_mode(struct intel_dp *intel_dp, bool enable) · 6 unmodified lines | |||
| 106 | } | 128 | } |
| 107 | 129 | ||
| 108 | /** | 130 | /** |
| 109 | * intel_dp_lttpr_init - detect LTTPRs and init the LTTPR link training mode | 131 | * intel_dp_init_lttpr_and_dprx_caps - detect LTTPR and DPRX caps, init the LTTPR link training mode |
| 110 | * @intel_dp: Intel DP struct | 132 | * @intel_dp: Intel DP struct |
| 111 | * | 133 | * |
| 112 | * Read the LTTPR common capabilities, switch to non-transparent link training | 134 | * Read the LTTPR common and DPRX capabilities and switch to non-transparent |
| 113 | * mode if any is detected and read the PHY capabilities for all detected | 135 | * link training mode if any is detected and read the PHY capabilities for all |
| 114 | * LTTPRs. In case of an LTTPR detection error or if the number of | 136 | * detected LTTPRs. In case of an LTTPR detection error or if the number of |
| 115 | * LTTPRs is more than is supported (8), fall back to the no-LTTPR, | 137 | * LTTPRs is more than is supported (8), fall back to the no-LTTPR, |
| 116 | * transparent mode link training mode. | 138 | * transparent mode link training mode. |
| 117 | * | 139 | * |
| 118 | * Returns: | 140 | * Returns: |
| 119 | * >0 if LTTPRs were detected and the non-transparent LT mode was set | 141 | * >0 if LTTPRs were detected and the non-transparent LT mode was set. The |
| 142 | * DPRX capabilities are read out. | ||
| 120 | * 0 if no LTTPRs or more than 8 LTTPRs were detected or in case of a | 143 | * 0 if no LTTPRs or more than 8 LTTPRs were detected or in case of a |
| 121 | * detection failure and the transparent LT mode was set | 144 | * detection failure and the transparent LT mode was set. The DPRX |
| 145 | * capabilities are read out. | ||
| 146 | * <0 Reading out the DPRX capabilities failed. | ||
| 122 | */ | 147 | */ |
| 123 | int intel_dp_lttpr_init(struct intel_dp *intel_dp) | 148 | int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp) |
| 124 | { | 149 | { |
| 125 | int lttpr_count; | 150 | int lttpr_count; |
| 126 | bool ret; | 151 | bool ret; |
| 127 | int i; | 152 | int i; |
| 128 | 153 | ||
| 129 | if (intel_dp_is_edp(intel_dp)) | ||
| 130 | return 0; | ||
| 131 | |||
| 132 | ret = intel_dp_read_lttpr_common_caps(intel_dp); | 154 | ret = intel_dp_read_lttpr_common_caps(intel_dp); |
| 155 | |||
| 156 | /* The DPTX shall read the DPRX caps after LTTPR detection. */ | ||
| 157 | if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd)) { | ||
| 158 | intel_dp_reset_lttpr_common_caps(intel_dp); | ||
| 159 | return -EIO; | ||
| 160 | } | ||
| 161 | |||
| 133 | if (!ret) | 162 | if (!ret) |
| 134 | return 0; | 163 | return 0; |
| 135 | 164 | ||
| 165 | /* | ||
| 166 | * The 0xF0000-0xF02FF range is only valid if the DPCD revision is | ||
| 167 | * at least 1.4. | ||
| 168 | */ | ||
| 169 | if (intel_dp->dpcd[DP_DPCD_REV] < 0x14) { | ||
| 170 | intel_dp_reset_lttpr_common_caps(intel_dp); | ||
| 171 | return 0; | ||
| 172 | } | ||
| 173 | |||
| 136 | lttpr_count = drm_dp_lttpr_count(intel_dp->lttpr_common_caps); | 174 | lttpr_count = drm_dp_lttpr_count(intel_dp->lttpr_common_caps); |
| 137 | /* | 175 | /* |
| 138 | * Prevent setting LTTPR transparent mode explicitly if no LTTPRs are | 176 | * Prevent setting LTTPR transparent mode explicitly if no LTTPRs are |
| @@ -172,7 +210,7 @@ int intel_dp_lttpr_init(struct intel_dp *intel_dp) · 33 unmodified lines | |||
| 172 | 210 | ||
| 173 | return lttpr_count; | 211 | return lttpr_count; |
| 174 | } | 212 | } |
| 175 | EXPORT_SYMBOL(intel_dp_lttpr_init); | 213 | EXPORT_SYMBOL(intel_dp_init_lttpr_and_dprx_caps); |
| 176 | 214 | ||
| 177 | static u8 dp_voltage_max(u8 preemph) | 215 | static u8 dp_voltage_max(u8 preemph) |
| 178 | { | 216 | { |
| @@ -807,7 +845,10 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp, · 628 unmodified lines | |||
| 807 | * TODO: Reiniting LTTPRs here won't be needed once proper connector | 845 | * TODO: Reiniting LTTPRs here won't be needed once proper connector |
| 808 | * HW state readout is added. | 846 | * HW state readout is added. |
| 809 | */ | 847 | */ |
| 810 | int lttpr_count = intel_dp_lttpr_init(intel_dp); | 848 | int lttpr_count = intel_dp_init_lttpr_and_dprx_caps(intel_dp); |
| 849 | |||
| 850 | if (lttpr_count < 0) | ||
| 851 | return; | ||
| 811 | 852 | ||
| 812 | if (!intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count)) | 853 | if (!intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count)) |
| 813 | intel_dp_schedule_fallback_link_training(intel_dp, crtc_state); | 854 | intel_dp_schedule_fallback_link_training(intel_dp, crtc_state); |
| @@ -11,7 +11,7 @@ · 10 unmodified lines | |||
| 11 | struct intel_crtc_state; | 11 | struct intel_crtc_state; |
| 12 | struct intel_dp; | 12 | struct intel_dp; |
| 13 | 13 | ||
| 14 | int intel_dp_lttpr_init(struct intel_dp *intel_dp); | 14 | int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp); |
| 15 | 15 | ||
| 16 | void intel_dp_get_adjust_train(struct intel_dp *intel_dp, | 16 | void intel_dp_get_adjust_train(struct intel_dp *intel_dp, |
| 17 | const struct intel_crtc_state *crtc_state, | 17 | const struct intel_crtc_state *crtc_state, |
| @@ -1014,20 +1014,14 @@ static i915_reg_t dss_ctl1_reg(const struct intel_crtc_state *crtc_state) · 1013 unmodified lines | |||
| 1014 | { | 1014 | { |
| 1015 | enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe; | 1015 | enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe; |
| 1016 | 1016 | ||
| 1017 | if (crtc_state->cpu_transcoder == TRANSCODER_EDP) | 1017 | return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL1(pipe) : DSS_CTL1; |
| 1018 | return DSS_CTL1; | ||
| 1019 | |||
| 1020 | return ICL_PIPE_DSS_CTL1(pipe); | ||
| 1021 | } | 1018 | } |
| 1022 | 1019 | ||
| 1023 | static i915_reg_t dss_ctl2_reg(const struct intel_crtc_state *crtc_state) | 1020 | static i915_reg_t dss_ctl2_reg(const struct intel_crtc_state *crtc_state) |
| 1024 | { | 1021 | { |
| 1025 | enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe; | 1022 | enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe; |
| 1026 | 1023 | ||
| 1027 | if (crtc_state->cpu_transcoder == TRANSCODER_EDP) | 1024 | return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL2(pipe) : DSS_CTL2; |
| 1028 | return DSS_CTL2; | ||
| 1029 | |||
| 1030 | return ICL_PIPE_DSS_CTL2(pipe); | ||
| 1031 | } | 1025 | } |
| 1032 | 1026 | ||
| 1033 | void intel_dsc_enable(struct intel_encoder *encoder, | 1027 | void intel_dsc_enable(struct intel_encoder *encoder, |
| @@ -316,7 +316,18 @@ void i915_vma_revoke_fence(struct i915_vma *vma) · 315 unmodified lines | |||
| 316 | WRITE_ONCE(fence->vma, NULL); | 316 | WRITE_ONCE(fence->vma, NULL); |
| 317 | vma->fence = NULL; | 317 | vma->fence = NULL; |
| 318 | 318 | ||
| 319 | with_intel_runtime_pm_if_in_use(fence_to_uncore(fence)->rpm, wakeref) | 319 | /* |
| 320 | * Skip the write to HW if and only if the device is currently | ||
| 321 | * suspended. | ||
| 322 | * | ||
| 323 | * If the driver does not currently hold a wakeref (if_in_use == 0), | ||
| 324 | * the device may currently be runtime suspended, or it may be woken | ||
| 325 | * up before the suspend takes place. If the device is not suspended | ||
| 326 | * (powered down) and we skip clearing the fence register, the HW is | ||
| 327 | * left in an undefined state where we may end up with multiple | ||
| 328 | * registers overlapping. | ||
| 329 | */ | ||
| 330 | with_intel_runtime_pm_if_active(fence_to_uncore(fence)->rpm, wakeref) | ||
| 320 | fence_write(fence); | 331 | fence_write(fence); |
| 321 | } | 332 | } |
| 322 | 333 | ||
| @@ -603,7 +603,6 @@ static int append_oa_sample(struct i915_perf_stream *stream, · 602 unmodified lines | |||
| 603 | { | 603 | { |
| 604 | int report_size = stream->oa_buffer.format_size; | 604 | int report_size = stream->oa_buffer.format_size; |
| 605 | struct drm_i915_perf_record_header header; | 605 | struct drm_i915_perf_record_header header; |
| 606 | u32 sample_flags = stream->sample_flags; | ||
| 607 | 606 | ||
| 608 | header.type = DRM_I915_PERF_RECORD_SAMPLE; | 607 | header.type = DRM_I915_PERF_RECORD_SAMPLE; |
| 609 | header.pad = 0; | 608 | header.pad = 0; |
| @@ -617,10 +616,8 @@ static int append_oa_sample(struct i915_perf_stream *stream, · 7 unmodified lines | |||
| 617 | return -EFAULT; | 616 | return -EFAULT; |
| 618 | buf += sizeof(header); | 617 | buf += sizeof(header); |
| 619 | 618 | ||
| 620 | if (sample_flags & SAMPLE_OA_REPORT) { | 619 | if (copy_to_user(buf, report, report_size)) |
| 621 | if (copy_to_user(buf, report, report_size)) | 620 | return -EFAULT; |
| 622 | return -EFAULT; | ||
| 623 | } | ||
| 624 | 621 | ||
| 625 | (*offset) += header.size; | 622 | (*offset) += header.size; |
| 626 | 623 | ||
| @@ -2682,7 +2679,7 @@ static void i915_oa_stream_enable(struct i915_perf_stream *stream) · 2055 unmodified lines | |||
| 2682 | 2679 | ||
| 2683 | stream->perf->ops.oa_enable(stream); | 2680 | stream->perf->ops.oa_enable(stream); |
| 2684 | 2681 | ||
| 2685 | if (stream->periodic) | 2682 | if (stream->sample_flags & SAMPLE_OA_REPORT) |
| 2686 | hrtimer_start(&stream->poll_check_timer, | 2683 | hrtimer_start(&stream->poll_check_timer, |
| 2687 | ns_to_ktime(stream->poll_oa_period), | 2684 | ns_to_ktime(stream->poll_oa_period), |
| 2688 | HRTIMER_MODE_REL_PINNED); | 2685 | HRTIMER_MODE_REL_PINNED); |
| @@ -2745,7 +2742,7 @@ static void i915_oa_stream_disable(struct i915_perf_stream *stream) · 56 unmodified lines | |||
| 2745 | { | 2742 | { |
| 2746 | stream->perf->ops.oa_disable(stream); | 2743 | stream->perf->ops.oa_disable(stream); |
| 2747 | 2744 | ||
| 2748 | if (stream->periodic) | 2745 | if (stream->sample_flags & SAMPLE_OA_REPORT) |
| 2749 | hrtimer_cancel(&stream->poll_check_timer); | 2746 | hrtimer_cancel(&stream->poll_check_timer); |
| 2750 | } | 2747 | } |
| 2751 | 2748 | ||
| @@ -3028,7 +3025,7 @@ static ssize_t i915_perf_read(struct file *file, · 276 unmodified lines | |||
| 3028 | * disabled stream as an error. In particular it might otherwise lead | 3025 | * disabled stream as an error. In particular it might otherwise lead |
| 3029 | * to a deadlock for blocking file descriptors... | 3026 | * to a deadlock for blocking file descriptors... |
| 3030 | */ | 3027 | */ |
| 3031 | if (!stream->enabled) | 3028 | if (!stream->enabled || !(stream->sample_flags & SAMPLE_OA_REPORT)) |
| 3032 | return -EIO; | 3029 | return -EIO; |
| 3033 | 3030 | ||
| 3034 | if (!(file->f_flags & O_NONBLOCK)) { | 3031 | if (!(file->f_flags & O_NONBLOCK)) { |
| @@ -3316,7 +3316,18 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 3315 unmodified lines | |||
| 3316 | 3316 | ||
| 3317 | #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000) | 3317 | #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000) |
| 3318 | #define ILK_FBCQ_DIS (1 << 22) | 3318 | #define ILK_FBCQ_DIS (1 << 22) |
| 3319 | #define ILK_PABSTRETCH_DIS (1 << 21) | 3319 | #define ILK_PABSTRETCH_DIS REG_BIT(21) |
| 3320 | #define ILK_SABSTRETCH_DIS REG_BIT(20) | ||
| 3321 | #define IVB_PRI_STRETCH_MAX_MASK REG_GENMASK(21, 20) | ||
| 3322 | #define IVB_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 0) | ||
| 3323 | #define IVB_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 1) | ||
| 3324 | #define IVB_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 2) | ||
| 3325 | #define IVB_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 3) | ||
| 3326 | #define IVB_SPR_STRETCH_MAX_MASK REG_GENMASK(19, 18) | ||
| 3327 | #define IVB_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 0) | ||
| 3328 | #define IVB_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 1) | ||
| 3329 | #define IVB_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 2) | ||
| 3330 | #define IVB_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 3) | ||
| 3320 | 3331 | ||
| 3321 | 3332 | ||
| 3322 | /* | 3333 | /* |
| @@ -8039,6 +8050,16 @@ enum { · 4716 unmodified lines | |||
| 8039 | 8050 | ||
| 8040 | #define _CHICKEN_PIPESL_1_A 0x420b0 | 8051 | #define _CHICKEN_PIPESL_1_A 0x420b0 |
| 8041 | #define _CHICKEN_PIPESL_1_B 0x420b4 | 8052 | #define _CHICKEN_PIPESL_1_B 0x420b4 |
| 8053 | #define HSW_PRI_STRETCH_MAX_MASK REG_GENMASK(28, 27) | ||
| 8054 | #define HSW_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 0) | ||
| 8055 | #define HSW_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 1) | ||
| 8056 | #define HSW_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 2) | ||
| 8057 | #define HSW_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 3) | ||
| 8058 | #define HSW_SPR_STRETCH_MAX_MASK REG_GENMASK(26, 25) | ||
| 8059 | #define HSW_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 0) | ||
| 8060 | #define HSW_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 1) | ||
| 8061 | #define HSW_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 2) | ||
| 8062 | #define HSW_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 3) | ||
| 8042 | #define HSW_FBCQ_DIS (1 << 22) | 8063 | #define HSW_FBCQ_DIS (1 << 22) |
| 8043 | #define BDW_DPRS_MASK_VBLANK_SRD (1 << 0) | 8064 | #define BDW_DPRS_MASK_VBLANK_SRD (1 << 0) |
| 8044 | #define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B) | 8065 | #define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B) |
| @@ -7245,11 +7245,16 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv) · 7244 unmodified lines | |||
| 7245 | intel_uncore_write(&dev_priv->uncore, CHICKEN_PAR1_1, | 7245 | intel_uncore_write(&dev_priv->uncore, CHICKEN_PAR1_1, |
| 7246 | intel_uncore_read(&dev_priv->uncore, CHICKEN_PAR1_1) | DPA_MASK_VBLANK_SRD); | 7246 | intel_uncore_read(&dev_priv->uncore, CHICKEN_PAR1_1) | DPA_MASK_VBLANK_SRD); |
| 7247 | 7247 | ||
| 7248 | /* WaPsrDPRSUnmaskVBlankInSRD:bdw */ | ||
| 7249 | for_each_pipe(dev_priv, pipe) { | 7248 | for_each_pipe(dev_priv, pipe) { |
| 7249 | /* WaPsrDPRSUnmaskVBlankInSRD:bdw */ | ||
| 7250 | intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe), | 7250 | intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe), |
| 7251 | intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe)) | | 7251 | intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe)) | |
| 7252 | BDW_DPRS_MASK_VBLANK_SRD); | 7252 | BDW_DPRS_MASK_VBLANK_SRD); |
| 7253 | |||
| 7254 | /* Undocumented but fixes async flip + VT-d corruption */ | ||
| 7255 | if (intel_vtd_active()) | ||
| 7256 | intel_uncore_rmw(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe), | ||
| 7257 | HSW_PRI_STRETCH_MAX_MASK, HSW_PRI_STRETCH_MAX_X1); | ||
| 7253 | } | 7258 | } |
| 7254 | 7259 | ||
| 7255 | /* WaVSRefCountFullforceMissDisable:bdw */ | 7260 | /* WaVSRefCountFullforceMissDisable:bdw */ |
| @@ -7285,11 +7290,20 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv) · 29 unmodified lines | |||
| 7285 | 7290 | ||
| 7286 | static void hsw_init_clock_gating(struct drm_i915_private *dev_priv) | 7291 | static void hsw_init_clock_gating(struct drm_i915_private *dev_priv) |
| 7287 | { | 7292 | { |
| 7293 | enum pipe pipe; | ||
| 7294 | |||
| 7288 | /* WaFbcAsynchFlipDisableFbcQueue:hsw,bdw */ | 7295 | /* WaFbcAsynchFlipDisableFbcQueue:hsw,bdw */ |
| 7289 | intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A), | 7296 | intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A), |
| 7290 | intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A)) | | 7297 | intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A)) | |
| 7291 | HSW_FBCQ_DIS); | 7298 | HSW_FBCQ_DIS); |
| 7292 | 7299 | ||
| 7300 | for_each_pipe(dev_priv, pipe) { | ||
| 7301 | /* Undocumented but fixes async flip + VT-d corruption */ | ||
| 7302 | if (intel_vtd_active()) | ||
| 7303 | intel_uncore_rmw(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe), | ||
| 7304 | HSW_PRI_STRETCH_MAX_MASK, HSW_PRI_STRETCH_MAX_X1); | ||
| 7305 | } | ||
| 7306 | |||
| 7293 | /* This is required by WaCatErrorRejectionIssue:hsw */ | 7307 | /* This is required by WaCatErrorRejectionIssue:hsw */ |
| 7294 | intel_uncore_write(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, | 7308 | intel_uncore_write(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, |
| 7295 | intel_uncore_read(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | | 7309 | intel_uncore_read(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
| @@ -412,12 +412,20 @@ intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm) · 411 unmodified lines | |||
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | /** | 414 | /** |
| 415 | * intel_runtime_pm_get_if_in_use - grab a runtime pm reference if device in use | 415 | * __intel_runtime_pm_get_if_active - grab a runtime pm reference if device is active |
| 416 | * @rpm: the intel_runtime_pm structure | 416 | * @rpm: the intel_runtime_pm structure |
| 417 | * @ignore_usecount: get a ref even if dev->power.usage_count is 0 | ||
| 417 | * | 418 | * |
| 418 | * This function grabs a device-level runtime pm reference if the device is | 419 | * This function grabs a device-level runtime pm reference if the device is |
| 419 | * already in use and ensures that it is powered up. It is illegal to try | 420 | * already active and ensures that it is powered up. It is illegal to try |
| 420 | * and access the HW should intel_runtime_pm_get_if_in_use() report failure. | 421 | * and access the HW should intel_runtime_pm_get_if_active() report failure. |
| 422 | * | ||
| 423 | * If @ignore_usecount=true, a reference will be acquired even if there is no | ||
| 424 | * user requiring the device to be powered up (dev->power.usage_count == 0). | ||
| 425 | * If the function returns false in this case then it's guaranteed that the | ||
| 426 | * device's runtime suspend hook has been called already or that it will be | ||
| 427 | * called (and hence it's also guaranteed that the device's runtime resume | ||
| 428 | * hook will be called eventually). | ||
| 421 | * | 429 | * |
| 422 | * Any runtime pm reference obtained by this function must have a symmetric | 430 | * Any runtime pm reference obtained by this function must have a symmetric |
| 423 | * call to intel_runtime_pm_put() to release the reference again. | 431 | * call to intel_runtime_pm_put() to release the reference again. |
| @@ -425,7 +433,8 @@ intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm) · 1 unmodified line | |||
| 425 | * Returns: the wakeref cookie to pass to intel_runtime_pm_put(), evaluates | 433 | * Returns: the wakeref cookie to pass to intel_runtime_pm_put(), evaluates |
| 426 | * as True if the wakeref was acquired, or False otherwise. | 434 | * as True if the wakeref was acquired, or False otherwise. |
| 427 | */ | 435 | */ |
| 428 | intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm) | 436 | static intel_wakeref_t __intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm, |
| 437 | bool ignore_usecount) | ||
| 429 | { | 438 | { |
| 430 | if (IS_ENABLED(CONFIG_PM)) { | 439 | if (IS_ENABLED(CONFIG_PM)) { |
| 431 | /* | 440 | /* |
| @@ -434,7 +443,7 @@ intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm) · 2 unmodified lines | |||
| 434 | * function, since the power state is undefined. This applies | 443 | * function, since the power state is undefined. This applies |
| 435 | * atm to the late/early system suspend/resume handlers. | 444 | * atm to the late/early system suspend/resume handlers. |
| 436 | */ | 445 | */ |
| 437 | if (pm_runtime_get_if_in_use(rpm->kdev) <= 0) | 446 | if (pm_runtime_get_if_active(rpm->kdev, ignore_usecount) <= 0) |
| 438 | return 0; | 447 | return 0; |
| 439 | } | 448 | } |
| 440 | 449 | ||
| @@ -443,6 +452,16 @@ intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm) · 2 unmodified lines | |||
| 443 | return track_intel_runtime_pm_wakeref(rpm); | 452 | return track_intel_runtime_pm_wakeref(rpm); |
| 444 | } | 453 | } |
| 445 | 454 | ||
| 455 | intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm) | ||
| 456 | { | ||
| 457 | return __intel_runtime_pm_get_if_active(rpm, false); | ||
| 458 | } | ||
| 459 | |||
| 460 | intel_wakeref_t intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm) | ||
| 461 | { | ||
| 462 | return __intel_runtime_pm_get_if_active(rpm, true); | ||
| 463 | } | ||
| 464 | |||
| 446 | /** | 465 | /** |
| 447 | * intel_runtime_pm_get_noresume - grab a runtime pm reference | 466 | * intel_runtime_pm_get_noresume - grab a runtime pm reference |
| 448 | * @rpm: the intel_runtime_pm structure | 467 | * @rpm: the intel_runtime_pm structure |
| @@ -177,6 +177,7 @@ void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm); · 176 unmodified lines | |||
| 177 | 177 | ||
| 178 | intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm); | 178 | intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm); |
| 179 | intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm); | 179 | intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm); |
| 180 | intel_wakeref_t intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm); | ||
| 180 | intel_wakeref_t intel_runtime_pm_get_noresume(struct intel_runtime_pm *rpm); | 181 | intel_wakeref_t intel_runtime_pm_get_noresume(struct intel_runtime_pm *rpm); |
| 181 | intel_wakeref_t intel_runtime_pm_get_raw(struct intel_runtime_pm *rpm); | 182 | intel_wakeref_t intel_runtime_pm_get_raw(struct intel_runtime_pm *rpm); |
| 182 | 183 | ||
| @@ -188,6 +189,10 @@ intel_wakeref_t intel_runtime_pm_get_raw(struct intel_runtime_pm *rpm); · 5 unmodified lines | |||
| 188 | for ((wf) = intel_runtime_pm_get_if_in_use(rpm); (wf); \ | 189 | for ((wf) = intel_runtime_pm_get_if_in_use(rpm); (wf); \ |
| 189 | intel_runtime_pm_put((rpm), (wf)), (wf) = 0) | 190 | intel_runtime_pm_put((rpm), (wf)), (wf) = 0) |
| 190 | 191 | ||
| 192 | #define with_intel_runtime_pm_if_active(rpm, wf) \ | ||
| 193 | for ((wf) = intel_runtime_pm_get_if_active(rpm); (wf); \ | ||
| 194 | intel_runtime_pm_put((rpm), (wf)), (wf) = 0) | ||
| 195 | |||
| 191 | void intel_runtime_pm_put_unchecked(struct intel_runtime_pm *rpm); | 196 | void intel_runtime_pm_put_unchecked(struct intel_runtime_pm *rpm); |
| 192 | #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM) | 197 | #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM) |
| 193 | void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref); | 198 | void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref); |
| @@ -304,7 +304,7 @@ int a5xx_power_init(struct msm_gpu *gpu) · 303 unmodified lines | |||
| 304 | /* Set up the limits management */ | 304 | /* Set up the limits management */ |
| 305 | if (adreno_is_a530(adreno_gpu)) | 305 | if (adreno_is_a530(adreno_gpu)) |
| 306 | a530_lm_setup(gpu); | 306 | a530_lm_setup(gpu); |
| 307 | else | 307 | else if (adreno_is_a540(adreno_gpu)) |
| 308 | a540_lm_setup(gpu); | 308 | a540_lm_setup(gpu); |
| 309 | 309 | ||
| 310 | /* Set up SP/TP power collpase */ | 310 | /* Set up SP/TP power collpase */ |
| @@ -339,7 +339,7 @@ void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state) · 338 unmodified lines | |||
| 339 | else | 339 | else |
| 340 | bit = a6xx_gmu_oob_bits[state].ack_new; | 340 | bit = a6xx_gmu_oob_bits[state].ack_new; |
| 341 | 341 | ||
| 342 | gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, bit); | 342 | gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, 1 << bit); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | /* Enable CPU control of SPTP power power collapse */ | 345 | /* Enable CPU control of SPTP power power collapse */ |
| @@ -522,28 +522,73 @@ static int a6xx_cp_init(struct msm_gpu *gpu) · 521 unmodified lines | |||
| 522 | return a6xx_idle(gpu, ring) ? 0 : -EINVAL; | 522 | return a6xx_idle(gpu, ring) ? 0 : -EINVAL; |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | static void a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, | 525 | /* |
| 526 | * Check that the microcode version is new enough to include several key | ||
| 527 | * security fixes. Return true if the ucode is safe. | ||
| 528 | */ | ||
| 529 | static bool a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, | ||
| 526 | struct drm_gem_object *obj) | 530 | struct drm_gem_object *obj) |
| 527 | { | 531 | { |
| 532 | struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; | ||
| 533 | struct msm_gpu *gpu = &adreno_gpu->base; | ||
| 528 | u32 *buf = msm_gem_get_vaddr(obj); | 534 | u32 *buf = msm_gem_get_vaddr(obj); |
| 535 | bool ret = false; | ||
| 529 | 536 | ||
| 530 | if (IS_ERR(buf)) | 537 | if (IS_ERR(buf)) |
| 531 | return; | 538 | return false; |
| 532 | 539 | ||
| 533 | /* | 540 | /* |
| 534 | * If the lowest nibble is 0xa that is an indication that this microcode | 541 | * Targets up to a640 (a618, a630 and a640) need to check for a |
| 535 | * has been patched. The actual version is in dword [3] but we only care | 542 | * microcode version that is patched to support the whereami opcode or |
| 536 | * about the patchlevel which is the lowest nibble of dword [3] | 543 | * one that is new enough to include it by default. |
| 537 | * | ||
| 538 | * Otherwise check that the firmware is greater than or equal to 1.90 | ||
| 539 | * which was the first version that had this fix built in | ||
| 540 | */ | 544 | */ |
| 541 | if (((buf[0] & 0xf) == 0xa) && (buf[2] & 0xf) >= 1) | 545 | if (adreno_is_a618(adreno_gpu) || adreno_is_a630(adreno_gpu) || |
| 542 | a6xx_gpu->has_whereami = true; | 546 | adreno_is_a640(adreno_gpu)) { |
| 543 | else if ((buf[0] & 0xfff) > 0x190) | 547 | /* |
| 544 | a6xx_gpu->has_whereami = true; | 548 | * If the lowest nibble is 0xa that is an indication that this |
| 549 | * microcode has been patched. The actual version is in dword | ||
| 550 | * [3] but we only care about the patchlevel which is the lowest | ||
| 551 | * nibble of dword [3] | ||
| 552 | * | ||
| 553 | * Otherwise check that the firmware is greater than or equal | ||
| 554 | * to 1.90 which was the first version that had this fix built | ||
| 555 | * in | ||
| 556 | */ | ||
| 557 | if ((((buf[0] & 0xf) == 0xa) && (buf[2] & 0xf) >= 1) || | ||
| 558 | (buf[0] & 0xfff) >= 0x190) { | ||
| 559 | a6xx_gpu->has_whereami = true; | ||
| 560 | ret = true; | ||
| 561 | goto out; | ||
| 562 | } | ||
| 563 | |||
| 564 | DRM_DEV_ERROR(&gpu->pdev->dev, | ||
| 565 | "a630 SQE ucode is too old. Have version %x need at least %x\n", | ||
| 566 | buf[0] & 0xfff, 0x190); | ||
| 567 | } else { | ||
| 568 | /* | ||
| 569 | * a650 tier targets don't need whereami but still need to be | ||
| 570 | * equal to or newer than 1.95 for other security fixes | ||
| 571 | */ | ||
| 572 | if (adreno_is_a650(adreno_gpu)) { | ||
| 573 | if ((buf[0] & 0xfff) >= 0x195) { | ||
| 574 | ret = true; | ||
| 575 | goto out; | ||
| 576 | } | ||
| 577 | |||
| 578 | DRM_DEV_ERROR(&gpu->pdev->dev, | ||
| 579 | "a650 SQE ucode is too old. Have version %x need at least %x\n", | ||
| 580 | buf[0] & 0xfff, 0x195); | ||
| 581 | } | ||
| 545 | 582 | ||
| 583 | /* | ||
| 584 | * When a660 is added those targets should return true here | ||
| 585 | * since those have all the critical security fixes built in | ||
| 586 | * from the start | ||
| 587 | */ | ||
| 588 | } | ||
| 589 | out: | ||
| 546 | msm_gem_put_vaddr(obj); | 590 | msm_gem_put_vaddr(obj); |
| 591 | return ret; | ||
| 547 | } | 592 | } |
| 548 | 593 | ||
| 549 | static int a6xx_ucode_init(struct msm_gpu *gpu) | 594 | static int a6xx_ucode_init(struct msm_gpu *gpu) |
| @@ -566,7 +611,13 @@ static int a6xx_ucode_init(struct msm_gpu *gpu) · 16 unmodified lines | |||
| 566 | } | 611 | } |
| 567 | 612 | ||
| 568 | msm_gem_object_set_name(a6xx_gpu->sqe_bo, "sqefw"); | 613 | msm_gem_object_set_name(a6xx_gpu->sqe_bo, "sqefw"); |
| 569 | a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo); | 614 | if (!a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo)) { |
| 615 | msm_gem_unpin_iova(a6xx_gpu->sqe_bo, gpu->aspace); | ||
| 616 | drm_gem_object_put(a6xx_gpu->sqe_bo); | ||
| 617 | |||
| 618 | a6xx_gpu->sqe_bo = NULL; | ||
| 619 | return -EPERM; | ||
| 620 | } | ||
| 570 | } | 621 | } |
| 571 | 622 | ||
| 572 | gpu_write64(gpu, REG_A6XX_CP_SQE_INSTR_BASE_LO, | 623 | gpu_write64(gpu, REG_A6XX_CP_SQE_INSTR_BASE_LO, |
| @@ -1350,35 +1401,20 @@ static int a6xx_set_supported_hw(struct device *dev, struct a6xx_gpu *a6xx_gpu, · 777 unmodified lines | |||
| 1350 | u32 revn) | 1401 | u32 revn) |
| 1351 | { | 1402 | { |
| 1352 | struct opp_table *opp_table; | 1403 | struct opp_table *opp_table; |
| 1353 | struct nvmem_cell *cell; | ||
| 1354 | u32 supp_hw = UINT_MAX; | 1404 | u32 supp_hw = UINT_MAX; |
| 1355 | void *buf; | 1405 | u16 speedbin; |
| 1356 | 1406 | int ret; | |
| 1357 | cell = nvmem_cell_get(dev, "speed_bin"); | ||
| 1358 | /* | ||
| 1359 | * -ENOENT means that the platform doesn't support speedbin which is | ||
| 1360 | * fine | ||
| 1361 | */ | ||
| 1362 | if (PTR_ERR(cell) == -ENOENT) | ||
| 1363 | return 0; | ||
| 1364 | else if (IS_ERR(cell)) { | ||
| 1365 | DRM_DEV_ERROR(dev, | ||
| 1366 | "failed to read speed-bin. Some OPPs may not be supported by hardware"); | ||
| 1367 | goto done; | ||
| 1368 | } | ||
| 1369 | 1407 | ||
| 1370 | buf = nvmem_cell_read(cell, NULL); | 1408 | ret = nvmem_cell_read_u16(dev, "speed_bin", &speedbin); |
| 1371 | if (IS_ERR(buf)) { | 1409 | if (ret) { |
| 1372 | nvmem_cell_put(cell); | ||
| 1373 | DRM_DEV_ERROR(dev, | 1410 | DRM_DEV_ERROR(dev, |
| 1374 | "failed to read speed-bin. Some OPPs may not be supported by hardware"); | 1411 | "failed to read speed-bin (%d). Some OPPs may not be supported by hardware", |
| 1412 | ret); | ||
| 1375 | goto done; | 1413 | goto done; |
| 1376 | } | 1414 | } |
| 1415 | speedbin = le16_to_cpu(speedbin); | ||
| 1377 | 1416 | ||
| 1378 | supp_hw = fuse_to_supp_hw(dev, revn, *((u32 *) buf)); | 1417 | supp_hw = fuse_to_supp_hw(dev, revn, speedbin); |
| 1379 | |||
| 1380 | kfree(buf); | ||
| 1381 | nvmem_cell_put(cell); | ||
| 1382 | 1418 | ||
| 1383 | done: | 1419 | done: |
| 1384 | opp_table = dev_pm_opp_set_supported_hw(dev, &supp_hw, 1); | 1420 | opp_table = dev_pm_opp_set_supported_hw(dev, &supp_hw, 1); |
| @@ -43,6 +43,8 @@ · 42 unmodified lines | |||
| 43 | #define DPU_DEBUGFS_DIR "msm_dpu" | 43 | #define DPU_DEBUGFS_DIR "msm_dpu" |
| 44 | #define DPU_DEBUGFS_HWMASKNAME "hw_log_mask" | 44 | #define DPU_DEBUGFS_HWMASKNAME "hw_log_mask" |
| 45 | 45 | ||
| 46 | #define MIN_IB_BW 400000000ULL /* Min ib vote 400MB */ | ||
| 47 | |||
| 46 | static int dpu_kms_hw_init(struct msm_kms *kms); | 48 | static int dpu_kms_hw_init(struct msm_kms *kms); |
| 47 | static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); | 49 | static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); |
| 48 | 50 | ||
| @@ -931,6 +933,9 @@ static int dpu_kms_hw_init(struct msm_kms *kms) · 882 unmodified lines | |||
| 931 | DPU_DEBUG("REG_DMA is not defined"); | 933 | DPU_DEBUG("REG_DMA is not defined"); |
| 932 | } | 934 | } |
| 933 | 935 | ||
| 936 | if (of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss")) | ||
| 937 | dpu_kms_parse_data_bus_icc_path(dpu_kms); | ||
| 938 | |||
| 934 | pm_runtime_get_sync(&dpu_kms->pdev->dev); | 939 | pm_runtime_get_sync(&dpu_kms->pdev->dev); |
| 935 | 940 | ||
| 936 | dpu_kms->core_rev = readl_relaxed(dpu_kms->mmio + 0x0); | 941 | dpu_kms->core_rev = readl_relaxed(dpu_kms->mmio + 0x0); |
| @@ -1032,9 +1037,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) · 95 unmodified lines | |||
| 1032 | 1037 | ||
| 1033 | dpu_vbif_init_memtypes(dpu_kms); | 1038 | dpu_vbif_init_memtypes(dpu_kms); |
| 1034 | 1039 | ||
| 1035 | if (of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss")) | ||
| 1036 | dpu_kms_parse_data_bus_icc_path(dpu_kms); | ||
| 1037 | |||
| 1038 | pm_runtime_put_sync(&dpu_kms->pdev->dev); | 1040 | pm_runtime_put_sync(&dpu_kms->pdev->dev); |
| 1039 | 1041 | ||
| 1040 | return 0; | 1042 | return 0; |
| @@ -1191,10 +1193,10 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) · 150 unmodified lines | |||
| 1191 | 1193 | ||
| 1192 | ddev = dpu_kms->dev; | 1194 | ddev = dpu_kms->dev; |
| 1193 | 1195 | ||
| 1196 | WARN_ON(!(dpu_kms->num_paths)); | ||
| 1194 | /* Min vote of BW is required before turning on AXI clk */ | 1197 | /* Min vote of BW is required before turning on AXI clk */ |
| 1195 | for (i = 0; i < dpu_kms->num_paths; i++) | 1198 | for (i = 0; i < dpu_kms->num_paths; i++) |
| 1196 | icc_set_bw(dpu_kms->path[i], 0, | 1199 | icc_set_bw(dpu_kms->path[i], 0, Bps_to_icc(MIN_IB_BW)); |
| 1197 | dpu_kms->catalog->perf.min_dram_ib); | ||
| 1198 | 1200 | ||
| 1199 | rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true); | 1201 | rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true); |
| 1200 | if (rc) { | 1202 | if (rc) { |
| @@ -32,6 +32,8 @@ struct dp_aux_private { · 31 unmodified lines | |||
| 32 | struct drm_dp_aux dp_aux; | 32 | struct drm_dp_aux dp_aux; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | #define MAX_AUX_RETRIES 5 | ||
| 36 | |||
| 35 | static const char *dp_aux_get_error(u32 aux_error) | 37 | static const char *dp_aux_get_error(u32 aux_error) |
| 36 | { | 38 | { |
| 37 | switch (aux_error) { | 39 | switch (aux_error) { |
| @@ -377,6 +379,11 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, · 339 unmodified lines | |||
| 377 | ret = dp_aux_cmd_fifo_tx(aux, msg); | 379 | ret = dp_aux_cmd_fifo_tx(aux, msg); |
| 378 | 380 | ||
| 379 | if (ret < 0) { | 381 | if (ret < 0) { |
| 382 | if (aux->native) { | ||
| 383 | aux->retry_cnt++; | ||
| 384 | if (!(aux->retry_cnt % MAX_AUX_RETRIES)) | ||
| 385 | dp_catalog_aux_update_cfg(aux->catalog); | ||
| 386 | } | ||
| 380 | usleep_range(400, 500); /* at least 400us to next try */ | 387 | usleep_range(400, 500); /* at least 400us to next try */ |
| 381 | goto unlock_exit; | 388 | goto unlock_exit; |
| 382 | } | 389 | } |
| @@ -163,7 +163,7 @@ struct msm_dsi_pll *msm_dsi_pll_init(struct platform_device *pdev, · 162 unmodified lines | |||
| 163 | break; | 163 | break; |
| 164 | case MSM_DSI_PHY_7NM: | 164 | case MSM_DSI_PHY_7NM: |
| 165 | case MSM_DSI_PHY_7NM_V4_1: | 165 | case MSM_DSI_PHY_7NM_V4_1: |
| 166 | pll = msm_dsi_pll_7nm_init(pdev, id); | 166 | pll = msm_dsi_pll_7nm_init(pdev, type, id); |
| 167 | break; | 167 | break; |
| 168 | default: | 168 | default: |
| 169 | pll = ERR_PTR(-ENXIO); | 169 | pll = ERR_PTR(-ENXIO); |
| @@ -117,10 +117,12 @@ msm_dsi_pll_10nm_init(struct platform_device *pdev, int id) · 116 unmodified lines | |||
| 117 | } | 117 | } |
| 118 | #endif | 118 | #endif |
| 119 | #ifdef CONFIG_DRM_MSM_DSI_7NM_PHY | 119 | #ifdef CONFIG_DRM_MSM_DSI_7NM_PHY |
| 120 | struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, int id); | 120 | struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, |
| 121 | enum msm_dsi_phy_type type, int id); | ||
| 121 | #else | 122 | #else |
| 122 | static inline struct msm_dsi_pll * | 123 | static inline struct msm_dsi_pll * |
| 123 | msm_dsi_pll_7nm_init(struct platform_device *pdev, int id) | 124 | msm_dsi_pll_7nm_init(struct platform_device *pdev, |
| 125 | enum msm_dsi_phy_type type, int id) | ||
| 124 | { | 126 | { |
| 125 | return ERR_PTR(-ENODEV); | 127 | return ERR_PTR(-ENODEV); |
| 126 | } | 128 | } |
| @@ -325,7 +325,7 @@ static void dsi_pll_commit(struct dsi_pll_7nm *pll) · 324 unmodified lines | |||
| 325 | pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_LOW_1, reg->frac_div_start_low); | 325 | pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_LOW_1, reg->frac_div_start_low); |
| 326 | pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_MID_1, reg->frac_div_start_mid); | 326 | pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_MID_1, reg->frac_div_start_mid); |
| 327 | pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_HIGH_1, reg->frac_div_start_high); | 327 | pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_HIGH_1, reg->frac_div_start_high); |
| 328 | pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCKDET_RATE_1, 0x40); | 328 | pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCKDET_RATE_1, reg->pll_lockdet_rate); |
| 329 | pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCK_DELAY, 0x06); | 329 | pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCK_DELAY, 0x06); |
| 330 | pll_write(base + REG_DSI_7nm_PHY_PLL_CMODE_1, 0x10); /* TODO: 0x00 for CPHY */ | 330 | pll_write(base + REG_DSI_7nm_PHY_PLL_CMODE_1, 0x10); /* TODO: 0x00 for CPHY */ |
| 331 | pll_write(base + REG_DSI_7nm_PHY_PLL_CLOCK_INVERTERS, reg->pll_clock_inverters); | 331 | pll_write(base + REG_DSI_7nm_PHY_PLL_CLOCK_INVERTERS, reg->pll_clock_inverters); |
| @@ -509,6 +509,7 @@ static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw, · 177 unmodified lines | |||
| 509 | { | 509 | { |
| 510 | struct msm_dsi_pll *pll = hw_clk_to_pll(hw); | 510 | struct msm_dsi_pll *pll = hw_clk_to_pll(hw); |
| 511 | struct dsi_pll_7nm *pll_7nm = to_pll_7nm(pll); | 511 | struct dsi_pll_7nm *pll_7nm = to_pll_7nm(pll); |
| 512 | struct dsi_pll_config *config = &pll_7nm->pll_configuration; | ||
| 512 | void __iomem *base = pll_7nm->mmio; | 513 | void __iomem *base = pll_7nm->mmio; |
| 513 | u64 ref_clk = pll_7nm->vco_ref_clk_rate; | 514 | u64 ref_clk = pll_7nm->vco_ref_clk_rate; |
| 514 | u64 vco_rate = 0x0; | 515 | u64 vco_rate = 0x0; |
| @@ -529,9 +530,8 @@ static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw, · 14 unmodified lines | |||
| 529 | /* | 530 | /* |
| 530 | * TODO: | 531 | * TODO: |
| 531 | * 1. Assumes prescaler is disabled | 532 | * 1. Assumes prescaler is disabled |
| 532 | * 2. Multiplier is 2^18. it should be 2^(num_of_frac_bits) | ||
| 533 | */ | 533 | */ |
| 534 | multiplier = 1 << 18; | 534 | multiplier = 1 << config->frac_bits; |
| 535 | pll_freq = dec * (ref_clk * 2); | 535 | pll_freq = dec * (ref_clk * 2); |
| 536 | tmp64 = (ref_clk * 2 * frac); | 536 | tmp64 = (ref_clk * 2 * frac); |
| 537 | pll_freq += div_u64(tmp64, multiplier); | 537 | pll_freq += div_u64(tmp64, multiplier); |
| @@ -852,7 +852,8 @@ err_base_clk_hw: · 314 unmodified lines | |||
| 852 | return ret; | 852 | return ret; |
| 853 | } | 853 | } |
| 854 | 854 | ||
| 855 | struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, int id) | 855 | struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, |
| 856 | enum msm_dsi_phy_type type, int id) | ||
| 856 | { | 857 | { |
| 857 | struct dsi_pll_7nm *pll_7nm; | 858 | struct dsi_pll_7nm *pll_7nm; |
| 858 | struct msm_dsi_pll *pll; | 859 | struct msm_dsi_pll *pll; |
| @@ -885,7 +886,7 @@ struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, int id) · 26 unmodified lines | |||
| 885 | pll = &pll_7nm->base; | 886 | pll = &pll_7nm->base; |
| 886 | pll->min_rate = 1000000000UL; | 887 | pll->min_rate = 1000000000UL; |
| 887 | pll->max_rate = 3500000000UL; | 888 | pll->max_rate = 3500000000UL; |
| 888 | if (pll->type == MSM_DSI_PHY_7NM_V4_1) { | 889 | if (type == MSM_DSI_PHY_7NM_V4_1) { |
| 889 | pll->min_rate = 600000000UL; | 890 | pll->min_rate = 600000000UL; |
| 890 | pll->max_rate = (unsigned long)5000000000ULL; | 891 | pll->max_rate = (unsigned long)5000000000ULL; |
| 891 | /* workaround for max rate overflowing on 32-bit builds: */ | 892 | /* workaround for max rate overflowing on 32-bit builds: */ |
| @@ -57,10 +57,13 @@ static void vblank_put(struct msm_kms *kms, unsigned crtc_mask) · 56 unmodified lines | |||
| 57 | 57 | ||
| 58 | static void lock_crtcs(struct msm_kms *kms, unsigned int crtc_mask) | 58 | static void lock_crtcs(struct msm_kms *kms, unsigned int crtc_mask) |
| 59 | { | 59 | { |
| 60 | int crtc_index; | ||
| 60 | struct drm_crtc *crtc; | 61 | struct drm_crtc *crtc; |
| 61 | 62 | ||
| 62 | for_each_crtc_mask(kms->dev, crtc, crtc_mask) | 63 | for_each_crtc_mask(kms->dev, crtc, crtc_mask) { |
| 63 | mutex_lock(&kms->commit_lock[drm_crtc_index(crtc)]); | 64 | crtc_index = drm_crtc_index(crtc); |
| 65 | mutex_lock_nested(&kms->commit_lock[crtc_index], crtc_index); | ||
| 66 | } | ||
| 64 | } | 67 | } |
| 65 | 68 | ||
| 66 | static void unlock_crtcs(struct msm_kms *kms, unsigned int crtc_mask) | 69 | static void unlock_crtcs(struct msm_kms *kms, unsigned int crtc_mask) |
| @@ -1072,6 +1072,10 @@ static int __maybe_unused msm_pm_resume(struct device *dev) · 1071 unmodified lines | |||
| 1072 | static int __maybe_unused msm_pm_prepare(struct device *dev) | 1072 | static int __maybe_unused msm_pm_prepare(struct device *dev) |
| 1073 | { | 1073 | { |
| 1074 | struct drm_device *ddev = dev_get_drvdata(dev); | 1074 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 1075 | struct msm_drm_private *priv = ddev ? ddev->dev_private : NULL; | ||
| 1076 | |||
| 1077 | if (!priv || !priv->kms) | ||
| 1078 | return 0; | ||
| 1075 | 1079 | ||
| 1076 | return drm_mode_config_helper_suspend(ddev); | 1080 | return drm_mode_config_helper_suspend(ddev); |
| 1077 | } | 1081 | } |
| @@ -1079,6 +1083,10 @@ static int __maybe_unused msm_pm_prepare(struct device *dev) · 1 unmodified line | |||
| 1079 | static void __maybe_unused msm_pm_complete(struct device *dev) | 1083 | static void __maybe_unused msm_pm_complete(struct device *dev) |
| 1080 | { | 1084 | { |
| 1081 | struct drm_device *ddev = dev_get_drvdata(dev); | 1085 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 1086 | struct msm_drm_private *priv = ddev ? ddev->dev_private : NULL; | ||
| 1087 | |||
| 1088 | if (!priv || !priv->kms) | ||
| 1089 | return; | ||
| 1082 | 1090 | ||
| 1083 | drm_mode_config_helper_resume(ddev); | 1091 | drm_mode_config_helper_resume(ddev); |
| 1084 | } | 1092 | } |
| @@ -1311,6 +1319,10 @@ static int msm_pdev_remove(struct platform_device *pdev) · 226 unmodified lines | |||
| 1311 | static void msm_pdev_shutdown(struct platform_device *pdev) | 1319 | static void msm_pdev_shutdown(struct platform_device *pdev) |
| 1312 | { | 1320 | { |
| 1313 | struct drm_device *drm = platform_get_drvdata(pdev); | 1321 | struct drm_device *drm = platform_get_drvdata(pdev); |
| 1322 | struct msm_drm_private *priv = drm ? drm->dev_private : NULL; | ||
| 1323 | |||
| 1324 | if (!priv || !priv->kms) | ||
| 1325 | return; | ||
| 1314 | 1326 | ||
| 1315 | drm_atomic_helper_shutdown(drm); | 1327 | drm_atomic_helper_shutdown(drm); |
| 1316 | } | 1328 | } |
| @@ -45,7 +45,7 @@ int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence, · 44 unmodified lines | |||
| 45 | int ret; | 45 | int ret; |
| 46 | 46 | ||
| 47 | if (fence > fctx->last_fence) { | 47 | if (fence > fctx->last_fence) { |
| 48 | DRM_ERROR("%s: waiting on invalid fence: %u (of %u)\n", | 48 | DRM_ERROR_RATELIMITED("%s: waiting on invalid fence: %u (of %u)\n", |
| 49 | fctx->name, fence, fctx->last_fence); | 49 | fctx->name, fence, fctx->last_fence); |
| 50 | return -EINVAL; | 50 | return -EINVAL; |
| 51 | } | 51 | } |
| @@ -157,7 +157,6 @@ struct msm_kms { · 156 unmodified lines | |||
| 157 | * from the crtc's pending_timer close to end of the frame: | 157 | * from the crtc's pending_timer close to end of the frame: |
| 158 | */ | 158 | */ |
| 159 | struct mutex commit_lock[MAX_CRTCS]; | 159 | struct mutex commit_lock[MAX_CRTCS]; |
| 160 | struct lock_class_key commit_lock_keys[MAX_CRTCS]; | ||
| 161 | unsigned pending_crtc_mask; | 160 | unsigned pending_crtc_mask; |
| 162 | struct msm_pending_timer pending_timers[MAX_CRTCS]; | 161 | struct msm_pending_timer pending_timers[MAX_CRTCS]; |
| 163 | }; | 162 | }; |
| @@ -167,11 +166,8 @@ static inline int msm_kms_init(struct msm_kms *kms, · 3 unmodified lines | |||
| 167 | { | 166 | { |
| 168 | unsigned i, ret; | 167 | unsigned i, ret; |
| 169 | 168 | ||
| 170 | for (i = 0; i < ARRAY_SIZE(kms->commit_lock); i++) { | 169 | for (i = 0; i < ARRAY_SIZE(kms->commit_lock); i++) |
| 171 | lockdep_register_key(&kms->commit_lock_keys[i]); | 170 | mutex_init(&kms->commit_lock[i]); |
| 172 | __mutex_init(&kms->commit_lock[i], "&kms->commit_lock[i]", | ||
| 173 | &kms->commit_lock_keys[i]); | ||
| 174 | } | ||
| 175 | 171 | ||
| 176 | kms->funcs = funcs; | 172 | kms->funcs = funcs; |
| 177 | 173 | ||
| @@ -2693,9 +2693,20 @@ nv50_display_create(struct drm_device *dev) · 2692 unmodified lines | |||
| 2693 | else | 2693 | else |
| 2694 | nouveau_display(dev)->format_modifiers = disp50xx_modifiers; | 2694 | nouveau_display(dev)->format_modifiers = disp50xx_modifiers; |
| 2695 | 2695 | ||
| 2696 | if (disp->disp->object.oclass >= GK104_DISP) { | 2696 | /* FIXME: 256x256 cursors are supported on Kepler, however unlike Maxwell and later |
| 2697 | * generations Kepler requires that we use small pages (4K) for cursor scanout surfaces. The | ||
| 2698 | * proper fix for this is to teach nouveau to migrate fbs being used for the cursor plane to | ||
| 2699 | * small page allocations in prepare_fb(). When this is implemented, we should also force | ||
| 2700 | * large pages (128K) for ovly fbs in order to fix Kepler ovlys. | ||
| 2701 | * But until then, just limit cursors to 128x128 - which is small enough to avoid ever using | ||
| 2702 | * large pages. | ||
| 2703 | */ | ||
| 2704 | if (disp->disp->object.oclass >= GM107_DISP) { | ||
| 2697 | dev->mode_config.cursor_width = 256; | 2705 | dev->mode_config.cursor_width = 256; |
| 2698 | dev->mode_config.cursor_height = 256; | 2706 | dev->mode_config.cursor_height = 256; |
| 2707 | } else if (disp->disp->object.oclass >= GK104_DISP) { | ||
| 2708 | dev->mode_config.cursor_width = 128; | ||
| 2709 | dev->mode_config.cursor_height = 128; | ||
| 2699 | } else { | 2710 | } else { |
| 2700 | dev->mode_config.cursor_width = 64; | 2711 | dev->mode_config.cursor_width = 64; |
| 2701 | dev->mode_config.cursor_height = 64; | 2712 | dev->mode_config.cursor_height = 64; |
| @@ -551,6 +551,10 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo) · 550 unmodified lines | |||
| 551 | 551 | ||
| 552 | if (!ttm_dma) | 552 | if (!ttm_dma) |
| 553 | return; | 553 | return; |
| 554 | if (!ttm_dma->pages) { | ||
| 555 | NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma); | ||
| 556 | return; | ||
| 557 | } | ||
| 554 | 558 | ||
| 555 | /* Don't waste time looping if the object is coherent */ | 559 | /* Don't waste time looping if the object is coherent */ |
| 556 | if (nvbo->force_coherent) | 560 | if (nvbo->force_coherent) |
| @@ -583,6 +587,10 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo) · 26 unmodified lines | |||
| 583 | 587 | ||
| 584 | if (!ttm_dma) | 588 | if (!ttm_dma) |
| 585 | return; | 589 | return; |
| 590 | if (!ttm_dma->pages) { | ||
| 591 | NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma); | ||
| 592 | return; | ||
| 593 | } | ||
| 586 | 594 | ||
| 587 | /* Don't waste time looping if the object is coherent */ | 595 | /* Don't waste time looping if the object is coherent */ |
| 588 | if (nvbo->force_coherent) | 596 | if (nvbo->force_coherent) |
| @@ -2149,11 +2149,12 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int vc, · 2148 unmodified lines | |||
| 2149 | const struct mipi_dsi_msg *msg) | 2149 | const struct mipi_dsi_msg *msg) |
| 2150 | { | 2150 | { |
| 2151 | struct mipi_dsi_packet pkt; | 2151 | struct mipi_dsi_packet pkt; |
| 2152 | int ret; | ||
| 2152 | u32 r; | 2153 | u32 r; |
| 2153 | 2154 | ||
| 2154 | r = mipi_dsi_create_packet(&pkt, msg); | 2155 | ret = mipi_dsi_create_packet(&pkt, msg); |
| 2155 | if (r < 0) | 2156 | if (ret < 0) |
| 2156 | return r; | 2157 | return ret; |
| 2157 | 2158 | ||
| 2158 | WARN_ON(!dsi_bus_is_locked(dsi)); | 2159 | WARN_ON(!dsi_bus_is_locked(dsi)); |
| 2159 | 2160 | ||
| @@ -48,21 +48,12 @@ static unsigned int rcar_du_encoder_count_ports(struct device_node *node) · 47 unmodified lines | |||
| 48 | static const struct drm_encoder_funcs rcar_du_encoder_funcs = { | 48 | static const struct drm_encoder_funcs rcar_du_encoder_funcs = { |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | static void rcar_du_encoder_release(struct drm_device *dev, void *res) | ||
| 52 | { | ||
| 53 | struct rcar_du_encoder *renc = res; | ||
| 54 | |||
| 55 | drm_encoder_cleanup(&renc->base); | ||
| 56 | kfree(renc); | ||
| 57 | } | ||
| 58 | |||
| 59 | int rcar_du_encoder_init(struct rcar_du_device *rcdu, | 51 | int rcar_du_encoder_init(struct rcar_du_device *rcdu, |
| 60 | enum rcar_du_output output, | 52 | enum rcar_du_output output, |
| 61 | struct device_node *enc_node) | 53 | struct device_node *enc_node) |
| 62 | { | 54 | { |
| 63 | struct rcar_du_encoder *renc; | 55 | struct rcar_du_encoder *renc; |
| 64 | struct drm_bridge *bridge; | 56 | struct drm_bridge *bridge; |
| 65 | int ret; | ||
| 66 | 57 | ||
| 67 | /* | 58 | /* |
| 68 | * Locate the DRM bridge from the DT node. For the DPAD outputs, if the | 59 | * Locate the DRM bridge from the DT node. For the DPAD outputs, if the |
| @@ -101,26 +92,16 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, · 32 unmodified lines | |||
| 101 | return -ENOLINK; | 92 | return -ENOLINK; |
| 102 | } | 93 | } |
| 103 | 94 | ||
| 104 | renc = kzalloc(sizeof(*renc), GFP_KERNEL); | ||
| 105 | if (renc == NULL) | ||
| 106 | return -ENOMEM; | ||
| 107 | |||
| 108 | renc->output = output; | ||
| 109 | |||
| 110 | dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n", | 95 | dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n", |
| 111 | enc_node, output); | 96 | enc_node, output); |
| 112 | 97 | ||
| 113 | ret = drm_encoder_init(&rcdu->ddev, &renc->base, &rcar_du_encoder_funcs, | 98 | renc = drmm_encoder_alloc(&rcdu->ddev, struct rcar_du_encoder, base, |
| 114 | DRM_MODE_ENCODER_NONE, NULL); | 99 | &rcar_du_encoder_funcs, DRM_MODE_ENCODER_NONE, |
| 115 | if (ret < 0) { | 100 | NULL); |
| 116 | kfree(renc); | 101 | if (!renc) |
| 117 | return ret; | 102 | return -ENOMEM; |
| 118 | } | ||
| 119 | 103 | ||
| 120 | ret = drmm_add_action_or_reset(&rcdu->ddev, rcar_du_encoder_release, | 104 | renc->output = output; |
| 121 | renc); | ||
| 122 | if (ret) | ||
| 123 | return ret; | ||
| 124 | 105 | ||
| 125 | /* | 106 | /* |
| 126 | * Attach the bridge to the encoder. The bridge will create the | 107 | * Attach the bridge to the encoder. The bridge will create the |
| @@ -266,6 +266,8 @@ config ADI_AXI_ADC · 265 unmodified lines | |||
| 266 | select IIO_BUFFER | 266 | select IIO_BUFFER |
| 267 | select IIO_BUFFER_HW_CONSUMER | 267 | select IIO_BUFFER_HW_CONSUMER |
| 268 | select IIO_BUFFER_DMAENGINE | 268 | select IIO_BUFFER_DMAENGINE |
| 269 | depends on HAS_IOMEM | ||
| 270 | depends on OF | ||
| 269 | help | 271 | help |
| 270 | Say yes here to build support for Analog Devices Generic | 272 | Say yes here to build support for Analog Devices Generic |
| 271 | AXI ADC IP core. The IP core is used for interfacing with | 273 | AXI ADC IP core. The IP core is used for interfacing with |
| @@ -923,6 +925,7 @@ config STM32_ADC_CORE · 651 unmodified lines | |||
| 923 | depends on ARCH_STM32 || COMPILE_TEST | 925 | depends on ARCH_STM32 || COMPILE_TEST |
| 924 | depends on OF | 926 | depends on OF |
| 925 | depends on REGULATOR | 927 | depends on REGULATOR |
| 928 | depends on HAS_IOMEM | ||
| 926 | select IIO_BUFFER | 929 | select IIO_BUFFER |
| 927 | select MFD_STM32_TIMERS | 930 | select MFD_STM32_TIMERS |
| 928 | select IIO_STM32_TIMER_TRIGGER | 931 | select IIO_STM32_TIMER_TRIGGER |
| @@ -918,7 +918,7 @@ static int ab8500_gpadc_read_raw(struct iio_dev *indio_dev, · 917 unmodified lines | |||
| 918 | return processed; | 918 | return processed; |
| 919 | 919 | ||
| 920 | /* Return millivolt or milliamps or millicentigrades */ | 920 | /* Return millivolt or milliamps or millicentigrades */ |
| 921 | *val = processed * 1000; | 921 | *val = processed; |
| 922 | return IIO_VAL_INT; | 922 | return IIO_VAL_INT; |
| 923 | } | 923 | } |
| 924 | 924 | ||
| @@ -91,7 +91,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val, · 90 unmodified lines | |||
| 91 | int ret; | 91 | int ret; |
| 92 | int i; | 92 | int i; |
| 93 | int bits_per_word = ad7949_adc->resolution; | 93 | int bits_per_word = ad7949_adc->resolution; |
| 94 | int mask = GENMASK(ad7949_adc->resolution, 0); | 94 | int mask = GENMASK(ad7949_adc->resolution - 1, 0); |
| 95 | struct spi_message msg; | 95 | struct spi_message msg; |
| 96 | struct spi_transfer tx[] = { | 96 | struct spi_transfer tx[] = { |
| 97 | { | 97 | { |
| @@ -597,7 +597,7 @@ static const struct vadc_channels vadc_chans[] = { · 596 unmodified lines | |||
| 597 | VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1) | 597 | VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1) |
| 598 | 598 | ||
| 599 | VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0) | 599 | VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0) |
| 600 | VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0) | 600 | VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT) |
| 601 | VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0) | 601 | VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0) |
| 602 | VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0) | 602 | VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0) |
| 603 | VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0) | 603 | VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0) |
| @@ -551,6 +551,8 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p) · 550 unmodified lines | |||
| 551 | MPU3050_FIFO_R, | 551 | MPU3050_FIFO_R, |
| 552 | &fifo_values[offset], | 552 | &fifo_values[offset], |
| 553 | toread); | 553 | toread); |
| 554 | if (ret) | ||
| 555 | goto out_trigger_unlock; | ||
| 554 | 556 | ||
| 555 | dev_dbg(mpu3050->dev, | 557 | dev_dbg(mpu3050->dev, |
| 556 | "%04x %04x %04x %04x %04x\n", | 558 | "%04x %04x %04x %04x %04x\n", |
| @@ -15,7 +15,10 @@ · 14 unmodified lines | |||
| 15 | struct hid_humidity_state { | 15 | struct hid_humidity_state { |
| 16 | struct hid_sensor_common common_attributes; | 16 | struct hid_sensor_common common_attributes; |
| 17 | struct hid_sensor_hub_attribute_info humidity_attr; | 17 | struct hid_sensor_hub_attribute_info humidity_attr; |
| 18 | s32 humidity_data; | 18 | struct { |
| 19 | s32 humidity_data; | ||
| 20 | u64 timestamp __aligned(8); | ||
| 21 | } scan; | ||
| 19 | int scale_pre_decml; | 22 | int scale_pre_decml; |
| 20 | int scale_post_decml; | 23 | int scale_post_decml; |
| 21 | int scale_precision; | 24 | int scale_precision; |
| @@ -125,9 +128,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev, · 103 unmodified lines | |||
| 125 | struct hid_humidity_state *humid_st = iio_priv(indio_dev); | 128 | struct hid_humidity_state *humid_st = iio_priv(indio_dev); |
| 126 | 129 | ||
| 127 | if (atomic_read(&humid_st->common_attributes.data_ready)) | 130 | if (atomic_read(&humid_st->common_attributes.data_ready)) |
| 128 | iio_push_to_buffers_with_timestamp(indio_dev, | 131 | iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan, |
| 129 | &humid_st->humidity_data, | 132 | iio_get_time_ns(indio_dev)); |
| 130 | iio_get_time_ns(indio_dev)); | ||
| 131 | 133 | ||
| 132 | return 0; | 134 | return 0; |
| 133 | } | 135 | } |
| @@ -142,7 +144,7 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev, · 8 unmodified lines | |||
| 142 | 144 | ||
| 143 | switch (usage_id) { | 145 | switch (usage_id) { |
| 144 | case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY: | 146 | case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY: |
| 145 | humid_st->humidity_data = *(s32 *)raw_data; | 147 | humid_st->scan.humidity_data = *(s32 *)raw_data; |
| 146 | 148 | ||
| 147 | return 0; | 149 | return 0; |
| 148 | default: | 150 | default: |
| @@ -462,8 +462,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev) · 461 unmodified lines | |||
| 462 | if (ret) | 462 | if (ret) |
| 463 | goto err_ret; | 463 | goto err_ret; |
| 464 | 464 | ||
| 465 | ret = sscanf(indio_dev->name, "adis%u\n", &device_id); | 465 | if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) { |
| 466 | if (ret != 1) { | ||
| 467 | ret = -EINVAL; | 466 | ret = -EINVAL; |
| 468 | goto err_ret; | 467 | goto err_ret; |
| 469 | } | 468 | } |
| @@ -23,6 +23,9 @@ struct prox_state { · 22 unmodified lines | |||
| 23 | struct hid_sensor_common common_attributes; | 23 | struct hid_sensor_common common_attributes; |
| 24 | struct hid_sensor_hub_attribute_info prox_attr; | 24 | struct hid_sensor_hub_attribute_info prox_attr; |
| 25 | u32 human_presence; | 25 | u32 human_presence; |
| 26 | int scale_pre_decml; | ||
| 27 | int scale_post_decml; | ||
| 28 | int scale_precision; | ||
| 26 | }; | 29 | }; |
| 27 | 30 | ||
| 28 | /* Channel definitions */ | 31 | /* Channel definitions */ |
| @@ -93,8 +96,9 @@ static int prox_read_raw(struct iio_dev *indio_dev, · 64 unmodified lines | |||
| 93 | ret_type = IIO_VAL_INT; | 96 | ret_type = IIO_VAL_INT; |
| 94 | break; | 97 | break; |
| 95 | case IIO_CHAN_INFO_SCALE: | 98 | case IIO_CHAN_INFO_SCALE: |
| 96 | *val = prox_state->prox_attr.units; | 99 | *val = prox_state->scale_pre_decml; |
| 97 | ret_type = IIO_VAL_INT; | 100 | *val2 = prox_state->scale_post_decml; |
| 101 | ret_type = prox_state->scale_precision; | ||
| 98 | break; | 102 | break; |
| 99 | case IIO_CHAN_INFO_OFFSET: | 103 | case IIO_CHAN_INFO_OFFSET: |
| 100 | *val = hid_sensor_convert_exponent( | 104 | *val = hid_sensor_convert_exponent( |
| @@ -234,6 +238,11 @@ static int prox_parse_report(struct platform_device *pdev, · 133 unmodified lines | |||
| 234 | HID_USAGE_SENSOR_HUMAN_PRESENCE, | 238 | HID_USAGE_SENSOR_HUMAN_PRESENCE, |
| 235 | &st->common_attributes.sensitivity); | 239 | &st->common_attributes.sensitivity); |
| 236 | 240 | ||
| 241 | st->scale_precision = hid_sensor_format_scale( | ||
| 242 | hsdev->usage, | ||
| 243 | &st->prox_attr, | ||
| 244 | &st->scale_pre_decml, &st->scale_post_decml); | ||
| 245 | |||
| 237 | return ret; | 246 | return ret; |
| 238 | } | 247 | } |
| 239 | 248 | ||
| @@ -15,7 +15,10 @@ · 14 unmodified lines | |||
| 15 | struct temperature_state { | 15 | struct temperature_state { |
| 16 | struct hid_sensor_common common_attributes; | 16 | struct hid_sensor_common common_attributes; |
| 17 | struct hid_sensor_hub_attribute_info temperature_attr; | 17 | struct hid_sensor_hub_attribute_info temperature_attr; |
| 18 | s32 temperature_data; | 18 | struct { |
| 19 | s32 temperature_data; | ||
| 20 | u64 timestamp __aligned(8); | ||
| 21 | } scan; | ||
| 19 | int scale_pre_decml; | 22 | int scale_pre_decml; |
| 20 | int scale_post_decml; | 23 | int scale_post_decml; |
| 21 | int scale_precision; | 24 | int scale_precision; |
| @@ -32,7 +35,7 @@ static const struct iio_chan_spec temperature_channels[] = { · 10 unmodified lines | |||
| 32 | BIT(IIO_CHAN_INFO_SAMP_FREQ) | | 35 | BIT(IIO_CHAN_INFO_SAMP_FREQ) | |
| 33 | BIT(IIO_CHAN_INFO_HYSTERESIS), | 36 | BIT(IIO_CHAN_INFO_HYSTERESIS), |
| 34 | }, | 37 | }, |
| 35 | IIO_CHAN_SOFT_TIMESTAMP(3), | 38 | IIO_CHAN_SOFT_TIMESTAMP(1), |
| 36 | }; | 39 | }; |
| 37 | 40 | ||
| 38 | /* Adjust channel real bits based on report descriptor */ | 41 | /* Adjust channel real bits based on report descriptor */ |
| @@ -123,9 +126,8 @@ static int temperature_proc_event(struct hid_sensor_hub_device *hsdev, · 84 unmodified lines | |||
| 123 | struct temperature_state *temp_st = iio_priv(indio_dev); | 126 | struct temperature_state *temp_st = iio_priv(indio_dev); |
| 124 | 127 | ||
| 125 | if (atomic_read(&temp_st->common_attributes.data_ready)) | 128 | if (atomic_read(&temp_st->common_attributes.data_ready)) |
| 126 | iio_push_to_buffers_with_timestamp(indio_dev, | 129 | iio_push_to_buffers_with_timestamp(indio_dev, &temp_st->scan, |
| 127 | &temp_st->temperature_data, | 130 | iio_get_time_ns(indio_dev)); |
| 128 | iio_get_time_ns(indio_dev)); | ||
| 129 | 131 | ||
| 130 | return 0; | 132 | return 0; |
| 131 | } | 133 | } |
| @@ -140,7 +142,7 @@ static int temperature_capture_sample(struct hid_sensor_hub_device *hsdev, · 8 unmodified lines | |||
| 140 | 142 | ||
| 141 | switch (usage_id) { | 143 | switch (usage_id) { |
| 142 | case HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE: | 144 | case HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE: |
| 143 | temp_st->temperature_data = *(s32 *)raw_data; | 145 | temp_st->scan.temperature_data = *(s32 *)raw_data; |
| 144 | return 0; | 146 | return 0; |
| 145 | default: | 147 | default: |
| 146 | return -EINVAL; | 148 | return -EINVAL; |
| @@ -3610,13 +3610,13 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id) · 3609 unmodified lines | |||
| 3610 | ep->com.local_addr.ss_family == AF_INET) { | 3610 | ep->com.local_addr.ss_family == AF_INET) { |
| 3611 | err = cxgb4_remove_server_filter( | 3611 | err = cxgb4_remove_server_filter( |
| 3612 | ep->com.dev->rdev.lldi.ports[0], ep->stid, | 3612 | ep->com.dev->rdev.lldi.ports[0], ep->stid, |
| 3613 | ep->com.dev->rdev.lldi.rxq_ids[0], 0); | 3613 | ep->com.dev->rdev.lldi.rxq_ids[0], false); |
| 3614 | } else { | 3614 | } else { |
| 3615 | struct sockaddr_in6 *sin6; | 3615 | struct sockaddr_in6 *sin6; |
| 3616 | c4iw_init_wr_wait(ep->com.wr_waitp); | 3616 | c4iw_init_wr_wait(ep->com.wr_waitp); |
| 3617 | err = cxgb4_remove_server( | 3617 | err = cxgb4_remove_server( |
| 3618 | ep->com.dev->rdev.lldi.ports[0], ep->stid, | 3618 | ep->com.dev->rdev.lldi.ports[0], ep->stid, |
| 3619 | ep->com.dev->rdev.lldi.rxq_ids[0], 0); | 3619 | ep->com.dev->rdev.lldi.rxq_ids[0], true); |
| 3620 | if (err) | 3620 | if (err) |
| 3621 | goto done; | 3621 | goto done; |
| 3622 | err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp, | 3622 | err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp, |
| @@ -1194,8 +1194,10 @@ static void hns_roce_cmq_init_regs(struct hns_roce_dev *hr_dev, bool ring_type) · 1193 unmodified lines | |||
| 1194 | upper_32_bits(dma)); | 1194 | upper_32_bits(dma)); |
| 1195 | roce_write(hr_dev, ROCEE_TX_CMQ_DEPTH_REG, | 1195 | roce_write(hr_dev, ROCEE_TX_CMQ_DEPTH_REG, |
| 1196 | (u32)ring->desc_num >> HNS_ROCE_CMQ_DESC_NUM_S); | 1196 | (u32)ring->desc_num >> HNS_ROCE_CMQ_DESC_NUM_S); |
| 1197 | roce_write(hr_dev, ROCEE_TX_CMQ_HEAD_REG, 0); | 1197 | |
| 1198 | /* Make sure to write tail first and then head */ | ||
| 1198 | roce_write(hr_dev, ROCEE_TX_CMQ_TAIL_REG, 0); | 1199 | roce_write(hr_dev, ROCEE_TX_CMQ_TAIL_REG, 0); |
| 1200 | roce_write(hr_dev, ROCEE_TX_CMQ_HEAD_REG, 0); | ||
| 1199 | } else { | 1201 | } else { |
| 1200 | roce_write(hr_dev, ROCEE_RX_CMQ_BASEADDR_L_REG, (u32)dma); | 1202 | roce_write(hr_dev, ROCEE_RX_CMQ_BASEADDR_L_REG, (u32)dma); |
| 1201 | roce_write(hr_dev, ROCEE_RX_CMQ_BASEADDR_H_REG, | 1203 | roce_write(hr_dev, ROCEE_RX_CMQ_BASEADDR_H_REG, |
| @@ -1116,7 +1116,7 @@ static void devx_obj_build_destroy_cmd(void *in, void *out, void *din, · 1115 unmodified lines | |||
| 1116 | case MLX5_CMD_OP_CREATE_MKEY: | 1116 | case MLX5_CMD_OP_CREATE_MKEY: |
| 1117 | MLX5_SET(destroy_mkey_in, din, opcode, | 1117 | MLX5_SET(destroy_mkey_in, din, opcode, |
| 1118 | MLX5_CMD_OP_DESTROY_MKEY); | 1118 | MLX5_CMD_OP_DESTROY_MKEY); |
| 1119 | MLX5_SET(destroy_mkey_in, in, mkey_index, *obj_id); | 1119 | MLX5_SET(destroy_mkey_in, din, mkey_index, *obj_id); |
| 1120 | break; | 1120 | break; |
| 1121 | case MLX5_CMD_OP_CREATE_CQ: | 1121 | case MLX5_CMD_OP_CREATE_CQ: |
| 1122 | MLX5_SET(destroy_cq_in, din, opcode, MLX5_CMD_OP_DESTROY_CQ); | 1122 | MLX5_SET(destroy_cq_in, din, opcode, MLX5_CMD_OP_DESTROY_CQ); |
| @@ -1078,7 +1078,7 @@ static int _create_kernel_qp(struct mlx5_ib_dev *dev, · 1077 unmodified lines | |||
| 1078 | 1078 | ||
| 1079 | qpc = MLX5_ADDR_OF(create_qp_in, *in, qpc); | 1079 | qpc = MLX5_ADDR_OF(create_qp_in, *in, qpc); |
| 1080 | MLX5_SET(qpc, qpc, uar_page, uar_index); | 1080 | MLX5_SET(qpc, qpc, uar_page, uar_index); |
| 1081 | MLX5_SET(qpc, qpc, ts_format, MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT); | 1081 | MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); |
| 1082 | MLX5_SET(qpc, qpc, log_page_size, qp->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT); | 1082 | MLX5_SET(qpc, qpc, log_page_size, qp->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT); |
| 1083 | 1083 | ||
| 1084 | /* Set "fast registration enabled" for all kernel QPs */ | 1084 | /* Set "fast registration enabled" for all kernel QPs */ |
| @@ -1188,7 +1188,8 @@ static int get_rq_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq) · 103 unmodified lines | |||
| 1188 | } | 1188 | } |
| 1189 | return MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING; | 1189 | return MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING; |
| 1190 | } | 1190 | } |
| 1191 | return MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT; | 1191 | return fr_supported ? MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING : |
| 1192 | MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT; | ||
| 1192 | } | 1193 | } |
| 1193 | 1194 | ||
| 1194 | static int get_sq_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq) | 1195 | static int get_sq_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq) |
| @@ -1206,7 +1207,8 @@ static int get_sq_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq) · 11 unmodified lines | |||
| 1206 | } | 1207 | } |
| 1207 | return MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING; | 1208 | return MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING; |
| 1208 | } | 1209 | } |
| 1209 | return MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT; | 1210 | return fr_supported ? MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING : |
| 1211 | MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT; | ||
| 1210 | } | 1212 | } |
| 1211 | 1213 | ||
| 1212 | static int get_qp_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq, | 1214 | static int get_qp_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq, |
| @@ -1217,7 +1219,8 @@ static int get_qp_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq, · 4 unmodified lines | |||
| 1217 | MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING || | 1219 | MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING || |
| 1218 | MLX5_CAP_ROCE(dev->mdev, qp_ts_format) == | 1220 | MLX5_CAP_ROCE(dev->mdev, qp_ts_format) == |
| 1219 | MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME; | 1221 | MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME; |
| 1220 | int ts_format = MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT; | 1222 | int ts_format = fr_supported ? MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING : |
| 1223 | MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT; | ||
| 1221 | 1224 | ||
| 1222 | if (recv_cq && | 1225 | if (recv_cq && |
| 1223 | recv_cq->create_flags & IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION) | 1226 | recv_cq->create_flags & IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION) |
| @@ -1930,6 +1933,7 @@ static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, · 706 unmodified lines | |||
| 1930 | if (qp->flags & IB_QP_CREATE_MANAGED_RECV) | 1933 | if (qp->flags & IB_QP_CREATE_MANAGED_RECV) |
| 1931 | MLX5_SET(qpc, qpc, cd_slave_receive, 1); | 1934 | MLX5_SET(qpc, qpc, cd_slave_receive, 1); |
| 1932 | 1935 | ||
| 1936 | MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); | ||
| 1933 | MLX5_SET(qpc, qpc, rq_type, MLX5_SRQ_RQ); | 1937 | MLX5_SET(qpc, qpc, rq_type, MLX5_SRQ_RQ); |
| 1934 | MLX5_SET(qpc, qpc, no_sq, 1); | 1938 | MLX5_SET(qpc, qpc, no_sq, 1); |
| 1935 | MLX5_SET(qpc, qpc, cqn_rcv, to_mcq(devr->c0)->mcq.cqn); | 1939 | MLX5_SET(qpc, qpc, cqn_rcv, to_mcq(devr->c0)->mcq.cqn); |
| @@ -4873,6 +4877,7 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, · 2937 unmodified lines | |||
| 4873 | struct mlx5_ib_dev *dev; | 4877 | struct mlx5_ib_dev *dev; |
| 4874 | int has_net_offloads; | 4878 | int has_net_offloads; |
| 4875 | __be64 *rq_pas0; | 4879 | __be64 *rq_pas0; |
| 4880 | int ts_format; | ||
| 4876 | void *in; | 4881 | void *in; |
| 4877 | void *rqc; | 4882 | void *rqc; |
| 4878 | void *wq; | 4883 | void *wq; |
| @@ -4881,6 +4886,10 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, · 2 unmodified lines | |||
| 4881 | 4886 | ||
| 4882 | dev = to_mdev(pd->device); | 4887 | dev = to_mdev(pd->device); |
| 4883 | 4888 | ||
| 4889 | ts_format = get_rq_ts_format(dev, to_mcq(init_attr->cq)); | ||
| 4890 | if (ts_format < 0) | ||
| 4891 | return ts_format; | ||
| 4892 | |||
| 4884 | inlen = MLX5_ST_SZ_BYTES(create_rq_in) + sizeof(u64) * rwq->rq_num_pas; | 4893 | inlen = MLX5_ST_SZ_BYTES(create_rq_in) + sizeof(u64) * rwq->rq_num_pas; |
| 4885 | in = kvzalloc(inlen, GFP_KERNEL); | 4894 | in = kvzalloc(inlen, GFP_KERNEL); |
| 4886 | if (!in) | 4895 | if (!in) |
| @@ -4890,6 +4899,7 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, · 3 unmodified lines | |||
| 4890 | rqc = MLX5_ADDR_OF(create_rq_in, in, ctx); | 4899 | rqc = MLX5_ADDR_OF(create_rq_in, in, ctx); |
| 4891 | MLX5_SET(rqc, rqc, mem_rq_type, | 4900 | MLX5_SET(rqc, rqc, mem_rq_type, |
| 4892 | MLX5_RQC_MEM_RQ_TYPE_MEMORY_RQ_INLINE); | 4901 | MLX5_RQC_MEM_RQ_TYPE_MEMORY_RQ_INLINE); |
| 4902 | MLX5_SET(rqc, rqc, ts_format, ts_format); | ||
| 4893 | MLX5_SET(rqc, rqc, user_index, rwq->user_index); | 4903 | MLX5_SET(rqc, rqc, user_index, rwq->user_index); |
| 4894 | MLX5_SET(rqc, rqc, cqn, to_mcq(init_attr->cq)->mcq.cqn); | 4904 | MLX5_SET(rqc, rqc, cqn, to_mcq(init_attr->cq)->mcq.cqn); |
| 4895 | MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); | 4905 | MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); |
| @@ -26,7 +26,6 @@ · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 27 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
| 28 | MODULE_DESCRIPTION("Joystick device interfaces"); | 28 | MODULE_DESCRIPTION("Joystick device interfaces"); |
| 29 | MODULE_SUPPORTED_DEVICE("input/js"); | ||
| 30 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
| 31 | 30 | ||
| 32 | #define JOYDEV_MINOR_BASE 0 | 31 | #define JOYDEV_MINOR_BASE 0 |
| @@ -2714,7 +2714,6 @@ static int __init early_amd_iommu_init(void) · 2713 unmodified lines | |||
| 2714 | struct acpi_table_header *ivrs_base; | 2714 | struct acpi_table_header *ivrs_base; |
| 2715 | int i, remap_cache_sz, ret; | 2715 | int i, remap_cache_sz, ret; |
| 2716 | acpi_status status; | 2716 | acpi_status status; |
| 2717 | u32 pci_id; | ||
| 2718 | 2717 | ||
| 2719 | if (!amd_iommu_detected) | 2718 | if (!amd_iommu_detected) |
| 2720 | return -ENODEV; | 2719 | return -ENODEV; |
| @@ -2804,16 +2803,6 @@ static int __init early_amd_iommu_init(void) · 83 unmodified lines | |||
| 2804 | if (ret) | 2803 | if (ret) |
| 2805 | goto out; | 2804 | goto out; |
| 2806 | 2805 | ||
| 2807 | /* Disable IOMMU if there's Stoney Ridge graphics */ | ||
| 2808 | for (i = 0; i < 32; i++) { | ||
| 2809 | pci_id = read_pci_config(0, i, 0, 0); | ||
| 2810 | if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) { | ||
| 2811 | pr_info("Disable IOMMU on Stoney Ridge\n"); | ||
| 2812 | amd_iommu_disabled = true; | ||
| 2813 | break; | ||
| 2814 | } | ||
| 2815 | } | ||
| 2816 | |||
| 2817 | /* Disable any previously enabled IOMMUs */ | 2806 | /* Disable any previously enabled IOMMUs */ |
| 2818 | if (!is_kdump_kernel() || amd_iommu_disabled) | 2807 | if (!is_kdump_kernel() || amd_iommu_disabled) |
| 2819 | disable_iommus(); | 2808 | disable_iommus(); |
| @@ -2880,6 +2869,7 @@ static bool detect_ivrs(void) · 60 unmodified lines | |||
| 2880 | { | 2869 | { |
| 2881 | struct acpi_table_header *ivrs_base; | 2870 | struct acpi_table_header *ivrs_base; |
| 2882 | acpi_status status; | 2871 | acpi_status status; |
| 2872 | int i; | ||
| 2883 | 2873 | ||
| 2884 | status = acpi_get_table("IVRS", 0, &ivrs_base); | 2874 | status = acpi_get_table("IVRS", 0, &ivrs_base); |
| 2885 | if (status == AE_NOT_FOUND) | 2875 | if (status == AE_NOT_FOUND) |
| @@ -2892,6 +2882,17 @@ static bool detect_ivrs(void) · 6 unmodified lines | |||
| 2892 | 2882 | ||
| 2893 | acpi_put_table(ivrs_base); | 2883 | acpi_put_table(ivrs_base); |
| 2894 | 2884 | ||
| 2885 | /* Don't use IOMMU if there is Stoney Ridge graphics */ | ||
| 2886 | for (i = 0; i < 32; i++) { | ||
| 2887 | u32 pci_id; | ||
| 2888 | |||
| 2889 | pci_id = read_pci_config(0, i, 0, 0); | ||
| 2890 | if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) { | ||
| 2891 | pr_info("Disable IOMMU on Stoney Ridge\n"); | ||
| 2892 | return false; | ||
| 2893 | } | ||
| 2894 | } | ||
| 2895 | |||
| 2895 | /* Make sure ACS will be enabled during PCI probe */ | 2896 | /* Make sure ACS will be enabled during PCI probe */ |
| 2896 | pci_request_acs(); | 2897 | pci_request_acs(); |
| 2897 | 2898 | ||
| @@ -2918,12 +2919,12 @@ static int __init state_next(void) · 20 unmodified lines | |||
| 2918 | } | 2919 | } |
| 2919 | break; | 2920 | break; |
| 2920 | case IOMMU_IVRS_DETECTED: | 2921 | case IOMMU_IVRS_DETECTED: |
| 2921 | ret = early_amd_iommu_init(); | 2922 | if (amd_iommu_disabled) { |
| 2922 | init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED; | ||
| 2923 | if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) { | ||
| 2924 | pr_info("AMD IOMMU disabled\n"); | ||
| 2925 | init_state = IOMMU_CMDLINE_DISABLED; | 2923 | init_state = IOMMU_CMDLINE_DISABLED; |
| 2926 | ret = -EINVAL; | 2924 | ret = -EINVAL; |
| 2925 | } else { | ||
| 2926 | ret = early_amd_iommu_init(); | ||
| 2927 | init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED; | ||
| 2927 | } | 2928 | } |
| 2928 | break; | 2929 | break; |
| 2929 | case IOMMU_ACPI_FINISHED: | 2930 | case IOMMU_ACPI_FINISHED: |
| @@ -3001,8 +3002,11 @@ int __init amd_iommu_prepare(void) · 71 unmodified lines | |||
| 3001 | amd_iommu_irq_remap = true; | 3002 | amd_iommu_irq_remap = true; |
| 3002 | 3003 | ||
| 3003 | ret = iommu_go_to_state(IOMMU_ACPI_FINISHED); | 3004 | ret = iommu_go_to_state(IOMMU_ACPI_FINISHED); |
| 3004 | if (ret) | 3005 | if (ret) { |
| 3006 | amd_iommu_irq_remap = false; | ||
| 3005 | return ret; | 3007 | return ret; |
| 3008 | } | ||
| 3009 | |||
| 3006 | return amd_iommu_irq_remap ? 0 : -ENODEV; | 3010 | return amd_iommu_irq_remap ? 0 : -ENODEV; |
| 3007 | } | 3011 | } |
| 3008 | 3012 | ||
| @@ -849,12 +849,11 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev) · 848 unmodified lines | |||
| 849 | smmu = tegra_smmu_find(args.np); | 849 | smmu = tegra_smmu_find(args.np); |
| 850 | if (smmu) { | 850 | if (smmu) { |
| 851 | err = tegra_smmu_configure(smmu, dev, &args); | 851 | err = tegra_smmu_configure(smmu, dev, &args); |
| 852 | of_node_put(args.np); | ||
| 853 | 852 | ||
| 854 | if (err < 0) | 853 | if (err < 0) { |
| 854 | of_node_put(args.np); | ||
| 855 | return ERR_PTR(err); | 855 | return ERR_PTR(err); |
| 856 | 856 | } | |
| 857 | break; | ||
| 858 | } | 857 | } |
| 859 | 858 | ||
| 860 | of_node_put(args.np); | 859 | of_node_put(args.np); |
| @@ -721,7 +721,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb) · 720 unmodified lines | |||
| 721 | * Return value: CAPI result code | 721 | * Return value: CAPI result code |
| 722 | */ | 722 | */ |
| 723 | 723 | ||
| 724 | u16 capi20_get_manufacturer(u32 contr, u8 *buf) | 724 | u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]) |
| 725 | { | 725 | { |
| 726 | struct capi_ctr *ctr; | 726 | struct capi_ctr *ctr; |
| 727 | u16 ret; | 727 | u16 ret; |
| @@ -787,7 +787,7 @@ u16 capi20_get_version(u32 contr, struct capi_version *verp) · 59 unmodified lines | |||
| 787 | * Return value: CAPI result code | 787 | * Return value: CAPI result code |
| 788 | */ | 788 | */ |
| 789 | 789 | ||
| 790 | u16 capi20_get_serial(u32 contr, u8 *serial) | 790 | u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]) |
| 791 | { | 791 | { |
| 792 | struct capi_ctr *ctr; | 792 | struct capi_ctr *ctr; |
| 793 | u16 ret; | 793 | u16 ret; |
| @@ -694,7 +694,7 @@ isac_release(struct isac_hw *isac) · 693 unmodified lines | |||
| 694 | { | 694 | { |
| 695 | if (isac->type & IPAC_TYPE_ISACX) | 695 | if (isac->type & IPAC_TYPE_ISACX) |
| 696 | WriteISAC(isac, ISACX_MASK, 0xff); | 696 | WriteISAC(isac, ISACX_MASK, 0xff); |
| 697 | else | 697 | else if (isac->type != 0) |
| 698 | WriteISAC(isac, ISAC_MASK, 0xff); | 698 | WriteISAC(isac, ISAC_MASK, 0xff); |
| 699 | if (isac->dch.timer.function != NULL) { | 699 | if (isac->dch.timer.function != NULL) { |
| 700 | del_timer(&isac->dch.timer); | 700 | del_timer(&isac->dch.timer); |
| @@ -529,7 +529,7 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_ · 528 unmodified lines | |||
| 529 | * Grab our output buffer. | 529 | * Grab our output buffer. |
| 530 | */ | 530 | */ |
| 531 | nl = orig_nl = get_result_buffer(param, param_size, &len); | 531 | nl = orig_nl = get_result_buffer(param, param_size, &len); |
| 532 | if (len < needed) { | 532 | if (len < needed || len < sizeof(nl->dev)) { |
| 533 | param->flags |= DM_BUFFER_FULL_FLAG; | 533 | param->flags |= DM_BUFFER_FULL_FLAG; |
| 534 | goto out; | 534 | goto out; |
| 535 | } | 535 | } |
| @@ -1594,6 +1594,13 @@ static int device_not_zoned_model(struct dm_target *ti, struct dm_dev *dev, · 1593 unmodified lines | |||
| 1594 | return blk_queue_zoned_model(q) != *zoned_model; | 1594 | return blk_queue_zoned_model(q) != *zoned_model; |
| 1595 | } | 1595 | } |
| 1596 | 1596 | ||
| 1597 | /* | ||
| 1598 | * Check the device zoned model based on the target feature flag. If the target | ||
| 1599 | * has the DM_TARGET_ZONED_HM feature flag set, host-managed zoned devices are | ||
| 1600 | * also accepted but all devices must have the same zoned model. If the target | ||
| 1601 | * has the DM_TARGET_MIXED_ZONED_MODEL feature set, the devices can have any | ||
| 1602 | * zoned model with all zoned devices having the same zone size. | ||
| 1603 | */ | ||
| 1597 | static bool dm_table_supports_zoned_model(struct dm_table *t, | 1604 | static bool dm_table_supports_zoned_model(struct dm_table *t, |
| 1598 | enum blk_zoned_model zoned_model) | 1605 | enum blk_zoned_model zoned_model) |
| 1599 | { | 1606 | { |
| @@ -1603,13 +1610,15 @@ static bool dm_table_supports_zoned_model(struct dm_table *t, · 3 unmodified lines | |||
| 1603 | for (i = 0; i < dm_table_get_num_targets(t); i++) { | 1610 | for (i = 0; i < dm_table_get_num_targets(t); i++) { |
| 1604 | ti = dm_table_get_target(t, i); | 1611 | ti = dm_table_get_target(t, i); |
| 1605 | 1612 | ||
| 1606 | if (zoned_model == BLK_ZONED_HM && | 1613 | if (dm_target_supports_zoned_hm(ti->type)) { |
| 1607 | !dm_target_supports_zoned_hm(ti->type)) | 1614 | if (!ti->type->iterate_devices || |
| 1608 | return false; | 1615 | ti->type->iterate_devices(ti, device_not_zoned_model, |
| 1609 | 1616 | &zoned_model)) | |
| 1610 | if (!ti->type->iterate_devices || | 1617 | return false; |
| 1611 | ti->type->iterate_devices(ti, device_not_zoned_model, &zoned_model)) | 1618 | } else if (!dm_target_supports_mixed_zoned_model(ti->type)) { |
| 1612 | return false; | 1619 | if (zoned_model == BLK_ZONED_HM) |
| 1620 | return false; | ||
| 1621 | } | ||
| 1613 | } | 1622 | } |
| 1614 | 1623 | ||
| 1615 | return true; | 1624 | return true; |
| @@ -1621,9 +1630,17 @@ static int device_not_matches_zone_sectors(struct dm_target *ti, struct dm_dev * · 5 unmodified lines | |||
| 1621 | struct request_queue *q = bdev_get_queue(dev->bdev); | 1630 | struct request_queue *q = bdev_get_queue(dev->bdev); |
| 1622 | unsigned int *zone_sectors = data; | 1631 | unsigned int *zone_sectors = data; |
| 1623 | 1632 | ||
| 1633 | if (!blk_queue_is_zoned(q)) | ||
| 1634 | return 0; | ||
| 1635 | |||
| 1624 | return blk_queue_zone_sectors(q) != *zone_sectors; | 1636 | return blk_queue_zone_sectors(q) != *zone_sectors; |
| 1625 | } | 1637 | } |
| 1626 | 1638 | ||
| 1639 | /* | ||
| 1640 | * Check consistency of zoned model and zone sectors across all targets. For | ||
| 1641 | * zone sectors, if the destination device is a zoned block device, it shall | ||
| 1642 | * have the specified zone_sectors. | ||
| 1643 | */ | ||
| 1627 | static int validate_hardware_zoned_model(struct dm_table *table, | 1644 | static int validate_hardware_zoned_model(struct dm_table *table, |
| 1628 | enum blk_zoned_model zoned_model, | 1645 | enum blk_zoned_model zoned_model, |
| 1629 | unsigned int zone_sectors) | 1646 | unsigned int zone_sectors) |
| @@ -1642,7 +1659,7 @@ static int validate_hardware_zoned_model(struct dm_table *table, · 12 unmodified lines | |||
| 1642 | return -EINVAL; | 1659 | return -EINVAL; |
| 1643 | 1660 | ||
| 1644 | if (dm_table_any_dev_attr(table, device_not_matches_zone_sectors, &zone_sectors)) { | 1661 | if (dm_table_any_dev_attr(table, device_not_matches_zone_sectors, &zone_sectors)) { |
| 1645 | DMERR("%s: zone sectors is not consistent across all devices", | 1662 | DMERR("%s: zone sectors is not consistent across all zoned devices", |
| 1646 | dm_device_name(table->md)); | 1663 | dm_device_name(table->md)); |
| 1647 | return -EINVAL; | 1664 | return -EINVAL; |
| 1648 | } | 1665 | } |
| @@ -34,7 +34,7 @@ · 33 unmodified lines | |||
| 34 | #define DM_VERITY_OPT_IGN_ZEROES "ignore_zero_blocks" | 34 | #define DM_VERITY_OPT_IGN_ZEROES "ignore_zero_blocks" |
| 35 | #define DM_VERITY_OPT_AT_MOST_ONCE "check_at_most_once" | 35 | #define DM_VERITY_OPT_AT_MOST_ONCE "check_at_most_once" |
| 36 | 36 | ||
| 37 | #define DM_VERITY_OPTS_MAX (2 + DM_VERITY_OPTS_FEC + \ | 37 | #define DM_VERITY_OPTS_MAX (3 + DM_VERITY_OPTS_FEC + \ |
| 38 | DM_VERITY_ROOT_HASH_VERIFICATION_OPTS) | 38 | DM_VERITY_ROOT_HASH_VERIFICATION_OPTS) |
| 39 | 39 | ||
| 40 | static unsigned dm_verity_prefetch_cluster = DM_VERITY_DEFAULT_PREFETCH_SIZE; | 40 | static unsigned dm_verity_prefetch_cluster = DM_VERITY_DEFAULT_PREFETCH_SIZE; |
| @@ -1143,7 +1143,7 @@ static int dmz_message(struct dm_target *ti, unsigned int argc, char **argv, · 1142 unmodified lines | |||
| 1143 | static struct target_type dmz_type = { | 1143 | static struct target_type dmz_type = { |
| 1144 | .name = "zoned", | 1144 | .name = "zoned", |
| 1145 | .version = {2, 0, 0}, | 1145 | .version = {2, 0, 0}, |
| 1146 | .features = DM_TARGET_SINGLETON | DM_TARGET_ZONED_HM, | 1146 | .features = DM_TARGET_SINGLETON | DM_TARGET_MIXED_ZONED_MODEL, |
| 1147 | .module = THIS_MODULE, | 1147 | .module = THIS_MODULE, |
| 1148 | .ctr = dmz_ctr, | 1148 | .ctr = dmz_ctr, |
| 1149 | .dtr = dmz_dtr, | 1149 | .dtr = dmz_dtr, |
| @@ -2036,7 +2036,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t, · 2035 unmodified lines | |||
| 2036 | if (size != dm_get_size(md)) | 2036 | if (size != dm_get_size(md)) |
| 2037 | memset(&md->geometry, 0, sizeof(md->geometry)); | 2037 | memset(&md->geometry, 0, sizeof(md->geometry)); |
| 2038 | 2038 | ||
| 2039 | set_capacity_and_notify(md->disk, size); | 2039 | if (!get_capacity(md->disk)) |
| 2040 | set_capacity(md->disk, size); | ||
| 2041 | else | ||
| 2042 | set_capacity_and_notify(md->disk, size); | ||
| 2040 | 2043 | ||
| 2041 | dm_table_event_callback(t, event_callback, md); | 2044 | dm_table_event_callback(t, event_callback, md); |
| 2042 | 2045 | ||
| @@ -430,4 +430,3 @@ MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>"); · 429 unmodified lines | |||
| 430 | MODULE_AUTHOR("Ben Backx <ben@bbackx.com>"); | 430 | MODULE_AUTHOR("Ben Backx <ben@bbackx.com>"); |
| 431 | MODULE_DESCRIPTION("FireDTV DVB Driver"); | 431 | MODULE_DESCRIPTION("FireDTV DVB Driver"); |
| 432 | MODULE_LICENSE("GPL"); | 432 | MODULE_LICENSE("GPL"); |
| 433 | MODULE_SUPPORTED_DEVICE("FireDTV DVB"); | ||
| @@ -41,7 +41,6 @@ MODULE_PARM_DESC(debug, · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | MODULE_AUTHOR("Andy Walls"); | 42 | MODULE_AUTHOR("Andy Walls"); |
| 43 | MODULE_DESCRIPTION("CX23418 ALSA Interface"); | 43 | MODULE_DESCRIPTION("CX23418 ALSA Interface"); |
| 44 | MODULE_SUPPORTED_DEVICE("CX23418 MPEG2 encoder"); | ||
| 45 | MODULE_LICENSE("GPL"); | 44 | MODULE_LICENSE("GPL"); |
| 46 | 45 | ||
| 47 | MODULE_VERSION(CX18_VERSION); | 46 | MODULE_VERSION(CX18_VERSION); |
| @@ -232,7 +232,6 @@ MODULE_PARM_DESC(cx18_first_minor, · 231 unmodified lines | |||
| 232 | 232 | ||
| 233 | MODULE_AUTHOR("Hans Verkuil"); | 233 | MODULE_AUTHOR("Hans Verkuil"); |
| 234 | MODULE_DESCRIPTION("CX23418 driver"); | 234 | MODULE_DESCRIPTION("CX23418 driver"); |
| 235 | MODULE_SUPPORTED_DEVICE("CX23418 MPEG2 encoder"); | ||
| 236 | MODULE_LICENSE("GPL"); | 235 | MODULE_LICENSE("GPL"); |
| 237 | 236 | ||
| 238 | MODULE_VERSION(CX18_VERSION); | 237 | MODULE_VERSION(CX18_VERSION); |
| @@ -104,7 +104,6 @@ MODULE_PARM_DESC(index, "Index value for cx25821 capture interface(s)."); · 103 unmodified lines | |||
| 104 | MODULE_DESCRIPTION("ALSA driver module for cx25821 based capture cards"); | 104 | MODULE_DESCRIPTION("ALSA driver module for cx25821 based capture cards"); |
| 105 | MODULE_AUTHOR("Hiep Huynh"); | 105 | MODULE_AUTHOR("Hiep Huynh"); |
| 106 | MODULE_LICENSE("GPL"); | 106 | MODULE_LICENSE("GPL"); |
| 107 | MODULE_SUPPORTED_DEVICE("{{Conexant,25821}"); /* "{{Conexant,23881}," */ | ||
| 108 | 107 | ||
| 109 | static unsigned int debug; | 108 | static unsigned int debug; |
| 110 | module_param(debug, int, 0644); | 109 | module_param(debug, int, 0644); |
| @@ -98,7 +98,6 @@ MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>"); · 97 unmodified lines | |||
| 98 | MODULE_LICENSE("GPL v2"); | 98 | MODULE_LICENSE("GPL v2"); |
| 99 | MODULE_VERSION(CX88_VERSION); | 99 | MODULE_VERSION(CX88_VERSION); |
| 100 | 100 | ||
| 101 | MODULE_SUPPORTED_DEVICE("{{Conexant,23881},{{Conexant,23882},{{Conexant,23883}"); | ||
| 102 | static unsigned int debug; | 101 | static unsigned int debug; |
| 103 | module_param(debug, int, 0644); | 102 | module_param(debug, int, 0644); |
| 104 | MODULE_PARM_DESC(debug, "enable debug messages"); | 103 | MODULE_PARM_DESC(debug, "enable debug messages"); |
| @@ -38,7 +38,6 @@ MODULE_PARM_DESC(index, · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | MODULE_AUTHOR("Andy Walls"); | 39 | MODULE_AUTHOR("Andy Walls"); |
| 40 | MODULE_DESCRIPTION("CX23415/CX23416 ALSA Interface"); | 40 | MODULE_DESCRIPTION("CX23415/CX23416 ALSA Interface"); |
| 41 | MODULE_SUPPORTED_DEVICE("CX23415/CX23416 MPEG2 encoder"); | ||
| 42 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
| 43 | 42 | ||
| 44 | MODULE_VERSION(IVTV_VERSION); | 43 | MODULE_VERSION(IVTV_VERSION); |
| @@ -275,9 +275,6 @@ MODULE_PARM_DESC(ivtv_first_minor, "Set device node number assigned to first car · 274 unmodified lines | |||
| 275 | 275 | ||
| 276 | MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil"); | 276 | MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil"); |
| 277 | MODULE_DESCRIPTION("CX23415/CX23416 driver"); | 277 | MODULE_DESCRIPTION("CX23415/CX23416 driver"); |
| 278 | MODULE_SUPPORTED_DEVICE | ||
| 279 | ("CX23415/CX23416 MPEG2 encoder (WinTV PVR-150/250/350/500,\n" | ||
| 280 | "\t\t\tYuan MPG series and similar)"); | ||
| 281 | MODULE_LICENSE("GPL"); | 278 | MODULE_LICENSE("GPL"); |
| 282 | 279 | ||
| 283 | MODULE_VERSION(IVTV_VERSION); | 280 | MODULE_VERSION(IVTV_VERSION); |
| @@ -1269,6 +1269,5 @@ late_initcall_sync(sta2x11_vip_init_module); · 1268 unmodified lines | |||
| 1269 | MODULE_DESCRIPTION("STA2X11 Video Input Port driver"); | 1269 | MODULE_DESCRIPTION("STA2X11 Video Input Port driver"); |
| 1270 | MODULE_AUTHOR("Wind River"); | 1270 | MODULE_AUTHOR("Wind River"); |
| 1271 | MODULE_LICENSE("GPL v2"); | 1271 | MODULE_LICENSE("GPL v2"); |
| 1272 | MODULE_SUPPORTED_DEVICE("sta2x11 video input"); | ||
| 1273 | MODULE_VERSION(DRV_VERSION); | 1272 | MODULE_VERSION(DRV_VERSION); |
| 1274 | MODULE_DEVICE_TABLE(pci, sta2x11_vip_pci_tbl); | 1273 | MODULE_DEVICE_TABLE(pci, sta2x11_vip_pci_tbl); |
| @@ -1363,4 +1363,3 @@ module_platform_driver(atmel_isi_driver); · 1362 unmodified lines | |||
| 1363 | MODULE_AUTHOR("Josh Wu <josh.wu@atmel.com>"); | 1363 | MODULE_AUTHOR("Josh Wu <josh.wu@atmel.com>"); |
| 1364 | MODULE_DESCRIPTION("The V4L2 driver for Atmel Linux"); | 1364 | MODULE_DESCRIPTION("The V4L2 driver for Atmel Linux"); |
| 1365 | MODULE_LICENSE("GPL"); | 1365 | MODULE_LICENSE("GPL"); |
| 1366 | MODULE_SUPPORTED_DEVICE("video"); | ||
| @@ -330,4 +330,3 @@ module_platform_driver(atmel_isc_driver); · 329 unmodified lines | |||
| 330 | MODULE_AUTHOR("Songjun Wu"); | 330 | MODULE_AUTHOR("Songjun Wu"); |
| 331 | MODULE_DESCRIPTION("The V4L2 driver for Atmel-ISC"); | 331 | MODULE_DESCRIPTION("The V4L2 driver for Atmel-ISC"); |
| 332 | MODULE_LICENSE("GPL v2"); | 332 | MODULE_LICENSE("GPL v2"); |
| 333 | MODULE_SUPPORTED_DEVICE("video"); | ||
| @@ -44,10 +44,6 @@ · 43 unmodified lines | |||
| 44 | MODULE_AUTHOR("Jonathan Corbet <corbet@lwn.net>"); | 44 | MODULE_AUTHOR("Jonathan Corbet <corbet@lwn.net>"); |
| 45 | MODULE_DESCRIPTION("Marvell 88ALP01 CMOS Camera Controller driver"); | 45 | MODULE_DESCRIPTION("Marvell 88ALP01 CMOS Camera Controller driver"); |
| 46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
| 47 | MODULE_SUPPORTED_DEVICE("Video"); | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | 47 | ||
| 52 | struct cafe_camera { | 48 | struct cafe_camera { |
| 53 | int registered; /* Fully initialized? */ | 49 | int registered; /* Fully initialized? */ |
| @@ -2149,4 +2149,3 @@ MODULE_AUTHOR("Yannick Fertre <yannick.fertre@st.com>"); · 2148 unmodified lines | |||
| 2149 | MODULE_AUTHOR("Hugues Fruchet <hugues.fruchet@st.com>"); | 2149 | MODULE_AUTHOR("Hugues Fruchet <hugues.fruchet@st.com>"); |
| 2150 | MODULE_DESCRIPTION("STMicroelectronics STM32 Digital Camera Memory Interface driver"); | 2150 | MODULE_DESCRIPTION("STMicroelectronics STM32 Digital Camera Memory Interface driver"); |
| 2151 | MODULE_LICENSE("GPL"); | 2151 | MODULE_LICENSE("GPL"); |
| 2152 | MODULE_SUPPORTED_DEVICE("video"); | ||
| @@ -56,7 +56,6 @@ MODULE_PARM_DESC(flicker_mode, "Flicker frequency (0 (disabled), " __stringify(5 · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | MODULE_AUTHOR("Steve Miller (STMicroelectronics) <steve.miller@st.com>"); | 57 | MODULE_AUTHOR("Steve Miller (STMicroelectronics) <steve.miller@st.com>"); |
| 58 | MODULE_DESCRIPTION("V4L-driver for STMicroelectronics CPiA2 based cameras"); | 58 | MODULE_DESCRIPTION("V4L-driver for STMicroelectronics CPiA2 based cameras"); |
| 59 | MODULE_SUPPORTED_DEVICE("video"); | ||
| 60 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
| 61 | MODULE_VERSION(CPIA_VERSION); | 60 | MODULE_VERSION(CPIA_VERSION); |
| 62 | 61 | ||
| @@ -51,7 +51,6 @@ MODULE_PARM_DESC(index, "Index value for tm6000x capture interface(s)."); · 50 unmodified lines | |||
| 51 | MODULE_DESCRIPTION("ALSA driver module for tm5600/tm6000/tm6010 based TV cards"); | 51 | MODULE_DESCRIPTION("ALSA driver module for tm5600/tm6000/tm6010 based TV cards"); |
| 52 | MODULE_AUTHOR("Mauro Carvalho Chehab"); | 52 | MODULE_AUTHOR("Mauro Carvalho Chehab"); |
| 53 | MODULE_LICENSE("GPL v2"); | 53 | MODULE_LICENSE("GPL v2"); |
| 54 | MODULE_SUPPORTED_DEVICE("{{Trident,tm5600},{{Trident,tm6000},{{Trident,tm6010}"); | ||
| 55 | static unsigned int debug; | 54 | static unsigned int debug; |
| 56 | module_param(debug, int, 0644); | 55 | module_param(debug, int, 0644); |
| 57 | MODULE_PARM_DESC(debug, "enable debug messages"); | 56 | MODULE_PARM_DESC(debug, "enable debug messages"); |
| @@ -23,8 +23,6 @@ MODULE_DESCRIPTION("DVB driver extension module for tm5600/6000/6010 based TV ca · 22 unmodified lines | |||
| 23 | MODULE_AUTHOR("Mauro Carvalho Chehab"); | 23 | MODULE_AUTHOR("Mauro Carvalho Chehab"); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | 25 | ||
| 26 | MODULE_SUPPORTED_DEVICE("{{Trident, tm5600},{{Trident, tm6000},{{Trident, tm6010}"); | ||
| 27 | |||
| 28 | static int debug; | 26 | static int debug; |
| 29 | 27 | ||
| 30 | module_param(debug, int, 0644); | 28 | module_param(debug, int, 0644); |
| @@ -72,7 +72,8 @@ static const struct dmi_system_id dmi_platform_info[] = { · 71 unmodified lines | |||
| 72 | {} | 72 | {} |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | static const struct resource intel_quark_i2c_res[] = { | 75 | /* This is used as a place holder and will be modified at run-time */ |
| 76 | static struct resource intel_quark_i2c_res[] = { | ||
| 76 | [INTEL_QUARK_IORES_MEM] = { | 77 | [INTEL_QUARK_IORES_MEM] = { |
| 77 | .flags = IORESOURCE_MEM, | 78 | .flags = IORESOURCE_MEM, |
| 78 | }, | 79 | }, |
| @@ -85,7 +86,8 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { · 6 unmodified lines | |||
| 85 | .adr = MFD_ACPI_MATCH_I2C, | 86 | .adr = MFD_ACPI_MATCH_I2C, |
| 86 | }; | 87 | }; |
| 87 | 88 | ||
| 88 | static const struct resource intel_quark_gpio_res[] = { | 89 | /* This is used as a place holder and will be modified at run-time */ |
| 90 | static struct resource intel_quark_gpio_res[] = { | ||
| 89 | [INTEL_QUARK_IORES_MEM] = { | 91 | [INTEL_QUARK_IORES_MEM] = { |
| 90 | .flags = IORESOURCE_MEM, | 92 | .flags = IORESOURCE_MEM, |
| 91 | }, | 93 | }, |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | MODULE_AUTHOR("Eric Brower <ebrower@usa.net>"); | 33 | MODULE_AUTHOR("Eric Brower <ebrower@usa.net>"); |
| 34 | MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets"); | 34 | MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets"); |
| 35 | MODULE_SUPPORTED_DEVICE(DRIVER_NAME); | ||
| 36 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
| 37 | MODULE_VERSION("2.1"); | 36 | MODULE_VERSION("2.1"); |
| 38 | 37 | ||
| @@ -127,6 +127,8 @@ static int com20020pci_probe(struct pci_dev *pdev, · 126 unmodified lines | |||
| 127 | int i, ioaddr, ret; | 127 | int i, ioaddr, ret; |
| 128 | struct resource *r; | 128 | struct resource *r; |
| 129 | 129 | ||
| 130 | ret = 0; | ||
| 131 | |||
| 130 | if (pci_enable_device(pdev)) | 132 | if (pci_enable_device(pdev)) |
| 131 | return -EIO; | 133 | return -EIO; |
| 132 | 134 | ||
| @@ -139,6 +141,8 @@ static int com20020pci_probe(struct pci_dev *pdev, · 6 unmodified lines | |||
| 139 | priv->ci = ci; | 141 | priv->ci = ci; |
| 140 | mm = &ci->misc_map; | 142 | mm = &ci->misc_map; |
| 141 | 143 | ||
| 144 | pci_set_drvdata(pdev, priv); | ||
| 145 | |||
| 142 | INIT_LIST_HEAD(&priv->list_dev); | 146 | INIT_LIST_HEAD(&priv->list_dev); |
| 143 | 147 | ||
| 144 | if (mm->size) { | 148 | if (mm->size) { |
| @@ -161,7 +165,7 @@ static int com20020pci_probe(struct pci_dev *pdev, · 16 unmodified lines | |||
| 161 | dev = alloc_arcdev(device); | 165 | dev = alloc_arcdev(device); |
| 162 | if (!dev) { | 166 | if (!dev) { |
| 163 | ret = -ENOMEM; | 167 | ret = -ENOMEM; |
| 164 | goto out_port; | 168 | break; |
| 165 | } | 169 | } |
| 166 | dev->dev_port = i; | 170 | dev->dev_port = i; |
| 167 | 171 | ||
| @@ -178,7 +182,7 @@ static int com20020pci_probe(struct pci_dev *pdev, · 10 unmodified lines | |||
| 178 | pr_err("IO region %xh-%xh already allocated\n", | 182 | pr_err("IO region %xh-%xh already allocated\n", |
| 179 | ioaddr, ioaddr + cm->size - 1); | 183 | ioaddr, ioaddr + cm->size - 1); |
| 180 | ret = -EBUSY; | 184 | ret = -EBUSY; |
| 181 | goto out_port; | 185 | goto err_free_arcdev; |
| 182 | } | 186 | } |
| 183 | 187 | ||
| 184 | /* Dummy access after Reset | 188 | /* Dummy access after Reset |
| @@ -216,18 +220,18 @@ static int com20020pci_probe(struct pci_dev *pdev, · 31 unmodified lines | |||
| 216 | if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) { | 220 | if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) { |
| 217 | pr_err("IO address %Xh is empty!\n", ioaddr); | 221 | pr_err("IO address %Xh is empty!\n", ioaddr); |
| 218 | ret = -EIO; | 222 | ret = -EIO; |
| 219 | goto out_port; | 223 | goto err_free_arcdev; |
| 220 | } | 224 | } |
| 221 | if (com20020_check(dev)) { | 225 | if (com20020_check(dev)) { |
| 222 | ret = -EIO; | 226 | ret = -EIO; |
| 223 | goto out_port; | 227 | goto err_free_arcdev; |
| 224 | } | 228 | } |
| 225 | 229 | ||
| 226 | card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev), | 230 | card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev), |
| 227 | GFP_KERNEL); | 231 | GFP_KERNEL); |
| 228 | if (!card) { | 232 | if (!card) { |
| 229 | ret = -ENOMEM; | 233 | ret = -ENOMEM; |
| 230 | goto out_port; | 234 | goto err_free_arcdev; |
| 231 | } | 235 | } |
| 232 | 236 | ||
| 233 | card->index = i; | 237 | card->index = i; |
| @@ -253,29 +257,29 @@ static int com20020pci_probe(struct pci_dev *pdev, · 19 unmodified lines | |||
| 253 | 257 | ||
| 254 | ret = devm_led_classdev_register(&pdev->dev, &card->tx_led); | 258 | ret = devm_led_classdev_register(&pdev->dev, &card->tx_led); |
| 255 | if (ret) | 259 | if (ret) |
| 256 | goto out_port; | 260 | goto err_free_arcdev; |
| 257 | 261 | ||
| 258 | ret = devm_led_classdev_register(&pdev->dev, &card->recon_led); | 262 | ret = devm_led_classdev_register(&pdev->dev, &card->recon_led); |
| 259 | if (ret) | 263 | if (ret) |
| 260 | goto out_port; | 264 | goto err_free_arcdev; |
| 261 | 265 | ||
| 262 | dev_set_drvdata(&dev->dev, card); | 266 | dev_set_drvdata(&dev->dev, card); |
| 263 | 267 | ||
| 264 | ret = com20020_found(dev, IRQF_SHARED); | 268 | ret = com20020_found(dev, IRQF_SHARED); |
| 265 | if (ret) | 269 | if (ret) |
| 266 | goto out_port; | 270 | goto err_free_arcdev; |
| 267 | 271 | ||
| 268 | devm_arcnet_led_init(dev, dev->dev_id, i); | 272 | devm_arcnet_led_init(dev, dev->dev_id, i); |
| 269 | 273 | ||
| 270 | list_add(&card->list, &priv->list_dev); | 274 | list_add(&card->list, &priv->list_dev); |
| 271 | } | 275 | continue; |
| 272 | 276 | ||
| 273 | pci_set_drvdata(pdev, priv); | 277 | err_free_arcdev: |
| 274 | 278 | free_arcdev(dev); | |
| 275 | return 0; | 279 | break; |
| 276 | 280 | } | |
| 277 | out_port: | 281 | if (ret) |
| 278 | com20020pci_remove(pdev); | 282 | com20020pci_remove(pdev); |
| 279 | return ret; | 283 | return ret; |
| 280 | } | 284 | } |
| 281 | 285 | ||
| @@ -3978,15 +3978,11 @@ static int bond_neigh_init(struct neighbour *n) · 3977 unmodified lines | |||
| 3978 | 3978 | ||
| 3979 | rcu_read_lock(); | 3979 | rcu_read_lock(); |
| 3980 | slave = bond_first_slave_rcu(bond); | 3980 | slave = bond_first_slave_rcu(bond); |
| 3981 | if (!slave) { | 3981 | if (!slave) |
| 3982 | ret = -EINVAL; | ||
| 3983 | goto out; | 3982 | goto out; |
| 3984 | } | ||
| 3985 | slave_ops = slave->dev->netdev_ops; | 3983 | slave_ops = slave->dev->netdev_ops; |
| 3986 | if (!slave_ops->ndo_neigh_setup) { | 3984 | if (!slave_ops->ndo_neigh_setup) |
| 3987 | ret = -EINVAL; | ||
| 3988 | goto out; | 3985 | goto out; |
| 3989 | } | ||
| 3990 | 3986 | ||
| 3991 | /* TODO: find another way [1] to implement this. | 3987 | /* TODO: find another way [1] to implement this. |
| 3992 | * Passing a zeroed structure is fragile, | 3988 | * Passing a zeroed structure is fragile, |
| @@ -212,18 +212,6 @@ static const struct can_bittiming_const c_can_bittiming_const = { · 211 unmodified lines | |||
| 212 | .brp_inc = 1, | 212 | .brp_inc = 1, |
| 213 | }; | 213 | }; |
| 214 | 214 | ||
| 215 | static inline void c_can_pm_runtime_enable(const struct c_can_priv *priv) | ||
| 216 | { | ||
| 217 | if (priv->device) | ||
| 218 | pm_runtime_enable(priv->device); | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline void c_can_pm_runtime_disable(const struct c_can_priv *priv) | ||
| 222 | { | ||
| 223 | if (priv->device) | ||
| 224 | pm_runtime_disable(priv->device); | ||
| 225 | } | ||
| 226 | |||
| 227 | static inline void c_can_pm_runtime_get_sync(const struct c_can_priv *priv) | 215 | static inline void c_can_pm_runtime_get_sync(const struct c_can_priv *priv) |
| 228 | { | 216 | { |
| 229 | if (priv->device) | 217 | if (priv->device) |
| @@ -1335,7 +1323,6 @@ static const struct net_device_ops c_can_netdev_ops = { · 1105 unmodified lines | |||
| 1335 | 1323 | ||
| 1336 | int register_c_can_dev(struct net_device *dev) | 1324 | int register_c_can_dev(struct net_device *dev) |
| 1337 | { | 1325 | { |
| 1338 | struct c_can_priv *priv = netdev_priv(dev); | ||
| 1339 | int err; | 1326 | int err; |
| 1340 | 1327 | ||
| 1341 | /* Deactivate pins to prevent DRA7 DCAN IP from being | 1328 | /* Deactivate pins to prevent DRA7 DCAN IP from being |
| @@ -1345,28 +1332,19 @@ int register_c_can_dev(struct net_device *dev) · 3 unmodified lines | |||
| 1345 | */ | 1332 | */ |
| 1346 | pinctrl_pm_select_sleep_state(dev->dev.parent); | 1333 | pinctrl_pm_select_sleep_state(dev->dev.parent); |
| 1347 | 1334 | ||
| 1348 | c_can_pm_runtime_enable(priv); | ||
| 1349 | |||
| 1350 | dev->flags |= IFF_ECHO; /* we support local echo */ | 1335 | dev->flags |= IFF_ECHO; /* we support local echo */ |
| 1351 | dev->netdev_ops = &c_can_netdev_ops; | 1336 | dev->netdev_ops = &c_can_netdev_ops; |
| 1352 | 1337 | ||
| 1353 | err = register_candev(dev); | 1338 | err = register_candev(dev); |
| 1354 | if (err) | 1339 | if (!err) |
| 1355 | c_can_pm_runtime_disable(priv); | ||
| 1356 | else | ||
| 1357 | devm_can_led_init(dev); | 1340 | devm_can_led_init(dev); |
| 1358 | |||
| 1359 | return err; | 1341 | return err; |
| 1360 | } | 1342 | } |
| 1361 | EXPORT_SYMBOL_GPL(register_c_can_dev); | 1343 | EXPORT_SYMBOL_GPL(register_c_can_dev); |
| 1362 | 1344 | ||
| 1363 | void unregister_c_can_dev(struct net_device *dev) | 1345 | void unregister_c_can_dev(struct net_device *dev) |
| 1364 | { | 1346 | { |
| 1365 | struct c_can_priv *priv = netdev_priv(dev); | ||
| 1366 | |||
| 1367 | unregister_candev(dev); | 1347 | unregister_candev(dev); |
| 1368 | |||
| 1369 | c_can_pm_runtime_disable(priv); | ||
| 1370 | } | 1348 | } |
| 1371 | EXPORT_SYMBOL_GPL(unregister_c_can_dev); | 1349 | EXPORT_SYMBOL_GPL(unregister_c_can_dev); |
| 1372 | 1350 | ||
| @@ -239,12 +239,13 @@ static void c_can_pci_remove(struct pci_dev *pdev) · 238 unmodified lines | |||
| 239 | { | 239 | { |
| 240 | struct net_device *dev = pci_get_drvdata(pdev); | 240 | struct net_device *dev = pci_get_drvdata(pdev); |
| 241 | struct c_can_priv *priv = netdev_priv(dev); | 241 | struct c_can_priv *priv = netdev_priv(dev); |
| 242 | void __iomem *addr = priv->base; | ||
| 242 | 243 | ||
| 243 | unregister_c_can_dev(dev); | 244 | unregister_c_can_dev(dev); |
| 244 | 245 | ||
| 245 | free_c_can_dev(dev); | 246 | free_c_can_dev(dev); |
| 246 | 247 | ||
| 247 | pci_iounmap(pdev, priv->base); | 248 | pci_iounmap(pdev, addr); |
| 248 | pci_disable_msi(pdev); | 249 | pci_disable_msi(pdev); |
| 249 | pci_clear_master(pdev); | 250 | pci_clear_master(pdev); |
| 250 | pci_release_regions(pdev); | 251 | pci_release_regions(pdev); |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
| 30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
| 31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
| 32 | #include <linux/pm_runtime.h> | ||
| 32 | #include <linux/clk.h> | 33 | #include <linux/clk.h> |
| 33 | #include <linux/of.h> | 34 | #include <linux/of.h> |
| 34 | #include <linux/of_device.h> | 35 | #include <linux/of_device.h> |
| @@ -386,6 +387,7 @@ static int c_can_plat_probe(struct platform_device *pdev) · 351 unmodified lines | |||
| 386 | platform_set_drvdata(pdev, dev); | 387 | platform_set_drvdata(pdev, dev); |
| 387 | SET_NETDEV_DEV(dev, &pdev->dev); | 388 | SET_NETDEV_DEV(dev, &pdev->dev); |
| 388 | 389 | ||
| 390 | pm_runtime_enable(priv->device); | ||
| 389 | ret = register_c_can_dev(dev); | 391 | ret = register_c_can_dev(dev); |
| 390 | if (ret) { | 392 | if (ret) { |
| 391 | dev_err(&pdev->dev, "registering %s failed (err=%d)\n", | 393 | dev_err(&pdev->dev, "registering %s failed (err=%d)\n", |
| @@ -398,6 +400,7 @@ static int c_can_plat_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 398 | return 0; | 400 | return 0; |
| 399 | 401 | ||
| 400 | exit_free_device: | 402 | exit_free_device: |
| 403 | pm_runtime_disable(priv->device); | ||
| 401 | free_c_can_dev(dev); | 404 | free_c_can_dev(dev); |
| 402 | exit: | 405 | exit: |
| 403 | dev_err(&pdev->dev, "probe failed\n"); | 406 | dev_err(&pdev->dev, "probe failed\n"); |
| @@ -408,9 +411,10 @@ exit: · 4 unmodified lines | |||
| 408 | static int c_can_plat_remove(struct platform_device *pdev) | 411 | static int c_can_plat_remove(struct platform_device *pdev) |
| 409 | { | 412 | { |
| 410 | struct net_device *dev = platform_get_drvdata(pdev); | 413 | struct net_device *dev = platform_get_drvdata(pdev); |
| 414 | struct c_can_priv *priv = netdev_priv(dev); | ||
| 411 | 415 | ||
| 412 | unregister_c_can_dev(dev); | 416 | unregister_c_can_dev(dev); |
| 413 | 417 | pm_runtime_disable(priv->device); | |
| 414 | free_c_can_dev(dev); | 418 | free_c_can_dev(dev); |
| 415 | 419 | ||
| 416 | return 0; | 420 | return 0; |
| @@ -355,6 +355,7 @@ static void can_dellink(struct net_device *dev, struct list_head *head) · 354 unmodified lines | |||
| 355 | 355 | ||
| 356 | struct rtnl_link_ops can_link_ops __read_mostly = { | 356 | struct rtnl_link_ops can_link_ops __read_mostly = { |
| 357 | .kind = "can", | 357 | .kind = "can", |
| 358 | .netns_refund = true, | ||
| 358 | .maxtype = IFLA_CAN_MAX, | 359 | .maxtype = IFLA_CAN_MAX, |
| 359 | .policy = can_policy, | 360 | .policy = can_policy, |
| 360 | .setup = can_setup, | 361 | .setup = can_setup, |
| @@ -697,9 +697,15 @@ static int flexcan_chip_disable(struct flexcan_priv *priv) · 696 unmodified lines | |||
| 697 | static int flexcan_chip_freeze(struct flexcan_priv *priv) | 697 | static int flexcan_chip_freeze(struct flexcan_priv *priv) |
| 698 | { | 698 | { |
| 699 | struct flexcan_regs __iomem *regs = priv->regs; | 699 | struct flexcan_regs __iomem *regs = priv->regs; |
| 700 | unsigned int timeout = 1000 * 1000 * 10 / priv->can.bittiming.bitrate; | 700 | unsigned int timeout; |
| 701 | u32 bitrate = priv->can.bittiming.bitrate; | ||
| 701 | u32 reg; | 702 | u32 reg; |
| 702 | 703 | ||
| 704 | if (bitrate) | ||
| 705 | timeout = 1000 * 1000 * 10 / bitrate; | ||
| 706 | else | ||
| 707 | timeout = FLEXCAN_TIMEOUT_US / 10; | ||
| 708 | |||
| 703 | reg = priv->read(®s->mcr); | 709 | reg = priv->read(®s->mcr); |
| 704 | reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT; | 710 | reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT; |
| 705 | priv->write(reg, ®s->mcr); | 711 | priv->write(reg, ®s->mcr); |
| @@ -57,6 +57,7 @@ MODULE_DESCRIPTION("CAN driver for Kvaser CAN/PCIe devices"); · 56 unmodified lines | |||
| 57 | #define KVASER_PCIEFD_KCAN_STAT_REG 0x418 | 57 | #define KVASER_PCIEFD_KCAN_STAT_REG 0x418 |
| 58 | #define KVASER_PCIEFD_KCAN_MODE_REG 0x41c | 58 | #define KVASER_PCIEFD_KCAN_MODE_REG 0x41c |
| 59 | #define KVASER_PCIEFD_KCAN_BTRN_REG 0x420 | 59 | #define KVASER_PCIEFD_KCAN_BTRN_REG 0x420 |
| 60 | #define KVASER_PCIEFD_KCAN_BUS_LOAD_REG 0x424 | ||
| 60 | #define KVASER_PCIEFD_KCAN_BTRD_REG 0x428 | 61 | #define KVASER_PCIEFD_KCAN_BTRD_REG 0x428 |
| 61 | #define KVASER_PCIEFD_KCAN_PWM_REG 0x430 | 62 | #define KVASER_PCIEFD_KCAN_PWM_REG 0x430 |
| 62 | /* Loopback control register */ | 63 | /* Loopback control register */ |
| @@ -949,6 +950,9 @@ static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie) · 886 unmodified lines | |||
| 949 | timer_setup(&can->bec_poll_timer, kvaser_pciefd_bec_poll_timer, | 950 | timer_setup(&can->bec_poll_timer, kvaser_pciefd_bec_poll_timer, |
| 950 | 0); | 951 | 0); |
| 951 | 952 | ||
| 953 | /* Disable Bus load reporting */ | ||
| 954 | iowrite32(0, can->reg_base + KVASER_PCIEFD_KCAN_BUS_LOAD_REG); | ||
| 955 | |||
| 952 | tx_npackets = ioread32(can->reg_base + | 956 | tx_npackets = ioread32(can->reg_base + |
| 953 | KVASER_PCIEFD_KCAN_TX_NPACKETS_REG); | 957 | KVASER_PCIEFD_KCAN_TX_NPACKETS_REG); |
| 954 | if (((tx_npackets >> KVASER_PCIEFD_KCAN_TX_NPACKETS_MAX_SHIFT) & | 958 | if (((tx_npackets >> KVASER_PCIEFD_KCAN_TX_NPACKETS_MAX_SHIFT) & |
| @@ -501,9 +501,6 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota) · 500 unmodified lines | |||
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | while ((rxfs & RXFS_FFL_MASK) && (quota > 0)) { | 503 | while ((rxfs & RXFS_FFL_MASK) && (quota > 0)) { |
| 504 | if (rxfs & RXFS_RFL) | ||
| 505 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); | ||
| 506 | |||
| 507 | m_can_read_fifo(dev, rxfs); | 504 | m_can_read_fifo(dev, rxfs); |
| 508 | 505 | ||
| 509 | quota--; | 506 | quota--; |
| @@ -876,7 +873,7 @@ static int m_can_rx_peripheral(struct net_device *dev) · 366 unmodified lines | |||
| 876 | { | 873 | { |
| 877 | struct m_can_classdev *cdev = netdev_priv(dev); | 874 | struct m_can_classdev *cdev = netdev_priv(dev); |
| 878 | 875 | ||
| 879 | m_can_rx_handler(dev, 1); | 876 | m_can_rx_handler(dev, M_CAN_NAPI_WEIGHT); |
| 880 | 877 | ||
| 881 | m_can_enable_all_interrupts(cdev); | 878 | m_can_enable_all_interrupts(cdev); |
| 882 | 879 | ||
| @@ -21,7 +21,6 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); | 22 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); |
| 23 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe/M.2 FD family cards"); | 23 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe/M.2 FD family cards"); |
| 24 | MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe/M.2 FD CAN cards"); | ||
| 25 | MODULE_LICENSE("GPL v2"); | 24 | MODULE_LICENSE("GPL v2"); |
| 26 | 25 | ||
| 27 | #define PCIEFD_DRV_NAME "peak_pciefd" | 26 | #define PCIEFD_DRV_NAME "peak_pciefd" |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | MODULE_AUTHOR("Sebastian Haas <haas@ems-wuenche.com>"); | 22 | MODULE_AUTHOR("Sebastian Haas <haas@ems-wuenche.com>"); |
| 23 | MODULE_DESCRIPTION("Socket-CAN driver for EMS CPC-PCI/PCIe/104P CAN cards"); | 23 | MODULE_DESCRIPTION("Socket-CAN driver for EMS CPC-PCI/PCIe/104P CAN cards"); |
| 24 | MODULE_SUPPORTED_DEVICE("EMS CPC-PCI/PCIe/104P CAN card"); | ||
| 25 | MODULE_LICENSE("GPL v2"); | 24 | MODULE_LICENSE("GPL v2"); |
| 26 | 25 | ||
| 27 | #define EMS_PCI_V1_MAX_CHAN 2 | 26 | #define EMS_PCI_V1_MAX_CHAN 2 |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | MODULE_AUTHOR("Markus Plessing <plessing@ems-wuensche.com>"); | 22 | MODULE_AUTHOR("Markus Plessing <plessing@ems-wuensche.com>"); |
| 23 | MODULE_DESCRIPTION("Socket-CAN driver for EMS CPC-CARD cards"); | 23 | MODULE_DESCRIPTION("Socket-CAN driver for EMS CPC-CARD cards"); |
| 24 | MODULE_SUPPORTED_DEVICE("EMS CPC-CARD CAN card"); | ||
| 25 | MODULE_LICENSE("GPL v2"); | 24 | MODULE_LICENSE("GPL v2"); |
| 26 | 25 | ||
| 27 | #define EMS_PCMCIA_MAX_CHAN 2 | 26 | #define EMS_PCMCIA_MAX_CHAN 2 |
| @@ -33,7 +33,6 @@ · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | MODULE_AUTHOR("Per Dalen <per.dalen@cnw.se>"); | 34 | MODULE_AUTHOR("Per Dalen <per.dalen@cnw.se>"); |
| 35 | MODULE_DESCRIPTION("Socket-CAN driver for KVASER PCAN PCI cards"); | 35 | MODULE_DESCRIPTION("Socket-CAN driver for KVASER PCAN PCI cards"); |
| 36 | MODULE_SUPPORTED_DEVICE("KVASER PCAN PCI CAN card"); | ||
| 37 | MODULE_LICENSE("GPL v2"); | 36 | MODULE_LICENSE("GPL v2"); |
| 38 | 37 | ||
| 39 | #define MAX_NO_OF_CHANNELS 4 /* max no of channels on a single card */ | 38 | #define MAX_NO_OF_CHANNELS 4 /* max no of channels on a single card */ |
| @@ -24,8 +24,6 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); | 25 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); |
| 26 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCI family cards"); | 26 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCI family cards"); |
| 27 | MODULE_SUPPORTED_DEVICE("PEAK PCAN PCI/PCIe/PCIeC miniPCI CAN cards"); | ||
| 28 | MODULE_SUPPORTED_DEVICE("PEAK PCAN miniPCIe/cPCI PC/104+ PCI/104e CAN Cards"); | ||
| 29 | MODULE_LICENSE("GPL v2"); | 27 | MODULE_LICENSE("GPL v2"); |
| 30 | 28 | ||
| 31 | #define DRV_NAME "peak_pci" | 29 | #define DRV_NAME "peak_pci" |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | |||
| 22 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); | 22 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); |
| 23 | MODULE_DESCRIPTION("CAN driver for PEAK-System PCAN-PC Cards"); | 23 | MODULE_DESCRIPTION("CAN driver for PEAK-System PCAN-PC Cards"); |
| 24 | MODULE_LICENSE("GPL v2"); | 24 | MODULE_LICENSE("GPL v2"); |
| 25 | MODULE_SUPPORTED_DEVICE("PEAK PCAN-PC Card"); | ||
| 26 | 25 | ||
| 27 | /* PEAK-System PCMCIA driver name */ | 26 | /* PEAK-System PCMCIA driver name */ |
| 28 | #define PCC_NAME "peak_pcmcia" | 27 | #define PCC_NAME "peak_pcmcia" |
| @@ -25,18 +25,6 @@ · 24 unmodified lines | |||
| 25 | MODULE_AUTHOR("Pavel Cheblakov <P.B.Cheblakov@inp.nsk.su>"); | 25 | MODULE_AUTHOR("Pavel Cheblakov <P.B.Cheblakov@inp.nsk.su>"); |
| 26 | MODULE_DESCRIPTION("Socket-CAN driver for PLX90xx PCI-bridge cards with " | 26 | MODULE_DESCRIPTION("Socket-CAN driver for PLX90xx PCI-bridge cards with " |
| 27 | "the SJA1000 chips"); | 27 | "the SJA1000 chips"); |
| 28 | MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, " | ||
| 29 | "Adlink PCI-7841/cPCI-7841 SE, " | ||
| 30 | "Marathon CAN-bus-PCI, " | ||
| 31 | "Marathon CAN-bus-PCIe, " | ||
| 32 | "TEWS TECHNOLOGIES TPMC810, " | ||
| 33 | "esd CAN-PCI/CPCI/PCI104/200, " | ||
| 34 | "esd CAN-PCI/PMC/266, " | ||
| 35 | "esd CAN-PCIe/2000, " | ||
| 36 | "Connect Tech Inc. CANpro/104-Plus Opto (CRG001), " | ||
| 37 | "IXXAT PC-I 04/PCI, " | ||
| 38 | "ELCUS CAN-200-PCI, " | ||
| 39 | "ASEM DUAL CAN-RAW") | ||
| 40 | MODULE_LICENSE("GPL v2"); | 28 | MODULE_LICENSE("GPL v2"); |
| 41 | 29 | ||
| 42 | #define PLX_PCI_MAX_CHAN 2 | 30 | #define PLX_PCI_MAX_CHAN 2 |
| @@ -73,6 +73,7 @@ config CAN_KVASER_USB · 72 unmodified lines | |||
| 73 | - Kvaser Memorator Pro 5xHS | 73 | - Kvaser Memorator Pro 5xHS |
| 74 | - Kvaser USBcan Light 4xHS | 74 | - Kvaser USBcan Light 4xHS |
| 75 | - Kvaser USBcan Pro 2xHS v2 | 75 | - Kvaser USBcan Pro 2xHS v2 |
| 76 | - Kvaser USBcan Pro 4xHS | ||
| 76 | - Kvaser USBcan Pro 5xHS | 77 | - Kvaser USBcan Pro 5xHS |
| 77 | - Kvaser U100 | 78 | - Kvaser U100 |
| 78 | - Kvaser U100P | 79 | - Kvaser U100P |
| @@ -86,8 +86,9 @@ · 85 unmodified lines | |||
| 86 | #define USB_U100_PRODUCT_ID 273 | 86 | #define USB_U100_PRODUCT_ID 273 |
| 87 | #define USB_U100P_PRODUCT_ID 274 | 87 | #define USB_U100P_PRODUCT_ID 274 |
| 88 | #define USB_U100S_PRODUCT_ID 275 | 88 | #define USB_U100S_PRODUCT_ID 275 |
| 89 | #define USB_USBCAN_PRO_4HS_PRODUCT_ID 276 | ||
| 89 | #define USB_HYDRA_PRODUCT_ID_END \ | 90 | #define USB_HYDRA_PRODUCT_ID_END \ |
| 90 | USB_U100S_PRODUCT_ID | 91 | USB_USBCAN_PRO_4HS_PRODUCT_ID |
| 91 | 92 | ||
| 92 | static inline bool kvaser_is_leaf(const struct usb_device_id *id) | 93 | static inline bool kvaser_is_leaf(const struct usb_device_id *id) |
| 93 | { | 94 | { |
| @@ -193,6 +194,7 @@ static const struct usb_device_id kvaser_usb_table[] = { · 99 unmodified lines | |||
| 193 | { USB_DEVICE(KVASER_VENDOR_ID, USB_U100_PRODUCT_ID) }, | 194 | { USB_DEVICE(KVASER_VENDOR_ID, USB_U100_PRODUCT_ID) }, |
| 194 | { USB_DEVICE(KVASER_VENDOR_ID, USB_U100P_PRODUCT_ID) }, | 195 | { USB_DEVICE(KVASER_VENDOR_ID, USB_U100P_PRODUCT_ID) }, |
| 195 | { USB_DEVICE(KVASER_VENDOR_ID, USB_U100S_PRODUCT_ID) }, | 196 | { USB_DEVICE(KVASER_VENDOR_ID, USB_U100S_PRODUCT_ID) }, |
| 197 | { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_4HS_PRODUCT_ID) }, | ||
| 196 | { } | 198 | { } |
| 197 | }; | 199 | }; |
| 198 | MODULE_DEVICE_TABLE(usb, kvaser_usb_table); | 200 | MODULE_DEVICE_TABLE(usb, kvaser_usb_table); |
| @@ -18,8 +18,6 @@ · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | #include "pcan_usb_core.h" | 19 | #include "pcan_usb_core.h" |
| 20 | 20 | ||
| 21 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB adapter"); | ||
| 22 | |||
| 23 | /* PCAN-USB Endpoints */ | 21 | /* PCAN-USB Endpoints */ |
| 24 | #define PCAN_USB_EP_CMDOUT 1 | 22 | #define PCAN_USB_EP_CMDOUT 1 |
| 25 | #define PCAN_USB_EP_CMDIN (PCAN_USB_EP_CMDOUT | USB_DIR_IN) | 23 | #define PCAN_USB_EP_CMDIN (PCAN_USB_EP_CMDOUT | USB_DIR_IN) |
| @@ -16,9 +16,6 @@ · 15 unmodified lines | |||
| 16 | #include "pcan_usb_core.h" | 16 | #include "pcan_usb_core.h" |
| 17 | #include "pcan_usb_pro.h" | 17 | #include "pcan_usb_pro.h" |
| 18 | 18 | ||
| 19 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB FD adapter"); | ||
| 20 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro FD adapter"); | ||
| 21 | |||
| 22 | #define PCAN_USBPROFD_CHANNEL_COUNT 2 | 19 | #define PCAN_USBPROFD_CHANNEL_COUNT 2 |
| 23 | #define PCAN_USBFD_CHANNEL_COUNT 1 | 20 | #define PCAN_USBFD_CHANNEL_COUNT 1 |
| 24 | 21 | ||
| @@ -17,8 +17,6 @@ · 16 unmodified lines | |||
| 17 | #include "pcan_usb_core.h" | 17 | #include "pcan_usb_core.h" |
| 18 | #include "pcan_usb_pro.h" | 18 | #include "pcan_usb_pro.h" |
| 19 | 19 | ||
| 20 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter"); | ||
| 21 | |||
| 22 | #define PCAN_USBPRO_CHANNEL_COUNT 2 | 20 | #define PCAN_USBPRO_CHANNEL_COUNT 2 |
| 23 | 21 | ||
| 24 | /* PCAN-USB Pro adapter internal clock (MHz) */ | 22 | /* PCAN-USB Pro adapter internal clock (MHz) */ |
| @@ -1105,13 +1105,6 @@ static int b53_setup(struct dsa_switch *ds) · 1104 unmodified lines | |||
| 1105 | b53_disable_port(ds, port); | 1105 | b53_disable_port(ds, port); |
| 1106 | } | 1106 | } |
| 1107 | 1107 | ||
| 1108 | /* Let DSA handle the case were multiple bridges span the same switch | ||
| 1109 | * device and different VLAN awareness settings are requested, which | ||
| 1110 | * would be breaking filtering semantics for any of the other bridge | ||
| 1111 | * devices. (not hardware supported) | ||
| 1112 | */ | ||
| 1113 | ds->vlan_filtering_is_global = true; | ||
| 1114 | |||
| 1115 | return b53_setup_devlink_resources(ds); | 1108 | return b53_setup_devlink_resources(ds); |
| 1116 | } | 1109 | } |
| 1117 | 1110 | ||
| @@ -2664,6 +2657,13 @@ struct b53_device *b53_switch_alloc(struct device *base, · 1546 unmodified lines | |||
| 2664 | ds->ops = &b53_switch_ops; | 2657 | ds->ops = &b53_switch_ops; |
| 2665 | ds->untag_bridge_pvid = true; | 2658 | ds->untag_bridge_pvid = true; |
| 2666 | dev->vlan_enabled = true; | 2659 | dev->vlan_enabled = true; |
| 2660 | /* Let DSA handle the case were multiple bridges span the same switch | ||
| 2661 | * device and different VLAN awareness settings are requested, which | ||
| 2662 | * would be breaking filtering semantics for any of the other bridge | ||
| 2663 | * devices. (not hardware supported) | ||
| 2664 | */ | ||
| 2665 | ds->vlan_filtering_is_global = true; | ||
| 2666 | |||
| 2667 | mutex_init(&dev->reg_mutex); | 2667 | mutex_init(&dev->reg_mutex); |
| 2668 | mutex_init(&dev->stats_mutex); | 2668 | mutex_init(&dev->stats_mutex); |
| 2669 | 2669 | ||
| @@ -114,7 +114,10 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) · 113 unmodified lines | |||
| 114 | /* Force link status for IMP port */ | 114 | /* Force link status for IMP port */ |
| 115 | reg = core_readl(priv, offset); | 115 | reg = core_readl(priv, offset); |
| 116 | reg |= (MII_SW_OR | LINK_STS); | 116 | reg |= (MII_SW_OR | LINK_STS); |
| 117 | reg &= ~GMII_SPEED_UP_2G; | 117 | if (priv->type == BCM4908_DEVICE_ID) |
| 118 | reg |= GMII_SPEED_UP_2G; | ||
| 119 | else | ||
| 120 | reg &= ~GMII_SPEED_UP_2G; | ||
| 118 | core_writel(priv, reg, offset); | 121 | core_writel(priv, reg, offset); |
| 119 | 122 | ||
| 120 | /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ | 123 | /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ |
| @@ -585,8 +588,10 @@ static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) · 464 unmodified lines | |||
| 585 | * in bits 15:8 and the patch level in bits 7:0 which is exactly what | 588 | * in bits 15:8 and the patch level in bits 7:0 which is exactly what |
| 586 | * the REG_PHY_REVISION register layout is. | 589 | * the REG_PHY_REVISION register layout is. |
| 587 | */ | 590 | */ |
| 588 | 591 | if (priv->int_phy_mask & BIT(port)) | |
| 589 | return priv->hw_params.gphy_rev; | 592 | return priv->hw_params.gphy_rev; |
| 593 | else | ||
| 594 | return 0; | ||
| 590 | } | 595 | } |
| 591 | 596 | ||
| 592 | static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port, | 597 | static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port, |
| @@ -436,34 +436,32 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) · 435 unmodified lines | |||
| 436 | TD_DM_DRVP(8) | TD_DM_DRVN(8)); | 436 | TD_DM_DRVP(8) | TD_DM_DRVN(8)); |
| 437 | 437 | ||
| 438 | /* Setup core clock for MT7530 */ | 438 | /* Setup core clock for MT7530 */ |
| 439 | if (!trgint) { | 439 | /* Disable MT7530 core clock */ |
| 440 | /* Disable MT7530 core clock */ | 440 | core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); |
| 441 | core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); | ||
| 442 | |||
| 443 | /* Disable PLL, since phy_device has not yet been created | ||
| 444 | * provided for phy_[read,write]_mmd_indirect is called, we | ||
| 445 | * provide our own core_write_mmd_indirect to complete this | ||
| 446 | * function. | ||
| 447 | */ | ||
| 448 | core_write_mmd_indirect(priv, | ||
| 449 | CORE_GSWPLL_GRP1, | ||
| 450 | MDIO_MMD_VEND2, | ||
| 451 | 0); | ||
| 452 | |||
| 453 | /* Set core clock into 500Mhz */ | ||
| 454 | core_write(priv, CORE_GSWPLL_GRP2, | ||
| 455 | RG_GSWPLL_POSDIV_500M(1) | | ||
| 456 | RG_GSWPLL_FBKDIV_500M(25)); | ||
| 457 | 441 | ||
| 458 | /* Enable PLL */ | 442 | /* Disable PLL, since phy_device has not yet been created |
| 459 | core_write(priv, CORE_GSWPLL_GRP1, | 443 | * provided for phy_[read,write]_mmd_indirect is called, we |
| 460 | RG_GSWPLL_EN_PRE | | 444 | * provide our own core_write_mmd_indirect to complete this |
| 461 | RG_GSWPLL_POSDIV_200M(2) | | 445 | * function. |
| 462 | RG_GSWPLL_FBKDIV_200M(32)); | 446 | */ |
| 463 | 447 | core_write_mmd_indirect(priv, | |
| 464 | /* Enable MT7530 core clock */ | 448 | CORE_GSWPLL_GRP1, |
| 465 | core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); | 449 | MDIO_MMD_VEND2, |
| 466 | } | 450 | 0); |
| 451 | |||
| 452 | /* Set core clock into 500Mhz */ | ||
| 453 | core_write(priv, CORE_GSWPLL_GRP2, | ||
| 454 | RG_GSWPLL_POSDIV_500M(1) | | ||
| 455 | RG_GSWPLL_FBKDIV_500M(25)); | ||
| 456 | |||
| 457 | /* Enable PLL */ | ||
| 458 | core_write(priv, CORE_GSWPLL_GRP1, | ||
| 459 | RG_GSWPLL_EN_PRE | | ||
| 460 | RG_GSWPLL_POSDIV_200M(2) | | ||
| 461 | RG_GSWPLL_FBKDIV_200M(32)); | ||
| 462 | |||
| 463 | /* Enable MT7530 core clock */ | ||
| 464 | core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); | ||
| 467 | 465 | ||
| 468 | /* Setup the MT7530 TRGMII Tx Clock */ | 466 | /* Setup the MT7530 TRGMII Tx Clock */ |
| 469 | core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); | 467 | core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); |
| @@ -54,7 +54,7 @@ config B44_PCI · 53 unmodified lines | |||
| 54 | config BCM4908_ENET | 54 | config BCM4908_ENET |
| 55 | tristate "Broadcom BCM4908 internal mac support" | 55 | tristate "Broadcom BCM4908 internal mac support" |
| 56 | depends on ARCH_BCM4908 || COMPILE_TEST | 56 | depends on ARCH_BCM4908 || COMPILE_TEST |
| 57 | default y | 57 | default y if ARCH_BCM4908 |
| 58 | help | 58 | help |
| 59 | This driver supports Ethernet controller integrated into Broadcom | 59 | This driver supports Ethernet controller integrated into Broadcom |
| 60 | BCM4908 family SoCs. | 60 | BCM4908 family SoCs. |
| @@ -722,7 +722,7 @@ static int chcr_ktls_cpl_set_tcb_rpl(struct adapter *adap, unsigned char *input) · 721 unmodified lines | |||
| 722 | kvfree(tx_info); | 722 | kvfree(tx_info); |
| 723 | return 0; | 723 | return 0; |
| 724 | } | 724 | } |
| 725 | tx_info->open_state = false; | 725 | tx_info->open_state = CH_KTLS_OPEN_SUCCESS; |
| 726 | spin_unlock(&tx_info->lock); | 726 | spin_unlock(&tx_info->lock); |
| 727 | 727 | ||
| 728 | complete(&tx_info->completion); | 728 | complete(&tx_info->completion); |
| @@ -1337,6 +1337,7 @@ static int ftgmac100_poll(struct napi_struct *napi, int budget) · 1336 unmodified lines | |||
| 1337 | */ | 1337 | */ |
| 1338 | if (unlikely(priv->need_mac_restart)) { | 1338 | if (unlikely(priv->need_mac_restart)) { |
| 1339 | ftgmac100_start_hw(priv); | 1339 | ftgmac100_start_hw(priv); |
| 1340 | priv->need_mac_restart = false; | ||
| 1340 | 1341 | ||
| 1341 | /* Re-enable "bad" interrupts */ | 1342 | /* Re-enable "bad" interrupts */ |
| 1342 | iowrite32(FTGMAC100_INT_BAD, | 1343 | iowrite32(FTGMAC100_INT_BAD, |
| @@ -899,6 +899,8 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) · 898 unmodified lines | |||
| 899 | } else { | 899 | } else { |
| 900 | data &= ~IGP02E1000_PM_D0_LPLU; | 900 | data &= ~IGP02E1000_PM_D0_LPLU; |
| 901 | ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); | 901 | ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); |
| 902 | if (ret_val) | ||
| 903 | return ret_val; | ||
| 902 | /* LPLU and SmartSpeed are mutually exclusive. LPLU is used | 904 | /* LPLU and SmartSpeed are mutually exclusive. LPLU is used |
| 903 | * during Dx states where the power conservation is most | 905 | * during Dx states where the power conservation is most |
| 904 | * important. During driver activity we should enable | 906 | * important. During driver activity we should enable |
| @@ -1,8 +1,8 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright(c) 1999 - 2018 Intel Corporation. */ | 2 | /* Copyright(c) 1999 - 2018 Intel Corporation. */ |
| 3 | 3 | ||
| 4 | #ifndef _E1000_HW_H_ | 4 | #ifndef _E1000E_HW_H_ |
| 5 | #define _E1000_HW_H_ | 5 | #define _E1000E_HW_H_ |
| 6 | 6 | ||
| 7 | #include "regs.h" | 7 | #include "regs.h" |
| 8 | #include "defines.h" | 8 | #include "defines.h" |
| @@ -714,4 +714,4 @@ struct e1000_hw { · 705 unmodified lines | |||
| 714 | #include "80003es2lan.h" | 714 | #include "80003es2lan.h" |
| 715 | #include "ich8lan.h" | 715 | #include "ich8lan.h" |
| 716 | 716 | ||
| 717 | #endif | 717 | #endif /* _E1000E_HW_H_ */ |
| @@ -5974,15 +5974,19 @@ static void e1000_reset_task(struct work_struct *work) · 5973 unmodified lines | |||
| 5974 | struct e1000_adapter *adapter; | 5974 | struct e1000_adapter *adapter; |
| 5975 | adapter = container_of(work, struct e1000_adapter, reset_task); | 5975 | adapter = container_of(work, struct e1000_adapter, reset_task); |
| 5976 | 5976 | ||
| 5977 | rtnl_lock(); | ||
| 5977 | /* don't run the task if already down */ | 5978 | /* don't run the task if already down */ |
| 5978 | if (test_bit(__E1000_DOWN, &adapter->state)) | 5979 | if (test_bit(__E1000_DOWN, &adapter->state)) { |
| 5980 | rtnl_unlock(); | ||
| 5979 | return; | 5981 | return; |
| 5982 | } | ||
| 5980 | 5983 | ||
| 5981 | if (!(adapter->flags & FLAG_RESTART_NOW)) { | 5984 | if (!(adapter->flags & FLAG_RESTART_NOW)) { |
| 5982 | e1000e_dump(adapter); | 5985 | e1000e_dump(adapter); |
| 5983 | e_err("Reset adapter unexpectedly\n"); | 5986 | e_err("Reset adapter unexpectedly\n"); |
| 5984 | } | 5987 | } |
| 5985 | e1000e_reinit_locked(adapter); | 5988 | e1000e_reinit_locked(adapter); |
| 5989 | rtnl_unlock(); | ||
| 5986 | } | 5990 | } |
| 5987 | 5991 | ||
| 5988 | /** | 5992 | /** |
| @@ -3258,6 +3258,17 @@ static int i40e_configure_tx_ring(struct i40e_ring *ring) · 3257 unmodified lines | |||
| 3258 | return 0; | 3258 | return 0; |
| 3259 | } | 3259 | } |
| 3260 | 3260 | ||
| 3261 | /** | ||
| 3262 | * i40e_rx_offset - Return expected offset into page to access data | ||
| 3263 | * @rx_ring: Ring we are requesting offset of | ||
| 3264 | * | ||
| 3265 | * Returns the offset value for ring into the data buffer. | ||
| 3266 | */ | ||
| 3267 | static unsigned int i40e_rx_offset(struct i40e_ring *rx_ring) | ||
| 3268 | { | ||
| 3269 | return ring_uses_build_skb(rx_ring) ? I40E_SKB_PAD : 0; | ||
| 3270 | } | ||
| 3271 | |||
| 3261 | /** | 3272 | /** |
| 3262 | * i40e_configure_rx_ring - Configure a receive ring context | 3273 | * i40e_configure_rx_ring - Configure a receive ring context |
| 3263 | * @ring: The Rx ring to configure | 3274 | * @ring: The Rx ring to configure |
| @@ -3369,6 +3380,8 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring) · 105 unmodified lines | |||
| 3369 | else | 3380 | else |
| 3370 | set_ring_build_skb_enabled(ring); | 3381 | set_ring_build_skb_enabled(ring); |
| 3371 | 3382 | ||
| 3383 | ring->rx_offset = i40e_rx_offset(ring); | ||
| 3384 | |||
| 3372 | /* cache tail for quicker writes, and clear the reg before use */ | 3385 | /* cache tail for quicker writes, and clear the reg before use */ |
| 3373 | ring->tail = hw->hw_addr + I40E_QRX_TAIL(pf_q); | 3386 | ring->tail = hw->hw_addr + I40E_QRX_TAIL(pf_q); |
| 3374 | writel(0, ring->tail); | 3387 | writel(0, ring->tail); |
| @@ -1569,17 +1569,6 @@ void i40e_free_rx_resources(struct i40e_ring *rx_ring) · 1568 unmodified lines | |||
| 1569 | } | 1569 | } |
| 1570 | } | 1570 | } |
| 1571 | 1571 | ||
| 1572 | /** | ||
| 1573 | * i40e_rx_offset - Return expected offset into page to access data | ||
| 1574 | * @rx_ring: Ring we are requesting offset of | ||
| 1575 | * | ||
| 1576 | * Returns the offset value for ring into the data buffer. | ||
| 1577 | */ | ||
| 1578 | static unsigned int i40e_rx_offset(struct i40e_ring *rx_ring) | ||
| 1579 | { | ||
| 1580 | return ring_uses_build_skb(rx_ring) ? I40E_SKB_PAD : 0; | ||
| 1581 | } | ||
| 1582 | |||
| 1583 | /** | 1572 | /** |
| 1584 | * i40e_setup_rx_descriptors - Allocate Rx descriptors | 1573 | * i40e_setup_rx_descriptors - Allocate Rx descriptors |
| 1585 | * @rx_ring: Rx descriptor ring (for a specific queue) to setup | 1574 | * @rx_ring: Rx descriptor ring (for a specific queue) to setup |
| @@ -1608,7 +1597,6 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring) · 22 unmodified lines | |||
| 1608 | rx_ring->next_to_alloc = 0; | 1597 | rx_ring->next_to_alloc = 0; |
| 1609 | rx_ring->next_to_clean = 0; | 1598 | rx_ring->next_to_clean = 0; |
| 1610 | rx_ring->next_to_use = 0; | 1599 | rx_ring->next_to_use = 0; |
| 1611 | rx_ring->rx_offset = i40e_rx_offset(rx_ring); | ||
| 1612 | 1600 | ||
| 1613 | /* XDP RX-queue info only needed for RX rings exposed to XDP */ | 1601 | /* XDP RX-queue info only needed for RX rings exposed to XDP */ |
| 1614 | if (rx_ring->vsi->type == I40E_VSI_MAIN) { | 1602 | if (rx_ring->vsi->type == I40E_VSI_MAIN) { |
| @@ -274,6 +274,22 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q) · 273 unmodified lines | |||
| 274 | tlan_ctx->legacy_int = ICE_TX_LEGACY; | 274 | tlan_ctx->legacy_int = ICE_TX_LEGACY; |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | /** | ||
| 278 | * ice_rx_offset - Return expected offset into page to access data | ||
| 279 | * @rx_ring: Ring we are requesting offset of | ||
| 280 | * | ||
| 281 | * Returns the offset value for ring into the data buffer. | ||
| 282 | */ | ||
| 283 | static unsigned int ice_rx_offset(struct ice_ring *rx_ring) | ||
| 284 | { | ||
| 285 | if (ice_ring_uses_build_skb(rx_ring)) | ||
| 286 | return ICE_SKB_PAD; | ||
| 287 | else if (ice_is_xdp_ena_vsi(rx_ring->vsi)) | ||
| 288 | return XDP_PACKET_HEADROOM; | ||
| 289 | |||
| 290 | return 0; | ||
| 291 | } | ||
| 292 | |||
| 277 | /** | 293 | /** |
| 278 | * ice_setup_rx_ctx - Configure a receive ring context | 294 | * ice_setup_rx_ctx - Configure a receive ring context |
| 279 | * @ring: The Rx ring to configure | 295 | * @ring: The Rx ring to configure |
| @@ -413,11 +429,15 @@ int ice_setup_rx_ctx(struct ice_ring *ring) · 133 unmodified lines | |||
| 413 | else | 429 | else |
| 414 | ice_set_ring_build_skb_ena(ring); | 430 | ice_set_ring_build_skb_ena(ring); |
| 415 | 431 | ||
| 432 | ring->rx_offset = ice_rx_offset(ring); | ||
| 433 | |||
| 416 | /* init queue specific tail register */ | 434 | /* init queue specific tail register */ |
| 417 | ring->tail = hw->hw_addr + QRX_TAIL(pf_q); | 435 | ring->tail = hw->hw_addr + QRX_TAIL(pf_q); |
| 418 | writel(0, ring->tail); | 436 | writel(0, ring->tail); |
| 419 | 437 | ||
| 420 | if (ring->xsk_pool) { | 438 | if (ring->xsk_pool) { |
| 439 | bool ok; | ||
| 440 | |||
| 421 | if (!xsk_buff_can_alloc(ring->xsk_pool, num_bufs)) { | 441 | if (!xsk_buff_can_alloc(ring->xsk_pool, num_bufs)) { |
| 422 | dev_warn(dev, "XSK buffer pool does not provide enough addresses to fill %d buffers on Rx ring %d\n", | 442 | dev_warn(dev, "XSK buffer pool does not provide enough addresses to fill %d buffers on Rx ring %d\n", |
| 423 | num_bufs, ring->q_index); | 443 | num_bufs, ring->q_index); |
| @@ -426,8 +446,8 @@ int ice_setup_rx_ctx(struct ice_ring *ring) · 2 unmodified lines | |||
| 426 | return 0; | 446 | return 0; |
| 427 | } | 447 | } |
| 428 | 448 | ||
| 429 | err = ice_alloc_rx_bufs_zc(ring, num_bufs); | 449 | ok = ice_alloc_rx_bufs_zc(ring, num_bufs); |
| 430 | if (err) | 450 | if (!ok) |
| 431 | dev_info(dev, "Failed to allocate some buffers on XSK buffer pool enabled Rx ring %d (pf_q %d)\n", | 451 | dev_info(dev, "Failed to allocate some buffers on XSK buffer pool enabled Rx ring %d (pf_q %d)\n", |
| 432 | ring->q_index, pf_q); | 452 | ring->q_index, pf_q); |
| 433 | return 0; | 453 | return 0; |
| @@ -443,22 +443,6 @@ void ice_free_rx_ring(struct ice_ring *rx_ring) · 442 unmodified lines | |||
| 443 | } | 443 | } |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | /** | ||
| 447 | * ice_rx_offset - Return expected offset into page to access data | ||
| 448 | * @rx_ring: Ring we are requesting offset of | ||
| 449 | * | ||
| 450 | * Returns the offset value for ring into the data buffer. | ||
| 451 | */ | ||
| 452 | static unsigned int ice_rx_offset(struct ice_ring *rx_ring) | ||
| 453 | { | ||
| 454 | if (ice_ring_uses_build_skb(rx_ring)) | ||
| 455 | return ICE_SKB_PAD; | ||
| 456 | else if (ice_is_xdp_ena_vsi(rx_ring->vsi)) | ||
| 457 | return XDP_PACKET_HEADROOM; | ||
| 458 | |||
| 459 | return 0; | ||
| 460 | } | ||
| 461 | |||
| 462 | /** | 446 | /** |
| 463 | * ice_setup_rx_ring - Allocate the Rx descriptors | 447 | * ice_setup_rx_ring - Allocate the Rx descriptors |
| 464 | * @rx_ring: the Rx ring to set up | 448 | * @rx_ring: the Rx ring to set up |
| @@ -493,7 +477,6 @@ int ice_setup_rx_ring(struct ice_ring *rx_ring) · 28 unmodified lines | |||
| 493 | 477 | ||
| 494 | rx_ring->next_to_use = 0; | 478 | rx_ring->next_to_use = 0; |
| 495 | rx_ring->next_to_clean = 0; | 479 | rx_ring->next_to_clean = 0; |
| 496 | rx_ring->rx_offset = ice_rx_offset(rx_ring); | ||
| 497 | 480 | ||
| 498 | if (ice_is_xdp_ena_vsi(rx_ring->vsi)) | 481 | if (ice_is_xdp_ena_vsi(rx_ring->vsi)) |
| 499 | WRITE_ONCE(rx_ring->xdp_prog, rx_ring->vsi->xdp_prog); | 482 | WRITE_ONCE(rx_ring->xdp_prog, rx_ring->vsi->xdp_prog); |
| @@ -358,18 +358,18 @@ xsk_pool_if_up: · 357 unmodified lines | |||
| 358 | * This function allocates a number of Rx buffers from the fill ring | 358 | * This function allocates a number of Rx buffers from the fill ring |
| 359 | * or the internal recycle mechanism and places them on the Rx ring. | 359 | * or the internal recycle mechanism and places them on the Rx ring. |
| 360 | * | 360 | * |
| 361 | * Returns false if all allocations were successful, true if any fail. | 361 | * Returns true if all allocations were successful, false if any fail. |
| 362 | */ | 362 | */ |
| 363 | bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) | 363 | bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) |
| 364 | { | 364 | { |
| 365 | union ice_32b_rx_flex_desc *rx_desc; | 365 | union ice_32b_rx_flex_desc *rx_desc; |
| 366 | u16 ntu = rx_ring->next_to_use; | 366 | u16 ntu = rx_ring->next_to_use; |
| 367 | struct ice_rx_buf *rx_buf; | 367 | struct ice_rx_buf *rx_buf; |
| 368 | bool ret = false; | 368 | bool ok = true; |
| 369 | dma_addr_t dma; | 369 | dma_addr_t dma; |
| 370 | 370 | ||
| 371 | if (!count) | 371 | if (!count) |
| 372 | return false; | 372 | return true; |
| 373 | 373 | ||
| 374 | rx_desc = ICE_RX_DESC(rx_ring, ntu); | 374 | rx_desc = ICE_RX_DESC(rx_ring, ntu); |
| 375 | rx_buf = &rx_ring->rx_buf[ntu]; | 375 | rx_buf = &rx_ring->rx_buf[ntu]; |
| @@ -377,7 +377,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) · 1 unmodified line | |||
| 377 | do { | 377 | do { |
| 378 | rx_buf->xdp = xsk_buff_alloc(rx_ring->xsk_pool); | 378 | rx_buf->xdp = xsk_buff_alloc(rx_ring->xsk_pool); |
| 379 | if (!rx_buf->xdp) { | 379 | if (!rx_buf->xdp) { |
| 380 | ret = true; | 380 | ok = false; |
| 381 | break; | 381 | break; |
| 382 | } | 382 | } |
| 383 | 383 | ||
| @@ -402,7 +402,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) · 18 unmodified lines | |||
| 402 | ice_release_rx_desc(rx_ring, ntu); | 402 | ice_release_rx_desc(rx_ring, ntu); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | return ret; | 405 | return ok; |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | /** | 408 | /** |
| @@ -1,8 +1,8 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright(c) 2007 - 2018 Intel Corporation. */ | 2 | /* Copyright(c) 2007 - 2018 Intel Corporation. */ |
| 3 | 3 | ||
| 4 | #ifndef _E1000_HW_H_ | 4 | #ifndef _E1000_IGB_HW_H_ |
| 5 | #define _E1000_HW_H_ | 5 | #define _E1000_IGB_HW_H_ |
| 6 | 6 | ||
| 7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
| 8 | #include <linux/delay.h> | 8 | #include <linux/delay.h> |
| @@ -551,4 +551,4 @@ s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); · 542 unmodified lines | |||
| 551 | 551 | ||
| 552 | void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); | 552 | void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); |
| 553 | void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); | 553 | void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); |
| 554 | #endif /* _E1000_HW_H_ */ | 554 | #endif /* _E1000_IGB_HW_H_ */ |
| @@ -748,8 +748,8 @@ void igb_ptp_suspend(struct igb_adapter *adapter); · 747 unmodified lines | |||
| 748 | void igb_ptp_rx_hang(struct igb_adapter *adapter); | 748 | void igb_ptp_rx_hang(struct igb_adapter *adapter); |
| 749 | void igb_ptp_tx_hang(struct igb_adapter *adapter); | 749 | void igb_ptp_tx_hang(struct igb_adapter *adapter); |
| 750 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb); | 750 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb); |
| 751 | void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, | 751 | int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, |
| 752 | struct sk_buff *skb); | 752 | struct sk_buff *skb); |
| 753 | int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); | 753 | int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); |
| 754 | int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); | 754 | int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); |
| 755 | void igb_set_flag_queue_pairs(struct igb_adapter *, const u32); | 755 | void igb_set_flag_queue_pairs(struct igb_adapter *, const u32); |
| @@ -8214,7 +8214,8 @@ static void igb_reuse_rx_page(struct igb_ring *rx_ring, · 8213 unmodified lines | |||
| 8214 | new_buff->pagecnt_bias = old_buff->pagecnt_bias; | 8214 | new_buff->pagecnt_bias = old_buff->pagecnt_bias; |
| 8215 | } | 8215 | } |
| 8216 | 8216 | ||
| 8217 | static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer) | 8217 | static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer, |
| 8218 | int rx_buf_pgcnt) | ||
| 8218 | { | 8219 | { |
| 8219 | unsigned int pagecnt_bias = rx_buffer->pagecnt_bias; | 8220 | unsigned int pagecnt_bias = rx_buffer->pagecnt_bias; |
| 8220 | struct page *page = rx_buffer->page; | 8221 | struct page *page = rx_buffer->page; |
| @@ -8225,7 +8226,7 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer) · 4 unmodified lines | |||
| 8225 | 8226 | ||
| 8226 | #if (PAGE_SIZE < 8192) | 8227 | #if (PAGE_SIZE < 8192) |
| 8227 | /* if we are only owner of page we can reuse it */ | 8228 | /* if we are only owner of page we can reuse it */ |
| 8228 | if (unlikely((page_ref_count(page) - pagecnt_bias) > 1)) | 8229 | if (unlikely((rx_buf_pgcnt - pagecnt_bias) > 1)) |
| 8229 | return false; | 8230 | return false; |
| 8230 | #else | 8231 | #else |
| 8231 | #define IGB_LAST_OFFSET \ | 8232 | #define IGB_LAST_OFFSET \ |
| @@ -8301,9 +8302,10 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring, · 69 unmodified lines | |||
| 8301 | return NULL; | 8302 | return NULL; |
| 8302 | 8303 | ||
| 8303 | if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) { | 8304 | if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) { |
| 8304 | igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb); | 8305 | if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb)) { |
| 8305 | xdp->data += IGB_TS_HDR_LEN; | 8306 | xdp->data += IGB_TS_HDR_LEN; |
| 8306 | size -= IGB_TS_HDR_LEN; | 8307 | size -= IGB_TS_HDR_LEN; |
| 8308 | } | ||
| 8307 | } | 8309 | } |
| 8308 | 8310 | ||
| 8309 | /* Determine available headroom for copy */ | 8311 | /* Determine available headroom for copy */ |
| @@ -8364,8 +8366,8 @@ static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring, · 54 unmodified lines | |||
| 8364 | 8366 | ||
| 8365 | /* pull timestamp out of packet data */ | 8367 | /* pull timestamp out of packet data */ |
| 8366 | if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { | 8368 | if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { |
| 8367 | igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb); | 8369 | if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb)) |
| 8368 | __skb_pull(skb, IGB_TS_HDR_LEN); | 8370 | __skb_pull(skb, IGB_TS_HDR_LEN); |
| 8369 | } | 8371 | } |
| 8370 | 8372 | ||
| 8371 | /* update buffer offset */ | 8373 | /* update buffer offset */ |
| @@ -8614,11 +8616,17 @@ static unsigned int igb_rx_offset(struct igb_ring *rx_ring) · 242 unmodified lines | |||
| 8614 | } | 8616 | } |
| 8615 | 8617 | ||
| 8616 | static struct igb_rx_buffer *igb_get_rx_buffer(struct igb_ring *rx_ring, | 8618 | static struct igb_rx_buffer *igb_get_rx_buffer(struct igb_ring *rx_ring, |
| 8617 | const unsigned int size) | 8619 | const unsigned int size, int *rx_buf_pgcnt) |
| 8618 | { | 8620 | { |
| 8619 | struct igb_rx_buffer *rx_buffer; | 8621 | struct igb_rx_buffer *rx_buffer; |
| 8620 | 8622 | ||
| 8621 | rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; | 8623 | rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; |
| 8624 | *rx_buf_pgcnt = | ||
| 8625 | #if (PAGE_SIZE < 8192) | ||
| 8626 | page_count(rx_buffer->page); | ||
| 8627 | #else | ||
| 8628 | 0; | ||
| 8629 | #endif | ||
| 8622 | prefetchw(rx_buffer->page); | 8630 | prefetchw(rx_buffer->page); |
| 8623 | 8631 | ||
| 8624 | /* we are reusing so sync this buffer for CPU use */ | 8632 | /* we are reusing so sync this buffer for CPU use */ |
| @@ -8634,9 +8642,9 @@ static struct igb_rx_buffer *igb_get_rx_buffer(struct igb_ring *rx_ring, · 9 unmodified lines | |||
| 8634 | } | 8642 | } |
| 8635 | 8643 | ||
| 8636 | static void igb_put_rx_buffer(struct igb_ring *rx_ring, | 8644 | static void igb_put_rx_buffer(struct igb_ring *rx_ring, |
| 8637 | struct igb_rx_buffer *rx_buffer) | 8645 | struct igb_rx_buffer *rx_buffer, int rx_buf_pgcnt) |
| 8638 | { | 8646 | { |
| 8639 | if (igb_can_reuse_rx_page(rx_buffer)) { | 8647 | if (igb_can_reuse_rx_page(rx_buffer, rx_buf_pgcnt)) { |
| 8640 | /* hand second half of page back to the ring */ | 8648 | /* hand second half of page back to the ring */ |
| 8641 | igb_reuse_rx_page(rx_ring, rx_buffer); | 8649 | igb_reuse_rx_page(rx_ring, rx_buffer); |
| 8642 | } else { | 8650 | } else { |
| @@ -8664,6 +8672,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 21 unmodified lines | |||
| 8664 | unsigned int xdp_xmit = 0; | 8672 | unsigned int xdp_xmit = 0; |
| 8665 | struct xdp_buff xdp; | 8673 | struct xdp_buff xdp; |
| 8666 | u32 frame_sz = 0; | 8674 | u32 frame_sz = 0; |
| 8675 | int rx_buf_pgcnt; | ||
| 8667 | 8676 | ||
| 8668 | /* Frame size depend on rx_ring setup when PAGE_SIZE=4K */ | 8677 | /* Frame size depend on rx_ring setup when PAGE_SIZE=4K */ |
| 8669 | #if (PAGE_SIZE < 8192) | 8678 | #if (PAGE_SIZE < 8192) |
| @@ -8693,7 +8702,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 23 unmodified lines | |||
| 8693 | */ | 8702 | */ |
| 8694 | dma_rmb(); | 8703 | dma_rmb(); |
| 8695 | 8704 | ||
| 8696 | rx_buffer = igb_get_rx_buffer(rx_ring, size); | 8705 | rx_buffer = igb_get_rx_buffer(rx_ring, size, &rx_buf_pgcnt); |
| 8697 | 8706 | ||
| 8698 | /* retrieve a buffer from the ring */ | 8707 | /* retrieve a buffer from the ring */ |
| 8699 | if (!skb) { | 8708 | if (!skb) { |
| @@ -8736,7 +8745,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 36 unmodified lines | |||
| 8736 | break; | 8745 | break; |
| 8737 | } | 8746 | } |
| 8738 | 8747 | ||
| 8739 | igb_put_rx_buffer(rx_ring, rx_buffer); | 8748 | igb_put_rx_buffer(rx_ring, rx_buffer, rx_buf_pgcnt); |
| 8740 | cleaned_count++; | 8749 | cleaned_count++; |
| 8741 | 8750 | ||
| 8742 | /* fetch next buffer in frame if non-eop */ | 8751 | /* fetch next buffer in frame if non-eop */ |
| @@ -856,6 +856,9 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) · 855 unmodified lines | |||
| 856 | dev_kfree_skb_any(skb); | 856 | dev_kfree_skb_any(skb); |
| 857 | } | 857 | } |
| 858 | 858 | ||
| 859 | #define IGB_RET_PTP_DISABLED 1 | ||
| 860 | #define IGB_RET_PTP_INVALID 2 | ||
| 861 | |||
| 859 | /** | 862 | /** |
| 860 | * igb_ptp_rx_pktstamp - retrieve Rx per packet timestamp | 863 | * igb_ptp_rx_pktstamp - retrieve Rx per packet timestamp |
| 861 | * @q_vector: Pointer to interrupt specific structure | 864 | * @q_vector: Pointer to interrupt specific structure |
| @@ -864,19 +867,29 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) · 2 unmodified lines | |||
| 864 | * | 867 | * |
| 865 | * This function is meant to retrieve a timestamp from the first buffer of an | 868 | * This function is meant to retrieve a timestamp from the first buffer of an |
| 866 | * incoming frame. The value is stored in little endian format starting on | 869 | * incoming frame. The value is stored in little endian format starting on |
| 867 | * byte 8. | 870 | * byte 8 |
| 871 | * | ||
| 872 | * Returns: 0 if success, nonzero if failure | ||
| 868 | **/ | 873 | **/ |
| 869 | void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, | 874 | int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, |
| 870 | struct sk_buff *skb) | 875 | struct sk_buff *skb) |
| 871 | { | 876 | { |
| 872 | __le64 *regval = (__le64 *)va; | ||
| 873 | struct igb_adapter *adapter = q_vector->adapter; | 877 | struct igb_adapter *adapter = q_vector->adapter; |
| 878 | __le64 *regval = (__le64 *)va; | ||
| 874 | int adjust = 0; | 879 | int adjust = 0; |
| 875 | 880 | ||
| 881 | if (!(adapter->ptp_flags & IGB_PTP_ENABLED)) | ||
| 882 | return IGB_RET_PTP_DISABLED; | ||
| 883 | |||
| 876 | /* The timestamp is recorded in little endian format. | 884 | /* The timestamp is recorded in little endian format. |
| 877 | * DWORD: 0 1 2 3 | 885 | * DWORD: 0 1 2 3 |
| 878 | * Field: Reserved Reserved SYSTIML SYSTIMH | 886 | * Field: Reserved Reserved SYSTIML SYSTIMH |
| 879 | */ | 887 | */ |
| 888 | |||
| 889 | /* check reserved dwords are zero, be/le doesn't matter for zero */ | ||
| 890 | if (regval[0]) | ||
| 891 | return IGB_RET_PTP_INVALID; | ||
| 892 | |||
| 880 | igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), | 893 | igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), |
| 881 | le64_to_cpu(regval[1])); | 894 | le64_to_cpu(regval[1])); |
| 882 | 895 | ||
| @@ -896,6 +909,8 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 13 unmodified lines | |||
| 896 | } | 909 | } |
| 897 | skb_hwtstamps(skb)->hwtstamp = | 910 | skb_hwtstamps(skb)->hwtstamp = |
| 898 | ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust); | 911 | ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust); |
| 912 | |||
| 913 | return 0; | ||
| 899 | } | 914 | } |
| 900 | 915 | ||
| 901 | /** | 916 | /** |
| @@ -906,13 +921,15 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 4 unmodified lines | |||
| 906 | * This function is meant to retrieve a timestamp from the internal registers | 921 | * This function is meant to retrieve a timestamp from the internal registers |
| 907 | * of the adapter and store it in the skb. | 922 | * of the adapter and store it in the skb. |
| 908 | **/ | 923 | **/ |
| 909 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, | 924 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb) |
| 910 | struct sk_buff *skb) | ||
| 911 | { | 925 | { |
| 912 | struct igb_adapter *adapter = q_vector->adapter; | 926 | struct igb_adapter *adapter = q_vector->adapter; |
| 913 | struct e1000_hw *hw = &adapter->hw; | 927 | struct e1000_hw *hw = &adapter->hw; |
| 914 | u64 regval; | ||
| 915 | int adjust = 0; | 928 | int adjust = 0; |
| 929 | u64 regval; | ||
| 930 | |||
| 931 | if (!(adapter->ptp_flags & IGB_PTP_ENABLED)) | ||
| 932 | return; | ||
| 916 | 933 | ||
| 917 | /* If this bit is set, then the RX registers contain the time stamp. No | 934 | /* If this bit is set, then the RX registers contain the time stamp. No |
| 918 | * other packet will be time stamped until we read these registers, so | 935 | * other packet will be time stamped until we read these registers, so |
| @@ -547,7 +547,7 @@ void igc_ptp_init(struct igc_adapter *adapter); · 546 unmodified lines | |||
| 547 | void igc_ptp_reset(struct igc_adapter *adapter); | 547 | void igc_ptp_reset(struct igc_adapter *adapter); |
| 548 | void igc_ptp_suspend(struct igc_adapter *adapter); | 548 | void igc_ptp_suspend(struct igc_adapter *adapter); |
| 549 | void igc_ptp_stop(struct igc_adapter *adapter); | 549 | void igc_ptp_stop(struct igc_adapter *adapter); |
| 550 | void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va, | 550 | void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, __le32 *va, |
| 551 | struct sk_buff *skb); | 551 | struct sk_buff *skb); |
| 552 | int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); | 552 | int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); |
| 553 | int igc_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); | 553 | int igc_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); |
| @@ -1711,6 +1711,9 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev, · 1710 unmodified lines | |||
| 1711 | Autoneg); | 1711 | Autoneg); |
| 1712 | } | 1712 | } |
| 1713 | 1713 | ||
| 1714 | /* Set pause flow control settings */ | ||
| 1715 | ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); | ||
| 1716 | |||
| 1714 | switch (hw->fc.requested_mode) { | 1717 | switch (hw->fc.requested_mode) { |
| 1715 | case igc_fc_full: | 1718 | case igc_fc_full: |
| 1716 | ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause); | 1719 | ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause); |
| @@ -1725,9 +1728,7 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev, · 8 unmodified lines | |||
| 1725 | Asym_Pause); | 1728 | Asym_Pause); |
| 1726 | break; | 1729 | break; |
| 1727 | default: | 1730 | default: |
| 1728 | ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause); | 1731 | break; |
| 1729 | ethtool_link_ksettings_add_link_mode(cmd, advertising, | ||
| 1730 | Asym_Pause); | ||
| 1731 | } | 1732 | } |
| 1732 | 1733 | ||
| 1733 | status = pm_runtime_suspended(&adapter->pdev->dev) ? | 1734 | status = pm_runtime_suspended(&adapter->pdev->dev) ? |
| @@ -3831,10 +3831,19 @@ static void igc_reset_task(struct work_struct *work) · 3830 unmodified lines | |||
| 3831 | 3831 | ||
| 3832 | adapter = container_of(work, struct igc_adapter, reset_task); | 3832 | adapter = container_of(work, struct igc_adapter, reset_task); |
| 3833 | 3833 | ||
| 3834 | rtnl_lock(); | ||
| 3835 | /* If we're already down or resetting, just bail */ | ||
| 3836 | if (test_bit(__IGC_DOWN, &adapter->state) || | ||
| 3837 | test_bit(__IGC_RESETTING, &adapter->state)) { | ||
| 3838 | rtnl_unlock(); | ||
| 3839 | return; | ||
| 3840 | } | ||
| 3841 | |||
| 3834 | igc_rings_dump(adapter); | 3842 | igc_rings_dump(adapter); |
| 3835 | igc_regs_dump(adapter); | 3843 | igc_regs_dump(adapter); |
| 3836 | netdev_err(adapter->netdev, "Reset adapter\n"); | 3844 | netdev_err(adapter->netdev, "Reset adapter\n"); |
| 3837 | igc_reinit_locked(adapter); | 3845 | igc_reinit_locked(adapter); |
| 3846 | rtnl_unlock(); | ||
| 3838 | } | 3847 | } |
| 3839 | 3848 | ||
| 3840 | /** | 3849 | /** |
| @@ -152,46 +152,54 @@ static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, · 151 unmodified lines | |||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | /** | 154 | /** |
| 155 | * igc_ptp_rx_pktstamp - retrieve Rx per packet timestamp | 155 | * igc_ptp_rx_pktstamp - Retrieve timestamp from Rx packet buffer |
| 156 | * @q_vector: Pointer to interrupt specific structure | 156 | * @q_vector: Pointer to interrupt specific structure |
| 157 | * @va: Pointer to address containing Rx buffer | 157 | * @va: Pointer to address containing Rx buffer |
| 158 | * @skb: Buffer containing timestamp and packet | 158 | * @skb: Buffer containing timestamp and packet |
| 159 | * | 159 | * |
| 160 | * This function is meant to retrieve the first timestamp from the | 160 | * This function retrieves the timestamp saved in the beginning of packet |
| 161 | * first buffer of an incoming frame. The value is stored in little | 161 | * buffer. While two timestamps are available, one in timer0 reference and the |
| 162 | * endian format starting on byte 0. There's a second timestamp | 162 | * other in timer1 reference, this function considers only the timestamp in |
| 163 | * starting on byte 8. | 163 | * timer0 reference. |
| 164 | **/ | 164 | */ |
| 165 | void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va, | 165 | void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, __le32 *va, |
| 166 | struct sk_buff *skb) | 166 | struct sk_buff *skb) |
| 167 | { | 167 | { |
| 168 | struct igc_adapter *adapter = q_vector->adapter; | 168 | struct igc_adapter *adapter = q_vector->adapter; |
| 169 | __le64 *regval = (__le64 *)va; | 169 | u64 regval; |
| 170 | int adjust = 0; | 170 | int adjust; |
| 171 | 171 | ||
| 172 | /* The timestamp is recorded in little endian format. | 172 | /* Timestamps are saved in little endian at the beginning of the packet |
| 173 | * DWORD: | 0 | 1 | 2 | 3 | 173 | * buffer following the layout: |
| 174 | * Field: | Timer0 Low | Timer0 High | Timer1 Low | Timer1 High | 174 | * |
| 175 | * DWORD: | 0 | 1 | 2 | 3 | | ||
| 176 | * Field: | Timer1 SYSTIML | Timer1 SYSTIMH | Timer0 SYSTIML | Timer0 SYSTIMH | | ||
| 177 | * | ||
| 178 | * SYSTIML holds the nanoseconds part while SYSTIMH holds the seconds | ||
| 179 | * part of the timestamp. | ||
| 175 | */ | 180 | */ |
| 176 | igc_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), | 181 | regval = le32_to_cpu(va[2]); |
| 177 | le64_to_cpu(regval[0])); | 182 | regval |= (u64)le32_to_cpu(va[3]) << 32; |
| 178 | 183 | igc_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval); | |
| 179 | /* adjust timestamp for the RX latency based on link speed */ | 184 | |
| 180 | if (adapter->hw.mac.type == igc_i225) { | 185 | /* Adjust timestamp for the RX latency based on link speed */ |
| 181 | switch (adapter->link_speed) { | 186 | switch (adapter->link_speed) { |
| 182 | case SPEED_10: | 187 | case SPEED_10: |
| 183 | adjust = IGC_I225_RX_LATENCY_10; | 188 | adjust = IGC_I225_RX_LATENCY_10; |
| 184 | break; | 189 | break; |
| 185 | case SPEED_100: | 190 | case SPEED_100: |
| 186 | adjust = IGC_I225_RX_LATENCY_100; | 191 | adjust = IGC_I225_RX_LATENCY_100; |
| 187 | break; | 192 | break; |
| 188 | case SPEED_1000: | 193 | case SPEED_1000: |
| 189 | adjust = IGC_I225_RX_LATENCY_1000; | 194 | adjust = IGC_I225_RX_LATENCY_1000; |
| 190 | break; | 195 | break; |
| 191 | case SPEED_2500: | 196 | case SPEED_2500: |
| 192 | adjust = IGC_I225_RX_LATENCY_2500; | 197 | adjust = IGC_I225_RX_LATENCY_2500; |
| 193 | break; | 198 | break; |
| 194 | } | 199 | default: |
| 200 | adjust = 0; | ||
| 201 | netdev_warn_once(adapter->netdev, "Imprecise timestamp\n"); | ||
| 202 | break; | ||
| 195 | } | 203 | } |
| 196 | skb_hwtstamps(skb)->hwtstamp = | 204 | skb_hwtstamps(skb)->hwtstamp = |
| 197 | ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust); | 205 | ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust); |
| @@ -4118,6 +4118,8 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, · 4117 unmodified lines | |||
| 4118 | #endif | 4118 | #endif |
| 4119 | } | 4119 | } |
| 4120 | 4120 | ||
| 4121 | ring->rx_offset = ixgbe_rx_offset(ring); | ||
| 4122 | |||
| 4121 | if (ring->xsk_pool && hw->mac.type != ixgbe_mac_82599EB) { | 4123 | if (ring->xsk_pool && hw->mac.type != ixgbe_mac_82599EB) { |
| 4122 | u32 xsk_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool); | 4124 | u32 xsk_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool); |
| 4123 | 4125 | ||
| @@ -6578,7 +6580,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter, · 2454 unmodified lines | |||
| 6578 | 6580 | ||
| 6579 | rx_ring->next_to_clean = 0; | 6581 | rx_ring->next_to_clean = 0; |
| 6580 | rx_ring->next_to_use = 0; | 6582 | rx_ring->next_to_use = 0; |
| 6581 | rx_ring->rx_offset = ixgbe_rx_offset(rx_ring); | ||
| 6582 | 6583 | ||
| 6583 | /* XDP RX-queue info */ | 6584 | /* XDP RX-queue info */ |
| 6584 | if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, adapter->netdev, | 6585 | if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, adapter->netdev, |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | config NET_VENDOR_MARVELL | 6 | config NET_VENDOR_MARVELL |
| 7 | bool "Marvell devices" | 7 | bool "Marvell devices" |
| 8 | default y | 8 | default y |
| 9 | depends on PCI || CPU_PXA168 || MV64X60 || PPC32 || PLAT_ORION || INET || COMPILE_TEST | 9 | depends on PCI || CPU_PXA168 || PPC32 || PLAT_ORION || INET || COMPILE_TEST |
| 10 | help | 10 | help |
| 11 | If you have a network (Ethernet) card belonging to this class, say Y. | 11 | If you have a network (Ethernet) card belonging to this class, say Y. |
| 12 | 12 | ||
| @@ -19,7 +19,7 @@ if NET_VENDOR_MARVELL · 6 unmodified lines | |||
| 19 | 19 | ||
| 20 | config MV643XX_ETH | 20 | config MV643XX_ETH |
| 21 | tristate "Marvell Discovery (643XX) and Orion ethernet support" | 21 | tristate "Marvell Discovery (643XX) and Orion ethernet support" |
| 22 | depends on MV64X60 || PPC32 || PLAT_ORION || COMPILE_TEST | 22 | depends on PPC32 || PLAT_ORION || COMPILE_TEST |
| 23 | depends on INET | 23 | depends on INET |
| 24 | select PHYLIB | 24 | select PHYLIB |
| 25 | select MVMDIO | 25 | select MVMDIO |
| @@ -2684,7 +2684,7 @@ static const struct of_device_id mv643xx_eth_shared_ids[] = { · 2683 unmodified lines | |||
| 2684 | MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_ids); | 2684 | MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_ids); |
| 2685 | #endif | 2685 | #endif |
| 2686 | 2686 | ||
| 2687 | #if defined(CONFIG_OF_IRQ) && !defined(CONFIG_MV64X60) | 2687 | #ifdef CONFIG_OF_IRQ |
| 2688 | #define mv643xx_eth_property(_np, _name, _v) \ | 2688 | #define mv643xx_eth_property(_np, _name, _v) \ |
| 2689 | do { \ | 2689 | do { \ |
| 2690 | u32 tmp; \ | 2690 | u32 tmp; \ |
| @@ -13499,8 +13499,6 @@ static struct npc_mcam_kex npc_mkex_default = { · 13498 unmodified lines | |||
| 13499 | [NPC_LT_LC_IP] = { | 13499 | [NPC_LT_LC_IP] = { |
| 13500 | /* SIP+DIP: 8 bytes, KW2[63:0] */ | 13500 | /* SIP+DIP: 8 bytes, KW2[63:0] */ |
| 13501 | KEX_LD_CFG(0x07, 0xc, 0x1, 0x0, 0x10), | 13501 | KEX_LD_CFG(0x07, 0xc, 0x1, 0x0, 0x10), |
| 13502 | /* TOS: 1 byte, KW1[63:56] */ | ||
| 13503 | KEX_LD_CFG(0x0, 0x1, 0x1, 0x0, 0xf), | ||
| 13504 | }, | 13502 | }, |
| 13505 | /* Layer C: IPv6 */ | 13503 | /* Layer C: IPv6 */ |
| 13506 | [NPC_LT_LC_IP6] = { | 13504 | [NPC_LT_LC_IP6] = { |
| @@ -2462,8 +2462,10 @@ static void rvu_unregister_interrupts(struct rvu *rvu) · 2461 unmodified lines | |||
| 2462 | INTR_MASK(rvu->hw->total_pfs) & ~1ULL); | 2462 | INTR_MASK(rvu->hw->total_pfs) & ~1ULL); |
| 2463 | 2463 | ||
| 2464 | for (irq = 0; irq < rvu->num_vec; irq++) { | 2464 | for (irq = 0; irq < rvu->num_vec; irq++) { |
| 2465 | if (rvu->irq_allocated[irq]) | 2465 | if (rvu->irq_allocated[irq]) { |
| 2466 | free_irq(pci_irq_vector(rvu->pdev, irq), rvu); | 2466 | free_irq(pci_irq_vector(rvu->pdev, irq), rvu); |
| 2467 | rvu->irq_allocated[irq] = false; | ||
| 2468 | } | ||
| 2467 | } | 2469 | } |
| 2468 | 2470 | ||
| 2469 | pci_free_irq_vectors(rvu->pdev); | 2471 | pci_free_irq_vectors(rvu->pdev); |
| @@ -2975,8 +2977,8 @@ static void rvu_remove(struct pci_dev *pdev) · 505 unmodified lines | |||
| 2975 | struct rvu *rvu = pci_get_drvdata(pdev); | 2977 | struct rvu *rvu = pci_get_drvdata(pdev); |
| 2976 | 2978 | ||
| 2977 | rvu_dbg_exit(rvu); | 2979 | rvu_dbg_exit(rvu); |
| 2978 | rvu_unregister_interrupts(rvu); | ||
| 2979 | rvu_unregister_dl(rvu); | 2980 | rvu_unregister_dl(rvu); |
| 2981 | rvu_unregister_interrupts(rvu); | ||
| 2980 | rvu_flr_wq_destroy(rvu); | 2982 | rvu_flr_wq_destroy(rvu); |
| 2981 | rvu_cgx_exit(rvu); | 2983 | rvu_cgx_exit(rvu); |
| 2982 | rvu_fwdata_exit(rvu); | 2984 | rvu_fwdata_exit(rvu); |
| @@ -678,6 +678,7 @@ void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam, · 677 unmodified lines | |||
| 678 | u8 *intf, u8 *ena); | 678 | u8 *intf, u8 *ena); |
| 679 | bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature); | 679 | bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature); |
| 680 | u32 rvu_cgx_get_fifolen(struct rvu *rvu); | 680 | u32 rvu_cgx_get_fifolen(struct rvu *rvu); |
| 681 | void *rvu_first_cgx_pdata(struct rvu *rvu); | ||
| 681 | 682 | ||
| 682 | /* CPT APIs */ | 683 | /* CPT APIs */ |
| 683 | int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot); | 684 | int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot); |
| @@ -89,6 +89,21 @@ void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu) · 88 unmodified lines | |||
| 89 | return rvu->cgx_idmap[cgx_id]; | 89 | return rvu->cgx_idmap[cgx_id]; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | /* Return first enabled CGX instance if none are enabled then return NULL */ | ||
| 93 | void *rvu_first_cgx_pdata(struct rvu *rvu) | ||
| 94 | { | ||
| 95 | int first_enabled_cgx = 0; | ||
| 96 | void *cgxd = NULL; | ||
| 97 | |||
| 98 | for (; first_enabled_cgx < rvu->cgx_cnt_max; first_enabled_cgx++) { | ||
| 99 | cgxd = rvu_cgx_pdata(first_enabled_cgx, rvu); | ||
| 100 | if (cgxd) | ||
| 101 | break; | ||
| 102 | } | ||
| 103 | |||
| 104 | return cgxd; | ||
| 105 | } | ||
| 106 | |||
| 92 | /* Based on P2X connectivity find mapped NIX block for a PF */ | 107 | /* Based on P2X connectivity find mapped NIX block for a PF */ |
| 93 | static void rvu_map_cgx_nix_block(struct rvu *rvu, int pf, | 108 | static void rvu_map_cgx_nix_block(struct rvu *rvu, int pf, |
| 94 | int cgx_id, int lmac_id) | 109 | int cgx_id, int lmac_id) |
| @@ -711,10 +726,9 @@ int rvu_mbox_handler_cgx_features_get(struct rvu *rvu, · 616 unmodified lines | |||
| 711 | u32 rvu_cgx_get_fifolen(struct rvu *rvu) | 726 | u32 rvu_cgx_get_fifolen(struct rvu *rvu) |
| 712 | { | 727 | { |
| 713 | struct mac_ops *mac_ops; | 728 | struct mac_ops *mac_ops; |
| 714 | int rvu_def_cgx_id = 0; | ||
| 715 | u32 fifo_len; | 729 | u32 fifo_len; |
| 716 | 730 | ||
| 717 | mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu)); | 731 | mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu)); |
| 718 | fifo_len = mac_ops ? mac_ops->fifo_len : 0; | 732 | fifo_len = mac_ops ? mac_ops->fifo_len : 0; |
| 719 | 733 | ||
| 720 | return fifo_len; | 734 | return fifo_len; |
| @@ -234,12 +234,14 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 233 unmodified lines | |||
| 234 | char __user *buffer, | 234 | char __user *buffer, |
| 235 | size_t count, loff_t *ppos) | 235 | size_t count, loff_t *ppos) |
| 236 | { | 236 | { |
| 237 | int index, off = 0, flag = 0, go_back = 0, off_prev; | 237 | int index, off = 0, flag = 0, go_back = 0, len = 0; |
| 238 | struct rvu *rvu = filp->private_data; | 238 | struct rvu *rvu = filp->private_data; |
| 239 | int lf, pf, vf, pcifunc; | 239 | int lf, pf, vf, pcifunc; |
| 240 | struct rvu_block block; | 240 | struct rvu_block block; |
| 241 | int bytes_not_copied; | 241 | int bytes_not_copied; |
| 242 | int lf_str_size = 12; | ||
| 242 | int buf_size = 2048; | 243 | int buf_size = 2048; |
| 244 | char *lfs; | ||
| 243 | char *buf; | 245 | char *buf; |
| 244 | 246 | ||
| 245 | /* don't allow partial reads */ | 247 | /* don't allow partial reads */ |
| @@ -249,12 +251,20 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 3 unmodified lines | |||
| 249 | buf = kzalloc(buf_size, GFP_KERNEL); | 251 | buf = kzalloc(buf_size, GFP_KERNEL); |
| 250 | if (!buf) | 252 | if (!buf) |
| 251 | return -ENOSPC; | 253 | return -ENOSPC; |
| 252 | off += scnprintf(&buf[off], buf_size - 1 - off, "\npcifunc\t\t"); | 254 | |
| 255 | lfs = kzalloc(lf_str_size, GFP_KERNEL); | ||
| 256 | if (!lfs) { | ||
| 257 | kfree(buf); | ||
| 258 | return -ENOMEM; | ||
| 259 | } | ||
| 260 | off += scnprintf(&buf[off], buf_size - 1 - off, "%-*s", lf_str_size, | ||
| 261 | "pcifunc"); | ||
| 253 | for (index = 0; index < BLK_COUNT; index++) | 262 | for (index = 0; index < BLK_COUNT; index++) |
| 254 | if (strlen(rvu->hw->block[index].name)) | 263 | if (strlen(rvu->hw->block[index].name)) { |
| 255 | off += scnprintf(&buf[off], buf_size - 1 - off, | 264 | off += scnprintf(&buf[off], buf_size - 1 - off, |
| 256 | "%*s\t", (index - 1) * 2, | 265 | "%-*s", lf_str_size, |
| 257 | rvu->hw->block[index].name); | 266 | rvu->hw->block[index].name); |
| 267 | } | ||
| 258 | off += scnprintf(&buf[off], buf_size - 1 - off, "\n"); | 268 | off += scnprintf(&buf[off], buf_size - 1 - off, "\n"); |
| 259 | for (pf = 0; pf < rvu->hw->total_pfs; pf++) { | 269 | for (pf = 0; pf < rvu->hw->total_pfs; pf++) { |
| 260 | for (vf = 0; vf <= rvu->hw->total_vfs; vf++) { | 270 | for (vf = 0; vf <= rvu->hw->total_vfs; vf++) { |
| @@ -263,14 +273,15 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 2 unmodified lines | |||
| 263 | continue; | 273 | continue; |
| 264 | 274 | ||
| 265 | if (vf) { | 275 | if (vf) { |
| 276 | sprintf(lfs, "PF%d:VF%d", pf, vf - 1); | ||
| 266 | go_back = scnprintf(&buf[off], | 277 | go_back = scnprintf(&buf[off], |
| 267 | buf_size - 1 - off, | 278 | buf_size - 1 - off, |
| 268 | "PF%d:VF%d\t\t", pf, | 279 | "%-*s", lf_str_size, lfs); |
| 269 | vf - 1); | ||
| 270 | } else { | 280 | } else { |
| 281 | sprintf(lfs, "PF%d", pf); | ||
| 271 | go_back = scnprintf(&buf[off], | 282 | go_back = scnprintf(&buf[off], |
| 272 | buf_size - 1 - off, | 283 | buf_size - 1 - off, |
| 273 | "PF%d\t\t", pf); | 284 | "%-*s", lf_str_size, lfs); |
| 274 | } | 285 | } |
| 275 | 286 | ||
| 276 | off += go_back; | 287 | off += go_back; |
| @@ -278,20 +289,22 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 1 unmodified line | |||
| 278 | block = rvu->hw->block[index]; | 289 | block = rvu->hw->block[index]; |
| 279 | if (!strlen(block.name)) | 290 | if (!strlen(block.name)) |
| 280 | continue; | 291 | continue; |
| 281 | off_prev = off; | 292 | len = 0; |
| 293 | lfs[len] = '\0'; | ||
| 282 | for (lf = 0; lf < block.lf.max; lf++) { | 294 | for (lf = 0; lf < block.lf.max; lf++) { |
| 283 | if (block.fn_map[lf] != pcifunc) | 295 | if (block.fn_map[lf] != pcifunc) |
| 284 | continue; | 296 | continue; |
| 285 | flag = 1; | 297 | flag = 1; |
| 286 | off += scnprintf(&buf[off], buf_size - 1 | 298 | len += sprintf(&lfs[len], "%d,", lf); |
| 287 | - off, "%3d,", lf); | ||
| 288 | } | 299 | } |
| 289 | if (flag && off_prev != off) | 300 | |
| 290 | off--; | 301 | if (flag) |
| 291 | else | 302 | len--; |
| 292 | go_back++; | 303 | lfs[len] = '\0'; |
| 293 | off += scnprintf(&buf[off], buf_size - 1 - off, | 304 | off += scnprintf(&buf[off], buf_size - 1 - off, |
| 294 | "\t"); | 305 | "%-*s", lf_str_size, lfs); |
| 306 | if (!strlen(lfs)) | ||
| 307 | go_back += lf_str_size; | ||
| 295 | } | 308 | } |
| 296 | if (!flag) | 309 | if (!flag) |
| 297 | off -= go_back; | 310 | off -= go_back; |
| @@ -303,6 +316,7 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 5 unmodified lines | |||
| 303 | } | 316 | } |
| 304 | 317 | ||
| 305 | bytes_not_copied = copy_to_user(buffer, buf, off); | 318 | bytes_not_copied = copy_to_user(buffer, buf, off); |
| 319 | kfree(lfs); | ||
| 306 | kfree(buf); | 320 | kfree(buf); |
| 307 | 321 | ||
| 308 | if (bytes_not_copied) | 322 | if (bytes_not_copied) |
| @@ -319,7 +333,6 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) · 10 unmodified lines | |||
| 319 | struct rvu *rvu = filp->private; | 333 | struct rvu *rvu = filp->private; |
| 320 | struct pci_dev *pdev = NULL; | 334 | struct pci_dev *pdev = NULL; |
| 321 | struct mac_ops *mac_ops; | 335 | struct mac_ops *mac_ops; |
| 322 | int rvu_def_cgx_id = 0; | ||
| 323 | char cgx[10], lmac[10]; | 336 | char cgx[10], lmac[10]; |
| 324 | struct rvu_pfvf *pfvf; | 337 | struct rvu_pfvf *pfvf; |
| 325 | int pf, domain, blkid; | 338 | int pf, domain, blkid; |
| @@ -327,7 +340,10 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) · 1 unmodified line | |||
| 327 | u16 pcifunc; | 340 | u16 pcifunc; |
| 328 | 341 | ||
| 329 | domain = 2; | 342 | domain = 2; |
| 330 | mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu)); | 343 | mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu)); |
| 344 | /* There can be no CGX devices at all */ | ||
| 345 | if (!mac_ops) | ||
| 346 | return 0; | ||
| 331 | seq_printf(filp, "PCI dev\t\tRVU PF Func\tNIX block\t%s\tLMAC\n", | 347 | seq_printf(filp, "PCI dev\t\tRVU PF Func\tNIX block\t%s\tLMAC\n", |
| 332 | mac_ops->name); | 348 | mac_ops->name); |
| 333 | for (pf = 0; pf < rvu->hw->total_pfs; pf++) { | 349 | for (pf = 0; pf < rvu->hw->total_pfs; pf++) { |
| @@ -1818,7 +1834,6 @@ static void rvu_dbg_cgx_init(struct rvu *rvu) · 1484 unmodified lines | |||
| 1818 | { | 1834 | { |
| 1819 | struct mac_ops *mac_ops; | 1835 | struct mac_ops *mac_ops; |
| 1820 | unsigned long lmac_bmap; | 1836 | unsigned long lmac_bmap; |
| 1821 | int rvu_def_cgx_id = 0; | ||
| 1822 | int i, lmac_id; | 1837 | int i, lmac_id; |
| 1823 | char dname[20]; | 1838 | char dname[20]; |
| 1824 | void *cgx; | 1839 | void *cgx; |
| @@ -1826,7 +1841,7 @@ static void rvu_dbg_cgx_init(struct rvu *rvu) · 1 unmodified line | |||
| 1826 | if (!cgx_get_cgxcnt_max()) | 1841 | if (!cgx_get_cgxcnt_max()) |
| 1827 | return; | 1842 | return; |
| 1828 | 1843 | ||
| 1829 | mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu)); | 1844 | mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu)); |
| 1830 | if (!mac_ops) | 1845 | if (!mac_ops) |
| 1831 | return; | 1846 | return; |
| 1832 | 1847 | ||
| @@ -2629,7 +2629,7 @@ static int set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg) · 2628 unmodified lines | |||
| 2629 | struct nix_rx_flowkey_alg *field; | 2629 | struct nix_rx_flowkey_alg *field; |
| 2630 | struct nix_rx_flowkey_alg tmp; | 2630 | struct nix_rx_flowkey_alg tmp; |
| 2631 | u32 key_type, valid_key; | 2631 | u32 key_type, valid_key; |
| 2632 | int l4_key_offset; | 2632 | int l4_key_offset = 0; |
| 2633 | 2633 | ||
| 2634 | if (!alg) | 2634 | if (!alg) |
| 2635 | return -EINVAL; | 2635 | return -EINVAL; |
| @@ -2490,10 +2490,10 @@ int rvu_mbox_handler_npc_mcam_free_counter(struct rvu *rvu, · 2489 unmodified lines | |||
| 2490 | index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry); | 2490 | index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry); |
| 2491 | if (index >= mcam->bmap_entries) | 2491 | if (index >= mcam->bmap_entries) |
| 2492 | break; | 2492 | break; |
| 2493 | entry = index + 1; | ||
| 2493 | if (mcam->entry2cntr_map[index] != req->cntr) | 2494 | if (mcam->entry2cntr_map[index] != req->cntr) |
| 2494 | continue; | 2495 | continue; |
| 2495 | 2496 | ||
| 2496 | entry = index + 1; | ||
| 2497 | npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr, | 2497 | npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr, |
| 2498 | index, req->cntr); | 2498 | index, req->cntr); |
| 2499 | } | 2499 | } |
| @@ -257,17 +257,19 @@ int otx2_get_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc, · 256 unmodified lines | |||
| 257 | int otx2_get_all_flows(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc, | 257 | int otx2_get_all_flows(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc, |
| 258 | u32 *rule_locs) | 258 | u32 *rule_locs) |
| 259 | { | 259 | { |
| 260 | u32 rule_cnt = nfc->rule_cnt; | ||
| 260 | u32 location = 0; | 261 | u32 location = 0; |
| 261 | int idx = 0; | 262 | int idx = 0; |
| 262 | int err = 0; | 263 | int err = 0; |
| 263 | 264 | ||
| 264 | nfc->data = pfvf->flow_cfg->ntuple_max_flows; | 265 | nfc->data = pfvf->flow_cfg->ntuple_max_flows; |
| 265 | while ((!err || err == -ENOENT) && idx < nfc->rule_cnt) { | 266 | while ((!err || err == -ENOENT) && idx < rule_cnt) { |
| 266 | err = otx2_get_flow(pfvf, nfc, location); | 267 | err = otx2_get_flow(pfvf, nfc, location); |
| 267 | if (!err) | 268 | if (!err) |
| 268 | rule_locs[idx++] = location; | 269 | rule_locs[idx++] = location; |
| 269 | location++; | 270 | location++; |
| 270 | } | 271 | } |
| 272 | nfc->rule_cnt = rule_cnt; | ||
| 271 | 273 | ||
| 272 | return err; | 274 | return err; |
| 273 | } | 275 | } |
| @@ -1672,6 +1672,7 @@ int otx2_stop(struct net_device *netdev) · 1671 unmodified lines | |||
| 1672 | struct otx2_nic *pf = netdev_priv(netdev); | 1672 | struct otx2_nic *pf = netdev_priv(netdev); |
| 1673 | struct otx2_cq_poll *cq_poll = NULL; | 1673 | struct otx2_cq_poll *cq_poll = NULL; |
| 1674 | struct otx2_qset *qset = &pf->qset; | 1674 | struct otx2_qset *qset = &pf->qset; |
| 1675 | struct otx2_rss_info *rss; | ||
| 1675 | int qidx, vec, wrk; | 1676 | int qidx, vec, wrk; |
| 1676 | 1677 | ||
| 1677 | netif_carrier_off(netdev); | 1678 | netif_carrier_off(netdev); |
| @@ -1684,6 +1685,10 @@ int otx2_stop(struct net_device *netdev) · 6 unmodified lines | |||
| 1684 | /* First stop packet Rx/Tx */ | 1685 | /* First stop packet Rx/Tx */ |
| 1685 | otx2_rxtx_enable(pf, false); | 1686 | otx2_rxtx_enable(pf, false); |
| 1686 | 1687 | ||
| 1688 | /* Clear RSS enable flag */ | ||
| 1689 | rss = &pf->hw.rss_info; | ||
| 1690 | rss->enable = false; | ||
| 1691 | |||
| 1687 | /* Cleanup Queue IRQ */ | 1692 | /* Cleanup Queue IRQ */ |
| 1688 | vec = pci_irq_vector(pf->pdev, | 1693 | vec = pci_irq_vector(pf->pdev, |
| 1689 | pf->hw.nix_msixoff + NIX_LF_QINT_VEC_START); | 1694 | pf->hw.nix_msixoff + NIX_LF_QINT_VEC_START); |
| @@ -1544,8 +1544,8 @@ static int pxa168_eth_remove(struct platform_device *pdev) · 1543 unmodified lines | |||
| 1544 | clk_disable_unprepare(pep->clk); | 1544 | clk_disable_unprepare(pep->clk); |
| 1545 | mdiobus_unregister(pep->smi_bus); | 1545 | mdiobus_unregister(pep->smi_bus); |
| 1546 | mdiobus_free(pep->smi_bus); | 1546 | mdiobus_free(pep->smi_bus); |
| 1547 | unregister_netdev(dev); | ||
| 1548 | cancel_work_sync(&pep->tx_timeout_task); | 1547 | cancel_work_sync(&pep->tx_timeout_task); |
| 1548 | unregister_netdev(dev); | ||
| 1549 | free_netdev(dev); | 1549 | free_netdev(dev); |
| 1550 | return 0; | 1550 | return 0; |
| 1551 | } | 1551 | } |
| @@ -92,14 +92,15 @@ struct page_pool; · 91 unmodified lines | |||
| 92 | MLX5_MPWRQ_LOG_WQE_SZ - PAGE_SHIFT : 0) | 92 | MLX5_MPWRQ_LOG_WQE_SZ - PAGE_SHIFT : 0) |
| 93 | #define MLX5_MPWRQ_PAGES_PER_WQE BIT(MLX5_MPWRQ_WQE_PAGE_ORDER) | 93 | #define MLX5_MPWRQ_PAGES_PER_WQE BIT(MLX5_MPWRQ_WQE_PAGE_ORDER) |
| 94 | 94 | ||
| 95 | #define MLX5_MTT_OCTW(npages) (ALIGN(npages, 8) / 2) | 95 | #define MLX5_ALIGN_MTTS(mtts) (ALIGN(mtts, 8)) |
| 96 | #define MLX5_ALIGNED_MTTS_OCTW(mtts) ((mtts) / 2) | ||
| 97 | #define MLX5_MTT_OCTW(mtts) (MLX5_ALIGNED_MTTS_OCTW(MLX5_ALIGN_MTTS(mtts))) | ||
| 96 | /* Add another page to MLX5E_REQUIRED_WQE_MTTS as a buffer between | 98 | /* Add another page to MLX5E_REQUIRED_WQE_MTTS as a buffer between |
| 97 | * WQEs, This page will absorb write overflow by the hardware, when | 99 | * WQEs, This page will absorb write overflow by the hardware, when |
| 98 | * receiving packets larger than MTU. These oversize packets are | 100 | * receiving packets larger than MTU. These oversize packets are |
| 99 | * dropped by the driver at a later stage. | 101 | * dropped by the driver at a later stage. |
| 100 | */ | 102 | */ |
| 101 | #define MLX5E_REQUIRED_WQE_MTTS (ALIGN(MLX5_MPWRQ_PAGES_PER_WQE + 1, 8)) | 103 | #define MLX5E_REQUIRED_WQE_MTTS (MLX5_ALIGN_MTTS(MLX5_MPWRQ_PAGES_PER_WQE + 1)) |
| 102 | #define MLX5E_LOG_ALIGNED_MPWQE_PPW (ilog2(MLX5E_REQUIRED_WQE_MTTS)) | ||
| 103 | #define MLX5E_REQUIRED_MTTS(wqes) (wqes * MLX5E_REQUIRED_WQE_MTTS) | 104 | #define MLX5E_REQUIRED_MTTS(wqes) (wqes * MLX5E_REQUIRED_WQE_MTTS) |
| 104 | #define MLX5E_MAX_RQ_NUM_MTTS \ | 105 | #define MLX5E_MAX_RQ_NUM_MTTS \ |
| 105 | ((1 << 16) * 2) /* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ | 106 | ((1 << 16) * 2) /* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ |
| @@ -1181,7 +1181,8 @@ int mlx5_tc_ct_add_no_trk_match(struct mlx5_flow_spec *spec) · 1180 unmodified lines | |||
| 1181 | 1181 | ||
| 1182 | mlx5e_tc_match_to_reg_get_match(spec, CTSTATE_TO_REG, | 1182 | mlx5e_tc_match_to_reg_get_match(spec, CTSTATE_TO_REG, |
| 1183 | &ctstate, &ctstate_mask); | 1183 | &ctstate, &ctstate_mask); |
| 1184 | if (ctstate_mask) | 1184 | |
| 1185 | if ((ctstate & ctstate_mask) == MLX5_CT_STATE_TRK_BIT) | ||
| 1185 | return -EOPNOTSUPP; | 1186 | return -EOPNOTSUPP; |
| 1186 | 1187 | ||
| 1187 | ctstate_mask |= MLX5_CT_STATE_TRK_BIT; | 1188 | ctstate_mask |= MLX5_CT_STATE_TRK_BIT; |
| @@ -685,14 +685,14 @@ int mlx5e_tc_tun_route_lookup(struct mlx5e_priv *priv, · 684 unmodified lines | |||
| 685 | u16 vport_num; | 685 | u16 vport_num; |
| 686 | int err = 0; | 686 | int err = 0; |
| 687 | 687 | ||
| 688 | if (flow_attr->ip_version == 4) { | 688 | if (flow_attr->tun_ip_version == 4) { |
| 689 | /* Addresses are swapped for decap */ | 689 | /* Addresses are swapped for decap */ |
| 690 | attr.fl.fl4.saddr = esw_attr->rx_tun_attr->dst_ip.v4; | 690 | attr.fl.fl4.saddr = esw_attr->rx_tun_attr->dst_ip.v4; |
| 691 | attr.fl.fl4.daddr = esw_attr->rx_tun_attr->src_ip.v4; | 691 | attr.fl.fl4.daddr = esw_attr->rx_tun_attr->src_ip.v4; |
| 692 | err = mlx5e_route_lookup_ipv4_get(priv, priv->netdev, &attr); | 692 | err = mlx5e_route_lookup_ipv4_get(priv, priv->netdev, &attr); |
| 693 | } | 693 | } |
| 694 | #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6) | 694 | #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6) |
| 695 | else if (flow_attr->ip_version == 6) { | 695 | else if (flow_attr->tun_ip_version == 6) { |
| 696 | /* Addresses are swapped for decap */ | 696 | /* Addresses are swapped for decap */ |
| 697 | attr.fl.fl6.saddr = esw_attr->rx_tun_attr->dst_ip.v6; | 697 | attr.fl.fl6.saddr = esw_attr->rx_tun_attr->dst_ip.v6; |
| 698 | attr.fl.fl6.daddr = esw_attr->rx_tun_attr->src_ip.v6; | 698 | attr.fl.fl6.daddr = esw_attr->rx_tun_attr->src_ip.v6; |
| @@ -718,10 +718,10 @@ int mlx5e_tc_tun_route_lookup(struct mlx5e_priv *priv, · 19 unmodified lines | |||
| 718 | esw_attr->rx_tun_attr->decap_vport = vport_num; | 718 | esw_attr->rx_tun_attr->decap_vport = vport_num; |
| 719 | 719 | ||
| 720 | out: | 720 | out: |
| 721 | if (flow_attr->ip_version == 4) | 721 | if (flow_attr->tun_ip_version == 4) |
| 722 | mlx5e_route_lookup_ipv4_put(&attr); | 722 | mlx5e_route_lookup_ipv4_put(&attr); |
| 723 | #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6) | 723 | #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6) |
| 724 | else if (flow_attr->ip_version == 6) | 724 | else if (flow_attr->tun_ip_version == 6) |
| 725 | mlx5e_route_lookup_ipv6_put(&attr); | 725 | mlx5e_route_lookup_ipv6_put(&attr); |
| 726 | #endif | 726 | #endif |
| 727 | return err; | 727 | return err; |
| @@ -89,6 +89,7 @@ int mlx5e_tc_set_attr_rx_tun(struct mlx5e_tc_flow *flow, · 88 unmodified lines | |||
| 89 | * required to establish routing. | 89 | * required to establish routing. |
| 90 | */ | 90 | */ |
| 91 | flow_flag_set(flow, TUN_RX); | 91 | flow_flag_set(flow, TUN_RX); |
| 92 | flow->attr->tun_ip_version = ip_version; | ||
| 92 | return 0; | 93 | return 0; |
| 93 | } | 94 | } |
| 94 | 95 | ||
| @@ -1091,7 +1092,7 @@ int mlx5e_attach_decap_route(struct mlx5e_priv *priv, · 996 unmodified lines | |||
| 1091 | if (err || !esw_attr->rx_tun_attr->decap_vport) | 1092 | if (err || !esw_attr->rx_tun_attr->decap_vport) |
| 1092 | goto out; | 1093 | goto out; |
| 1093 | 1094 | ||
| 1094 | key.ip_version = attr->ip_version; | 1095 | key.ip_version = attr->tun_ip_version; |
| 1095 | if (key.ip_version == 4) | 1096 | if (key.ip_version == 4) |
| 1096 | key.endpoint_ip.v4 = esw_attr->rx_tun_attr->dst_ip.v4; | 1097 | key.endpoint_ip.v4 = esw_attr->rx_tun_attr->dst_ip.v4; |
| 1097 | else | 1098 | else |
| @@ -227,6 +227,10 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv, · 226 unmodified lines | |||
| 227 | option_key = (struct geneve_opt *)&enc_opts.key->data[0]; | 227 | option_key = (struct geneve_opt *)&enc_opts.key->data[0]; |
| 228 | option_mask = (struct geneve_opt *)&enc_opts.mask->data[0]; | 228 | option_mask = (struct geneve_opt *)&enc_opts.mask->data[0]; |
| 229 | 229 | ||
| 230 | if (option_mask->opt_class == 0 && option_mask->type == 0 && | ||
| 231 | !memchr_inv(option_mask->opt_data, 0, option_mask->length * 4)) | ||
| 232 | return 0; | ||
| 233 | |||
| 230 | if (option_key->length > max_tlv_option_data_len) { | 234 | if (option_key->length > max_tlv_option_data_len) { |
| 231 | NL_SET_ERR_MSG_MOD(extack, | 235 | NL_SET_ERR_MSG_MOD(extack, |
| 232 | "Matching on GENEVE options: unsupported option len"); | 236 | "Matching on GENEVE options: unsupported option len"); |
| @@ -1887,6 +1887,7 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev, · 1886 unmodified lines | |||
| 1887 | { | 1887 | { |
| 1888 | struct mlx5e_priv *priv = netdev_priv(netdev); | 1888 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 1889 | struct mlx5_core_dev *mdev = priv->mdev; | 1889 | struct mlx5_core_dev *mdev = priv->mdev; |
| 1890 | int err; | ||
| 1890 | 1891 | ||
| 1891 | if (!MLX5_CAP_GEN(mdev, cqe_compression)) | 1892 | if (!MLX5_CAP_GEN(mdev, cqe_compression)) |
| 1892 | return -EOPNOTSUPP; | 1893 | return -EOPNOTSUPP; |
| @@ -1896,7 +1897,10 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev, · 3 unmodified lines | |||
| 1896 | return -EINVAL; | 1897 | return -EINVAL; |
| 1897 | } | 1898 | } |
| 1898 | 1899 | ||
| 1899 | mlx5e_modify_rx_cqe_compression_locked(priv, enable); | 1900 | err = mlx5e_modify_rx_cqe_compression_locked(priv, enable); |
| 1901 | if (err) | ||
| 1902 | return err; | ||
| 1903 | |||
| 1900 | priv->channels.params.rx_cqe_compress_def = enable; | 1904 | priv->channels.params.rx_cqe_compress_def = enable; |
| 1901 | 1905 | ||
| 1902 | return 0; | 1906 | return 0; |
| @@ -2014,8 +2018,13 @@ static int set_pflag_tx_port_ts(struct net_device *netdev, bool enable) · 111 unmodified lines | |||
| 2014 | */ | 2018 | */ |
| 2015 | 2019 | ||
| 2016 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { | 2020 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { |
| 2021 | struct mlx5e_params old_params; | ||
| 2022 | |||
| 2023 | old_params = priv->channels.params; | ||
| 2017 | priv->channels.params = new_channels.params; | 2024 | priv->channels.params = new_channels.params; |
| 2018 | err = mlx5e_num_channels_changed(priv); | 2025 | err = mlx5e_num_channels_changed(priv); |
| 2026 | if (err) | ||
| 2027 | priv->channels.params = old_params; | ||
| 2019 | goto out; | 2028 | goto out; |
| 2020 | } | 2029 | } |
| 2021 | 2030 | ||
| @@ -334,9 +334,9 @@ static int mlx5e_create_rq_umr_mkey(struct mlx5_core_dev *mdev, struct mlx5e_rq · 333 unmodified lines | |||
| 334 | rq->wqe_overflow.addr); | 334 | rq->wqe_overflow.addr); |
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | static inline u64 mlx5e_get_mpwqe_offset(struct mlx5e_rq *rq, u16 wqe_ix) | 337 | static u64 mlx5e_get_mpwqe_offset(u16 wqe_ix) |
| 338 | { | 338 | { |
| 339 | return (wqe_ix << MLX5E_LOG_ALIGNED_MPWQE_PPW) << PAGE_SHIFT; | 339 | return MLX5E_REQUIRED_MTTS(wqe_ix) << PAGE_SHIFT; |
| 340 | } | 340 | } |
| 341 | 341 | ||
| 342 | static void mlx5e_init_frags_partition(struct mlx5e_rq *rq) | 342 | static void mlx5e_init_frags_partition(struct mlx5e_rq *rq) |
| @@ -577,7 +577,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, · 234 unmodified lines | |||
| 577 | mlx5_wq_ll_get_wqe(&rq->mpwqe.wq, i); | 577 | mlx5_wq_ll_get_wqe(&rq->mpwqe.wq, i); |
| 578 | u32 byte_count = | 578 | u32 byte_count = |
| 579 | rq->mpwqe.num_strides << rq->mpwqe.log_stride_sz; | 579 | rq->mpwqe.num_strides << rq->mpwqe.log_stride_sz; |
| 580 | u64 dma_offset = mlx5e_get_mpwqe_offset(rq, i); | 580 | u64 dma_offset = mlx5e_get_mpwqe_offset(i); |
| 581 | 581 | ||
| 582 | wqe->data[0].addr = cpu_to_be64(dma_offset + rq->buff.headroom); | 582 | wqe->data[0].addr = cpu_to_be64(dma_offset + rq->buff.headroom); |
| 583 | wqe->data[0].byte_count = cpu_to_be32(byte_count); | 583 | wqe->data[0].byte_count = cpu_to_be32(byte_count); |
| @@ -2368,8 +2368,9 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params, · 1784 unmodified lines | |||
| 2368 | { | 2368 | { |
| 2369 | switch (params->rq_wq_type) { | 2369 | switch (params->rq_wq_type) { |
| 2370 | case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: | 2370 | case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: |
| 2371 | return order_base_2(MLX5E_UMR_WQEBBS) + | 2371 | return max_t(u8, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE, |
| 2372 | mlx5e_get_rq_log_wq_sz(rqp->rqc); | 2372 | order_base_2(MLX5E_UMR_WQEBBS) + |
| 2373 | mlx5e_get_rq_log_wq_sz(rqp->rqc)); | ||
| 2373 | default: /* MLX5_WQ_TYPE_CYCLIC */ | 2374 | default: /* MLX5_WQ_TYPE_CYCLIC */ |
| 2374 | return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; | 2375 | return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; |
| 2375 | } | 2376 | } |
| @@ -2502,8 +2503,10 @@ void mlx5e_close_channels(struct mlx5e_channels *chs) · 126 unmodified lines | |||
| 2502 | { | 2503 | { |
| 2503 | int i; | 2504 | int i; |
| 2504 | 2505 | ||
| 2505 | if (chs->port_ptp) | 2506 | if (chs->port_ptp) { |
| 2506 | mlx5e_port_ptp_close(chs->port_ptp); | 2507 | mlx5e_port_ptp_close(chs->port_ptp); |
| 2508 | chs->port_ptp = NULL; | ||
| 2509 | } | ||
| 2507 | 2510 | ||
| 2508 | for (i = 0; i < chs->num; i++) | 2511 | for (i = 0; i < chs->num; i++) |
| 2509 | mlx5e_close_channel(chs->c[i]); | 2512 | mlx5e_close_channel(chs->c[i]); |
| @@ -3810,6 +3813,15 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s) · 1300 unmodified lines | |||
| 3810 | for (j = 0; j < priv->max_opened_tc; j++) { | 3813 | for (j = 0; j < priv->max_opened_tc; j++) { |
| 3811 | struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j]; | 3814 | struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j]; |
| 3812 | 3815 | ||
| 3816 | s->tx_packets += sq_stats->packets; | ||
| 3817 | s->tx_bytes += sq_stats->bytes; | ||
| 3818 | s->tx_dropped += sq_stats->dropped; | ||
| 3819 | } | ||
| 3820 | } | ||
| 3821 | if (priv->port_ptp_opened) { | ||
| 3822 | for (i = 0; i < priv->max_opened_tc; i++) { | ||
| 3823 | struct mlx5e_sq_stats *sq_stats = &priv->port_ptp_stats.sq[i]; | ||
| 3824 | |||
| 3813 | s->tx_packets += sq_stats->packets; | 3825 | s->tx_packets += sq_stats->packets; |
| 3814 | s->tx_bytes += sq_stats->bytes; | 3826 | s->tx_bytes += sq_stats->bytes; |
| 3815 | s->tx_dropped += sq_stats->dropped; | 3827 | s->tx_dropped += sq_stats->dropped; |
| @@ -3834,10 +3846,17 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) · 18 unmodified lines | |||
| 3834 | } | 3846 | } |
| 3835 | 3847 | ||
| 3836 | if (mlx5e_is_uplink_rep(priv)) { | 3848 | if (mlx5e_is_uplink_rep(priv)) { |
| 3849 | struct mlx5e_vport_stats *vstats = &priv->stats.vport; | ||
| 3850 | |||
| 3837 | stats->rx_packets = PPORT_802_3_GET(pstats, a_frames_received_ok); | 3851 | stats->rx_packets = PPORT_802_3_GET(pstats, a_frames_received_ok); |
| 3838 | stats->rx_bytes = PPORT_802_3_GET(pstats, a_octets_received_ok); | 3852 | stats->rx_bytes = PPORT_802_3_GET(pstats, a_octets_received_ok); |
| 3839 | stats->tx_packets = PPORT_802_3_GET(pstats, a_frames_transmitted_ok); | 3853 | stats->tx_packets = PPORT_802_3_GET(pstats, a_frames_transmitted_ok); |
| 3840 | stats->tx_bytes = PPORT_802_3_GET(pstats, a_octets_transmitted_ok); | 3854 | stats->tx_bytes = PPORT_802_3_GET(pstats, a_octets_transmitted_ok); |
| 3855 | |||
| 3856 | /* vport multicast also counts packets that are dropped due to steering | ||
| 3857 | * or rx out of buffer | ||
| 3858 | */ | ||
| 3859 | stats->multicast = VPORT_COUNTER_GET(vstats, received_eth_multicast.packets); | ||
| 3841 | } else { | 3860 | } else { |
| 3842 | mlx5e_fold_sw_stats64(priv, stats); | 3861 | mlx5e_fold_sw_stats64(priv, stats); |
| 3843 | } | 3862 | } |
| @@ -4683,8 +4702,10 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) · 839 unmodified lines | |||
| 4683 | struct mlx5e_channel *c = priv->channels.c[i]; | 4702 | struct mlx5e_channel *c = priv->channels.c[i]; |
| 4684 | 4703 | ||
| 4685 | mlx5e_rq_replace_xdp_prog(&c->rq, prog); | 4704 | mlx5e_rq_replace_xdp_prog(&c->rq, prog); |
| 4686 | if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) | 4705 | if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) { |
| 4706 | bpf_prog_inc(prog); | ||
| 4687 | mlx5e_rq_replace_xdp_prog(&c->xskrq, prog); | 4707 | mlx5e_rq_replace_xdp_prog(&c->xskrq, prog); |
| 4708 | } | ||
| 4688 | } | 4709 | } |
| 4689 | 4710 | ||
| 4690 | unlock: | 4711 | unlock: |
| @@ -4958,6 +4979,11 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 · 267 unmodified lines | |||
| 4958 | priv->max_nch); | 4979 | priv->max_nch); |
| 4959 | params->num_tc = 1; | 4980 | params->num_tc = 1; |
| 4960 | 4981 | ||
| 4982 | /* Set an initial non-zero value, so that mlx5e_select_queue won't | ||
| 4983 | * divide by zero if called before first activating channels. | ||
| 4984 | */ | ||
| 4985 | priv->num_tc_x_num_ch = params->num_channels * params->num_tc; | ||
| 4986 | |||
| 4961 | /* SQ */ | 4987 | /* SQ */ |
| 4962 | params->log_sq_size = is_kdump_kernel() ? | 4988 | params->log_sq_size = is_kdump_kernel() ? |
| 4963 | MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE : | 4989 | MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE : |
| @@ -5474,8 +5500,6 @@ int mlx5e_priv_init(struct mlx5e_priv *priv, · 510 unmodified lines | |||
| 5474 | struct net_device *netdev, | 5500 | struct net_device *netdev, |
| 5475 | struct mlx5_core_dev *mdev) | 5501 | struct mlx5_core_dev *mdev) |
| 5476 | { | 5502 | { |
| 5477 | memset(priv, 0, sizeof(*priv)); | ||
| 5478 | |||
| 5479 | /* priv init */ | 5503 | /* priv init */ |
| 5480 | priv->mdev = mdev; | 5504 | priv->mdev = mdev; |
| 5481 | priv->netdev = netdev; | 5505 | priv->netdev = netdev; |
| @@ -5508,12 +5532,18 @@ void mlx5e_priv_cleanup(struct mlx5e_priv *priv) · 26 unmodified lines | |||
| 5508 | { | 5532 | { |
| 5509 | int i; | 5533 | int i; |
| 5510 | 5534 | ||
| 5535 | /* bail if change profile failed and also rollback failed */ | ||
| 5536 | if (!priv->mdev) | ||
| 5537 | return; | ||
| 5538 | |||
| 5511 | destroy_workqueue(priv->wq); | 5539 | destroy_workqueue(priv->wq); |
| 5512 | free_cpumask_var(priv->scratchpad.cpumask); | 5540 | free_cpumask_var(priv->scratchpad.cpumask); |
| 5513 | 5541 | ||
| 5514 | for (i = 0; i < priv->htb.max_qos_sqs; i++) | 5542 | for (i = 0; i < priv->htb.max_qos_sqs; i++) |
| 5515 | kfree(priv->htb.qos_sq_stats[i]); | 5543 | kfree(priv->htb.qos_sq_stats[i]); |
| 5516 | kvfree(priv->htb.qos_sq_stats); | 5544 | kvfree(priv->htb.qos_sq_stats); |
| 5545 | |||
| 5546 | memset(priv, 0, sizeof(*priv)); | ||
| 5517 | } | 5547 | } |
| 5518 | 5548 | ||
| 5519 | struct net_device * | 5549 | struct net_device * |
| @@ -5630,11 +5660,10 @@ void mlx5e_detach_netdev(struct mlx5e_priv *priv) · 110 unmodified lines | |||
| 5630 | } | 5660 | } |
| 5631 | 5661 | ||
| 5632 | static int | 5662 | static int |
| 5633 | mlx5e_netdev_attach_profile(struct mlx5e_priv *priv, | 5663 | mlx5e_netdev_attach_profile(struct net_device *netdev, struct mlx5_core_dev *mdev, |
| 5634 | const struct mlx5e_profile *new_profile, void *new_ppriv) | 5664 | const struct mlx5e_profile *new_profile, void *new_ppriv) |
| 5635 | { | 5665 | { |
| 5636 | struct net_device *netdev = priv->netdev; | 5666 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 5637 | struct mlx5_core_dev *mdev = priv->mdev; | ||
| 5638 | int err; | 5667 | int err; |
| 5639 | 5668 | ||
| 5640 | err = mlx5e_priv_init(priv, netdev, mdev); | 5669 | err = mlx5e_priv_init(priv, netdev, mdev); |
| @@ -5647,10 +5676,16 @@ mlx5e_netdev_attach_profile(struct mlx5e_priv *priv, · 6 unmodified lines | |||
| 5647 | priv->ppriv = new_ppriv; | 5676 | priv->ppriv = new_ppriv; |
| 5648 | err = new_profile->init(priv->mdev, priv->netdev); | 5677 | err = new_profile->init(priv->mdev, priv->netdev); |
| 5649 | if (err) | 5678 | if (err) |
| 5650 | return err; | 5679 | goto priv_cleanup; |
| 5651 | err = mlx5e_attach_netdev(priv); | 5680 | err = mlx5e_attach_netdev(priv); |
| 5652 | if (err) | 5681 | if (err) |
| 5653 | new_profile->cleanup(priv); | 5682 | goto profile_cleanup; |
| 5683 | return err; | ||
| 5684 | |||
| 5685 | profile_cleanup: | ||
| 5686 | new_profile->cleanup(priv); | ||
| 5687 | priv_cleanup: | ||
| 5688 | mlx5e_priv_cleanup(priv); | ||
| 5654 | return err; | 5689 | return err; |
| 5655 | } | 5690 | } |
| 5656 | 5691 | ||
| @@ -5659,13 +5694,14 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv, · 2 unmodified lines | |||
| 5659 | { | 5694 | { |
| 5660 | unsigned int new_max_nch = mlx5e_calc_max_nch(priv, new_profile); | 5695 | unsigned int new_max_nch = mlx5e_calc_max_nch(priv, new_profile); |
| 5661 | const struct mlx5e_profile *orig_profile = priv->profile; | 5696 | const struct mlx5e_profile *orig_profile = priv->profile; |
| 5697 | struct net_device *netdev = priv->netdev; | ||
| 5698 | struct mlx5_core_dev *mdev = priv->mdev; | ||
| 5662 | void *orig_ppriv = priv->ppriv; | 5699 | void *orig_ppriv = priv->ppriv; |
| 5663 | int err, rollback_err; | 5700 | int err, rollback_err; |
| 5664 | 5701 | ||
| 5665 | /* sanity */ | 5702 | /* sanity */ |
| 5666 | if (new_max_nch != priv->max_nch) { | 5703 | if (new_max_nch != priv->max_nch) { |
| 5667 | netdev_warn(priv->netdev, | 5704 | netdev_warn(netdev, "%s: Replacing profile with different max channels\n", |
| 5668 | "%s: Replacing profile with different max channels\n", | ||
| 5669 | __func__); | 5705 | __func__); |
| 5670 | return -EINVAL; | 5706 | return -EINVAL; |
| 5671 | } | 5707 | } |
| @@ -5675,22 +5711,19 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv, · 3 unmodified lines | |||
| 5675 | priv->profile->cleanup(priv); | 5711 | priv->profile->cleanup(priv); |
| 5676 | mlx5e_priv_cleanup(priv); | 5712 | mlx5e_priv_cleanup(priv); |
| 5677 | 5713 | ||
| 5678 | err = mlx5e_netdev_attach_profile(priv, new_profile, new_ppriv); | 5714 | err = mlx5e_netdev_attach_profile(netdev, mdev, new_profile, new_ppriv); |
| 5679 | if (err) { /* roll back to original profile */ | 5715 | if (err) { /* roll back to original profile */ |
| 5680 | netdev_warn(priv->netdev, "%s: new profile init failed, %d\n", | 5716 | netdev_warn(netdev, "%s: new profile init failed, %d\n", __func__, err); |
| 5681 | __func__, err); | ||
| 5682 | goto rollback; | 5717 | goto rollback; |
| 5683 | } | 5718 | } |
| 5684 | 5719 | ||
| 5685 | return 0; | 5720 | return 0; |
| 5686 | 5721 | ||
| 5687 | rollback: | 5722 | rollback: |
| 5688 | rollback_err = mlx5e_netdev_attach_profile(priv, orig_profile, orig_ppriv); | 5723 | rollback_err = mlx5e_netdev_attach_profile(netdev, mdev, orig_profile, orig_ppriv); |
| 5689 | if (rollback_err) { | 5724 | if (rollback_err) |
| 5690 | netdev_err(priv->netdev, | 5725 | netdev_err(netdev, "%s: failed to rollback to orig profile, %d\n", |
| 5691 | "%s: failed to rollback to orig profile, %d\n", | ||
| 5692 | __func__, rollback_err); | 5726 | __func__, rollback_err); |
| 5693 | } | ||
| 5694 | return err; | 5727 | return err; |
| 5695 | } | 5728 | } |
| 5696 | 5729 | ||
| @@ -500,7 +500,6 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) · 499 unmodified lines | |||
| 500 | struct mlx5e_icosq *sq = rq->icosq; | 500 | struct mlx5e_icosq *sq = rq->icosq; |
| 501 | struct mlx5_wq_cyc *wq = &sq->wq; | 501 | struct mlx5_wq_cyc *wq = &sq->wq; |
| 502 | struct mlx5e_umr_wqe *umr_wqe; | 502 | struct mlx5e_umr_wqe *umr_wqe; |
| 503 | u16 xlt_offset = ix << (MLX5E_LOG_ALIGNED_MPWQE_PPW - 1); | ||
| 504 | u16 pi; | 503 | u16 pi; |
| 505 | int err; | 504 | int err; |
| 506 | int i; | 505 | int i; |
| @@ -531,7 +530,8 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) · 24 unmodified lines | |||
| 531 | umr_wqe->ctrl.opmod_idx_opcode = | 530 | umr_wqe->ctrl.opmod_idx_opcode = |
| 532 | cpu_to_be32((sq->pc << MLX5_WQE_CTRL_WQE_INDEX_SHIFT) | | 531 | cpu_to_be32((sq->pc << MLX5_WQE_CTRL_WQE_INDEX_SHIFT) | |
| 533 | MLX5_OPCODE_UMR); | 532 | MLX5_OPCODE_UMR); |
| 534 | umr_wqe->uctrl.xlt_offset = cpu_to_be16(xlt_offset); | 533 | umr_wqe->uctrl.xlt_offset = |
| 534 | cpu_to_be16(MLX5_ALIGNED_MTTS_OCTW(MLX5E_REQUIRED_MTTS(ix))); | ||
| 535 | 535 | ||
| 536 | sq->db.wqe_info[pi] = (struct mlx5e_icosq_wqe_info) { | 536 | sq->db.wqe_info[pi] = (struct mlx5e_icosq_wqe_info) { |
| 537 | .wqe_type = MLX5E_ICOSQ_WQE_UMR_RX, | 537 | .wqe_type = MLX5E_ICOSQ_WQE_UMR_RX, |
| @@ -2296,6 +2296,16 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 2295 unmodified lines | |||
| 2296 | *match_level = MLX5_MATCH_L4; | 2296 | *match_level = MLX5_MATCH_L4; |
| 2297 | } | 2297 | } |
| 2298 | 2298 | ||
| 2299 | /* Currenlty supported only for MPLS over UDP */ | ||
| 2300 | if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_MPLS) && | ||
| 2301 | !netif_is_bareudp(filter_dev)) { | ||
| 2302 | NL_SET_ERR_MSG_MOD(extack, | ||
| 2303 | "Matching on MPLS is supported only for MPLS over UDP"); | ||
| 2304 | netdev_err(priv->netdev, | ||
| 2305 | "Matching on MPLS is supported only for MPLS over UDP\n"); | ||
| 2306 | return -EOPNOTSUPP; | ||
| 2307 | } | ||
| 2308 | |||
| 2299 | return 0; | 2309 | return 0; |
| 2300 | } | 2310 | } |
| 2301 | 2311 | ||
| @@ -2899,6 +2909,37 @@ static int is_action_keys_supported(const struct flow_action_entry *act, · 597 unmodified lines | |||
| 2899 | return 0; | 2909 | return 0; |
| 2900 | } | 2910 | } |
| 2901 | 2911 | ||
| 2912 | static bool modify_tuple_supported(bool modify_tuple, bool ct_clear, | ||
| 2913 | bool ct_flow, struct netlink_ext_ack *extack, | ||
| 2914 | struct mlx5e_priv *priv, | ||
| 2915 | struct mlx5_flow_spec *spec) | ||
| 2916 | { | ||
| 2917 | if (!modify_tuple || ct_clear) | ||
| 2918 | return true; | ||
| 2919 | |||
| 2920 | if (ct_flow) { | ||
| 2921 | NL_SET_ERR_MSG_MOD(extack, | ||
| 2922 | "can't offload tuple modification with non-clear ct()"); | ||
| 2923 | netdev_info(priv->netdev, | ||
| 2924 | "can't offload tuple modification with non-clear ct()"); | ||
| 2925 | return false; | ||
| 2926 | } | ||
| 2927 | |||
| 2928 | /* Add ct_state=-trk match so it will be offloaded for non ct flows | ||
| 2929 | * (or after clear action), as otherwise, since the tuple is changed, | ||
| 2930 | * we can't restore ct state | ||
| 2931 | */ | ||
| 2932 | if (mlx5_tc_ct_add_no_trk_match(spec)) { | ||
| 2933 | NL_SET_ERR_MSG_MOD(extack, | ||
| 2934 | "can't offload tuple modification with ct matches and no ct(clear) action"); | ||
| 2935 | netdev_info(priv->netdev, | ||
| 2936 | "can't offload tuple modification with ct matches and no ct(clear) action"); | ||
| 2937 | return false; | ||
| 2938 | } | ||
| 2939 | |||
| 2940 | return true; | ||
| 2941 | } | ||
| 2942 | |||
| 2902 | static bool modify_header_match_supported(struct mlx5e_priv *priv, | 2943 | static bool modify_header_match_supported(struct mlx5e_priv *priv, |
| 2903 | struct mlx5_flow_spec *spec, | 2944 | struct mlx5_flow_spec *spec, |
| 2904 | struct flow_action *flow_action, | 2945 | struct flow_action *flow_action, |
| @@ -2937,18 +2978,9 @@ static bool modify_header_match_supported(struct mlx5e_priv *priv, · 32 unmodified lines | |||
| 2937 | return err; | 2978 | return err; |
| 2938 | } | 2979 | } |
| 2939 | 2980 | ||
| 2940 | /* Add ct_state=-trk match so it will be offloaded for non ct flows | 2981 | if (!modify_tuple_supported(modify_tuple, ct_clear, ct_flow, extack, |
| 2941 | * (or after clear action), as otherwise, since the tuple is changed, | 2982 | priv, spec)) |
| 2942 | * we can't restore ct state | ||
| 2943 | */ | ||
| 2944 | if (!ct_clear && modify_tuple && | ||
| 2945 | mlx5_tc_ct_add_no_trk_match(spec)) { | ||
| 2946 | NL_SET_ERR_MSG_MOD(extack, | ||
| 2947 | "can't offload tuple modify header with ct matches"); | ||
| 2948 | netdev_info(priv->netdev, | ||
| 2949 | "can't offload tuple modify header with ct matches"); | ||
| 2950 | return false; | 2983 | return false; |
| 2951 | } | ||
| 2952 | 2984 | ||
| 2953 | ip_proto = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ip_protocol); | 2985 | ip_proto = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ip_protocol); |
| 2954 | if (modify_ip_header && ip_proto != IPPROTO_TCP && | 2986 | if (modify_ip_header && ip_proto != IPPROTO_TCP && |
| @@ -4445,7 +4477,8 @@ static int apply_police_params(struct mlx5e_priv *priv, u64 rate, · 1490 unmodified lines | |||
| 4445 | */ | 4477 | */ |
| 4446 | if (rate) { | 4478 | if (rate) { |
| 4447 | rate = (rate * BITS_PER_BYTE) + 500000; | 4479 | rate = (rate * BITS_PER_BYTE) + 500000; |
| 4448 | rate_mbps = max_t(u64, do_div(rate, 1000000), 1); | 4480 | do_div(rate, 1000000); |
| 4481 | rate_mbps = max_t(u32, rate, 1); | ||
| 4449 | } | 4482 | } |
| 4450 | 4483 | ||
| 4451 | err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps); | 4484 | err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps); |
| @@ -79,6 +79,7 @@ struct mlx5_flow_attr { · 78 unmodified lines | |||
| 79 | u8 inner_match_level; | 79 | u8 inner_match_level; |
| 80 | u8 outer_match_level; | 80 | u8 outer_match_level; |
| 81 | u8 ip_version; | 81 | u8 ip_version; |
| 82 | u8 tun_ip_version; | ||
| 82 | u32 flags; | 83 | u32 flags; |
| 83 | union { | 84 | union { |
| 84 | struct mlx5_esw_flow_attr esw_attr[0]; | 85 | struct mlx5_esw_flow_attr esw_attr[0]; |
| @@ -551,7 +551,8 @@ esw_setup_dests(struct mlx5_flow_destination *dest, · 550 unmodified lines | |||
| 551 | 551 | ||
| 552 | if (!mlx5_eswitch_termtbl_required(esw, attr, flow_act, spec) && | 552 | if (!mlx5_eswitch_termtbl_required(esw, attr, flow_act, spec) && |
| 553 | MLX5_CAP_GEN(esw_attr->in_mdev, reg_c_preserve) && | 553 | MLX5_CAP_GEN(esw_attr->in_mdev, reg_c_preserve) && |
| 554 | mlx5_eswitch_vport_match_metadata_enabled(esw)) | 554 | mlx5_eswitch_vport_match_metadata_enabled(esw) && |
| 555 | MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ignore_flow_level)) | ||
| 555 | attr->flags |= MLX5_ESW_ATTR_FLAG_SRC_REWRITE; | 556 | attr->flags |= MLX5_ESW_ATTR_FLAG_SRC_REWRITE; |
| 556 | 557 | ||
| 557 | if (attr->dest_ft) { | 558 | if (attr->dest_ft) { |
| @@ -575,6 +575,7 @@ static int mlx5_fpga_conn_create_qp(struct mlx5_fpga_conn *conn, · 574 unmodified lines | |||
| 575 | MLX5_SET(qpc, qpc, log_sq_size, ilog2(conn->qp.sq.size)); | 575 | MLX5_SET(qpc, qpc, log_sq_size, ilog2(conn->qp.sq.size)); |
| 576 | MLX5_SET(qpc, qpc, cqn_snd, conn->cq.mcq.cqn); | 576 | MLX5_SET(qpc, qpc, cqn_snd, conn->cq.mcq.cqn); |
| 577 | MLX5_SET(qpc, qpc, cqn_rcv, conn->cq.mcq.cqn); | 577 | MLX5_SET(qpc, qpc, cqn_rcv, conn->cq.mcq.cqn); |
| 578 | MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(mdev)); | ||
| 578 | MLX5_SET64(qpc, qpc, dbr_addr, conn->qp.wq_ctrl.db.dma); | 579 | MLX5_SET64(qpc, qpc, dbr_addr, conn->qp.wq_ctrl.db.dma); |
| 579 | if (MLX5_CAP_GEN(mdev, cqe_version) == 1) | 580 | if (MLX5_CAP_GEN(mdev, cqe_version) == 1) |
| 580 | MLX5_SET(qpc, qpc, user_index, 0xFFFFFF); | 581 | MLX5_SET(qpc, qpc, user_index, 0xFFFFFF); |
| @@ -233,6 +233,7 @@ int mlx5i_create_underlay_qp(struct mlx5e_priv *priv) · 232 unmodified lines | |||
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | qpc = MLX5_ADDR_OF(create_qp_in, in, qpc); | 235 | qpc = MLX5_ADDR_OF(create_qp_in, in, qpc); |
| 236 | MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(priv->mdev)); | ||
| 236 | MLX5_SET(qpc, qpc, st, MLX5_QP_ST_UD); | 237 | MLX5_SET(qpc, qpc, st, MLX5_QP_ST_UD); |
| 237 | MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED); | 238 | MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED); |
| 238 | MLX5_SET(qpc, qpc, ulp_stateless_offload_mode, | 239 | MLX5_SET(qpc, qpc, ulp_stateless_offload_mode, |
| @@ -694,6 +695,7 @@ static int mlx5i_check_required_hca_cap(struct mlx5_core_dev *mdev) · 455 unmodified lines | |||
| 694 | static void mlx5_rdma_netdev_free(struct net_device *netdev) | 695 | static void mlx5_rdma_netdev_free(struct net_device *netdev) |
| 695 | { | 696 | { |
| 696 | struct mlx5e_priv *priv = mlx5i_epriv(netdev); | 697 | struct mlx5e_priv *priv = mlx5i_epriv(netdev); |
| 698 | struct mlx5_core_dev *mdev = priv->mdev; | ||
| 697 | struct mlx5i_priv *ipriv = priv->ppriv; | 699 | struct mlx5i_priv *ipriv = priv->ppriv; |
| 698 | const struct mlx5e_profile *profile = priv->profile; | 700 | const struct mlx5e_profile *profile = priv->profile; |
| 699 | 701 | ||
| @@ -702,7 +704,7 @@ static void mlx5_rdma_netdev_free(struct net_device *netdev) · 2 unmodified lines | |||
| 702 | 704 | ||
| 703 | if (!ipriv->sub_interface) { | 705 | if (!ipriv->sub_interface) { |
| 704 | mlx5i_pkey_qpn_ht_cleanup(netdev); | 706 | mlx5i_pkey_qpn_ht_cleanup(netdev); |
| 705 | mlx5e_destroy_mdev_resources(priv->mdev); | 707 | mlx5e_destroy_mdev_resources(mdev); |
| 706 | } | 708 | } |
| 707 | } | 709 | } |
| 708 | 710 | ||
| @@ -495,15 +495,15 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp, · 494 unmodified lines | |||
| 495 | return -EINVAL; | 495 | return -EINVAL; |
| 496 | 496 | ||
| 497 | field_select = MLX5_MTPPS_FS_ENABLE; | 497 | field_select = MLX5_MTPPS_FS_ENABLE; |
| 498 | pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, rq->perout.index); | ||
| 499 | if (pin < 0) | ||
| 500 | return -EBUSY; | ||
| 501 | |||
| 498 | if (on) { | 502 | if (on) { |
| 499 | bool rt_mode = mlx5_real_time_mode(mdev); | 503 | bool rt_mode = mlx5_real_time_mode(mdev); |
| 500 | u32 nsec; | 504 | u32 nsec; |
| 501 | s64 sec; | 505 | s64 sec; |
| 502 | 506 | ||
| 503 | pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, rq->perout.index); | ||
| 504 | if (pin < 0) | ||
| 505 | return -EBUSY; | ||
| 506 | |||
| 507 | pin_mode = MLX5_PIN_MODE_OUT; | 507 | pin_mode = MLX5_PIN_MODE_OUT; |
| 508 | pattern = MLX5_OUT_PATTERN_PERIODIC; | 508 | pattern = MLX5_OUT_PATTERN_PERIODIC; |
| 509 | ts.tv_sec = rq->perout.period.sec; | 509 | ts.tv_sec = rq->perout.period.sec; |
| @@ -181,15 +181,13 @@ static int mlx5_sf_dev_vhca_arm_all(struct mlx5_sf_dev_table *table) · 180 unmodified lines | |||
| 181 | u16 max_functions; | 181 | u16 max_functions; |
| 182 | u16 function_id; | 182 | u16 function_id; |
| 183 | int err = 0; | 183 | int err = 0; |
| 184 | bool ecpu; | ||
| 185 | int i; | 184 | int i; |
| 186 | 185 | ||
| 187 | max_functions = mlx5_sf_max_functions(dev); | 186 | max_functions = mlx5_sf_max_functions(dev); |
| 188 | function_id = MLX5_CAP_GEN(dev, sf_base_id); | 187 | function_id = MLX5_CAP_GEN(dev, sf_base_id); |
| 189 | ecpu = mlx5_read_embedded_cpu(dev); | ||
| 190 | /* Arm the vhca context as the vhca event notifier */ | 188 | /* Arm the vhca context as the vhca event notifier */ |
| 191 | for (i = 0; i < max_functions; i++) { | 189 | for (i = 0; i < max_functions; i++) { |
| 192 | err = mlx5_vhca_event_arm(dev, function_id, ecpu); | 190 | err = mlx5_vhca_event_arm(dev, function_id); |
| 193 | if (err) | 191 | if (err) |
| 194 | return err; | 192 | return err; |
| 195 | 193 | ||
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | #include "sf.h" | 6 | #include "sf.h" |
| 7 | #include "mlx5_ifc_vhca_event.h" | 7 | #include "mlx5_ifc_vhca_event.h" |
| 8 | #include "vhca_event.h" | 8 | #include "vhca_event.h" |
| 9 | #include "ecpf.h" | 9 | #include "mlx5_core.h" |
| 10 | 10 | ||
| 11 | struct mlx5_sf_hw { | 11 | struct mlx5_sf_hw { |
| 12 | u32 usr_sfnum; | 12 | u32 usr_sfnum; |
| @@ -18,7 +18,6 @@ struct mlx5_sf_hw_table { · 5 unmodified lines | |||
| 18 | struct mlx5_core_dev *dev; | 18 | struct mlx5_core_dev *dev; |
| 19 | struct mlx5_sf_hw *sfs; | 19 | struct mlx5_sf_hw *sfs; |
| 20 | int max_local_functions; | 20 | int max_local_functions; |
| 21 | u8 ecpu: 1; | ||
| 22 | struct mutex table_lock; /* Serializes sf deletion and vhca state change handler. */ | 21 | struct mutex table_lock; /* Serializes sf deletion and vhca state change handler. */ |
| 23 | struct notifier_block vhca_nb; | 22 | struct notifier_block vhca_nb; |
| 24 | }; | 23 | }; |
| @@ -64,7 +63,7 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum) · 39 unmodified lines | |||
| 64 | } | 63 | } |
| 65 | if (sw_id == -ENOSPC) { | 64 | if (sw_id == -ENOSPC) { |
| 66 | err = -ENOSPC; | 65 | err = -ENOSPC; |
| 67 | goto err; | 66 | goto exist_err; |
| 68 | } | 67 | } |
| 69 | 68 | ||
| 70 | hw_fn_id = mlx5_sf_sw_to_hw_id(table->dev, sw_id); | 69 | hw_fn_id = mlx5_sf_sw_to_hw_id(table->dev, sw_id); |
| @@ -72,7 +71,7 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum) · 1 unmodified line | |||
| 72 | if (err) | 71 | if (err) |
| 73 | goto err; | 72 | goto err; |
| 74 | 73 | ||
| 75 | err = mlx5_modify_vhca_sw_id(dev, hw_fn_id, table->ecpu, usr_sfnum); | 74 | err = mlx5_modify_vhca_sw_id(dev, hw_fn_id, usr_sfnum); |
| 76 | if (err) | 75 | if (err) |
| 77 | goto vhca_err; | 76 | goto vhca_err; |
| 78 | 77 | ||
| @@ -118,7 +117,7 @@ void mlx5_sf_hw_table_sf_deferred_free(struct mlx5_core_dev *dev, u16 id) · 39 unmodified lines | |||
| 118 | 117 | ||
| 119 | hw_fn_id = mlx5_sf_sw_to_hw_id(dev, id); | 118 | hw_fn_id = mlx5_sf_sw_to_hw_id(dev, id); |
| 120 | mutex_lock(&table->table_lock); | 119 | mutex_lock(&table->table_lock); |
| 121 | err = mlx5_cmd_query_vhca_state(dev, hw_fn_id, table->ecpu, out, sizeof(out)); | 120 | err = mlx5_cmd_query_vhca_state(dev, hw_fn_id, out, sizeof(out)); |
| 122 | if (err) | 121 | if (err) |
| 123 | goto err; | 122 | goto err; |
| 124 | state = MLX5_GET(query_vhca_state_out, out, vhca_state_context.vhca_state); | 123 | state = MLX5_GET(query_vhca_state_out, out, vhca_state_context.vhca_state); |
| @@ -164,7 +163,6 @@ int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev) · 39 unmodified lines | |||
| 164 | table->dev = dev; | 163 | table->dev = dev; |
| 165 | table->sfs = sfs; | 164 | table->sfs = sfs; |
| 166 | table->max_local_functions = max_functions; | 165 | table->max_local_functions = max_functions; |
| 167 | table->ecpu = mlx5_read_embedded_cpu(dev); | ||
| 168 | dev->priv.sf_hw_table = table; | 166 | dev->priv.sf_hw_table = table; |
| 169 | mlx5_core_dbg(dev, "SF HW table: max sfs = %d\n", max_functions); | 167 | mlx5_core_dbg(dev, "SF HW table: max sfs = %d\n", max_functions); |
| 170 | return 0; | 168 | return 0; |
| @@ -20,7 +20,7 @@ struct mlx5_ifc_vhca_state_context_bits { · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | u8 sw_function_id[0x20]; | 21 | u8 sw_function_id[0x20]; |
| 22 | 22 | ||
| 23 | u8 reserved_at_40[0x80]; | 23 | u8 reserved_at_40[0x40]; |
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | struct mlx5_ifc_query_vhca_state_out_bits { | 26 | struct mlx5_ifc_query_vhca_state_out_bits { |
| @@ -19,52 +19,51 @@ struct mlx5_vhca_event_work { · 18 unmodified lines | |||
| 19 | struct mlx5_vhca_state_event event; | 19 | struct mlx5_vhca_state_event event; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | int mlx5_cmd_query_vhca_state(struct mlx5_core_dev *dev, u16 function_id, | 22 | int mlx5_cmd_query_vhca_state(struct mlx5_core_dev *dev, u16 function_id, u32 *out, u32 outlen) |
| 23 | bool ecpu, u32 *out, u32 outlen) | ||
| 24 | { | 23 | { |
| 25 | u32 in[MLX5_ST_SZ_DW(query_vhca_state_in)] = {}; | 24 | u32 in[MLX5_ST_SZ_DW(query_vhca_state_in)] = {}; |
| 26 | 25 | ||
| 27 | MLX5_SET(query_vhca_state_in, in, opcode, MLX5_CMD_OP_QUERY_VHCA_STATE); | 26 | MLX5_SET(query_vhca_state_in, in, opcode, MLX5_CMD_OP_QUERY_VHCA_STATE); |
| 28 | MLX5_SET(query_vhca_state_in, in, function_id, function_id); | 27 | MLX5_SET(query_vhca_state_in, in, function_id, function_id); |
| 29 | MLX5_SET(query_vhca_state_in, in, embedded_cpu_function, ecpu); | 28 | MLX5_SET(query_vhca_state_in, in, embedded_cpu_function, 0); |
| 30 | 29 | ||
| 31 | return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); | 30 | return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); |
| 32 | } | 31 | } |
| 33 | 32 | ||
| 34 | static int mlx5_cmd_modify_vhca_state(struct mlx5_core_dev *dev, u16 function_id, | 33 | static int mlx5_cmd_modify_vhca_state(struct mlx5_core_dev *dev, u16 function_id, |
| 35 | bool ecpu, u32 *in, u32 inlen) | 34 | u32 *in, u32 inlen) |
| 36 | { | 35 | { |
| 37 | u32 out[MLX5_ST_SZ_DW(modify_vhca_state_out)] = {}; | 36 | u32 out[MLX5_ST_SZ_DW(modify_vhca_state_out)] = {}; |
| 38 | 37 | ||
| 39 | MLX5_SET(modify_vhca_state_in, in, opcode, MLX5_CMD_OP_MODIFY_VHCA_STATE); | 38 | MLX5_SET(modify_vhca_state_in, in, opcode, MLX5_CMD_OP_MODIFY_VHCA_STATE); |
| 40 | MLX5_SET(modify_vhca_state_in, in, function_id, function_id); | 39 | MLX5_SET(modify_vhca_state_in, in, function_id, function_id); |
| 41 | MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, ecpu); | 40 | MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, 0); |
| 42 | 41 | ||
| 43 | return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); | 42 | return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
| 44 | } | 43 | } |
| 45 | 44 | ||
| 46 | int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, bool ecpu, u32 sw_fn_id) | 45 | int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, u32 sw_fn_id) |
| 47 | { | 46 | { |
| 48 | u32 out[MLX5_ST_SZ_DW(modify_vhca_state_out)] = {}; | 47 | u32 out[MLX5_ST_SZ_DW(modify_vhca_state_out)] = {}; |
| 49 | u32 in[MLX5_ST_SZ_DW(modify_vhca_state_in)] = {}; | 48 | u32 in[MLX5_ST_SZ_DW(modify_vhca_state_in)] = {}; |
| 50 | 49 | ||
| 51 | MLX5_SET(modify_vhca_state_in, in, opcode, MLX5_CMD_OP_MODIFY_VHCA_STATE); | 50 | MLX5_SET(modify_vhca_state_in, in, opcode, MLX5_CMD_OP_MODIFY_VHCA_STATE); |
| 52 | MLX5_SET(modify_vhca_state_in, in, function_id, function_id); | 51 | MLX5_SET(modify_vhca_state_in, in, function_id, function_id); |
| 53 | MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, ecpu); | 52 | MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, 0); |
| 54 | MLX5_SET(modify_vhca_state_in, in, vhca_state_field_select.sw_function_id, 1); | 53 | MLX5_SET(modify_vhca_state_in, in, vhca_state_field_select.sw_function_id, 1); |
| 55 | MLX5_SET(modify_vhca_state_in, in, vhca_state_context.sw_function_id, sw_fn_id); | 54 | MLX5_SET(modify_vhca_state_in, in, vhca_state_context.sw_function_id, sw_fn_id); |
| 56 | 55 | ||
| 57 | return mlx5_cmd_exec_inout(dev, modify_vhca_state, in, out); | 56 | return mlx5_cmd_exec_inout(dev, modify_vhca_state, in, out); |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 60 | int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id, bool ecpu) | 59 | int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id) |
| 61 | { | 60 | { |
| 62 | u32 in[MLX5_ST_SZ_DW(modify_vhca_state_in)] = {}; | 61 | u32 in[MLX5_ST_SZ_DW(modify_vhca_state_in)] = {}; |
| 63 | 62 | ||
| 64 | MLX5_SET(modify_vhca_state_in, in, vhca_state_context.arm_change_event, 1); | 63 | MLX5_SET(modify_vhca_state_in, in, vhca_state_context.arm_change_event, 1); |
| 65 | MLX5_SET(modify_vhca_state_in, in, vhca_state_field_select.arm_change_event, 1); | 64 | MLX5_SET(modify_vhca_state_in, in, vhca_state_field_select.arm_change_event, 1); |
| 66 | 65 | ||
| 67 | return mlx5_cmd_modify_vhca_state(dev, function_id, ecpu, in, sizeof(in)); | 66 | return mlx5_cmd_modify_vhca_state(dev, function_id, in, sizeof(in)); |
| 68 | } | 67 | } |
| 69 | 68 | ||
| 70 | static void | 69 | static void |
| @@ -73,7 +72,7 @@ mlx5_vhca_event_notify(struct mlx5_core_dev *dev, struct mlx5_vhca_state_event * · 2 unmodified lines | |||
| 73 | u32 out[MLX5_ST_SZ_DW(query_vhca_state_out)] = {}; | 72 | u32 out[MLX5_ST_SZ_DW(query_vhca_state_out)] = {}; |
| 74 | int err; | 73 | int err; |
| 75 | 74 | ||
| 76 | err = mlx5_cmd_query_vhca_state(dev, event->function_id, event->ecpu, out, sizeof(out)); | 75 | err = mlx5_cmd_query_vhca_state(dev, event->function_id, out, sizeof(out)); |
| 77 | if (err) | 76 | if (err) |
| 78 | return; | 77 | return; |
| 79 | 78 | ||
| @@ -82,7 +81,7 @@ mlx5_vhca_event_notify(struct mlx5_core_dev *dev, struct mlx5_vhca_state_event * · 2 unmodified lines | |||
| 82 | event->new_vhca_state = MLX5_GET(query_vhca_state_out, out, | 81 | event->new_vhca_state = MLX5_GET(query_vhca_state_out, out, |
| 83 | vhca_state_context.vhca_state); | 82 | vhca_state_context.vhca_state); |
| 84 | 83 | ||
| 85 | mlx5_vhca_event_arm(dev, event->function_id, event->ecpu); | 84 | mlx5_vhca_event_arm(dev, event->function_id); |
| 86 | 85 | ||
| 87 | blocking_notifier_call_chain(&dev->priv.vhca_state_notifier->n_head, 0, event); | 86 | blocking_notifier_call_chain(&dev->priv.vhca_state_notifier->n_head, 0, event); |
| 88 | } | 87 | } |
| @@ -94,6 +93,7 @@ static void mlx5_vhca_state_work_handler(struct work_struct *_work) · 5 unmodified lines | |||
| 94 | struct mlx5_core_dev *dev = notifier->dev; | 93 | struct mlx5_core_dev *dev = notifier->dev; |
| 95 | 94 | ||
| 96 | mlx5_vhca_event_notify(dev, &work->event); | 95 | mlx5_vhca_event_notify(dev, &work->event); |
| 96 | kfree(work); | ||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static int | 99 | static int |
| @@ -110,7 +110,6 @@ mlx5_vhca_state_change_notifier(struct notifier_block *nb, unsigned long type, v · 10 unmodified lines | |||
| 110 | INIT_WORK(&work->work, &mlx5_vhca_state_work_handler); | 110 | INIT_WORK(&work->work, &mlx5_vhca_state_work_handler); |
| 111 | work->notifier = notifier; | 111 | work->notifier = notifier; |
| 112 | work->event.function_id = be16_to_cpu(eqe->data.vhca_state.function_id); | 112 | work->event.function_id = be16_to_cpu(eqe->data.vhca_state.function_id); |
| 113 | work->event.ecpu = be16_to_cpu(eqe->data.vhca_state.ec_function); | ||
| 114 | mlx5_events_work_enqueue(notifier->dev, &work->work); | 113 | mlx5_events_work_enqueue(notifier->dev, &work->work); |
| 115 | return NOTIFY_OK; | 114 | return NOTIFY_OK; |
| 116 | } | 115 | } |
| @@ -10,7 +10,6 @@ struct mlx5_vhca_state_event { · 9 unmodified lines | |||
| 10 | u16 function_id; | 10 | u16 function_id; |
| 11 | u16 sw_function_id; | 11 | u16 sw_function_id; |
| 12 | u8 new_vhca_state; | 12 | u8 new_vhca_state; |
| 13 | bool ecpu; | ||
| 14 | }; | 13 | }; |
| 15 | 14 | ||
| 16 | static inline bool mlx5_vhca_event_supported(const struct mlx5_core_dev *dev) | 15 | static inline bool mlx5_vhca_event_supported(const struct mlx5_core_dev *dev) |
| @@ -25,10 +24,10 @@ void mlx5_vhca_event_start(struct mlx5_core_dev *dev); · 8 unmodified lines | |||
| 25 | void mlx5_vhca_event_stop(struct mlx5_core_dev *dev); | 24 | void mlx5_vhca_event_stop(struct mlx5_core_dev *dev); |
| 26 | int mlx5_vhca_event_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb); | 25 | int mlx5_vhca_event_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb); |
| 27 | void mlx5_vhca_event_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb); | 26 | void mlx5_vhca_event_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb); |
| 28 | int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, bool ecpu, u32 sw_fn_id); | 27 | int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, u32 sw_fn_id); |
| 29 | int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id, bool ecpu); | 28 | int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id); |
| 30 | int mlx5_cmd_query_vhca_state(struct mlx5_core_dev *dev, u16 function_id, | 29 | int mlx5_cmd_query_vhca_state(struct mlx5_core_dev *dev, u16 function_id, |
| 31 | bool ecpu, u32 *out, u32 outlen); | 30 | u32 *out, u32 outlen); |
| 32 | #else | 31 | #else |
| 33 | 32 | ||
| 34 | static inline void mlx5_vhca_state_cap_handle(struct mlx5_core_dev *dev, void *set_hca_cap) | 33 | static inline void mlx5_vhca_state_cap_handle(struct mlx5_core_dev *dev, void *set_hca_cap) |
| @@ -169,6 +169,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, · 168 unmodified lines | |||
| 169 | MLX5_SET(qpc, qpc, log_rq_size, ilog2(dr_qp->rq.wqe_cnt)); | 169 | MLX5_SET(qpc, qpc, log_rq_size, ilog2(dr_qp->rq.wqe_cnt)); |
| 170 | MLX5_SET(qpc, qpc, rq_type, MLX5_NON_ZERO_RQ); | 170 | MLX5_SET(qpc, qpc, rq_type, MLX5_NON_ZERO_RQ); |
| 171 | MLX5_SET(qpc, qpc, log_sq_size, ilog2(dr_qp->sq.wqe_cnt)); | 171 | MLX5_SET(qpc, qpc, log_sq_size, ilog2(dr_qp->sq.wqe_cnt)); |
| 172 | MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(mdev)); | ||
| 172 | MLX5_SET64(qpc, qpc, dbr_addr, dr_qp->wq_ctrl.db.dma); | 173 | MLX5_SET64(qpc, qpc, dbr_addr, dr_qp->wq_ctrl.db.dma); |
| 173 | if (MLX5_CAP_GEN(mdev, cqe_version) == 1) | 174 | if (MLX5_CAP_GEN(mdev, cqe_version) == 1) |
| 174 | MLX5_SET(qpc, qpc, user_index, 0xFFFFFF); | 175 | MLX5_SET(qpc, qpc, user_index, 0xFFFFFF); |
| @@ -264,8 +264,8 @@ static void dr_ste_v1_set_miss_addr(u8 *hw_ste_p, u64 miss_addr) · 263 unmodified lines | |||
| 264 | static u64 dr_ste_v1_get_miss_addr(u8 *hw_ste_p) | 264 | static u64 dr_ste_v1_get_miss_addr(u8 *hw_ste_p) |
| 265 | { | 265 | { |
| 266 | u64 index = | 266 | u64 index = |
| 267 | (MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_31_6) | | 267 | ((u64)MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_31_6) | |
| 268 | MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_39_32) << 26); | 268 | ((u64)MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_39_32)) << 26); |
| 269 | 269 | ||
| 270 | return index << 6; | 270 | return index << 6; |
| 271 | } | 271 | } |
| @@ -327,8 +327,14 @@ int nfp_compile_flow_metadata(struct nfp_app *app, · 326 unmodified lines | |||
| 327 | goto err_free_ctx_entry; | 327 | goto err_free_ctx_entry; |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | /* Do net allocate a mask-id for pre_tun_rules. These flows are used to | ||
| 331 | * configure the pre_tun table and are never actually send to the | ||
| 332 | * firmware as an add-flow message. This causes the mask-id allocation | ||
| 333 | * on the firmware to get out of sync if allocated here. | ||
| 334 | */ | ||
| 330 | new_mask_id = 0; | 335 | new_mask_id = 0; |
| 331 | if (!nfp_check_mask_add(app, nfp_flow->mask_data, | 336 | if (!nfp_flow->pre_tun_rule.dev && |
| 337 | !nfp_check_mask_add(app, nfp_flow->mask_data, | ||
| 332 | nfp_flow->meta.mask_len, | 338 | nfp_flow->meta.mask_len, |
| 333 | &nfp_flow->meta.flags, &new_mask_id)) { | 339 | &nfp_flow->meta.flags, &new_mask_id)) { |
| 334 | NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot allocate a new mask id"); | 340 | NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot allocate a new mask id"); |
| @@ -359,7 +365,8 @@ int nfp_compile_flow_metadata(struct nfp_app *app, · 24 unmodified lines | |||
| 359 | goto err_remove_mask; | 365 | goto err_remove_mask; |
| 360 | } | 366 | } |
| 361 | 367 | ||
| 362 | if (!nfp_check_mask_remove(app, nfp_flow->mask_data, | 368 | if (!nfp_flow->pre_tun_rule.dev && |
| 369 | !nfp_check_mask_remove(app, nfp_flow->mask_data, | ||
| 363 | nfp_flow->meta.mask_len, | 370 | nfp_flow->meta.mask_len, |
| 364 | NULL, &new_mask_id)) { | 371 | NULL, &new_mask_id)) { |
| 365 | NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot release mask id"); | 372 | NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot release mask id"); |
| @@ -374,8 +381,10 @@ int nfp_compile_flow_metadata(struct nfp_app *app, · 8 unmodified lines | |||
| 374 | return 0; | 381 | return 0; |
| 375 | 382 | ||
| 376 | err_remove_mask: | 383 | err_remove_mask: |
| 377 | nfp_check_mask_remove(app, nfp_flow->mask_data, nfp_flow->meta.mask_len, | 384 | if (!nfp_flow->pre_tun_rule.dev) |
| 378 | NULL, &new_mask_id); | 385 | nfp_check_mask_remove(app, nfp_flow->mask_data, |
| 386 | nfp_flow->meta.mask_len, | ||
| 387 | NULL, &new_mask_id); | ||
| 379 | err_remove_rhash: | 388 | err_remove_rhash: |
| 380 | WARN_ON_ONCE(rhashtable_remove_fast(&priv->stats_ctx_table, | 389 | WARN_ON_ONCE(rhashtable_remove_fast(&priv->stats_ctx_table, |
| 381 | &ctx_entry->ht_node, | 390 | &ctx_entry->ht_node, |
| @@ -406,9 +415,10 @@ int nfp_modify_flow_metadata(struct nfp_app *app, · 24 unmodified lines | |||
| 406 | 415 | ||
| 407 | __nfp_modify_flow_metadata(priv, nfp_flow); | 416 | __nfp_modify_flow_metadata(priv, nfp_flow); |
| 408 | 417 | ||
| 409 | nfp_check_mask_remove(app, nfp_flow->mask_data, | 418 | if (!nfp_flow->pre_tun_rule.dev) |
| 410 | nfp_flow->meta.mask_len, &nfp_flow->meta.flags, | 419 | nfp_check_mask_remove(app, nfp_flow->mask_data, |
| 411 | &new_mask_id); | 420 | nfp_flow->meta.mask_len, &nfp_flow->meta.flags, |
| 421 | &new_mask_id); | ||
| 412 | 422 | ||
| 413 | /* Update flow payload with mask ids. */ | 423 | /* Update flow payload with mask ids. */ |
| 414 | nfp_flow->unmasked_data[NFP_FL_MASK_ID_LOCATION] = new_mask_id; | 424 | nfp_flow->unmasked_data[NFP_FL_MASK_ID_LOCATION] = new_mask_id; |
| @@ -1142,6 +1142,12 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, · 1141 unmodified lines | |||
| 1142 | return -EOPNOTSUPP; | 1142 | return -EOPNOTSUPP; |
| 1143 | } | 1143 | } |
| 1144 | 1144 | ||
| 1145 | if (!(key_layer & NFP_FLOWER_LAYER_IPV4) && | ||
| 1146 | !(key_layer & NFP_FLOWER_LAYER_IPV6)) { | ||
| 1147 | NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: match on ipv4/ipv6 eth_type must be present"); | ||
| 1148 | return -EOPNOTSUPP; | ||
| 1149 | } | ||
| 1150 | |||
| 1145 | /* Skip fields known to exist. */ | 1151 | /* Skip fields known to exist. */ |
| 1146 | mask += sizeof(struct nfp_flower_meta_tci); | 1152 | mask += sizeof(struct nfp_flower_meta_tci); |
| 1147 | ext += sizeof(struct nfp_flower_meta_tci); | 1153 | ext += sizeof(struct nfp_flower_meta_tci); |
| @@ -1152,6 +1158,13 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, · 4 unmodified lines | |||
| 1152 | mask += sizeof(struct nfp_flower_in_port); | 1158 | mask += sizeof(struct nfp_flower_in_port); |
| 1153 | ext += sizeof(struct nfp_flower_in_port); | 1159 | ext += sizeof(struct nfp_flower_in_port); |
| 1154 | 1160 | ||
| 1161 | /* Ensure destination MAC address matches pre_tun_dev. */ | ||
| 1162 | mac = (struct nfp_flower_mac_mpls *)ext; | ||
| 1163 | if (memcmp(&mac->mac_dst[0], flow->pre_tun_rule.dev->dev_addr, 6)) { | ||
| 1164 | NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: dest MAC must match output dev MAC"); | ||
| 1165 | return -EOPNOTSUPP; | ||
| 1166 | } | ||
| 1167 | |||
| 1155 | /* Ensure destination MAC address is fully matched. */ | 1168 | /* Ensure destination MAC address is fully matched. */ |
| 1156 | mac = (struct nfp_flower_mac_mpls *)mask; | 1169 | mac = (struct nfp_flower_mac_mpls *)mask; |
| 1157 | if (!is_broadcast_ether_addr(&mac->mac_dst[0])) { | 1170 | if (!is_broadcast_ether_addr(&mac->mac_dst[0])) { |
| @@ -1159,6 +1172,11 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, · 1 unmodified line | |||
| 1159 | return -EOPNOTSUPP; | 1172 | return -EOPNOTSUPP; |
| 1160 | } | 1173 | } |
| 1161 | 1174 | ||
| 1175 | if (mac->mpls_lse) { | ||
| 1176 | NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: MPLS not supported"); | ||
| 1177 | return -EOPNOTSUPP; | ||
| 1178 | } | ||
| 1179 | |||
| 1162 | mask += sizeof(struct nfp_flower_mac_mpls); | 1180 | mask += sizeof(struct nfp_flower_mac_mpls); |
| 1163 | ext += sizeof(struct nfp_flower_mac_mpls); | 1181 | ext += sizeof(struct nfp_flower_mac_mpls); |
| 1164 | if (key_layer & NFP_FLOWER_LAYER_IPV4 || | 1182 | if (key_layer & NFP_FLOWER_LAYER_IPV4 || |
| @@ -16,8 +16,9 @@ · 15 unmodified lines | |||
| 16 | #define NFP_FL_MAX_ROUTES 32 | 16 | #define NFP_FL_MAX_ROUTES 32 |
| 17 | 17 | ||
| 18 | #define NFP_TUN_PRE_TUN_RULE_LIMIT 32 | 18 | #define NFP_TUN_PRE_TUN_RULE_LIMIT 32 |
| 19 | #define NFP_TUN_PRE_TUN_RULE_DEL 0x1 | 19 | #define NFP_TUN_PRE_TUN_RULE_DEL BIT(0) |
| 20 | #define NFP_TUN_PRE_TUN_IDX_BIT 0x8 | 20 | #define NFP_TUN_PRE_TUN_IDX_BIT BIT(3) |
| 21 | #define NFP_TUN_PRE_TUN_IPV6_BIT BIT(7) | ||
| 21 | 22 | ||
| 22 | /** | 23 | /** |
| 23 | * struct nfp_tun_pre_run_rule - rule matched before decap | 24 | * struct nfp_tun_pre_run_rule - rule matched before decap |
| @@ -1268,6 +1269,7 @@ int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app, · 1244 unmodified lines | |||
| 1268 | { | 1269 | { |
| 1269 | struct nfp_flower_priv *app_priv = app->priv; | 1270 | struct nfp_flower_priv *app_priv = app->priv; |
| 1270 | struct nfp_tun_offloaded_mac *mac_entry; | 1271 | struct nfp_tun_offloaded_mac *mac_entry; |
| 1272 | struct nfp_flower_meta_tci *key_meta; | ||
| 1271 | struct nfp_tun_pre_tun_rule payload; | 1273 | struct nfp_tun_pre_tun_rule payload; |
| 1272 | struct net_device *internal_dev; | 1274 | struct net_device *internal_dev; |
| 1273 | int err; | 1275 | int err; |
| @@ -1290,6 +1292,15 @@ int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app, · 16 unmodified lines | |||
| 1290 | if (!mac_entry) | 1292 | if (!mac_entry) |
| 1291 | return -ENOENT; | 1293 | return -ENOENT; |
| 1292 | 1294 | ||
| 1295 | /* Set/clear IPV6 bit. cpu_to_be16() swap will lead to MSB being | ||
| 1296 | * set/clear for port_idx. | ||
| 1297 | */ | ||
| 1298 | key_meta = (struct nfp_flower_meta_tci *)flow->unmasked_data; | ||
| 1299 | if (key_meta->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV6) | ||
| 1300 | mac_entry->index |= NFP_TUN_PRE_TUN_IPV6_BIT; | ||
| 1301 | else | ||
| 1302 | mac_entry->index &= ~NFP_TUN_PRE_TUN_IPV6_BIT; | ||
| 1303 | |||
| 1293 | payload.port_idx = cpu_to_be16(mac_entry->index); | 1304 | payload.port_idx = cpu_to_be16(mac_entry->index); |
| 1294 | 1305 | ||
| 1295 | /* Copy mac id and vlan to flow - dev may not exist at delete time. */ | 1306 | /* Copy mac id and vlan to flow - dev may not exist at delete time. */ |
| @@ -1079,15 +1079,17 @@ static int ionic_tx_descs_needed(struct ionic_queue *q, struct sk_buff *skb) · 1078 unmodified lines | |||
| 1079 | { | 1079 | { |
| 1080 | int sg_elems = q->lif->qtype_info[IONIC_QTYPE_TXQ].max_sg_elems; | 1080 | int sg_elems = q->lif->qtype_info[IONIC_QTYPE_TXQ].max_sg_elems; |
| 1081 | struct ionic_tx_stats *stats = q_to_tx_stats(q); | 1081 | struct ionic_tx_stats *stats = q_to_tx_stats(q); |
| 1082 | int ndescs; | ||
| 1082 | int err; | 1083 | int err; |
| 1083 | 1084 | ||
| 1084 | /* If TSO, need roundup(skb->len/mss) descs */ | 1085 | /* Each desc is mss long max, so a descriptor for each gso_seg */ |
| 1085 | if (skb_is_gso(skb)) | 1086 | if (skb_is_gso(skb)) |
| 1086 | return (skb->len / skb_shinfo(skb)->gso_size) + 1; | 1087 | ndescs = skb_shinfo(skb)->gso_segs; |
| 1088 | else | ||
| 1089 | ndescs = 1; | ||
| 1087 | 1090 | ||
| 1088 | /* If non-TSO, just need 1 desc and nr_frags sg elems */ | ||
| 1089 | if (skb_shinfo(skb)->nr_frags <= sg_elems) | 1091 | if (skb_shinfo(skb)->nr_frags <= sg_elems) |
| 1090 | return 1; | 1092 | return ndescs; |
| 1091 | 1093 | ||
| 1092 | /* Too many frags, so linearize */ | 1094 | /* Too many frags, so linearize */ |
| 1093 | err = skb_linearize(skb); | 1095 | err = skb_linearize(skb); |
| @@ -1096,8 +1098,7 @@ static int ionic_tx_descs_needed(struct ionic_queue *q, struct sk_buff *skb) · 2 unmodified lines | |||
| 1096 | 1098 | ||
| 1097 | stats->linearize++; | 1099 | stats->linearize++; |
| 1098 | 1100 | ||
| 1099 | /* Need 1 desc and zero sg elems */ | 1101 | return ndescs; |
| 1100 | return 1; | ||
| 1101 | } | 1102 | } |
| 1102 | 1103 | ||
| 1103 | static int ionic_maybe_stop_tx(struct ionic_queue *q, int ndescs) | 1104 | static int ionic_maybe_stop_tx(struct ionic_queue *q, int ndescs) |
| @@ -1425,6 +1425,7 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) · 1424 unmodified lines | |||
| 1425 | 1425 | ||
| 1426 | if (fw_dump->tmpl_hdr == NULL || current_version > prev_version) { | 1426 | if (fw_dump->tmpl_hdr == NULL || current_version > prev_version) { |
| 1427 | vfree(fw_dump->tmpl_hdr); | 1427 | vfree(fw_dump->tmpl_hdr); |
| 1428 | fw_dump->tmpl_hdr = NULL; | ||
| 1428 | 1429 | ||
| 1429 | if (qlcnic_83xx_md_check_extended_dump_capability(adapter)) | 1430 | if (qlcnic_83xx_md_check_extended_dump_capability(adapter)) |
| 1430 | extended = !qlcnic_83xx_extend_md_capab(adapter); | 1431 | extended = !qlcnic_83xx_extend_md_capab(adapter); |
| @@ -1443,6 +1444,8 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) · 12 unmodified lines | |||
| 1443 | struct qlcnic_83xx_dump_template_hdr *hdr; | 1444 | struct qlcnic_83xx_dump_template_hdr *hdr; |
| 1444 | 1445 | ||
| 1445 | hdr = fw_dump->tmpl_hdr; | 1446 | hdr = fw_dump->tmpl_hdr; |
| 1447 | if (!hdr) | ||
| 1448 | return; | ||
| 1446 | hdr->drv_cap_mask = 0x1f; | 1449 | hdr->drv_cap_mask = 0x1f; |
| 1447 | fw_dump->cap_mask = 0x1f; | 1450 | fw_dump->cap_mask = 0x1f; |
| 1448 | dev_info(&pdev->dev, | 1451 | dev_info(&pdev->dev, |
| @@ -4646,6 +4646,9 @@ static void rtl8169_down(struct rtl8169_private *tp) · 4645 unmodified lines | |||
| 4646 | 4646 | ||
| 4647 | rtl8169_update_counters(tp); | 4647 | rtl8169_update_counters(tp); |
| 4648 | 4648 | ||
| 4649 | pci_clear_master(tp->pci_dev); | ||
| 4650 | rtl_pci_commit(tp); | ||
| 4651 | |||
| 4649 | rtl8169_cleanup(tp, true); | 4652 | rtl8169_cleanup(tp, true); |
| 4650 | 4653 | ||
| 4651 | rtl_prepare_power_down(tp); | 4654 | rtl_prepare_power_down(tp); |
| @@ -4653,6 +4656,7 @@ static void rtl8169_down(struct rtl8169_private *tp) · 1 unmodified line | |||
| 4653 | 4656 | ||
| 4654 | static void rtl8169_up(struct rtl8169_private *tp) | 4657 | static void rtl8169_up(struct rtl8169_private *tp) |
| 4655 | { | 4658 | { |
| 4659 | pci_set_master(tp->pci_dev); | ||
| 4656 | phy_resume(tp->phydev); | 4660 | phy_resume(tp->phydev); |
| 4657 | rtl8169_init_phy(tp); | 4661 | rtl8169_init_phy(tp); |
| 4658 | napi_enable(&tp->napi); | 4662 | napi_enable(&tp->napi); |
| @@ -5307,8 +5311,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 648 unmodified lines | |||
| 5307 | 5311 | ||
| 5308 | rtl_hw_reset(tp); | 5312 | rtl_hw_reset(tp); |
| 5309 | 5313 | ||
| 5310 | pci_set_master(pdev); | ||
| 5311 | |||
| 5312 | rc = rtl_alloc_irq(tp); | 5314 | rc = rtl_alloc_irq(tp); |
| 5313 | if (rc < 0) { | 5315 | if (rc < 0) { |
| 5314 | dev_err(&pdev->dev, "Can't allocate interrupt\n"); | 5316 | dev_err(&pdev->dev, "Can't allocate interrupt\n"); |
| @@ -1715,14 +1715,17 @@ static int netsec_netdev_init(struct net_device *ndev) · 1714 unmodified lines | |||
| 1715 | goto err1; | 1715 | goto err1; |
| 1716 | 1716 | ||
| 1717 | /* set phy power down */ | 1717 | /* set phy power down */ |
| 1718 | data = netsec_phy_read(priv->mii_bus, priv->phy_addr, MII_BMCR) | | 1718 | data = netsec_phy_read(priv->mii_bus, priv->phy_addr, MII_BMCR); |
| 1719 | BMCR_PDOWN; | 1719 | netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, |
| 1720 | netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, data); | 1720 | data | BMCR_PDOWN); |
| 1721 | 1721 | ||
| 1722 | ret = netsec_reset_hardware(priv, true); | 1722 | ret = netsec_reset_hardware(priv, true); |
| 1723 | if (ret) | 1723 | if (ret) |
| 1724 | goto err2; | 1724 | goto err2; |
| 1725 | 1725 | ||
| 1726 | /* Restore phy power state */ | ||
| 1727 | netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, data); | ||
| 1728 | |||
| 1726 | spin_lock_init(&priv->desc_ring[NETSEC_RING_TX].lock); | 1729 | spin_lock_init(&priv->desc_ring[NETSEC_RING_TX].lock); |
| 1727 | spin_lock_init(&priv->desc_ring[NETSEC_RING_RX].lock); | 1730 | spin_lock_init(&priv->desc_ring[NETSEC_RING_RX].lock); |
| 1728 | 1731 | ||
| @@ -1214,6 +1214,8 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) · 1213 unmodified lines | |||
| 1214 | plat_dat->init = sun8i_dwmac_init; | 1214 | plat_dat->init = sun8i_dwmac_init; |
| 1215 | plat_dat->exit = sun8i_dwmac_exit; | 1215 | plat_dat->exit = sun8i_dwmac_exit; |
| 1216 | plat_dat->setup = sun8i_dwmac_setup; | 1216 | plat_dat->setup = sun8i_dwmac_setup; |
| 1217 | plat_dat->tx_fifo_size = 4096; | ||
| 1218 | plat_dat->rx_fifo_size = 16384; | ||
| 1217 | 1219 | ||
| 1218 | ret = sun8i_dwmac_set_syscon(&pdev->dev, plat_dat); | 1220 | ret = sun8i_dwmac_set_syscon(&pdev->dev, plat_dat); |
| 1219 | if (ret) | 1221 | if (ret) |
| @@ -1880,7 +1880,7 @@ static int axienet_probe(struct platform_device *pdev) · 1879 unmodified lines | |||
| 1880 | if (IS_ERR(lp->regs)) { | 1880 | if (IS_ERR(lp->regs)) { |
| 1881 | dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n"); | 1881 | dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n"); |
| 1882 | ret = PTR_ERR(lp->regs); | 1882 | ret = PTR_ERR(lp->regs); |
| 1883 | goto free_netdev; | 1883 | goto cleanup_clk; |
| 1884 | } | 1884 | } |
| 1885 | lp->regs_start = ethres->start; | 1885 | lp->regs_start = ethres->start; |
| 1886 | 1886 | ||
| @@ -1958,18 +1958,18 @@ static int axienet_probe(struct platform_device *pdev) · 71 unmodified lines | |||
| 1958 | break; | 1958 | break; |
| 1959 | default: | 1959 | default: |
| 1960 | ret = -EINVAL; | 1960 | ret = -EINVAL; |
| 1961 | goto free_netdev; | 1961 | goto cleanup_clk; |
| 1962 | } | 1962 | } |
| 1963 | } else { | 1963 | } else { |
| 1964 | ret = of_get_phy_mode(pdev->dev.of_node, &lp->phy_mode); | 1964 | ret = of_get_phy_mode(pdev->dev.of_node, &lp->phy_mode); |
| 1965 | if (ret) | 1965 | if (ret) |
| 1966 | goto free_netdev; | 1966 | goto cleanup_clk; |
| 1967 | } | 1967 | } |
| 1968 | if (lp->switch_x_sgmii && lp->phy_mode != PHY_INTERFACE_MODE_SGMII && | 1968 | if (lp->switch_x_sgmii && lp->phy_mode != PHY_INTERFACE_MODE_SGMII && |
| 1969 | lp->phy_mode != PHY_INTERFACE_MODE_1000BASEX) { | 1969 | lp->phy_mode != PHY_INTERFACE_MODE_1000BASEX) { |
| 1970 | dev_err(&pdev->dev, "xlnx,switch-x-sgmii only supported with SGMII or 1000BaseX\n"); | 1970 | dev_err(&pdev->dev, "xlnx,switch-x-sgmii only supported with SGMII or 1000BaseX\n"); |
| 1971 | ret = -EINVAL; | 1971 | ret = -EINVAL; |
| 1972 | goto free_netdev; | 1972 | goto cleanup_clk; |
| 1973 | } | 1973 | } |
| 1974 | 1974 | ||
| 1975 | /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ | 1975 | /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ |
| @@ -1982,7 +1982,7 @@ static int axienet_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 1982 | dev_err(&pdev->dev, | 1982 | dev_err(&pdev->dev, |
| 1983 | "unable to get DMA resource\n"); | 1983 | "unable to get DMA resource\n"); |
| 1984 | of_node_put(np); | 1984 | of_node_put(np); |
| 1985 | goto free_netdev; | 1985 | goto cleanup_clk; |
| 1986 | } | 1986 | } |
| 1987 | lp->dma_regs = devm_ioremap_resource(&pdev->dev, | 1987 | lp->dma_regs = devm_ioremap_resource(&pdev->dev, |
| 1988 | &dmares); | 1988 | &dmares); |
| @@ -2002,12 +2002,12 @@ static int axienet_probe(struct platform_device *pdev) · 13 unmodified lines | |||
| 2002 | if (IS_ERR(lp->dma_regs)) { | 2002 | if (IS_ERR(lp->dma_regs)) { |
| 2003 | dev_err(&pdev->dev, "could not map DMA regs\n"); | 2003 | dev_err(&pdev->dev, "could not map DMA regs\n"); |
| 2004 | ret = PTR_ERR(lp->dma_regs); | 2004 | ret = PTR_ERR(lp->dma_regs); |
| 2005 | goto free_netdev; | 2005 | goto cleanup_clk; |
| 2006 | } | 2006 | } |
| 2007 | if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) { | 2007 | if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) { |
| 2008 | dev_err(&pdev->dev, "could not determine irqs\n"); | 2008 | dev_err(&pdev->dev, "could not determine irqs\n"); |
| 2009 | ret = -ENOMEM; | 2009 | ret = -ENOMEM; |
| 2010 | goto free_netdev; | 2010 | goto cleanup_clk; |
| 2011 | } | 2011 | } |
| 2012 | 2012 | ||
| 2013 | /* Autodetect the need for 64-bit DMA pointers. | 2013 | /* Autodetect the need for 64-bit DMA pointers. |
| @@ -2037,7 +2037,7 @@ static int axienet_probe(struct platform_device *pdev) · 23 unmodified lines | |||
| 2037 | ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width)); | 2037 | ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width)); |
| 2038 | if (ret) { | 2038 | if (ret) { |
| 2039 | dev_err(&pdev->dev, "No suitable DMA available\n"); | 2039 | dev_err(&pdev->dev, "No suitable DMA available\n"); |
| 2040 | goto free_netdev; | 2040 | goto cleanup_clk; |
| 2041 | } | 2041 | } |
| 2042 | 2042 | ||
| 2043 | /* Check for Ethernet core IRQ (optional) */ | 2043 | /* Check for Ethernet core IRQ (optional) */ |
| @@ -2068,12 +2068,12 @@ static int axienet_probe(struct platform_device *pdev) · 24 unmodified lines | |||
| 2068 | if (!lp->phy_node) { | 2068 | if (!lp->phy_node) { |
| 2069 | dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n"); | 2069 | dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n"); |
| 2070 | ret = -EINVAL; | 2070 | ret = -EINVAL; |
| 2071 | goto free_netdev; | 2071 | goto cleanup_mdio; |
| 2072 | } | 2072 | } |
| 2073 | lp->pcs_phy = of_mdio_find_device(lp->phy_node); | 2073 | lp->pcs_phy = of_mdio_find_device(lp->phy_node); |
| 2074 | if (!lp->pcs_phy) { | 2074 | if (!lp->pcs_phy) { |
| 2075 | ret = -EPROBE_DEFER; | 2075 | ret = -EPROBE_DEFER; |
| 2076 | goto free_netdev; | 2076 | goto cleanup_mdio; |
| 2077 | } | 2077 | } |
| 2078 | lp->phylink_config.pcs_poll = true; | 2078 | lp->phylink_config.pcs_poll = true; |
| 2079 | } | 2079 | } |
| @@ -2087,17 +2087,30 @@ static int axienet_probe(struct platform_device *pdev) · 7 unmodified lines | |||
| 2087 | if (IS_ERR(lp->phylink)) { | 2087 | if (IS_ERR(lp->phylink)) { |
| 2088 | ret = PTR_ERR(lp->phylink); | 2088 | ret = PTR_ERR(lp->phylink); |
| 2089 | dev_err(&pdev->dev, "phylink_create error (%i)\n", ret); | 2089 | dev_err(&pdev->dev, "phylink_create error (%i)\n", ret); |
| 2090 | goto free_netdev; | 2090 | goto cleanup_mdio; |
| 2091 | } | 2091 | } |
| 2092 | 2092 | ||
| 2093 | ret = register_netdev(lp->ndev); | 2093 | ret = register_netdev(lp->ndev); |
| 2094 | if (ret) { | 2094 | if (ret) { |
| 2095 | dev_err(lp->dev, "register_netdev() error (%i)\n", ret); | 2095 | dev_err(lp->dev, "register_netdev() error (%i)\n", ret); |
| 2096 | goto free_netdev; | 2096 | goto cleanup_phylink; |
| 2097 | } | 2097 | } |
| 2098 | 2098 | ||
| 2099 | return 0; | 2099 | return 0; |
| 2100 | 2100 | ||
| 2101 | cleanup_phylink: | ||
| 2102 | phylink_destroy(lp->phylink); | ||
| 2103 | |||
| 2104 | cleanup_mdio: | ||
| 2105 | if (lp->pcs_phy) | ||
| 2106 | put_device(&lp->pcs_phy->dev); | ||
| 2107 | if (lp->mii_bus) | ||
| 2108 | axienet_mdio_teardown(lp); | ||
| 2109 | of_node_put(lp->phy_node); | ||
| 2110 | |||
| 2111 | cleanup_clk: | ||
| 2112 | clk_disable_unprepare(lp->clk); | ||
| 2113 | |||
| 2101 | free_netdev: | 2114 | free_netdev: |
| 2102 | free_netdev(ndev); | 2115 | free_netdev(ndev); |
| 2103 | 2116 | ||
| @@ -2167,7 +2167,6 @@ static void __exit scc_cleanup_driver(void) · 2166 unmodified lines | |||
| 2167 | 2167 | ||
| 2168 | MODULE_AUTHOR("Joerg Reuter <jreuter@yaina.de>"); | 2168 | MODULE_AUTHOR("Joerg Reuter <jreuter@yaina.de>"); |
| 2169 | MODULE_DESCRIPTION("AX.25 Device Driver for Z8530 based HDLC cards"); | 2169 | MODULE_DESCRIPTION("AX.25 Device Driver for Z8530 based HDLC cards"); |
| 2170 | MODULE_SUPPORTED_DEVICE("Z8530 based SCC cards for Amateur Radio"); | ||
| 2171 | MODULE_LICENSE("GPL"); | 2170 | MODULE_LICENSE("GPL"); |
| 2172 | module_init(scc_init_driver); | 2171 | module_init(scc_init_driver); |
| 2173 | module_exit(scc_cleanup_driver); | 2172 | module_exit(scc_cleanup_driver); |
| @@ -175,21 +175,23 @@ bool ipa_cmd_table_valid(struct ipa *ipa, const struct ipa_mem *mem, · 174 unmodified lines | |||
| 175 | : field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK); | 175 | : field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK); |
| 176 | if (mem->offset > offset_max || | 176 | if (mem->offset > offset_max || |
| 177 | ipa->mem_offset > offset_max - mem->offset) { | 177 | ipa->mem_offset > offset_max - mem->offset) { |
| 178 | dev_err(dev, "IPv%c %s%s table region offset too large " | 178 | dev_err(dev, "IPv%c %s%s table region offset too large\n", |
| 179 | "(0x%04x + 0x%04x > 0x%04x)\n", | 179 | ipv6 ? '6' : '4', hashed ? "hashed " : "", |
| 180 | ipv6 ? '6' : '4', hashed ? "hashed " : "", | 180 | route ? "route" : "filter"); |
| 181 | route ? "route" : "filter", | 181 | dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", |
| 182 | ipa->mem_offset, mem->offset, offset_max); | 182 | ipa->mem_offset, mem->offset, offset_max); |
| 183 | |||
| 183 | return false; | 184 | return false; |
| 184 | } | 185 | } |
| 185 | 186 | ||
| 186 | if (mem->offset > ipa->mem_size || | 187 | if (mem->offset > ipa->mem_size || |
| 187 | mem->size > ipa->mem_size - mem->offset) { | 188 | mem->size > ipa->mem_size - mem->offset) { |
| 188 | dev_err(dev, "IPv%c %s%s table region out of range " | 189 | dev_err(dev, "IPv%c %s%s table region out of range\n", |
| 189 | "(0x%04x + 0x%04x > 0x%04x)\n", | 190 | ipv6 ? '6' : '4', hashed ? "hashed " : "", |
| 190 | ipv6 ? '6' : '4', hashed ? "hashed " : "", | 191 | route ? "route" : "filter"); |
| 191 | route ? "route" : "filter", | 192 | dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", |
| 192 | mem->offset, mem->size, ipa->mem_size); | 193 | mem->offset, mem->size, ipa->mem_size); |
| 194 | |||
| 193 | return false; | 195 | return false; |
| 194 | } | 196 | } |
| 195 | 197 | ||
| @@ -205,22 +207,36 @@ static bool ipa_cmd_header_valid(struct ipa *ipa) · 9 unmodified lines | |||
| 205 | u32 size_max; | 207 | u32 size_max; |
| 206 | u32 size; | 208 | u32 size; |
| 207 | 209 | ||
| 210 | /* In ipa_cmd_hdr_init_local_add() we record the offset and size | ||
| 211 | * of the header table memory area. Make sure the offset and size | ||
| 212 | * fit in the fields that need to hold them, and that the entire | ||
| 213 | * range is within the overall IPA memory range. | ||
| 214 | */ | ||
| 208 | offset_max = field_max(HDR_INIT_LOCAL_FLAGS_HDR_ADDR_FMASK); | 215 | offset_max = field_max(HDR_INIT_LOCAL_FLAGS_HDR_ADDR_FMASK); |
| 209 | if (mem->offset > offset_max || | 216 | if (mem->offset > offset_max || |
| 210 | ipa->mem_offset > offset_max - mem->offset) { | 217 | ipa->mem_offset > offset_max - mem->offset) { |
| 211 | dev_err(dev, "header table region offset too large " | 218 | dev_err(dev, "header table region offset too large\n"); |
| 212 | "(0x%04x + 0x%04x > 0x%04x)\n", | 219 | dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", |
| 213 | ipa->mem_offset + mem->offset, offset_max); | 220 | ipa->mem_offset, mem->offset, offset_max); |
| 221 | |||
| 214 | return false; | 222 | return false; |
| 215 | } | 223 | } |
| 216 | 224 | ||
| 217 | size_max = field_max(HDR_INIT_LOCAL_FLAGS_TABLE_SIZE_FMASK); | 225 | size_max = field_max(HDR_INIT_LOCAL_FLAGS_TABLE_SIZE_FMASK); |
| 218 | size = ipa->mem[IPA_MEM_MODEM_HEADER].size; | 226 | size = ipa->mem[IPA_MEM_MODEM_HEADER].size; |
| 219 | size += ipa->mem[IPA_MEM_AP_HEADER].size; | 227 | size += ipa->mem[IPA_MEM_AP_HEADER].size; |
| 220 | if (mem->offset > ipa->mem_size || size > ipa->mem_size - mem->offset) { | 228 | |
| 221 | dev_err(dev, "header table region out of range " | 229 | if (size > size_max) { |
| 222 | "(0x%04x + 0x%04x > 0x%04x)\n", | 230 | dev_err(dev, "header table region size too large\n"); |
| 223 | mem->offset, size, ipa->mem_size); | 231 | dev_err(dev, " (0x%04x > 0x%08x)\n", size, size_max); |
| 232 | |||
| 233 | return false; | ||
| 234 | } | ||
| 235 | if (size > ipa->mem_size || mem->offset > ipa->mem_size - size) { | ||
| 236 | dev_err(dev, "header table region out of range\n"); | ||
| 237 | dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", | ||
| 238 | mem->offset, size, ipa->mem_size); | ||
| 239 | |||
| 224 | return false; | 240 | return false; |
| 225 | } | 241 | } |
| 226 | 242 | ||
| @@ -249,6 +249,7 @@ static const struct qmi_msg_handler ipa_server_msg_handlers[] = { · 248 unmodified lines | |||
| 249 | .decoded_size = IPA_QMI_DRIVER_INIT_COMPLETE_REQ_SZ, | 249 | .decoded_size = IPA_QMI_DRIVER_INIT_COMPLETE_REQ_SZ, |
| 250 | .fn = ipa_server_driver_init_complete, | 250 | .fn = ipa_server_driver_init_complete, |
| 251 | }, | 251 | }, |
| 252 | { }, | ||
| 252 | }; | 253 | }; |
| 253 | 254 | ||
| 254 | /* Handle an INIT_DRIVER response message from the modem. */ | 255 | /* Handle an INIT_DRIVER response message from the modem. */ |
| @@ -269,6 +270,7 @@ static const struct qmi_msg_handler ipa_client_msg_handlers[] = { · 14 unmodified lines | |||
| 269 | .decoded_size = IPA_QMI_INIT_DRIVER_RSP_SZ, | 270 | .decoded_size = IPA_QMI_INIT_DRIVER_RSP_SZ, |
| 270 | .fn = ipa_client_init_driver, | 271 | .fn = ipa_client_init_driver, |
| 271 | }, | 272 | }, |
| 273 | { }, | ||
| 272 | }; | 274 | }; |
| 273 | 275 | ||
| 274 | /* Return a pointer to an init modem driver request structure, which contains | 276 | /* Return a pointer to an init modem driver request structure, which contains |
| @@ -342,6 +342,10 @@ static int bcm54xx_config_init(struct phy_device *phydev) · 341 unmodified lines | |||
| 342 | bcm54xx_adjust_rxrefclk(phydev); | 342 | bcm54xx_adjust_rxrefclk(phydev); |
| 343 | 343 | ||
| 344 | switch (BRCM_PHY_MODEL(phydev)) { | 344 | switch (BRCM_PHY_MODEL(phydev)) { |
| 345 | case PHY_ID_BCM50610: | ||
| 346 | case PHY_ID_BCM50610M: | ||
| 347 | err = bcm54xx_config_clock_delay(phydev); | ||
| 348 | break; | ||
| 345 | case PHY_ID_BCM54210E: | 349 | case PHY_ID_BCM54210E: |
| 346 | err = bcm54210e_config_init(phydev); | 350 | err = bcm54210e_config_init(phydev); |
| 347 | break; | 351 | break; |
| @@ -399,6 +403,11 @@ static int bcm54xx_resume(struct phy_device *phydev) · 51 unmodified lines | |||
| 399 | if (ret < 0) | 403 | if (ret < 0) |
| 400 | return ret; | 404 | return ret; |
| 401 | 405 | ||
| 406 | /* Upon exiting power down, the PHY remains in an internal reset state | ||
| 407 | * for 40us | ||
| 408 | */ | ||
| 409 | fsleep(40); | ||
| 410 | |||
| 402 | return bcm54xx_config_init(phydev); | 411 | return bcm54xx_config_init(phydev); |
| 403 | } | 412 | } |
| 404 | 413 | ||
| @@ -476,7 +476,7 @@ static void phylink_major_config(struct phylink *pl, bool restart, · 475 unmodified lines | |||
| 476 | err = pl->mac_ops->mac_finish(pl->config, pl->cur_link_an_mode, | 476 | err = pl->mac_ops->mac_finish(pl->config, pl->cur_link_an_mode, |
| 477 | state->interface); | 477 | state->interface); |
| 478 | if (err < 0) | 478 | if (err < 0) |
| 479 | phylink_err(pl, "mac_prepare failed: %pe\n", | 479 | phylink_err(pl, "mac_finish failed: %pe\n", |
| 480 | ERR_PTR(err)); | 480 | ERR_PTR(err)); |
| 481 | } | 481 | } |
| 482 | } | 482 | } |
| @@ -387,6 +387,8 @@ static int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *i · 386 unmodified lines | |||
| 387 | 387 | ||
| 388 | err = register_netdev(dev); | 388 | err = register_netdev(dev); |
| 389 | if (err) { | 389 | if (err) { |
| 390 | /* Set disconnected flag so that disconnect() returns early. */ | ||
| 391 | pnd->disconnected = 1; | ||
| 390 | usb_driver_release_interface(&usbpn_driver, data_intf); | 392 | usb_driver_release_interface(&usbpn_driver, data_intf); |
| 391 | goto out; | 393 | goto out; |
| 392 | } | 394 | } |
| @@ -6553,7 +6553,10 @@ static int rtl_ops_init(struct r8152 *tp) · 6552 unmodified lines | |||
| 6553 | ops->in_nway = rtl8153_in_nway; | 6553 | ops->in_nway = rtl8153_in_nway; |
| 6554 | ops->hw_phy_cfg = r8153_hw_phy_cfg; | 6554 | ops->hw_phy_cfg = r8153_hw_phy_cfg; |
| 6555 | ops->autosuspend_en = rtl8153_runtime_enable; | 6555 | ops->autosuspend_en = rtl8153_runtime_enable; |
| 6556 | tp->rx_buf_sz = 32 * 1024; | 6556 | if (tp->udev->speed < USB_SPEED_SUPER) |
| 6557 | tp->rx_buf_sz = 16 * 1024; | ||
| 6558 | else | ||
| 6559 | tp->rx_buf_sz = 32 * 1024; | ||
| 6557 | tp->eee_en = true; | 6560 | tp->eee_en = true; |
| 6558 | tp->eee_adv = MDIO_EEE_1000T | MDIO_EEE_100TX; | 6561 | tp->eee_adv = MDIO_EEE_1000T | MDIO_EEE_100TX; |
| 6559 | break; | 6562 | break; |
| @@ -302,8 +302,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) · 301 unmodified lines | |||
| 302 | if (rxq < rcv->real_num_rx_queues) { | 302 | if (rxq < rcv->real_num_rx_queues) { |
| 303 | rq = &rcv_priv->rq[rxq]; | 303 | rq = &rcv_priv->rq[rxq]; |
| 304 | rcv_xdp = rcu_access_pointer(rq->xdp_prog); | 304 | rcv_xdp = rcu_access_pointer(rq->xdp_prog); |
| 305 | if (rcv_xdp) | 305 | skb_record_rx_queue(skb, rxq); |
| 306 | skb_record_rx_queue(skb, rxq); | ||
| 307 | } | 306 | } |
| 308 | 307 | ||
| 309 | skb_tx_timestamp(skb); | 308 | skb_tx_timestamp(skb); |
| @@ -23,6 +23,8 @@ · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | struct x25_state { | 24 | struct x25_state { |
| 25 | x25_hdlc_proto settings; | 25 | x25_hdlc_proto settings; |
| 26 | bool up; | ||
| 27 | spinlock_t up_lock; /* Protects "up" */ | ||
| 26 | }; | 28 | }; |
| 27 | 29 | ||
| 28 | static int x25_ioctl(struct net_device *dev, struct ifreq *ifr); | 30 | static int x25_ioctl(struct net_device *dev, struct ifreq *ifr); |
| @@ -104,6 +106,8 @@ static void x25_data_transmit(struct net_device *dev, struct sk_buff *skb) · 75 unmodified lines | |||
| 104 | 106 | ||
| 105 | static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) | 107 | static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) |
| 106 | { | 108 | { |
| 109 | hdlc_device *hdlc = dev_to_hdlc(dev); | ||
| 110 | struct x25_state *x25st = state(hdlc); | ||
| 107 | int result; | 111 | int result; |
| 108 | 112 | ||
| 109 | /* There should be a pseudo header of 1 byte added by upper layers. | 113 | /* There should be a pseudo header of 1 byte added by upper layers. |
| @@ -114,11 +118,19 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) · 4 unmodified lines | |||
| 114 | return NETDEV_TX_OK; | 118 | return NETDEV_TX_OK; |
| 115 | } | 119 | } |
| 116 | 120 | ||
| 121 | spin_lock_bh(&x25st->up_lock); | ||
| 122 | if (!x25st->up) { | ||
| 123 | spin_unlock_bh(&x25st->up_lock); | ||
| 124 | kfree_skb(skb); | ||
| 125 | return NETDEV_TX_OK; | ||
| 126 | } | ||
| 127 | |||
| 117 | switch (skb->data[0]) { | 128 | switch (skb->data[0]) { |
| 118 | case X25_IFACE_DATA: /* Data to be transmitted */ | 129 | case X25_IFACE_DATA: /* Data to be transmitted */ |
| 119 | skb_pull(skb, 1); | 130 | skb_pull(skb, 1); |
| 120 | if ((result = lapb_data_request(dev, skb)) != LAPB_OK) | 131 | if ((result = lapb_data_request(dev, skb)) != LAPB_OK) |
| 121 | dev_kfree_skb(skb); | 132 | dev_kfree_skb(skb); |
| 133 | spin_unlock_bh(&x25st->up_lock); | ||
| 122 | return NETDEV_TX_OK; | 134 | return NETDEV_TX_OK; |
| 123 | 135 | ||
| 124 | case X25_IFACE_CONNECT: | 136 | case X25_IFACE_CONNECT: |
| @@ -147,6 +159,7 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) · 22 unmodified lines | |||
| 147 | break; | 159 | break; |
| 148 | } | 160 | } |
| 149 | 161 | ||
| 162 | spin_unlock_bh(&x25st->up_lock); | ||
| 150 | dev_kfree_skb(skb); | 163 | dev_kfree_skb(skb); |
| 151 | return NETDEV_TX_OK; | 164 | return NETDEV_TX_OK; |
| 152 | } | 165 | } |
| @@ -164,6 +177,7 @@ static int x25_open(struct net_device *dev) · 11 unmodified lines | |||
| 164 | .data_transmit = x25_data_transmit, | 177 | .data_transmit = x25_data_transmit, |
| 165 | }; | 178 | }; |
| 166 | hdlc_device *hdlc = dev_to_hdlc(dev); | 179 | hdlc_device *hdlc = dev_to_hdlc(dev); |
| 180 | struct x25_state *x25st = state(hdlc); | ||
| 167 | struct lapb_parms_struct params; | 181 | struct lapb_parms_struct params; |
| 168 | int result; | 182 | int result; |
| 169 | 183 | ||
| @@ -190,6 +204,10 @@ static int x25_open(struct net_device *dev) · 20 unmodified lines | |||
| 190 | if (result != LAPB_OK) | 204 | if (result != LAPB_OK) |
| 191 | return -EINVAL; | 205 | return -EINVAL; |
| 192 | 206 | ||
| 207 | spin_lock_bh(&x25st->up_lock); | ||
| 208 | x25st->up = true; | ||
| 209 | spin_unlock_bh(&x25st->up_lock); | ||
| 210 | |||
| 193 | return 0; | 211 | return 0; |
| 194 | } | 212 | } |
| 195 | 213 | ||
| @@ -197,6 +215,13 @@ static int x25_open(struct net_device *dev) · 1 unmodified line | |||
| 197 | 215 | ||
| 198 | static void x25_close(struct net_device *dev) | 216 | static void x25_close(struct net_device *dev) |
| 199 | { | 217 | { |
| 218 | hdlc_device *hdlc = dev_to_hdlc(dev); | ||
| 219 | struct x25_state *x25st = state(hdlc); | ||
| 220 | |||
| 221 | spin_lock_bh(&x25st->up_lock); | ||
| 222 | x25st->up = false; | ||
| 223 | spin_unlock_bh(&x25st->up_lock); | ||
| 224 | |||
| 200 | lapb_unregister(dev); | 225 | lapb_unregister(dev); |
| 201 | } | 226 | } |
| 202 | 227 | ||
| @@ -205,15 +230,28 @@ static void x25_close(struct net_device *dev) · 2 unmodified lines | |||
| 205 | static int x25_rx(struct sk_buff *skb) | 230 | static int x25_rx(struct sk_buff *skb) |
| 206 | { | 231 | { |
| 207 | struct net_device *dev = skb->dev; | 232 | struct net_device *dev = skb->dev; |
| 233 | hdlc_device *hdlc = dev_to_hdlc(dev); | ||
| 234 | struct x25_state *x25st = state(hdlc); | ||
| 208 | 235 | ||
| 209 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { | 236 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { |
| 210 | dev->stats.rx_dropped++; | 237 | dev->stats.rx_dropped++; |
| 211 | return NET_RX_DROP; | 238 | return NET_RX_DROP; |
| 212 | } | 239 | } |
| 213 | 240 | ||
| 214 | if (lapb_data_received(dev, skb) == LAPB_OK) | 241 | spin_lock_bh(&x25st->up_lock); |
| 242 | if (!x25st->up) { | ||
| 243 | spin_unlock_bh(&x25st->up_lock); | ||
| 244 | kfree_skb(skb); | ||
| 245 | dev->stats.rx_dropped++; | ||
| 246 | return NET_RX_DROP; | ||
| 247 | } | ||
| 248 | |||
| 249 | if (lapb_data_received(dev, skb) == LAPB_OK) { | ||
| 250 | spin_unlock_bh(&x25st->up_lock); | ||
| 215 | return NET_RX_SUCCESS; | 251 | return NET_RX_SUCCESS; |
| 252 | } | ||
| 216 | 253 | ||
| 254 | spin_unlock_bh(&x25st->up_lock); | ||
| 217 | dev->stats.rx_errors++; | 255 | dev->stats.rx_errors++; |
| 218 | dev_kfree_skb_any(skb); | 256 | dev_kfree_skb_any(skb); |
| 219 | return NET_RX_DROP; | 257 | return NET_RX_DROP; |
| @@ -298,6 +336,8 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr) · 78 unmodified lines | |||
| 298 | return result; | 336 | return result; |
| 299 | 337 | ||
| 300 | memcpy(&state(hdlc)->settings, &new_settings, size); | 338 | memcpy(&state(hdlc)->settings, &new_settings, size); |
| 339 | state(hdlc)->up = false; | ||
| 340 | spin_lock_init(&state(hdlc)->up_lock); | ||
| 301 | 341 | ||
| 302 | /* There's no header_ops so hard_header_len should be 0. */ | 342 | /* There's no header_ops so hard_header_len should be 0. */ |
| 303 | dev->hard_header_len = 0; | 343 | dev->hard_header_len = 0; |
| @@ -28,7 +28,6 @@ · 27 unmodified lines | |||
| 28 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); | 28 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); |
| 29 | MODULE_AUTHOR("Jouni Malinen <j@w1.fi>"); | 29 | MODULE_AUTHOR("Jouni Malinen <j@w1.fi>"); |
| 30 | MODULE_DESCRIPTION("Driver for IEEE 802.11b wireless cards based on ADMtek ADM8211"); | 30 | MODULE_DESCRIPTION("Driver for IEEE 802.11b wireless cards based on ADMtek ADM8211"); |
| 31 | MODULE_SUPPORTED_DEVICE("ADM8211"); | ||
| 32 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
| 33 | 32 | ||
| 34 | static unsigned int tx_ring_size __read_mostly = 16; | 33 | static unsigned int tx_ring_size __read_mostly = 16; |
| @@ -90,7 +90,6 @@ MODULE_PARM_DESC(no_hw_rfkill_switch, "Ignore the GPIO RFKill switch state"); · 89 unmodified lines | |||
| 90 | MODULE_AUTHOR("Jiri Slaby"); | 90 | MODULE_AUTHOR("Jiri Slaby"); |
| 91 | MODULE_AUTHOR("Nick Kossifidis"); | 91 | MODULE_AUTHOR("Nick Kossifidis"); |
| 92 | MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards."); | 92 | MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards."); |
| 93 | MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards"); | ||
| 94 | MODULE_LICENSE("Dual BSD/GPL"); | 93 | MODULE_LICENSE("Dual BSD/GPL"); |
| 95 | 94 | ||
| 96 | static int ath5k_init(struct ieee80211_hw *hw); | 95 | static int ath5k_init(struct ieee80211_hw *hw); |
| @@ -34,7 +34,6 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | MODULE_AUTHOR("Atheros Communications"); | 35 | MODULE_AUTHOR("Atheros Communications"); |
| 36 | MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); | 36 | MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); |
| 37 | MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards"); | ||
| 38 | MODULE_LICENSE("Dual BSD/GPL"); | 37 | MODULE_LICENSE("Dual BSD/GPL"); |
| 39 | 38 | ||
| 40 | static void ath9k_hw_set_clockrate(struct ath_hw *ah) | 39 | static void ath9k_hw_set_clockrate(struct ath_hw *ah) |
| @@ -37,7 +37,6 @@ static char *dev_info = "ath9k"; · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | MODULE_AUTHOR("Atheros Communications"); | 38 | MODULE_AUTHOR("Atheros Communications"); |
| 39 | MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); | 39 | MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); |
| 40 | MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards"); | ||
| 41 | MODULE_LICENSE("Dual BSD/GPL"); | 40 | MODULE_LICENSE("Dual BSD/GPL"); |
| 42 | 41 | ||
| 43 | static unsigned int ath9k_debug = ATH_DBG_DEFAULT; | 42 | static unsigned int ath9k_debug = ATH_DBG_DEFAULT; |
| @@ -75,7 +75,6 @@ · 74 unmodified lines | |||
| 75 | MODULE_AUTHOR("Simon Kelley"); | 75 | MODULE_AUTHOR("Simon Kelley"); |
| 76 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 76 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); |
| 77 | MODULE_LICENSE("GPL"); | 77 | MODULE_LICENSE("GPL"); |
| 78 | MODULE_SUPPORTED_DEVICE("Atmel at76c50x wireless cards"); | ||
| 79 | 78 | ||
| 80 | /* The name of the firmware file to be loaded | 79 | /* The name of the firmware file to be loaded |
| 81 | over-rides any automatic selection */ | 80 | over-rides any automatic selection */ |
| @@ -57,7 +57,6 @@ · 56 unmodified lines | |||
| 57 | MODULE_AUTHOR("Simon Kelley"); | 57 | MODULE_AUTHOR("Simon Kelley"); |
| 58 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 58 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); |
| 59 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
| 60 | MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards"); | ||
| 61 | 60 | ||
| 62 | /*====================================================================*/ | 61 | /*====================================================================*/ |
| 63 | 62 | ||
| @@ -16,7 +16,6 @@ · 15 unmodified lines | |||
| 16 | MODULE_AUTHOR("Simon Kelley"); | 16 | MODULE_AUTHOR("Simon Kelley"); |
| 17 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 17 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); |
| 18 | MODULE_LICENSE("GPL"); | 18 | MODULE_LICENSE("GPL"); |
| 19 | MODULE_SUPPORTED_DEVICE("Atmel at76c506 PCI wireless cards"); | ||
| 20 | 19 | ||
| 21 | static const struct pci_device_id card_ids[] = { | 20 | static const struct pci_device_id card_ids[] = { |
| 22 | { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID }, | 21 | { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID }, |
| @@ -87,7 +87,6 @@ static int n_adapters_found; · 86 unmodified lines | |||
| 87 | 87 | ||
| 88 | MODULE_AUTHOR("Broadcom Corporation"); | 88 | MODULE_AUTHOR("Broadcom Corporation"); |
| 89 | MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver."); | 89 | MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver."); |
| 90 | MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN cards"); | ||
| 91 | MODULE_LICENSE("Dual BSD/GPL"); | 90 | MODULE_LICENSE("Dual BSD/GPL"); |
| 92 | /* This needs to be adjusted when brcms_firmwares changes */ | 91 | /* This needs to be adjusted when brcms_firmwares changes */ |
| 93 | MODULE_FIRMWARE("brcm/bcm43xx-0.fw"); | 92 | MODULE_FIRMWARE("brcm/bcm43xx-0.fw"); |
| @@ -12,7 +12,6 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | MODULE_AUTHOR("Broadcom Corporation"); | 13 | MODULE_AUTHOR("Broadcom Corporation"); |
| 14 | MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver utilities."); | 14 | MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver utilities."); |
| 15 | MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN cards"); | ||
| 16 | MODULE_LICENSE("Dual BSD/GPL"); | 15 | MODULE_LICENSE("Dual BSD/GPL"); |
| 17 | 16 | ||
| 18 | struct sk_buff *brcmu_pkt_buf_get_skb(uint len) | 17 | struct sk_buff *brcmu_pkt_buf_get_skb(uint len) |
| @@ -251,7 +251,6 @@ MODULE_AUTHOR("Benjamin Reed"); · 250 unmodified lines | |||
| 251 | MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet cards. " | 251 | MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet cards. " |
| 252 | "Direct support for ISA/PCI/MPI cards and support for PCMCIA when used with airo_cs."); | 252 | "Direct support for ISA/PCI/MPI cards and support for PCMCIA when used with airo_cs."); |
| 253 | MODULE_LICENSE("Dual BSD/GPL"); | 253 | MODULE_LICENSE("Dual BSD/GPL"); |
| 254 | MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340/350"); | ||
| 255 | module_param_hw_array(io, int, ioport, NULL, 0); | 254 | module_param_hw_array(io, int, ioport, NULL, 0); |
| 256 | module_param_hw_array(irq, int, irq, NULL, 0); | 255 | module_param_hw_array(irq, int, irq, NULL, 0); |
| 257 | module_param_array(rates, int, NULL, 0); | 256 | module_param_array(rates, int, NULL, 0); |
| @@ -47,7 +47,6 @@ MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet " · 46 unmodified lines | |||
| 47 | "cards. This is the module that links the PCMCIA card " | 47 | "cards. This is the module that links the PCMCIA card " |
| 48 | "with the airo module."); | 48 | "with the airo module."); |
| 49 | MODULE_LICENSE("Dual BSD/GPL"); | 49 | MODULE_LICENSE("Dual BSD/GPL"); |
| 50 | MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); | ||
| 51 | 50 | ||
| 52 | /*====================================================================*/ | 51 | /*====================================================================*/ |
| 53 | 52 | ||
| @@ -26,7 +26,6 @@ static char *dev_info = "hostap_cs"; · 25 unmodified lines | |||
| 26 | MODULE_AUTHOR("Jouni Malinen"); | 26 | MODULE_AUTHOR("Jouni Malinen"); |
| 27 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " | 27 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " |
| 28 | "cards (PC Card)."); | 28 | "cards (PC Card)."); |
| 29 | MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)"); | ||
| 30 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
| 31 | 30 | ||
| 32 | 31 | ||
| @@ -27,7 +27,6 @@ static char *dev_info = "hostap_pci"; · 26 unmodified lines | |||
| 27 | MODULE_AUTHOR("Jouni Malinen"); | 27 | MODULE_AUTHOR("Jouni Malinen"); |
| 28 | MODULE_DESCRIPTION("Support for Intersil Prism2.5-based 802.11 wireless LAN " | 28 | MODULE_DESCRIPTION("Support for Intersil Prism2.5-based 802.11 wireless LAN " |
| 29 | "PCI cards."); | 29 | "PCI cards."); |
| 30 | MODULE_SUPPORTED_DEVICE("Intersil Prism2.5-based WLAN PCI cards"); | ||
| 31 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
| 32 | 31 | ||
| 33 | 32 | ||
| @@ -30,7 +30,6 @@ static char *dev_info = "hostap_plx"; · 29 unmodified lines | |||
| 30 | MODULE_AUTHOR("Jouni Malinen"); | 30 | MODULE_AUTHOR("Jouni Malinen"); |
| 31 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " | 31 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " |
| 32 | "cards (PLX)."); | 32 | "cards (PLX)."); |
| 33 | MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PLX)"); | ||
| 34 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
| 35 | 34 | ||
| 36 | 35 | ||
| @@ -1821,7 +1821,6 @@ static const struct pci_device_id rt2400pci_device_table[] = { · 1820 unmodified lines | |||
| 1821 | MODULE_AUTHOR(DRV_PROJECT); | 1821 | MODULE_AUTHOR(DRV_PROJECT); |
| 1822 | MODULE_VERSION(DRV_VERSION); | 1822 | MODULE_VERSION(DRV_VERSION); |
| 1823 | MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver."); | 1823 | MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver."); |
| 1824 | MODULE_SUPPORTED_DEVICE("Ralink RT2460 PCI & PCMCIA chipset based cards"); | ||
| 1825 | MODULE_DEVICE_TABLE(pci, rt2400pci_device_table); | 1824 | MODULE_DEVICE_TABLE(pci, rt2400pci_device_table); |
| 1826 | MODULE_LICENSE("GPL"); | 1825 | MODULE_LICENSE("GPL"); |
| 1827 | 1826 | ||
| @@ -2119,7 +2119,6 @@ static const struct pci_device_id rt2500pci_device_table[] = { · 2118 unmodified lines | |||
| 2119 | MODULE_AUTHOR(DRV_PROJECT); | 2119 | MODULE_AUTHOR(DRV_PROJECT); |
| 2120 | MODULE_VERSION(DRV_VERSION); | 2120 | MODULE_VERSION(DRV_VERSION); |
| 2121 | MODULE_DESCRIPTION("Ralink RT2500 PCI & PCMCIA Wireless LAN driver."); | 2121 | MODULE_DESCRIPTION("Ralink RT2500 PCI & PCMCIA Wireless LAN driver."); |
| 2122 | MODULE_SUPPORTED_DEVICE("Ralink RT2560 PCI & PCMCIA chipset based cards"); | ||
| 2123 | MODULE_DEVICE_TABLE(pci, rt2500pci_device_table); | 2122 | MODULE_DEVICE_TABLE(pci, rt2500pci_device_table); |
| 2124 | MODULE_LICENSE("GPL"); | 2123 | MODULE_LICENSE("GPL"); |
| 2125 | 2124 | ||
| @@ -1956,7 +1956,6 @@ static const struct usb_device_id rt2500usb_device_table[] = { · 1955 unmodified lines | |||
| 1956 | MODULE_AUTHOR(DRV_PROJECT); | 1956 | MODULE_AUTHOR(DRV_PROJECT); |
| 1957 | MODULE_VERSION(DRV_VERSION); | 1957 | MODULE_VERSION(DRV_VERSION); |
| 1958 | MODULE_DESCRIPTION("Ralink RT2500 USB Wireless LAN driver."); | 1958 | MODULE_DESCRIPTION("Ralink RT2500 USB Wireless LAN driver."); |
| 1959 | MODULE_SUPPORTED_DEVICE("Ralink RT2570 USB chipset based cards"); | ||
| 1960 | MODULE_DEVICE_TABLE(usb, rt2500usb_device_table); | 1959 | MODULE_DEVICE_TABLE(usb, rt2500usb_device_table); |
| 1961 | MODULE_LICENSE("GPL"); | 1960 | MODULE_LICENSE("GPL"); |
| 1962 | 1961 | ||
| @@ -439,7 +439,6 @@ static const struct pci_device_id rt2800pci_device_table[] = { · 438 unmodified lines | |||
| 439 | MODULE_AUTHOR(DRV_PROJECT); | 439 | MODULE_AUTHOR(DRV_PROJECT); |
| 440 | MODULE_VERSION(DRV_VERSION); | 440 | MODULE_VERSION(DRV_VERSION); |
| 441 | MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver."); | 441 | MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver."); |
| 442 | MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards"); | ||
| 443 | MODULE_FIRMWARE(FIRMWARE_RT2860); | 442 | MODULE_FIRMWARE(FIRMWARE_RT2860); |
| 444 | MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); | 443 | MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); |
| 445 | MODULE_LICENSE("GPL"); | 444 | MODULE_LICENSE("GPL"); |
| @@ -1248,7 +1248,6 @@ static const struct usb_device_id rt2800usb_device_table[] = { · 1247 unmodified lines | |||
| 1248 | MODULE_AUTHOR(DRV_PROJECT); | 1248 | MODULE_AUTHOR(DRV_PROJECT); |
| 1249 | MODULE_VERSION(DRV_VERSION); | 1249 | MODULE_VERSION(DRV_VERSION); |
| 1250 | MODULE_DESCRIPTION("Ralink RT2800 USB Wireless LAN driver."); | 1250 | MODULE_DESCRIPTION("Ralink RT2800 USB Wireless LAN driver."); |
| 1251 | MODULE_SUPPORTED_DEVICE("Ralink RT2870 USB chipset based cards"); | ||
| 1252 | MODULE_DEVICE_TABLE(usb, rt2800usb_device_table); | 1251 | MODULE_DEVICE_TABLE(usb, rt2800usb_device_table); |
| 1253 | MODULE_FIRMWARE(FIRMWARE_RT2870); | 1252 | MODULE_FIRMWARE(FIRMWARE_RT2870); |
| 1254 | MODULE_LICENSE("GPL"); | 1253 | MODULE_LICENSE("GPL"); |
| @@ -2993,8 +2993,6 @@ static const struct pci_device_id rt61pci_device_table[] = { · 2992 unmodified lines | |||
| 2993 | MODULE_AUTHOR(DRV_PROJECT); | 2993 | MODULE_AUTHOR(DRV_PROJECT); |
| 2994 | MODULE_VERSION(DRV_VERSION); | 2994 | MODULE_VERSION(DRV_VERSION); |
| 2995 | MODULE_DESCRIPTION("Ralink RT61 PCI & PCMCIA Wireless LAN driver."); | 2995 | MODULE_DESCRIPTION("Ralink RT61 PCI & PCMCIA Wireless LAN driver."); |
| 2996 | MODULE_SUPPORTED_DEVICE("Ralink RT2561, RT2561s & RT2661 " | ||
| 2997 | "PCI & PCMCIA chipset based cards"); | ||
| 2998 | MODULE_DEVICE_TABLE(pci, rt61pci_device_table); | 2996 | MODULE_DEVICE_TABLE(pci, rt61pci_device_table); |
| 2999 | MODULE_FIRMWARE(FIRMWARE_RT2561); | 2997 | MODULE_FIRMWARE(FIRMWARE_RT2561); |
| 3000 | MODULE_FIRMWARE(FIRMWARE_RT2561s); | 2998 | MODULE_FIRMWARE(FIRMWARE_RT2561s); |
| @@ -2513,7 +2513,6 @@ static const struct usb_device_id rt73usb_device_table[] = { · 2512 unmodified lines | |||
| 2513 | MODULE_AUTHOR(DRV_PROJECT); | 2513 | MODULE_AUTHOR(DRV_PROJECT); |
| 2514 | MODULE_VERSION(DRV_VERSION); | 2514 | MODULE_VERSION(DRV_VERSION); |
| 2515 | MODULE_DESCRIPTION("Ralink RT73 USB Wireless LAN driver."); | 2515 | MODULE_DESCRIPTION("Ralink RT73 USB Wireless LAN driver."); |
| 2516 | MODULE_SUPPORTED_DEVICE("Ralink RT2571W & RT2671 USB chipset based cards"); | ||
| 2517 | MODULE_DEVICE_TABLE(usb, rt73usb_device_table); | 2516 | MODULE_DEVICE_TABLE(usb, rt73usb_device_table); |
| 2518 | MODULE_FIRMWARE(FIRMWARE_RT2571); | 2517 | MODULE_FIRMWARE(FIRMWARE_RT2571); |
| 2519 | MODULE_LICENSE("GPL"); | 2518 | MODULE_LICENSE("GPL"); |
| @@ -441,6 +441,5 @@ module_init(rsi_91x_hal_module_init); · 440 unmodified lines | |||
| 441 | module_exit(rsi_91x_hal_module_exit); | 441 | module_exit(rsi_91x_hal_module_exit); |
| 442 | MODULE_AUTHOR("Redpine Signals Inc"); | 442 | MODULE_AUTHOR("Redpine Signals Inc"); |
| 443 | MODULE_DESCRIPTION("Station driver for RSI 91x devices"); | 443 | MODULE_DESCRIPTION("Station driver for RSI 91x devices"); |
| 444 | MODULE_SUPPORTED_DEVICE("RSI-91x"); | ||
| 445 | MODULE_VERSION("0.1"); | 444 | MODULE_VERSION("0.1"); |
| 446 | MODULE_LICENSE("Dual BSD/GPL"); | 445 | MODULE_LICENSE("Dual BSD/GPL"); |
| @@ -1571,7 +1571,6 @@ module_exit(rsi_module_exit); · 1570 unmodified lines | |||
| 1571 | 1571 | ||
| 1572 | MODULE_AUTHOR("Redpine Signals Inc"); | 1572 | MODULE_AUTHOR("Redpine Signals Inc"); |
| 1573 | MODULE_DESCRIPTION("Common SDIO layer for RSI drivers"); | 1573 | MODULE_DESCRIPTION("Common SDIO layer for RSI drivers"); |
| 1574 | MODULE_SUPPORTED_DEVICE("RSI-91x"); | ||
| 1575 | MODULE_DEVICE_TABLE(sdio, rsi_dev_table); | 1574 | MODULE_DEVICE_TABLE(sdio, rsi_dev_table); |
| 1576 | MODULE_FIRMWARE(FIRMWARE_RSI9113); | 1575 | MODULE_FIRMWARE(FIRMWARE_RSI9113); |
| 1577 | MODULE_VERSION("0.1"); | 1576 | MODULE_VERSION("0.1"); |
| @@ -928,7 +928,6 @@ module_usb_driver(rsi_driver); · 927 unmodified lines | |||
| 928 | 928 | ||
| 929 | MODULE_AUTHOR("Redpine Signals Inc"); | 929 | MODULE_AUTHOR("Redpine Signals Inc"); |
| 930 | MODULE_DESCRIPTION("Common USB layer for RSI drivers"); | 930 | MODULE_DESCRIPTION("Common USB layer for RSI drivers"); |
| 931 | MODULE_SUPPORTED_DEVICE("RSI-91x"); | ||
| 932 | MODULE_DEVICE_TABLE(usb, rsi_dev_table); | 931 | MODULE_DEVICE_TABLE(usb, rsi_dev_table); |
| 933 | MODULE_FIRMWARE(FIRMWARE_RSI9113); | 932 | MODULE_FIRMWARE(FIRMWARE_RSI9113); |
| 934 | MODULE_VERSION("0.1"); | 933 | MODULE_VERSION("0.1"); |
| @@ -1226,28 +1226,12 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status) · 1225 unmodified lines | |||
| 1226 | queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ); | 1226 | queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ); |
| 1227 | } | 1227 | } |
| 1228 | 1228 | ||
| 1229 | static int nvme_keep_alive(struct nvme_ctrl *ctrl) | ||
| 1230 | { | ||
| 1231 | struct request *rq; | ||
| 1232 | |||
| 1233 | rq = nvme_alloc_request(ctrl->admin_q, &ctrl->ka_cmd, | ||
| 1234 | BLK_MQ_REQ_RESERVED); | ||
| 1235 | if (IS_ERR(rq)) | ||
| 1236 | return PTR_ERR(rq); | ||
| 1237 | |||
| 1238 | rq->timeout = ctrl->kato * HZ; | ||
| 1239 | rq->end_io_data = ctrl; | ||
| 1240 | |||
| 1241 | blk_execute_rq_nowait(NULL, rq, 0, nvme_keep_alive_end_io); | ||
| 1242 | |||
| 1243 | return 0; | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | static void nvme_keep_alive_work(struct work_struct *work) | 1229 | static void nvme_keep_alive_work(struct work_struct *work) |
| 1247 | { | 1230 | { |
| 1248 | struct nvme_ctrl *ctrl = container_of(to_delayed_work(work), | 1231 | struct nvme_ctrl *ctrl = container_of(to_delayed_work(work), |
| 1249 | struct nvme_ctrl, ka_work); | 1232 | struct nvme_ctrl, ka_work); |
| 1250 | bool comp_seen = ctrl->comp_seen; | 1233 | bool comp_seen = ctrl->comp_seen; |
| 1234 | struct request *rq; | ||
| 1251 | 1235 | ||
| 1252 | if ((ctrl->ctratt & NVME_CTRL_ATTR_TBKAS) && comp_seen) { | 1236 | if ((ctrl->ctratt & NVME_CTRL_ATTR_TBKAS) && comp_seen) { |
| 1253 | dev_dbg(ctrl->device, | 1237 | dev_dbg(ctrl->device, |
| @@ -1257,12 +1241,18 @@ static void nvme_keep_alive_work(struct work_struct *work) · 3 unmodified lines | |||
| 1257 | return; | 1241 | return; |
| 1258 | } | 1242 | } |
| 1259 | 1243 | ||
| 1260 | if (nvme_keep_alive(ctrl)) { | 1244 | rq = nvme_alloc_request(ctrl->admin_q, &ctrl->ka_cmd, |
| 1245 | BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT); | ||
| 1246 | if (IS_ERR(rq)) { | ||
| 1261 | /* allocation failure, reset the controller */ | 1247 | /* allocation failure, reset the controller */ |
| 1262 | dev_err(ctrl->device, "keep-alive failed\n"); | 1248 | dev_err(ctrl->device, "keep-alive failed: %ld\n", PTR_ERR(rq)); |
| 1263 | nvme_reset_ctrl(ctrl); | 1249 | nvme_reset_ctrl(ctrl); |
| 1264 | return; | 1250 | return; |
| 1265 | } | 1251 | } |
| 1252 | |||
| 1253 | rq->timeout = ctrl->kato * HZ; | ||
| 1254 | rq->end_io_data = ctrl; | ||
| 1255 | blk_execute_rq_nowait(NULL, rq, 0, nvme_keep_alive_end_io); | ||
| 1266 | } | 1256 | } |
| 1267 | 1257 | ||
| 1268 | static void nvme_start_keep_alive(struct nvme_ctrl *ctrl) | 1258 | static void nvme_start_keep_alive(struct nvme_ctrl *ctrl) |
| @@ -1964,30 +1954,18 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns) · 695 unmodified lines | |||
| 1964 | blk_queue_max_write_zeroes_sectors(queue, UINT_MAX); | 1954 | blk_queue_max_write_zeroes_sectors(queue, UINT_MAX); |
| 1965 | } | 1955 | } |
| 1966 | 1956 | ||
| 1967 | static void nvme_config_write_zeroes(struct gendisk *disk, struct nvme_ns *ns) | 1957 | /* |
| 1958 | * Even though NVMe spec explicitly states that MDTS is not applicable to the | ||
| 1959 | * write-zeroes, we are cautious and limit the size to the controllers | ||
| 1960 | * max_hw_sectors value, which is based on the MDTS field and possibly other | ||
| 1961 | * limiting factors. | ||
| 1962 | */ | ||
| 1963 | static void nvme_config_write_zeroes(struct request_queue *q, | ||
| 1964 | struct nvme_ctrl *ctrl) | ||
| 1968 | { | 1965 | { |
| 1969 | u64 max_blocks; | 1966 | if ((ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES) && |
| 1970 | 1967 | !(ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES)) | |
| 1971 | if (!(ns->ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES) || | 1968 | blk_queue_max_write_zeroes_sectors(q, ctrl->max_hw_sectors); |
| 1972 | (ns->ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES)) | ||
| 1973 | return; | ||
| 1974 | /* | ||
| 1975 | * Even though NVMe spec explicitly states that MDTS is not | ||
| 1976 | * applicable to the write-zeroes:- "The restriction does not apply to | ||
| 1977 | * commands that do not transfer data between the host and the | ||
| 1978 | * controller (e.g., Write Uncorrectable ro Write Zeroes command).". | ||
| 1979 | * In order to be more cautious use controller's max_hw_sectors value | ||
| 1980 | * to configure the maximum sectors for the write-zeroes which is | ||
| 1981 | * configured based on the controller's MDTS field in the | ||
| 1982 | * nvme_init_identify() if available. | ||
| 1983 | */ | ||
| 1984 | if (ns->ctrl->max_hw_sectors == UINT_MAX) | ||
| 1985 | max_blocks = (u64)USHRT_MAX + 1; | ||
| 1986 | else | ||
| 1987 | max_blocks = ns->ctrl->max_hw_sectors + 1; | ||
| 1988 | |||
| 1989 | blk_queue_max_write_zeroes_sectors(disk->queue, | ||
| 1990 | nvme_lba_to_sect(ns, max_blocks)); | ||
| 1991 | } | 1969 | } |
| 1992 | 1970 | ||
| 1993 | static bool nvme_ns_ids_valid(struct nvme_ns_ids *ids) | 1971 | static bool nvme_ns_ids_valid(struct nvme_ns_ids *ids) |
| @@ -2159,7 +2137,7 @@ static void nvme_update_disk_info(struct gendisk *disk, · 165 unmodified lines | |||
| 2159 | set_capacity_and_notify(disk, capacity); | 2137 | set_capacity_and_notify(disk, capacity); |
| 2160 | 2138 | ||
| 2161 | nvme_config_discard(disk, ns); | 2139 | nvme_config_discard(disk, ns); |
| 2162 | nvme_config_write_zeroes(disk, ns); | 2140 | nvme_config_write_zeroes(disk->queue, ns->ctrl); |
| 2163 | 2141 | ||
| 2164 | set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) || | 2142 | set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) || |
| 2165 | test_bit(NVME_NS_FORCE_RO, &ns->flags)); | 2143 | test_bit(NVME_NS_FORCE_RO, &ns->flags)); |
| @@ -18,6 +18,13 @@ · 17 unmodified lines | |||
| 18 | /* default is -1: the fail fast mechanism is disabled */ | 18 | /* default is -1: the fail fast mechanism is disabled */ |
| 19 | #define NVMF_DEF_FAIL_FAST_TMO -1 | 19 | #define NVMF_DEF_FAIL_FAST_TMO -1 |
| 20 | 20 | ||
| 21 | /* | ||
| 22 | * Reserved one command for internal usage. This command is used for sending | ||
| 23 | * the connect command, as well as for the keep alive command on the admin | ||
| 24 | * queue once live. | ||
| 25 | */ | ||
| 26 | #define NVMF_RESERVED_TAGS 1 | ||
| 27 | |||
| 21 | /* | 28 | /* |
| 22 | * Define a host as seen by the target. We allocate one at boot, but also | 29 | * Define a host as seen by the target. We allocate one at boot, but also |
| 23 | * allow the override it when creating controllers. This is both to provide | 30 | * allow the override it when creating controllers. This is both to provide |
| @@ -2863,7 +2863,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) · 2862 unmodified lines | |||
| 2863 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); | 2863 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); |
| 2864 | ctrl->tag_set.ops = &nvme_fc_mq_ops; | 2864 | ctrl->tag_set.ops = &nvme_fc_mq_ops; |
| 2865 | ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; | 2865 | ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; |
| 2866 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ | 2866 | ctrl->tag_set.reserved_tags = NVMF_RESERVED_TAGS; |
| 2867 | ctrl->tag_set.numa_node = ctrl->ctrl.numa_node; | 2867 | ctrl->tag_set.numa_node = ctrl->ctrl.numa_node; |
| 2868 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 2868 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
| 2869 | ctrl->tag_set.cmd_size = | 2869 | ctrl->tag_set.cmd_size = |
| @@ -3485,7 +3485,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · 615 unmodified lines | |||
| 3485 | memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set)); | 3485 | memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set)); |
| 3486 | ctrl->admin_tag_set.ops = &nvme_fc_admin_mq_ops; | 3486 | ctrl->admin_tag_set.ops = &nvme_fc_admin_mq_ops; |
| 3487 | ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH; | 3487 | ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH; |
| 3488 | ctrl->admin_tag_set.reserved_tags = 2; /* fabric connect + Keep-Alive */ | 3488 | ctrl->admin_tag_set.reserved_tags = NVMF_RESERVED_TAGS; |
| 3489 | ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node; | 3489 | ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node; |
| 3490 | ctrl->admin_tag_set.cmd_size = | 3490 | ctrl->admin_tag_set.cmd_size = |
| 3491 | struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv, | 3491 | struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv, |
| @@ -736,8 +736,11 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl) · 735 unmodified lines | |||
| 736 | return ret; | 736 | return ret; |
| 737 | 737 | ||
| 738 | ctrl->ctrl.queue_count = nr_io_queues + 1; | 738 | ctrl->ctrl.queue_count = nr_io_queues + 1; |
| 739 | if (ctrl->ctrl.queue_count < 2) | 739 | if (ctrl->ctrl.queue_count < 2) { |
| 740 | return 0; | 740 | dev_err(ctrl->ctrl.device, |
| 741 | "unable to set any I/O queues\n"); | ||
| 742 | return -ENOMEM; | ||
| 743 | } | ||
| 741 | 744 | ||
| 742 | dev_info(ctrl->ctrl.device, | 745 | dev_info(ctrl->ctrl.device, |
| 743 | "creating %d I/O queues.\n", nr_io_queues); | 746 | "creating %d I/O queues.\n", nr_io_queues); |
| @@ -798,7 +801,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl, · 54 unmodified lines | |||
| 798 | memset(set, 0, sizeof(*set)); | 801 | memset(set, 0, sizeof(*set)); |
| 799 | set->ops = &nvme_rdma_admin_mq_ops; | 802 | set->ops = &nvme_rdma_admin_mq_ops; |
| 800 | set->queue_depth = NVME_AQ_MQ_TAG_DEPTH; | 803 | set->queue_depth = NVME_AQ_MQ_TAG_DEPTH; |
| 801 | set->reserved_tags = 2; /* connect + keep-alive */ | 804 | set->reserved_tags = NVMF_RESERVED_TAGS; |
| 802 | set->numa_node = nctrl->numa_node; | 805 | set->numa_node = nctrl->numa_node; |
| 803 | set->cmd_size = sizeof(struct nvme_rdma_request) + | 806 | set->cmd_size = sizeof(struct nvme_rdma_request) + |
| 804 | NVME_RDMA_DATA_SGL_SIZE; | 807 | NVME_RDMA_DATA_SGL_SIZE; |
| @@ -811,7 +814,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl, · 6 unmodified lines | |||
| 811 | memset(set, 0, sizeof(*set)); | 814 | memset(set, 0, sizeof(*set)); |
| 812 | set->ops = &nvme_rdma_mq_ops; | 815 | set->ops = &nvme_rdma_mq_ops; |
| 813 | set->queue_depth = nctrl->sqsize + 1; | 816 | set->queue_depth = nctrl->sqsize + 1; |
| 814 | set->reserved_tags = 1; /* fabric connect */ | 817 | set->reserved_tags = NVMF_RESERVED_TAGS; |
| 815 | set->numa_node = nctrl->numa_node; | 818 | set->numa_node = nctrl->numa_node; |
| 816 | set->flags = BLK_MQ_F_SHOULD_MERGE; | 819 | set->flags = BLK_MQ_F_SHOULD_MERGE; |
| 817 | set->cmd_size = sizeof(struct nvme_rdma_request) + | 820 | set->cmd_size = sizeof(struct nvme_rdma_request) + |
| @@ -287,7 +287,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, · 286 unmodified lines | |||
| 287 | * directly, otherwise queue io_work. Also, only do that if we | 287 | * directly, otherwise queue io_work. Also, only do that if we |
| 288 | * are on the same cpu, so we don't introduce contention. | 288 | * are on the same cpu, so we don't introduce contention. |
| 289 | */ | 289 | */ |
| 290 | if (queue->io_cpu == __smp_processor_id() && | 290 | if (queue->io_cpu == raw_smp_processor_id() && |
| 291 | sync && empty && mutex_trylock(&queue->send_mutex)) { | 291 | sync && empty && mutex_trylock(&queue->send_mutex)) { |
| 292 | queue->more_requests = !last; | 292 | queue->more_requests = !last; |
| 293 | nvme_tcp_send_all(queue); | 293 | nvme_tcp_send_all(queue); |
| @@ -568,6 +568,13 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, · 274 unmodified lines | |||
| 568 | req->pdu_len = le32_to_cpu(pdu->r2t_length); | 568 | req->pdu_len = le32_to_cpu(pdu->r2t_length); |
| 569 | req->pdu_sent = 0; | 569 | req->pdu_sent = 0; |
| 570 | 570 | ||
| 571 | if (unlikely(!req->pdu_len)) { | ||
| 572 | dev_err(queue->ctrl->ctrl.device, | ||
| 573 | "req %d r2t len is %u, probably a bug...\n", | ||
| 574 | rq->tag, req->pdu_len); | ||
| 575 | return -EPROTO; | ||
| 576 | } | ||
| 577 | |||
| 571 | if (unlikely(req->data_sent + req->pdu_len > req->data_len)) { | 578 | if (unlikely(req->data_sent + req->pdu_len > req->data_len)) { |
| 572 | dev_err(queue->ctrl->ctrl.device, | 579 | dev_err(queue->ctrl->ctrl.device, |
| 573 | "req %d r2t len %u exceeded data len %u (%zu sent)\n", | 580 | "req %d r2t len %u exceeded data len %u (%zu sent)\n", |
| @@ -1575,7 +1582,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl, · 1001 unmodified lines | |||
| 1575 | memset(set, 0, sizeof(*set)); | 1582 | memset(set, 0, sizeof(*set)); |
| 1576 | set->ops = &nvme_tcp_admin_mq_ops; | 1583 | set->ops = &nvme_tcp_admin_mq_ops; |
| 1577 | set->queue_depth = NVME_AQ_MQ_TAG_DEPTH; | 1584 | set->queue_depth = NVME_AQ_MQ_TAG_DEPTH; |
| 1578 | set->reserved_tags = 2; /* connect + keep-alive */ | 1585 | set->reserved_tags = NVMF_RESERVED_TAGS; |
| 1579 | set->numa_node = nctrl->numa_node; | 1586 | set->numa_node = nctrl->numa_node; |
| 1580 | set->flags = BLK_MQ_F_BLOCKING; | 1587 | set->flags = BLK_MQ_F_BLOCKING; |
| 1581 | set->cmd_size = sizeof(struct nvme_tcp_request); | 1588 | set->cmd_size = sizeof(struct nvme_tcp_request); |
| @@ -1587,7 +1594,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl, · 5 unmodified lines | |||
| 1587 | memset(set, 0, sizeof(*set)); | 1594 | memset(set, 0, sizeof(*set)); |
| 1588 | set->ops = &nvme_tcp_mq_ops; | 1595 | set->ops = &nvme_tcp_mq_ops; |
| 1589 | set->queue_depth = nctrl->sqsize + 1; | 1596 | set->queue_depth = nctrl->sqsize + 1; |
| 1590 | set->reserved_tags = 1; /* fabric connect */ | 1597 | set->reserved_tags = NVMF_RESERVED_TAGS; |
| 1591 | set->numa_node = nctrl->numa_node; | 1598 | set->numa_node = nctrl->numa_node; |
| 1592 | set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING; | 1599 | set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING; |
| 1593 | set->cmd_size = sizeof(struct nvme_tcp_request); | 1600 | set->cmd_size = sizeof(struct nvme_tcp_request); |
| @@ -1745,8 +1752,11 @@ static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) · 151 unmodified lines | |||
| 1745 | return ret; | 1752 | return ret; |
| 1746 | 1753 | ||
| 1747 | ctrl->queue_count = nr_io_queues + 1; | 1754 | ctrl->queue_count = nr_io_queues + 1; |
| 1748 | if (ctrl->queue_count < 2) | 1755 | if (ctrl->queue_count < 2) { |
| 1749 | return 0; | 1756 | dev_err(ctrl->device, |
| 1757 | "unable to set any I/O queues\n"); | ||
| 1758 | return -ENOMEM; | ||
| 1759 | } | ||
| 1750 | 1760 | ||
| 1751 | dev_info(ctrl->device, | 1761 | dev_info(ctrl->device, |
| 1752 | "creating %d I/O queues.\n", nr_io_queues); | 1762 | "creating %d I/O queues.\n", nr_io_queues); |
| @@ -1118,9 +1118,20 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl) · 1117 unmodified lines | |||
| 1118 | { | 1118 | { |
| 1119 | lockdep_assert_held(&ctrl->lock); | 1119 | lockdep_assert_held(&ctrl->lock); |
| 1120 | 1120 | ||
| 1121 | if (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES || | 1121 | /* |
| 1122 | nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES || | 1122 | * Only I/O controllers should verify iosqes,iocqes. |
| 1123 | nvmet_cc_mps(ctrl->cc) != 0 || | 1123 | * Strictly speaking, the spec says a discovery controller |
| 1124 | * should verify iosqes,iocqes are zeroed, however that | ||
| 1125 | * would break backwards compatibility, so don't enforce it. | ||
| 1126 | */ | ||
| 1127 | if (ctrl->subsys->type != NVME_NQN_DISC && | ||
| 1128 | (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES || | ||
| 1129 | nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) { | ||
| 1130 | ctrl->csts = NVME_CSTS_CFS; | ||
| 1131 | return; | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | if (nvmet_cc_mps(ctrl->cc) != 0 || | ||
| 1124 | nvmet_cc_ams(ctrl->cc) != 0 || | 1135 | nvmet_cc_ams(ctrl->cc) != 0 || |
| 1125 | nvmet_cc_css(ctrl->cc) != 0) { | 1136 | nvmet_cc_css(ctrl->cc) != 0) { |
| 1126 | ctrl->csts = NVME_CSTS_CFS; | 1137 | ctrl->csts = NVME_CSTS_CFS; |
| @@ -349,7 +349,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) · 348 unmodified lines | |||
| 349 | memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set)); | 349 | memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set)); |
| 350 | ctrl->admin_tag_set.ops = &nvme_loop_admin_mq_ops; | 350 | ctrl->admin_tag_set.ops = &nvme_loop_admin_mq_ops; |
| 351 | ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH; | 351 | ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH; |
| 352 | ctrl->admin_tag_set.reserved_tags = 2; /* connect + keep-alive */ | 352 | ctrl->admin_tag_set.reserved_tags = NVMF_RESERVED_TAGS; |
| 353 | ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node; | 353 | ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node; |
| 354 | ctrl->admin_tag_set.cmd_size = sizeof(struct nvme_loop_iod) + | 354 | ctrl->admin_tag_set.cmd_size = sizeof(struct nvme_loop_iod) + |
| 355 | NVME_INLINE_SG_CNT * sizeof(struct scatterlist); | 355 | NVME_INLINE_SG_CNT * sizeof(struct scatterlist); |
| @@ -520,7 +520,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) · 164 unmodified lines | |||
| 520 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); | 520 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); |
| 521 | ctrl->tag_set.ops = &nvme_loop_mq_ops; | 521 | ctrl->tag_set.ops = &nvme_loop_mq_ops; |
| 522 | ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; | 522 | ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; |
| 523 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ | 523 | ctrl->tag_set.reserved_tags = NVMF_RESERVED_TAGS; |
| 524 | ctrl->tag_set.numa_node = ctrl->ctrl.numa_node; | 524 | ctrl->tag_set.numa_node = ctrl->ctrl.numa_node; |
| 525 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 525 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
| 526 | ctrl->tag_set.cmd_size = sizeof(struct nvme_loop_iod) + | 526 | ctrl->tag_set.cmd_size = sizeof(struct nvme_loop_iod) + |
| @@ -1098,11 +1098,11 @@ static int nvmet_tcp_try_recv_data(struct nvmet_tcp_queue *queue) · 1097 unmodified lines | |||
| 1098 | cmd->rbytes_done += ret; | 1098 | cmd->rbytes_done += ret; |
| 1099 | } | 1099 | } |
| 1100 | 1100 | ||
| 1101 | nvmet_tcp_unmap_pdu_iovec(cmd); | ||
| 1101 | if (queue->data_digest) { | 1102 | if (queue->data_digest) { |
| 1102 | nvmet_tcp_prep_recv_ddgst(cmd); | 1103 | nvmet_tcp_prep_recv_ddgst(cmd); |
| 1103 | return 0; | 1104 | return 0; |
| 1104 | } | 1105 | } |
| 1105 | nvmet_tcp_unmap_pdu_iovec(cmd); | ||
| 1106 | 1106 | ||
| 1107 | if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED) && | 1107 | if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED) && |
| 1108 | cmd->rbytes_done == cmd->req.transfer_len) { | 1108 | cmd->rbytes_done == cmd->req.transfer_len) { |
| @@ -241,6 +241,5 @@ module_platform_driver_probe(amiga_parallel_driver, amiga_parallel_probe); · 240 unmodified lines | |||
| 241 | 241 | ||
| 242 | MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>"); | 242 | MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>"); |
| 243 | MODULE_DESCRIPTION("Parport Driver for Amiga builtin Port"); | 243 | MODULE_DESCRIPTION("Parport Driver for Amiga builtin Port"); |
| 244 | MODULE_SUPPORTED_DEVICE("Amiga builtin Parallel Port"); | ||
| 245 | MODULE_LICENSE("GPL"); | 244 | MODULE_LICENSE("GPL"); |
| 246 | MODULE_ALIAS("platform:amiga-parallel"); | 245 | MODULE_ALIAS("platform:amiga-parallel"); |
| @@ -218,7 +218,6 @@ static void __exit parport_atari_exit(void) · 217 unmodified lines | |||
| 218 | 218 | ||
| 219 | MODULE_AUTHOR("Andreas Schwab"); | 219 | MODULE_AUTHOR("Andreas Schwab"); |
| 220 | MODULE_DESCRIPTION("Parport Driver for Atari builtin Port"); | 220 | MODULE_DESCRIPTION("Parport Driver for Atari builtin Port"); |
| 221 | MODULE_SUPPORTED_DEVICE("Atari builtin Parallel Port"); | ||
| 222 | MODULE_LICENSE("GPL"); | 221 | MODULE_LICENSE("GPL"); |
| 223 | 222 | ||
| 224 | module_init(parport_atari_init) | 223 | module_init(parport_atari_init) |
| @@ -41,7 +41,6 @@ · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | MODULE_AUTHOR("Helge Deller <deller@gmx.de>"); | 42 | MODULE_AUTHOR("Helge Deller <deller@gmx.de>"); |
| 43 | MODULE_DESCRIPTION("HP-PARISC PC-style parallel port driver"); | 43 | MODULE_DESCRIPTION("HP-PARISC PC-style parallel port driver"); |
| 44 | MODULE_SUPPORTED_DEVICE("integrated PC-style parallel port"); | ||
| 45 | MODULE_LICENSE("GPL"); | 44 | MODULE_LICENSE("GPL"); |
| 46 | 45 | ||
| 47 | 46 | ||
| @@ -359,7 +359,6 @@ static void __exit parport_mfc3_exit(void) · 358 unmodified lines | |||
| 359 | 359 | ||
| 360 | MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>"); | 360 | MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>"); |
| 361 | MODULE_DESCRIPTION("Parport Driver for Multiface 3 expansion cards Parallel Port"); | 361 | MODULE_DESCRIPTION("Parport Driver for Multiface 3 expansion cards Parallel Port"); |
| 362 | MODULE_SUPPORTED_DEVICE("Multiface 3 Parallel Port"); | ||
| 363 | MODULE_LICENSE("GPL"); | 362 | MODULE_LICENSE("GPL"); |
| 364 | 363 | ||
| 365 | module_init(parport_mfc3_init) | 364 | module_init(parport_mfc3_init) |
| @@ -377,6 +377,5 @@ module_platform_driver(bpp_sbus_driver); · 376 unmodified lines | |||
| 377 | 377 | ||
| 378 | MODULE_AUTHOR("Derrick J Brashear"); | 378 | MODULE_AUTHOR("Derrick J Brashear"); |
| 379 | MODULE_DESCRIPTION("Parport Driver for Sparc bidirectional Port"); | 379 | MODULE_DESCRIPTION("Parport Driver for Sparc bidirectional Port"); |
| 380 | MODULE_SUPPORTED_DEVICE("Sparc Bidirectional Parallel Port"); | ||
| 381 | MODULE_VERSION("2.0"); | 380 | MODULE_VERSION("2.0"); |
| 382 | MODULE_LICENSE("GPL"); | 381 | MODULE_LICENSE("GPL"); |
| @@ -34,12 +34,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr, · 33 unmodified lines | |||
| 34 | if (nbytes >= MAX_DRC_NAME_LEN) | 34 | if (nbytes >= MAX_DRC_NAME_LEN) |
| 35 | return 0; | 35 | return 0; |
| 36 | 36 | ||
| 37 | memcpy(drc_name, buf, nbytes); | 37 | strscpy(drc_name, buf, nbytes + 1); |
| 38 | 38 | ||
| 39 | end = strchr(drc_name, '\n'); | 39 | end = strchr(drc_name, '\n'); |
| 40 | if (!end) | 40 | if (end) |
| 41 | end = &drc_name[nbytes]; | 41 | *end = '\0'; |
| 42 | *end = '\0'; | ||
| 43 | 42 | ||
| 44 | rc = dlpar_add_slot(drc_name); | 43 | rc = dlpar_add_slot(drc_name); |
| 45 | if (rc) | 44 | if (rc) |
| @@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj, · 19 unmodified lines | |||
| 65 | if (nbytes >= MAX_DRC_NAME_LEN) | 64 | if (nbytes >= MAX_DRC_NAME_LEN) |
| 66 | return 0; | 65 | return 0; |
| 67 | 66 | ||
| 68 | memcpy(drc_name, buf, nbytes); | 67 | strscpy(drc_name, buf, nbytes + 1); |
| 69 | 68 | ||
| 70 | end = strchr(drc_name, '\n'); | 69 | end = strchr(drc_name, '\n'); |
| 71 | if (!end) | 70 | if (end) |
| 72 | end = &drc_name[nbytes]; | 71 | *end = '\0'; |
| 73 | *end = '\0'; | ||
| 74 | 72 | ||
| 75 | rc = dlpar_remove_slot(drc_name); | 73 | rc = dlpar_remove_slot(drc_name); |
| 76 | if (rc) | 74 | if (rc) |
| @@ -93,8 +93,9 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) · 92 unmodified lines | |||
| 93 | pci_dev_put(pdev); | 93 | pci_dev_put(pdev); |
| 94 | return -EBUSY; | 94 | return -EBUSY; |
| 95 | } | 95 | } |
| 96 | pci_dev_put(pdev); | ||
| 96 | 97 | ||
| 97 | zpci_remove_device(zdev); | 98 | zpci_remove_device(zdev, false); |
| 98 | 99 | ||
| 99 | rc = zpci_disable_device(zdev); | 100 | rc = zpci_disable_device(zdev); |
| 100 | if (rc) | 101 | if (rc) |
| @@ -1173,15 +1173,20 @@ config INTEL_PMC_CORE · 1172 unmodified lines | |||
| 1173 | depends on PCI | 1173 | depends on PCI |
| 1174 | help | 1174 | help |
| 1175 | The Intel Platform Controller Hub for Intel Core SoCs provides access | 1175 | The Intel Platform Controller Hub for Intel Core SoCs provides access |
| 1176 | to Power Management Controller registers via a PCI interface. This | 1176 | to Power Management Controller registers via various interfaces. This |
| 1177 | driver can utilize debugging capabilities and supported features as | 1177 | driver can utilize debugging capabilities and supported features as |
| 1178 | exposed by the Power Management Controller. | 1178 | exposed by the Power Management Controller. It also may perform some |
| 1179 | tasks in the PMC in order to enable transition into the SLPS0 state. | ||
| 1180 | It should be selected on all Intel platforms supported by the driver. | ||
| 1179 | 1181 | ||
| 1180 | Supported features: | 1182 | Supported features: |
| 1181 | - SLP_S0_RESIDENCY counter | 1183 | - SLP_S0_RESIDENCY counter |
| 1182 | - PCH IP Power Gating status | 1184 | - PCH IP Power Gating status |
| 1183 | - LTR Ignore | 1185 | - LTR Ignore / LTR Show |
| 1184 | - MPHY/PLL gating status (Sunrisepoint PCH only) | 1186 | - MPHY/PLL gating status (Sunrisepoint PCH only) |
| 1187 | - SLPS0 Debug registers (Cannonlake/Icelake PCH) | ||
| 1188 | - Low Power Mode registers (Tigerlake and beyond) | ||
| 1189 | - PMC quirks as needed to enable SLPS0/S0ix | ||
| 1185 | 1190 | ||
| 1186 | config INTEL_PMT_CLASS | 1191 | config INTEL_PMT_CLASS |
| 1187 | tristate | 1192 | tristate |
| @@ -185,5 +185,8 @@ void exit_enum_attributes(void) · 184 unmodified lines | |||
| 185 | sysfs_remove_group(wmi_priv.enumeration_data[instance_id].attr_name_kobj, | 185 | sysfs_remove_group(wmi_priv.enumeration_data[instance_id].attr_name_kobj, |
| 186 | &enumeration_attr_group); | 186 | &enumeration_attr_group); |
| 187 | } | 187 | } |
| 188 | wmi_priv.enumeration_instances_count = 0; | ||
| 189 | |||
| 188 | kfree(wmi_priv.enumeration_data); | 190 | kfree(wmi_priv.enumeration_data); |
| 191 | wmi_priv.enumeration_data = NULL; | ||
| 189 | } | 192 | } |
| @@ -175,5 +175,8 @@ void exit_int_attributes(void) · 174 unmodified lines | |||
| 175 | sysfs_remove_group(wmi_priv.integer_data[instance_id].attr_name_kobj, | 175 | sysfs_remove_group(wmi_priv.integer_data[instance_id].attr_name_kobj, |
| 176 | &integer_attr_group); | 176 | &integer_attr_group); |
| 177 | } | 177 | } |
| 178 | wmi_priv.integer_instances_count = 0; | ||
| 179 | |||
| 178 | kfree(wmi_priv.integer_data); | 180 | kfree(wmi_priv.integer_data); |
| 181 | wmi_priv.integer_data = NULL; | ||
| 179 | } | 182 | } |
| @@ -183,5 +183,8 @@ void exit_po_attributes(void) · 182 unmodified lines | |||
| 183 | sysfs_remove_group(wmi_priv.po_data[instance_id].attr_name_kobj, | 183 | sysfs_remove_group(wmi_priv.po_data[instance_id].attr_name_kobj, |
| 184 | &po_attr_group); | 184 | &po_attr_group); |
| 185 | } | 185 | } |
| 186 | wmi_priv.po_instances_count = 0; | ||
| 187 | |||
| 186 | kfree(wmi_priv.po_data); | 188 | kfree(wmi_priv.po_data); |
| 189 | wmi_priv.po_data = NULL; | ||
| 187 | } | 190 | } |
| @@ -155,5 +155,8 @@ void exit_str_attributes(void) · 154 unmodified lines | |||
| 155 | sysfs_remove_group(wmi_priv.str_data[instance_id].attr_name_kobj, | 155 | sysfs_remove_group(wmi_priv.str_data[instance_id].attr_name_kobj, |
| 156 | &str_attr_group); | 156 | &str_attr_group); |
| 157 | } | 157 | } |
| 158 | wmi_priv.str_instances_count = 0; | ||
| 159 | |||
| 158 | kfree(wmi_priv.str_data); | 160 | kfree(wmi_priv.str_data); |
| 161 | wmi_priv.str_data = NULL; | ||
| 159 | } | 162 | } |
| @@ -210,25 +210,17 @@ static struct kobj_attribute pending_reboot = __ATTR_RO(pending_reboot); · 209 unmodified lines | |||
| 210 | */ | 210 | */ |
| 211 | static int create_attributes_level_sysfs_files(void) | 211 | static int create_attributes_level_sysfs_files(void) |
| 212 | { | 212 | { |
| 213 | int ret = sysfs_create_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr); | 213 | int ret; |
| 214 | 214 | ||
| 215 | if (ret) { | 215 | ret = sysfs_create_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr); |
| 216 | pr_debug("could not create reset_bios file\n"); | 216 | if (ret) |
| 217 | return ret; | 217 | return ret; |
| 218 | } | ||
| 219 | 218 | ||
| 220 | ret = sysfs_create_file(&wmi_priv.main_dir_kset->kobj, &pending_reboot.attr); | 219 | ret = sysfs_create_file(&wmi_priv.main_dir_kset->kobj, &pending_reboot.attr); |
| 221 | if (ret) { | 220 | if (ret) |
| 222 | pr_debug("could not create changing_pending_reboot file\n"); | 221 | return ret; |
| 223 | sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr); | ||
| 224 | } | ||
| 225 | return ret; | ||
| 226 | } | ||
| 227 | 222 | ||
| 228 | static void release_reset_bios_data(void) | 223 | return 0; |
| 229 | { | ||
| 230 | sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr); | ||
| 231 | sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &pending_reboot.attr); | ||
| 232 | } | 224 | } |
| 233 | 225 | ||
| 234 | static ssize_t wmi_sysman_attr_show(struct kobject *kobj, struct attribute *attr, | 226 | static ssize_t wmi_sysman_attr_show(struct kobject *kobj, struct attribute *attr, |
| @@ -373,8 +365,6 @@ static void destroy_attribute_objs(struct kset *kset) · 138 unmodified lines | |||
| 373 | */ | 365 | */ |
| 374 | static void release_attributes_data(void) | 366 | static void release_attributes_data(void) |
| 375 | { | 367 | { |
| 376 | release_reset_bios_data(); | ||
| 377 | |||
| 378 | mutex_lock(&wmi_priv.mutex); | 368 | mutex_lock(&wmi_priv.mutex); |
| 379 | exit_enum_attributes(); | 369 | exit_enum_attributes(); |
| 380 | exit_int_attributes(); | 370 | exit_int_attributes(); |
| @@ -386,11 +376,13 @@ static void release_attributes_data(void) · 5 unmodified lines | |||
| 386 | wmi_priv.authentication_dir_kset = NULL; | 376 | wmi_priv.authentication_dir_kset = NULL; |
| 387 | } | 377 | } |
| 388 | if (wmi_priv.main_dir_kset) { | 378 | if (wmi_priv.main_dir_kset) { |
| 379 | sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr); | ||
| 380 | sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &pending_reboot.attr); | ||
| 389 | destroy_attribute_objs(wmi_priv.main_dir_kset); | 381 | destroy_attribute_objs(wmi_priv.main_dir_kset); |
| 390 | kset_unregister(wmi_priv.main_dir_kset); | 382 | kset_unregister(wmi_priv.main_dir_kset); |
| 383 | wmi_priv.main_dir_kset = NULL; | ||
| 391 | } | 384 | } |
| 392 | mutex_unlock(&wmi_priv.mutex); | 385 | mutex_unlock(&wmi_priv.mutex); |
| 393 | |||
| 394 | } | 386 | } |
| 395 | 387 | ||
| 396 | /** | 388 | /** |
| @@ -497,7 +489,6 @@ nextobj: · 100 unmodified lines | |||
| 497 | 489 | ||
| 498 | err_attr_init: | 490 | err_attr_init: |
| 499 | mutex_unlock(&wmi_priv.mutex); | 491 | mutex_unlock(&wmi_priv.mutex); |
| 500 | release_attributes_data(); | ||
| 501 | kfree(obj); | 492 | kfree(obj); |
| 502 | return retval; | 493 | return retval; |
| 503 | } | 494 | } |
| @@ -513,102 +504,91 @@ static int __init sysman_init(void) · 9 unmodified lines | |||
| 513 | } | 504 | } |
| 514 | 505 | ||
| 515 | ret = init_bios_attr_set_interface(); | 506 | ret = init_bios_attr_set_interface(); |
| 516 | if (ret || !wmi_priv.bios_attr_wdev) { | 507 | if (ret) |
| 517 | pr_debug("failed to initialize set interface\n"); | 508 | return ret; |
| 518 | goto fail_set_interface; | ||
| 519 | } | ||
| 520 | 509 | ||
| 521 | ret = init_bios_attr_pass_interface(); | 510 | ret = init_bios_attr_pass_interface(); |
| 522 | if (ret || !wmi_priv.password_attr_wdev) { | 511 | if (ret) |
| 523 | pr_debug("failed to initialize pass interface\n"); | 512 | goto err_exit_bios_attr_set_interface; |
| 524 | goto fail_pass_interface; | 513 | |
| 514 | if (!wmi_priv.bios_attr_wdev || !wmi_priv.password_attr_wdev) { | ||
| 515 | pr_debug("failed to find set or pass interface\n"); | ||
| 516 | ret = -ENODEV; | ||
| 517 | goto err_exit_bios_attr_pass_interface; | ||
| 525 | } | 518 | } |
| 526 | 519 | ||
| 527 | ret = class_register(&firmware_attributes_class); | 520 | ret = class_register(&firmware_attributes_class); |
| 528 | if (ret) | 521 | if (ret) |
| 529 | goto fail_class; | 522 | goto err_exit_bios_attr_pass_interface; |
| 530 | 523 | ||
| 531 | wmi_priv.class_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0), | 524 | wmi_priv.class_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0), |
| 532 | NULL, "%s", DRIVER_NAME); | 525 | NULL, "%s", DRIVER_NAME); |
| 533 | if (IS_ERR(wmi_priv.class_dev)) { | 526 | if (IS_ERR(wmi_priv.class_dev)) { |
| 534 | ret = PTR_ERR(wmi_priv.class_dev); | 527 | ret = PTR_ERR(wmi_priv.class_dev); |
| 535 | goto fail_classdev; | 528 | goto err_unregister_class; |
| 536 | } | 529 | } |
| 537 | 530 | ||
| 538 | wmi_priv.main_dir_kset = kset_create_and_add("attributes", NULL, | 531 | wmi_priv.main_dir_kset = kset_create_and_add("attributes", NULL, |
| 539 | &wmi_priv.class_dev->kobj); | 532 | &wmi_priv.class_dev->kobj); |
| 540 | if (!wmi_priv.main_dir_kset) { | 533 | if (!wmi_priv.main_dir_kset) { |
| 541 | ret = -ENOMEM; | 534 | ret = -ENOMEM; |
| 542 | goto fail_main_kset; | 535 | goto err_destroy_classdev; |
| 543 | } | 536 | } |
| 544 | 537 | ||
| 545 | wmi_priv.authentication_dir_kset = kset_create_and_add("authentication", NULL, | 538 | wmi_priv.authentication_dir_kset = kset_create_and_add("authentication", NULL, |
| 546 | &wmi_priv.class_dev->kobj); | 539 | &wmi_priv.class_dev->kobj); |
| 547 | if (!wmi_priv.authentication_dir_kset) { | 540 | if (!wmi_priv.authentication_dir_kset) { |
| 548 | ret = -ENOMEM; | 541 | ret = -ENOMEM; |
| 549 | goto fail_authentication_kset; | 542 | goto err_release_attributes_data; |
| 550 | } | 543 | } |
| 551 | 544 | ||
| 552 | ret = create_attributes_level_sysfs_files(); | 545 | ret = create_attributes_level_sysfs_files(); |
| 553 | if (ret) { | 546 | if (ret) { |
| 554 | pr_debug("could not create reset BIOS attribute\n"); | 547 | pr_debug("could not create reset BIOS attribute\n"); |
| 555 | goto fail_reset_bios; | 548 | goto err_release_attributes_data; |
| 556 | } | 549 | } |
| 557 | 550 | ||
| 558 | ret = init_bios_attributes(ENUM, DELL_WMI_BIOS_ENUMERATION_ATTRIBUTE_GUID); | 551 | ret = init_bios_attributes(ENUM, DELL_WMI_BIOS_ENUMERATION_ATTRIBUTE_GUID); |
| 559 | if (ret) { | 552 | if (ret) { |
| 560 | pr_debug("failed to populate enumeration type attributes\n"); | 553 | pr_debug("failed to populate enumeration type attributes\n"); |
| 561 | goto fail_create_group; | 554 | goto err_release_attributes_data; |
| 562 | } | 555 | } |
| 563 | 556 | ||
| 564 | ret = init_bios_attributes(INT, DELL_WMI_BIOS_INTEGER_ATTRIBUTE_GUID); | 557 | ret = init_bios_attributes(INT, DELL_WMI_BIOS_INTEGER_ATTRIBUTE_GUID); |
| 565 | if (ret) { | 558 | if (ret) { |
| 566 | pr_debug("failed to populate integer type attributes\n"); | 559 | pr_debug("failed to populate integer type attributes\n"); |
| 567 | goto fail_create_group; | 560 | goto err_release_attributes_data; |
| 568 | } | 561 | } |
| 569 | 562 | ||
| 570 | ret = init_bios_attributes(STR, DELL_WMI_BIOS_STRING_ATTRIBUTE_GUID); | 563 | ret = init_bios_attributes(STR, DELL_WMI_BIOS_STRING_ATTRIBUTE_GUID); |
| 571 | if (ret) { | 564 | if (ret) { |
| 572 | pr_debug("failed to populate string type attributes\n"); | 565 | pr_debug("failed to populate string type attributes\n"); |
| 573 | goto fail_create_group; | 566 | goto err_release_attributes_data; |
| 574 | } | 567 | } |
| 575 | 568 | ||
| 576 | ret = init_bios_attributes(PO, DELL_WMI_BIOS_PASSOBJ_ATTRIBUTE_GUID); | 569 | ret = init_bios_attributes(PO, DELL_WMI_BIOS_PASSOBJ_ATTRIBUTE_GUID); |
| 577 | if (ret) { | 570 | if (ret) { |
| 578 | pr_debug("failed to populate pass object type attributes\n"); | 571 | pr_debug("failed to populate pass object type attributes\n"); |
| 579 | goto fail_create_group; | 572 | goto err_release_attributes_data; |
| 580 | } | 573 | } |
| 581 | 574 | ||
| 582 | return 0; | 575 | return 0; |
| 583 | 576 | ||
| 584 | fail_create_group: | 577 | err_release_attributes_data: |
| 585 | release_attributes_data(); | 578 | release_attributes_data(); |
| 586 | 579 | ||
| 587 | fail_reset_bios: | 580 | err_destroy_classdev: |
| 588 | if (wmi_priv.authentication_dir_kset) { | ||
| 589 | kset_unregister(wmi_priv.authentication_dir_kset); | ||
| 590 | wmi_priv.authentication_dir_kset = NULL; | ||
| 591 | } | ||
| 592 | |||
| 593 | fail_authentication_kset: | ||
| 594 | if (wmi_priv.main_dir_kset) { | ||
| 595 | kset_unregister(wmi_priv.main_dir_kset); | ||
| 596 | wmi_priv.main_dir_kset = NULL; | ||
| 597 | } | ||
| 598 | |||
| 599 | fail_main_kset: | ||
| 600 | device_destroy(&firmware_attributes_class, MKDEV(0, 0)); | 581 | device_destroy(&firmware_attributes_class, MKDEV(0, 0)); |
| 601 | 582 | ||
| 602 | fail_classdev: | 583 | err_unregister_class: |
| 603 | class_unregister(&firmware_attributes_class); | 584 | class_unregister(&firmware_attributes_class); |
| 604 | 585 | ||
| 605 | fail_class: | 586 | err_exit_bios_attr_pass_interface: |
| 606 | exit_bios_attr_pass_interface(); | 587 | exit_bios_attr_pass_interface(); |
| 607 | 588 | ||
| 608 | fail_pass_interface: | 589 | err_exit_bios_attr_set_interface: |
| 609 | exit_bios_attr_set_interface(); | 590 | exit_bios_attr_set_interface(); |
| 610 | 591 | ||
| 611 | fail_set_interface: | ||
| 612 | return ret; | 592 | return ret; |
| 613 | } | 593 | } |
| 614 | 594 | ||
| @@ -90,6 +90,13 @@ static const struct dmi_system_id button_array_table[] = { · 89 unmodified lines | |||
| 90 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"), | 90 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"), |
| 91 | }, | 91 | }, |
| 92 | }, | 92 | }, |
| 93 | { | ||
| 94 | .ident = "Lenovo ThinkPad X1 Tablet Gen 2", | ||
| 95 | .matches = { | ||
| 96 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
| 97 | DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Tablet Gen 2"), | ||
| 98 | }, | ||
| 99 | }, | ||
| 93 | { } | 100 | { } |
| 94 | }; | 101 | }; |
| 95 | 102 | ||
| @@ -48,8 +48,16 @@ static const struct key_entry intel_vbtn_keymap[] = { · 47 unmodified lines | |||
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | static const struct key_entry intel_vbtn_switchmap[] = { | 50 | static const struct key_entry intel_vbtn_switchmap[] = { |
| 51 | { KE_SW, 0xCA, { .sw = { SW_DOCK, 1 } } }, /* Docked */ | 51 | /* |
| 52 | { KE_SW, 0xCB, { .sw = { SW_DOCK, 0 } } }, /* Undocked */ | 52 | * SW_DOCK should only be reported for docking stations, but DSDTs using the |
| 53 | * intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set | ||
| 54 | * SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0). | ||
| 55 | * This causes userspace to think the laptop is docked to a port-replicator | ||
| 56 | * and to disable suspend-on-lid-close, which is undesirable. | ||
| 57 | * Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting. | ||
| 58 | */ | ||
| 59 | { KE_IGNORE, 0xCA, { .sw = { SW_DOCK, 1 } } }, /* Docked */ | ||
| 60 | { KE_IGNORE, 0xCB, { .sw = { SW_DOCK, 0 } } }, /* Undocked */ | ||
| 53 | { KE_SW, 0xCC, { .sw = { SW_TABLET_MODE, 1 } } }, /* Tablet */ | 61 | { KE_SW, 0xCC, { .sw = { SW_TABLET_MODE, 1 } } }, /* Tablet */ |
| 54 | { KE_SW, 0xCD, { .sw = { SW_TABLET_MODE, 0 } } }, /* Laptop */ | 62 | { KE_SW, 0xCD, { .sw = { SW_TABLET_MODE, 0 } } }, /* Laptop */ |
| 55 | { KE_END } | 63 | { KE_END } |
| @@ -863,34 +863,45 @@ out_unlock: · 862 unmodified lines | |||
| 863 | } | 863 | } |
| 864 | DEFINE_SHOW_ATTRIBUTE(pmc_core_pll); | 864 | DEFINE_SHOW_ATTRIBUTE(pmc_core_pll); |
| 865 | 865 | ||
| 866 | static ssize_t pmc_core_ltr_ignore_write(struct file *file, | 866 | static int pmc_core_send_ltr_ignore(u32 value) |
| 867 | const char __user *userbuf, | ||
| 868 | size_t count, loff_t *ppos) | ||
| 869 | { | 867 | { |
| 870 | struct pmc_dev *pmcdev = &pmc; | 868 | struct pmc_dev *pmcdev = &pmc; |
| 871 | const struct pmc_reg_map *map = pmcdev->map; | 869 | const struct pmc_reg_map *map = pmcdev->map; |
| 872 | u32 val, buf_size, fd; | 870 | u32 reg; |
| 873 | int err; | 871 | int err = 0; |
| 874 | |||
| 875 | buf_size = count < 64 ? count : 64; | ||
| 876 | |||
| 877 | err = kstrtou32_from_user(userbuf, buf_size, 10, &val); | ||
| 878 | if (err) | ||
| 879 | return err; | ||
| 880 | 872 | ||
| 881 | mutex_lock(&pmcdev->lock); | 873 | mutex_lock(&pmcdev->lock); |
| 882 | 874 | ||
| 883 | if (val > map->ltr_ignore_max) { | 875 | if (value > map->ltr_ignore_max) { |
| 884 | err = -EINVAL; | 876 | err = -EINVAL; |
| 885 | goto out_unlock; | 877 | goto out_unlock; |
| 886 | } | 878 | } |
| 887 | 879 | ||
| 888 | fd = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset); | 880 | reg = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset); |
| 889 | fd |= (1U << val); | 881 | reg |= BIT(value); |
| 890 | pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, fd); | 882 | pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, reg); |
| 891 | 883 | ||
| 892 | out_unlock: | 884 | out_unlock: |
| 893 | mutex_unlock(&pmcdev->lock); | 885 | mutex_unlock(&pmcdev->lock); |
| 886 | |||
| 887 | return err; | ||
| 888 | } | ||
| 889 | |||
| 890 | static ssize_t pmc_core_ltr_ignore_write(struct file *file, | ||
| 891 | const char __user *userbuf, | ||
| 892 | size_t count, loff_t *ppos) | ||
| 893 | { | ||
| 894 | u32 buf_size, value; | ||
| 895 | int err; | ||
| 896 | |||
| 897 | buf_size = min_t(u32, count, 64); | ||
| 898 | |||
| 899 | err = kstrtou32_from_user(userbuf, buf_size, 10, &value); | ||
| 900 | if (err) | ||
| 901 | return err; | ||
| 902 | |||
| 903 | err = pmc_core_send_ltr_ignore(value); | ||
| 904 | |||
| 894 | return err == 0 ? count : err; | 905 | return err == 0 ? count : err; |
| 895 | } | 906 | } |
| 896 | 907 | ||
| @@ -1244,6 +1255,15 @@ static int pmc_core_probe(struct platform_device *pdev) · 347 unmodified lines | |||
| 1244 | pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); | 1255 | pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); |
| 1245 | dmi_check_system(pmc_core_dmi_table); | 1256 | dmi_check_system(pmc_core_dmi_table); |
| 1246 | 1257 | ||
| 1258 | /* | ||
| 1259 | * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when | ||
| 1260 | * a cable is attached. Tell the PMC to ignore it. | ||
| 1261 | */ | ||
| 1262 | if (pmcdev->map == &tgl_reg_map) { | ||
| 1263 | dev_dbg(&pdev->dev, "ignoring GBE LTR\n"); | ||
| 1264 | pmc_core_send_ltr_ignore(3); | ||
| 1265 | } | ||
| 1266 | |||
| 1247 | pmc_core_dbgfs_register(pmcdev); | 1267 | pmc_core_dbgfs_register(pmcdev); |
| 1248 | 1268 | ||
| 1249 | device_initialized = true; | 1269 | device_initialized = true; |
| @@ -173,7 +173,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, · 172 unmodified lines | |||
| 173 | struct intel_pmt_namespace *ns, | 173 | struct intel_pmt_namespace *ns, |
| 174 | struct device *parent) | 174 | struct device *parent) |
| 175 | { | 175 | { |
| 176 | struct resource res; | 176 | struct resource res = {0}; |
| 177 | struct device *dev; | 177 | struct device *dev; |
| 178 | int ret; | 178 | int ret; |
| 179 | 179 | ||
| @@ -23,18 +23,17 @@ · 22 unmodified lines | |||
| 23 | #define CRASH_TYPE_OOBMSM 1 | 23 | #define CRASH_TYPE_OOBMSM 1 |
| 24 | 24 | ||
| 25 | /* Control Flags */ | 25 | /* Control Flags */ |
| 26 | #define CRASHLOG_FLAG_DISABLE BIT(27) | 26 | #define CRASHLOG_FLAG_DISABLE BIT(28) |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| 29 | * Bits 28 and 29 control the state of bit 31. | 29 | * Bits 29 and 30 control the state of bit 31. |
| 30 | * | 30 | * |
| 31 | * Bit 28 will clear bit 31, if set, allowing a new crashlog to be captured. | 31 | * Bit 29 will clear bit 31, if set, allowing a new crashlog to be captured. |
| 32 | * Bit 29 will immediately trigger a crashlog to be generated, setting bit 31. | 32 | * Bit 30 will immediately trigger a crashlog to be generated, setting bit 31. |
| 33 | * Bit 30 is read-only and reserved as 0. | ||
| 34 | * Bit 31 is the read-only status with a 1 indicating log is complete. | 33 | * Bit 31 is the read-only status with a 1 indicating log is complete. |
| 35 | */ | 34 | */ |
| 36 | #define CRASHLOG_FLAG_TRIGGER_CLEAR BIT(28) | 35 | #define CRASHLOG_FLAG_TRIGGER_CLEAR BIT(29) |
| 37 | #define CRASHLOG_FLAG_TRIGGER_EXECUTE BIT(29) | 36 | #define CRASHLOG_FLAG_TRIGGER_EXECUTE BIT(30) |
| 38 | #define CRASHLOG_FLAG_TRIGGER_COMPLETE BIT(31) | 37 | #define CRASHLOG_FLAG_TRIGGER_COMPLETE BIT(31) |
| 39 | #define CRASHLOG_FLAG_TRIGGER_MASK GENMASK(31, 28) | 38 | #define CRASHLOG_FLAG_TRIGGER_MASK GENMASK(31, 28) |
| 40 | 39 | ||
| @@ -4081,13 +4081,19 @@ static bool hotkey_notify_6xxx(const u32 hkey, · 4080 unmodified lines | |||
| 4081 | 4081 | ||
| 4082 | case TP_HKEY_EV_KEY_NUMLOCK: | 4082 | case TP_HKEY_EV_KEY_NUMLOCK: |
| 4083 | case TP_HKEY_EV_KEY_FN: | 4083 | case TP_HKEY_EV_KEY_FN: |
| 4084 | case TP_HKEY_EV_KEY_FN_ESC: | ||
| 4085 | /* key press events, we just ignore them as long as the EC | 4084 | /* key press events, we just ignore them as long as the EC |
| 4086 | * is still reporting them in the normal keyboard stream */ | 4085 | * is still reporting them in the normal keyboard stream */ |
| 4087 | *send_acpi_ev = false; | 4086 | *send_acpi_ev = false; |
| 4088 | *ignore_acpi_ev = true; | 4087 | *ignore_acpi_ev = true; |
| 4089 | return true; | 4088 | return true; |
| 4090 | 4089 | ||
| 4090 | case TP_HKEY_EV_KEY_FN_ESC: | ||
| 4091 | /* Get the media key status to foce the status LED to update */ | ||
| 4092 | acpi_evalf(hkey_handle, NULL, "GMKS", "v"); | ||
| 4093 | *send_acpi_ev = false; | ||
| 4094 | *ignore_acpi_ev = true; | ||
| 4095 | return true; | ||
| 4096 | |||
| 4091 | case TP_HKEY_EV_TABLET_CHANGED: | 4097 | case TP_HKEY_EV_TABLET_CHANGED: |
| 4092 | tpacpi_input_send_tabletsw(); | 4098 | tpacpi_input_send_tabletsw(); |
| 4093 | hotkey_tablet_mode_notify_change(); | 4099 | hotkey_tablet_mode_notify_change(); |
| @@ -9845,6 +9851,11 @@ static struct ibm_struct lcdshadow_driver_data = { · 5751 unmodified lines | |||
| 9845 | * Thinkpad sensor interfaces | 9851 | * Thinkpad sensor interfaces |
| 9846 | */ | 9852 | */ |
| 9847 | 9853 | ||
| 9854 | #define DYTC_CMD_QUERY 0 /* To get DYTC status - enable/revision */ | ||
| 9855 | #define DYTC_QUERY_ENABLE_BIT 8 /* Bit 8 - 0 = disabled, 1 = enabled */ | ||
| 9856 | #define DYTC_QUERY_SUBREV_BIT 16 /* Bits 16 - 27 - sub revision */ | ||
| 9857 | #define DYTC_QUERY_REV_BIT 28 /* Bits 28 - 31 - revision */ | ||
| 9858 | |||
| 9848 | #define DYTC_CMD_GET 2 /* To get current IC function and mode */ | 9859 | #define DYTC_CMD_GET 2 /* To get current IC function and mode */ |
| 9849 | #define DYTC_GET_LAPMODE_BIT 17 /* Set when in lapmode */ | 9860 | #define DYTC_GET_LAPMODE_BIT 17 /* Set when in lapmode */ |
| 9850 | 9861 | ||
| @@ -9855,6 +9866,7 @@ static bool has_palmsensor; · 4 unmodified lines | |||
| 9855 | static bool has_lapsensor; | 9866 | static bool has_lapsensor; |
| 9856 | static bool palm_state; | 9867 | static bool palm_state; |
| 9857 | static bool lap_state; | 9868 | static bool lap_state; |
| 9869 | static int dytc_version; | ||
| 9858 | 9870 | ||
| 9859 | static int dytc_command(int command, int *output) | 9871 | static int dytc_command(int command, int *output) |
| 9860 | { | 9872 | { |
| @@ -9869,6 +9881,33 @@ static int dytc_command(int command, int *output) · 8 unmodified lines | |||
| 9869 | return 0; | 9881 | return 0; |
| 9870 | } | 9882 | } |
| 9871 | 9883 | ||
| 9884 | static int dytc_get_version(void) | ||
| 9885 | { | ||
| 9886 | int err, output; | ||
| 9887 | |||
| 9888 | /* Check if we've been called before - and just return cached value */ | ||
| 9889 | if (dytc_version) | ||
| 9890 | return dytc_version; | ||
| 9891 | |||
| 9892 | /* Otherwise query DYTC and extract version information */ | ||
| 9893 | err = dytc_command(DYTC_CMD_QUERY, &output); | ||
| 9894 | /* | ||
| 9895 | * If support isn't available (ENODEV) then don't return an error | ||
| 9896 | * and don't create the sysfs group | ||
| 9897 | */ | ||
| 9898 | if (err == -ENODEV) | ||
| 9899 | return 0; | ||
| 9900 | /* For all other errors we can flag the failure */ | ||
| 9901 | if (err) | ||
| 9902 | return err; | ||
| 9903 | |||
| 9904 | /* Check DYTC is enabled and supports mode setting */ | ||
| 9905 | if (output & BIT(DYTC_QUERY_ENABLE_BIT)) | ||
| 9906 | dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF; | ||
| 9907 | |||
| 9908 | return 0; | ||
| 9909 | } | ||
| 9910 | |||
| 9872 | static int lapsensor_get(bool *present, bool *state) | 9911 | static int lapsensor_get(bool *present, bool *state) |
| 9873 | { | 9912 | { |
| 9874 | int output, err; | 9913 | int output, err; |
| @@ -9974,7 +10013,18 @@ static int tpacpi_proxsensor_init(struct ibm_init_struct *iibm) · 99 unmodified lines | |||
| 9974 | if (err) | 10013 | if (err) |
| 9975 | return err; | 10014 | return err; |
| 9976 | } | 10015 | } |
| 9977 | if (has_lapsensor) { | 10016 | |
| 10017 | /* Check if we know the DYTC version, if we don't then get it */ | ||
| 10018 | if (!dytc_version) { | ||
| 10019 | err = dytc_get_version(); | ||
| 10020 | if (err) | ||
| 10021 | return err; | ||
| 10022 | } | ||
| 10023 | /* | ||
| 10024 | * Platforms before DYTC version 5 claim to have a lap sensor, but it doesn't work, so we | ||
| 10025 | * ignore them | ||
| 10026 | */ | ||
| 10027 | if (has_lapsensor && (dytc_version >= 5)) { | ||
| 9978 | err = sysfs_create_file(&tpacpi_pdev->dev.kobj, &dev_attr_dytc_lapmode.attr); | 10028 | err = sysfs_create_file(&tpacpi_pdev->dev.kobj, &dev_attr_dytc_lapmode.attr); |
| 9979 | if (err) | 10029 | if (err) |
| 9980 | return err; | 10030 | return err; |
| @@ -9999,14 +10049,9 @@ static struct ibm_struct proxsensor_driver_data = { · 18 unmodified lines | |||
| 9999 | * DYTC Platform Profile interface | 10049 | * DYTC Platform Profile interface |
| 10000 | */ | 10050 | */ |
| 10001 | 10051 | ||
| 10002 | #define DYTC_CMD_QUERY 0 /* To get DYTC status - enable/revision */ | ||
| 10003 | #define DYTC_CMD_SET 1 /* To enable/disable IC function mode */ | 10052 | #define DYTC_CMD_SET 1 /* To enable/disable IC function mode */ |
| 10004 | #define DYTC_CMD_RESET 0x1ff /* To reset back to default */ | 10053 | #define DYTC_CMD_RESET 0x1ff /* To reset back to default */ |
| 10005 | 10054 | ||
| 10006 | #define DYTC_QUERY_ENABLE_BIT 8 /* Bit 8 - 0 = disabled, 1 = enabled */ | ||
| 10007 | #define DYTC_QUERY_SUBREV_BIT 16 /* Bits 16 - 27 - sub revision */ | ||
| 10008 | #define DYTC_QUERY_REV_BIT 28 /* Bits 28 - 31 - revision */ | ||
| 10009 | |||
| 10010 | #define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */ | 10055 | #define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */ |
| 10011 | #define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */ | 10056 | #define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */ |
| 10012 | 10057 | ||
| @@ -10142,8 +10187,13 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, · 129 unmodified lines | |||
| 10142 | return err; | 10187 | return err; |
| 10143 | 10188 | ||
| 10144 | if (profile == PLATFORM_PROFILE_BALANCED) { | 10189 | if (profile == PLATFORM_PROFILE_BALANCED) { |
| 10145 | /* To get back to balanced mode we just issue a reset command */ | 10190 | /* |
| 10146 | err = dytc_command(DYTC_CMD_RESET, &output); | 10191 | * To get back to balanced mode we need to issue a reset command. |
| 10192 | * Note we still need to disable CQL mode before hand and re-enable | ||
| 10193 | * it afterwards, otherwise dytc_lapmode gets reset to 0 and stays | ||
| 10194 | * stuck at 0 for aprox. 30 minutes. | ||
| 10195 | */ | ||
| 10196 | err = dytc_cql_command(DYTC_CMD_RESET, &output); | ||
| 10147 | if (err) | 10197 | if (err) |
| 10148 | goto unlock; | 10198 | goto unlock; |
| 10149 | } else { | 10199 | } else { |
| @@ -10211,28 +10261,28 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 61 unmodified lines | |||
| 10211 | if (err) | 10261 | if (err) |
| 10212 | return err; | 10262 | return err; |
| 10213 | 10263 | ||
| 10264 | /* Check if we know the DYTC version, if we don't then get it */ | ||
| 10265 | if (!dytc_version) { | ||
| 10266 | err = dytc_get_version(); | ||
| 10267 | if (err) | ||
| 10268 | return err; | ||
| 10269 | } | ||
| 10214 | /* Check DYTC is enabled and supports mode setting */ | 10270 | /* Check DYTC is enabled and supports mode setting */ |
| 10215 | if (output & BIT(DYTC_QUERY_ENABLE_BIT)) { | 10271 | if (dytc_version >= 5) { |
| 10216 | /* Only DYTC v5.0 and later has this feature. */ | 10272 | dbg_printk(TPACPI_DBG_INIT, |
| 10217 | int dytc_version; | 10273 | "DYTC version %d: thermal mode available\n", dytc_version); |
| 10218 | 10274 | /* Create platform_profile structure and register */ | |
| 10219 | dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF; | 10275 | err = platform_profile_register(&dytc_profile); |
| 10220 | if (dytc_version >= 5) { | 10276 | /* |
| 10221 | dbg_printk(TPACPI_DBG_INIT, | 10277 | * If for some reason platform_profiles aren't enabled |
| 10222 | "DYTC version %d: thermal mode available\n", dytc_version); | 10278 | * don't quit terminally. |
| 10223 | /* Create platform_profile structure and register */ | 10279 | */ |
| 10224 | err = platform_profile_register(&dytc_profile); | 10280 | if (err) |
| 10225 | /* | 10281 | return 0; |
| 10226 | * If for some reason platform_profiles aren't enabled | ||
| 10227 | * don't quit terminally. | ||
| 10228 | */ | ||
| 10229 | if (err) | ||
| 10230 | return 0; | ||
| 10231 | 10282 | ||
| 10232 | dytc_profile_available = true; | 10283 | dytc_profile_available = true; |
| 10233 | /* Ensure initial values are correct */ | 10284 | /* Ensure initial values are correct */ |
| 10234 | dytc_profile_refresh(); | 10285 | dytc_profile_refresh(); |
| 10235 | } | ||
| 10236 | } | 10286 | } |
| 10237 | return 0; | 10287 | return 0; |
| 10238 | } | 10288 | } |
| @@ -189,15 +189,16 @@ int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) · 188 unmodified lines | |||
| 189 | tmr_add = ptp_qoriq->tmr_add; | 189 | tmr_add = ptp_qoriq->tmr_add; |
| 190 | adj = tmr_add; | 190 | adj = tmr_add; |
| 191 | 191 | ||
| 192 | /* calculate diff as adj*(scaled_ppm/65536)/1000000 | 192 | /* |
| 193 | * and round() to the nearest integer | 193 | * Calculate diff and round() to the nearest integer |
| 194 | * | ||
| 195 | * diff = adj * (ppb / 1000000000) | ||
| 196 | * = adj * scaled_ppm / 65536000000 | ||
| 194 | */ | 197 | */ |
| 195 | adj *= scaled_ppm; | 198 | diff = mul_u64_u64_div_u64(adj, scaled_ppm, 32768000000); |
| 196 | diff = div_u64(adj, 8000000); | 199 | diff = DIV64_U64_ROUND_UP(diff, 2); |
| 197 | diff = (diff >> 13) + ((diff >> 12) & 1); | ||
| 198 | 200 | ||
| 199 | tmr_add = neg_adj ? tmr_add - diff : tmr_add + diff; | 201 | tmr_add = neg_adj ? tmr_add - diff : tmr_add + diff; |
| 200 | |||
| 201 | ptp_qoriq->write(®s->ctrl_regs->tmr_add, tmr_add); | 202 | ptp_qoriq->write(®s->ctrl_regs->tmr_add, tmr_add); |
| 202 | 203 | ||
| 203 | return 0; | 204 | return 0; |
| @@ -63,7 +63,6 @@ void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *); · 62 unmodified lines | |||
| 63 | MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>"); | 63 | MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>"); |
| 64 | MODULE_DESCRIPTION("Linux on S/390 DASD device driver," | 64 | MODULE_DESCRIPTION("Linux on S/390 DASD device driver," |
| 65 | " Copyright IBM Corp. 2000"); | 65 | " Copyright IBM Corp. 2000"); |
| 66 | MODULE_SUPPORTED_DEVICE("dasd"); | ||
| 67 | MODULE_LICENSE("GPL"); | 66 | MODULE_LICENSE("GPL"); |
| 68 | 67 | ||
| 69 | /* | 68 | /* |
| @@ -50,7 +50,6 @@ MODULE_PARM_DESC(sol_compat, · 49 unmodified lines | |||
| 50 | MODULE_AUTHOR("Eric Brower <ebrower@usa.net>"); | 50 | MODULE_AUTHOR("Eric Brower <ebrower@usa.net>"); |
| 51 | MODULE_DESCRIPTION("7-Segment Display driver for Sun Microsystems CP1400/1500"); | 51 | MODULE_DESCRIPTION("7-Segment Display driver for Sun Microsystems CP1400/1500"); |
| 52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
| 53 | MODULE_SUPPORTED_DEVICE("d7s"); | ||
| 54 | 53 | ||
| 55 | struct d7s { | 54 | struct d7s { |
| 56 | void __iomem *regs; | 55 | void __iomem *regs; |
| @@ -80,7 +80,6 @@ · 79 unmodified lines | |||
| 80 | MODULE_AUTHOR("Hewlett-Packard Company"); | 80 | MODULE_AUTHOR("Hewlett-Packard Company"); |
| 81 | MODULE_DESCRIPTION("Driver for HP Smart Array Controller version " \ | 81 | MODULE_DESCRIPTION("Driver for HP Smart Array Controller version " \ |
| 82 | HPSA_DRIVER_VERSION); | 82 | HPSA_DRIVER_VERSION); |
| 83 | MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers"); | ||
| 84 | MODULE_VERSION(HPSA_DRIVER_VERSION); | 83 | MODULE_VERSION(HPSA_DRIVER_VERSION); |
| 85 | MODULE_LICENSE("GPL"); | 84 | MODULE_LICENSE("GPL"); |
| 86 | MODULE_ALIAS("cciss"); | 85 | MODULE_ALIAS("cciss"); |
| @@ -2371,6 +2371,24 @@ static int ibmvfc_match_lun(struct ibmvfc_event *evt, void *device) · 2370 unmodified lines | |||
| 2371 | return 0; | 2371 | return 0; |
| 2372 | } | 2372 | } |
| 2373 | 2373 | ||
| 2374 | /** | ||
| 2375 | * ibmvfc_event_is_free - Check if event is free or not | ||
| 2376 | * @evt: ibmvfc event struct | ||
| 2377 | * | ||
| 2378 | * Returns: | ||
| 2379 | * true / false | ||
| 2380 | **/ | ||
| 2381 | static bool ibmvfc_event_is_free(struct ibmvfc_event *evt) | ||
| 2382 | { | ||
| 2383 | struct ibmvfc_event *loop_evt; | ||
| 2384 | |||
| 2385 | list_for_each_entry(loop_evt, &evt->queue->free, queue_list) | ||
| 2386 | if (loop_evt == evt) | ||
| 2387 | return true; | ||
| 2388 | |||
| 2389 | return false; | ||
| 2390 | } | ||
| 2391 | |||
| 2374 | /** | 2392 | /** |
| 2375 | * ibmvfc_wait_for_ops - Wait for ops to complete | 2393 | * ibmvfc_wait_for_ops - Wait for ops to complete |
| 2376 | * @vhost: ibmvfc host struct | 2394 | * @vhost: ibmvfc host struct |
| @@ -2385,35 +2403,58 @@ static int ibmvfc_wait_for_ops(struct ibmvfc_host *vhost, void *device, · 8 unmodified lines | |||
| 2385 | { | 2403 | { |
| 2386 | struct ibmvfc_event *evt; | 2404 | struct ibmvfc_event *evt; |
| 2387 | DECLARE_COMPLETION_ONSTACK(comp); | 2405 | DECLARE_COMPLETION_ONSTACK(comp); |
| 2388 | int wait; | 2406 | int wait, i, q_index, q_size; |
| 2389 | unsigned long flags; | 2407 | unsigned long flags; |
| 2390 | signed long timeout = IBMVFC_ABORT_WAIT_TIMEOUT * HZ; | 2408 | signed long timeout = IBMVFC_ABORT_WAIT_TIMEOUT * HZ; |
| 2409 | struct ibmvfc_queue *queues; | ||
| 2391 | 2410 | ||
| 2392 | ENTER; | 2411 | ENTER; |
| 2412 | if (vhost->mq_enabled && vhost->using_channels) { | ||
| 2413 | queues = vhost->scsi_scrqs.scrqs; | ||
| 2414 | q_size = vhost->scsi_scrqs.active_queues; | ||
| 2415 | } else { | ||
| 2416 | queues = &vhost->crq; | ||
| 2417 | q_size = 1; | ||
| 2418 | } | ||
| 2419 | |||
| 2393 | do { | 2420 | do { |
| 2394 | wait = 0; | 2421 | wait = 0; |
| 2395 | spin_lock_irqsave(&vhost->crq.l_lock, flags); | 2422 | spin_lock_irqsave(vhost->host->host_lock, flags); |
| 2396 | list_for_each_entry(evt, &vhost->crq.sent, queue_list) { | 2423 | for (q_index = 0; q_index < q_size; q_index++) { |
| 2397 | if (match(evt, device)) { | 2424 | spin_lock(&queues[q_index].l_lock); |
| 2398 | evt->eh_comp = ∁ | 2425 | for (i = 0; i < queues[q_index].evt_pool.size; i++) { |
| 2399 | wait++; | 2426 | evt = &queues[q_index].evt_pool.events[i]; |
| 2427 | if (!ibmvfc_event_is_free(evt)) { | ||
| 2428 | if (match(evt, device)) { | ||
| 2429 | evt->eh_comp = ∁ | ||
| 2430 | wait++; | ||
| 2431 | } | ||
| 2432 | } | ||
| 2400 | } | 2433 | } |
| 2434 | spin_unlock(&queues[q_index].l_lock); | ||
| 2401 | } | 2435 | } |
| 2402 | spin_unlock_irqrestore(&vhost->crq.l_lock, flags); | 2436 | spin_unlock_irqrestore(vhost->host->host_lock, flags); |
| 2403 | 2437 | ||
| 2404 | if (wait) { | 2438 | if (wait) { |
| 2405 | timeout = wait_for_completion_timeout(&comp, timeout); | 2439 | timeout = wait_for_completion_timeout(&comp, timeout); |
| 2406 | 2440 | ||
| 2407 | if (!timeout) { | 2441 | if (!timeout) { |
| 2408 | wait = 0; | 2442 | wait = 0; |
| 2409 | spin_lock_irqsave(&vhost->crq.l_lock, flags); | 2443 | spin_lock_irqsave(vhost->host->host_lock, flags); |
| 2410 | list_for_each_entry(evt, &vhost->crq.sent, queue_list) { | 2444 | for (q_index = 0; q_index < q_size; q_index++) { |
| 2411 | if (match(evt, device)) { | 2445 | spin_lock(&queues[q_index].l_lock); |
| 2412 | evt->eh_comp = NULL; | 2446 | for (i = 0; i < queues[q_index].evt_pool.size; i++) { |
| 2413 | wait++; | 2447 | evt = &queues[q_index].evt_pool.events[i]; |
| 2448 | if (!ibmvfc_event_is_free(evt)) { | ||
| 2449 | if (match(evt, device)) { | ||
| 2450 | evt->eh_comp = NULL; | ||
| 2451 | wait++; | ||
| 2452 | } | ||
| 2453 | } | ||
| 2414 | } | 2454 | } |
| 2455 | spin_unlock(&queues[q_index].l_lock); | ||
| 2415 | } | 2456 | } |
| 2416 | spin_unlock_irqrestore(&vhost->crq.l_lock, flags); | 2457 | spin_unlock_irqrestore(vhost->host->host_lock, flags); |
| 2417 | if (wait) | 2458 | if (wait) |
| 2418 | dev_err(vhost->dev, "Timed out waiting for aborted commands\n"); | 2459 | dev_err(vhost->dev, "Timed out waiting for aborted commands\n"); |
| 2419 | LEAVE; | 2460 | LEAVE; |
| @@ -5784,6 +5825,8 @@ static void ibmvfc_free_mem(struct ibmvfc_host *vhost) · 3364 unmodified lines | |||
| 5784 | vhost->disc_buf_dma); | 5825 | vhost->disc_buf_dma); |
| 5785 | dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf), | 5826 | dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf), |
| 5786 | vhost->login_buf, vhost->login_buf_dma); | 5827 | vhost->login_buf, vhost->login_buf_dma); |
| 5828 | dma_free_coherent(vhost->dev, sizeof(*vhost->channel_setup_buf), | ||
| 5829 | vhost->channel_setup_buf, vhost->channel_setup_dma); | ||
| 5787 | dma_pool_destroy(vhost->sg_pool); | 5830 | dma_pool_destroy(vhost->sg_pool); |
| 5788 | ibmvfc_free_queue(vhost, async_q); | 5831 | ibmvfc_free_queue(vhost, async_q); |
| 5789 | LEAVE; | 5832 | LEAVE; |
| @@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, · 2420 unmodified lines | |||
| 2421 | memset(dstbuf, 0, 33); | 2421 | memset(dstbuf, 0, 33); |
| 2422 | size = (nbytes < 32) ? nbytes : 32; | 2422 | size = (nbytes < 32) ? nbytes : 32; |
| 2423 | if (copy_from_user(dstbuf, buf, size)) | 2423 | if (copy_from_user(dstbuf, buf, size)) |
| 2424 | return 0; | 2424 | return -EFAULT; |
| 2425 | 2425 | ||
| 2426 | if (dent == phba->debug_InjErrLBA) { | 2426 | if (dent == phba->debug_InjErrLBA) { |
| 2427 | if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') && | 2427 | if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') && |
| @@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, · 2 unmodified lines | |||
| 2430 | } | 2430 | } |
| 2431 | 2431 | ||
| 2432 | if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp))) | 2432 | if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp))) |
| 2433 | return 0; | 2433 | return -EINVAL; |
| 2434 | 2434 | ||
| 2435 | if (dent == phba->debug_writeGuard) | 2435 | if (dent == phba->debug_writeGuard) |
| 2436 | phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp; | 2436 | phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp; |
| @@ -7806,14 +7806,18 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 7805 unmodified lines | |||
| 7806 | ioc->pend_os_device_add_sz++; | 7806 | ioc->pend_os_device_add_sz++; |
| 7807 | ioc->pend_os_device_add = kzalloc(ioc->pend_os_device_add_sz, | 7807 | ioc->pend_os_device_add = kzalloc(ioc->pend_os_device_add_sz, |
| 7808 | GFP_KERNEL); | 7808 | GFP_KERNEL); |
| 7809 | if (!ioc->pend_os_device_add) | 7809 | if (!ioc->pend_os_device_add) { |
| 7810 | r = -ENOMEM; | ||
| 7810 | goto out_free_resources; | 7811 | goto out_free_resources; |
| 7812 | } | ||
| 7811 | 7813 | ||
| 7812 | ioc->device_remove_in_progress_sz = ioc->pend_os_device_add_sz; | 7814 | ioc->device_remove_in_progress_sz = ioc->pend_os_device_add_sz; |
| 7813 | ioc->device_remove_in_progress = | 7815 | ioc->device_remove_in_progress = |
| 7814 | kzalloc(ioc->device_remove_in_progress_sz, GFP_KERNEL); | 7816 | kzalloc(ioc->device_remove_in_progress_sz, GFP_KERNEL); |
| 7815 | if (!ioc->device_remove_in_progress) | 7817 | if (!ioc->device_remove_in_progress) { |
| 7818 | r = -ENOMEM; | ||
| 7816 | goto out_free_resources; | 7819 | goto out_free_resources; |
| 7820 | } | ||
| 7817 | 7821 | ||
| 7818 | ioc->fwfault_debug = mpt3sas_fwfault_debug; | 7822 | ioc->fwfault_debug = mpt3sas_fwfault_debug; |
| 7819 | 7823 | ||
| @@ -413,7 +413,7 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc, · 412 unmodified lines | |||
| 413 | * And add this object to port_table_list. | 413 | * And add this object to port_table_list. |
| 414 | */ | 414 | */ |
| 415 | if (!ioc->multipath_on_hba) { | 415 | if (!ioc->multipath_on_hba) { |
| 416 | port = kzalloc(sizeof(struct hba_port), GFP_KERNEL); | 416 | port = kzalloc(sizeof(struct hba_port), GFP_ATOMIC); |
| 417 | if (!port) | 417 | if (!port) |
| 418 | return NULL; | 418 | return NULL; |
| 419 | 419 | ||
| @@ -2273,12 +2273,12 @@ static void myrs_cleanup(struct myrs_hba *cs) · 2272 unmodified lines | |||
| 2273 | if (cs->mmio_base) { | 2273 | if (cs->mmio_base) { |
| 2274 | cs->disable_intr(cs); | 2274 | cs->disable_intr(cs); |
| 2275 | iounmap(cs->mmio_base); | 2275 | iounmap(cs->mmio_base); |
| 2276 | cs->mmio_base = NULL; | ||
| 2276 | } | 2277 | } |
| 2277 | if (cs->irq) | 2278 | if (cs->irq) |
| 2278 | free_irq(cs->irq, cs); | 2279 | free_irq(cs->irq, cs); |
| 2279 | if (cs->io_addr) | 2280 | if (cs->io_addr) |
| 2280 | release_region(cs->io_addr, 0x80); | 2281 | release_region(cs->io_addr, 0x80); |
| 2281 | iounmap(cs->mmio_base); | ||
| 2282 | pci_set_drvdata(pdev, NULL); | 2282 | pci_set_drvdata(pdev, NULL); |
| 2283 | pci_disable_device(pdev); | 2283 | pci_disable_device(pdev); |
| 2284 | scsi_host_put(cs->host); | 2284 | scsi_host_put(cs->host); |
| @@ -55,7 +55,6 @@ · 54 unmodified lines | |||
| 55 | 55 | ||
| 56 | MODULE_AUTHOR("YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>"); | 56 | MODULE_AUTHOR("YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>"); |
| 57 | MODULE_DESCRIPTION("WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI host adapter module"); | 57 | MODULE_DESCRIPTION("WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI host adapter module"); |
| 58 | MODULE_SUPPORTED_DEVICE("sd,sr,sg,st"); | ||
| 59 | MODULE_LICENSE("GPL"); | 58 | MODULE_LICENSE("GPL"); |
| 60 | 59 | ||
| 61 | #include "nsp_io.h" | 60 | #include "nsp_io.h" |
| @@ -1675,6 +1675,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) · 1674 unmodified lines | |||
| 1675 | if (!qedi->global_queues[i]) { | 1675 | if (!qedi->global_queues[i]) { |
| 1676 | QEDI_ERR(&qedi->dbg_ctx, | 1676 | QEDI_ERR(&qedi->dbg_ctx, |
| 1677 | "Unable to allocation global queue %d.\n", i); | 1677 | "Unable to allocation global queue %d.\n", i); |
| 1678 | status = -ENOMEM; | ||
| 1678 | goto mem_alloc_failure; | 1679 | goto mem_alloc_failure; |
| 1679 | } | 1680 | } |
| 1680 | 1681 | ||
| @@ -3222,8 +3222,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, · 3221 unmodified lines | |||
| 3222 | if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || | 3222 | if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || |
| 3223 | (cmd->sess && cmd->sess->deleted)) { | 3223 | (cmd->sess && cmd->sess->deleted)) { |
| 3224 | cmd->state = QLA_TGT_STATE_PROCESSED; | 3224 | cmd->state = QLA_TGT_STATE_PROCESSED; |
| 3225 | res = 0; | 3225 | return 0; |
| 3226 | goto free; | ||
| 3227 | } | 3226 | } |
| 3228 | 3227 | ||
| 3229 | ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018, | 3228 | ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018, |
| @@ -3234,8 +3233,9 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, · 4 unmodified lines | |||
| 3234 | 3233 | ||
| 3235 | res = qlt_pre_xmit_response(cmd, &prm, xmit_type, scsi_status, | 3234 | res = qlt_pre_xmit_response(cmd, &prm, xmit_type, scsi_status, |
| 3236 | &full_req_cnt); | 3235 | &full_req_cnt); |
| 3237 | if (unlikely(res != 0)) | 3236 | if (unlikely(res != 0)) { |
| 3238 | goto free; | 3237 | return res; |
| 3238 | } | ||
| 3239 | 3239 | ||
| 3240 | spin_lock_irqsave(qpair->qp_lock_ptr, flags); | 3240 | spin_lock_irqsave(qpair->qp_lock_ptr, flags); |
| 3241 | 3241 | ||
| @@ -3255,8 +3255,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, · 13 unmodified lines | |||
| 3255 | vha->flags.online, qla2x00_reset_active(vha), | 3255 | vha->flags.online, qla2x00_reset_active(vha), |
| 3256 | cmd->reset_count, qpair->chip_reset); | 3256 | cmd->reset_count, qpair->chip_reset); |
| 3257 | spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); | 3257 | spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); |
| 3258 | res = 0; | 3258 | return 0; |
| 3259 | goto free; | ||
| 3260 | } | 3259 | } |
| 3261 | 3260 | ||
| 3262 | /* Does F/W have an IOCBs for this request */ | 3261 | /* Does F/W have an IOCBs for this request */ |
| @@ -3359,8 +3358,6 @@ out_unmap_unlock: · 96 unmodified lines | |||
| 3359 | qlt_unmap_sg(vha, cmd); | 3358 | qlt_unmap_sg(vha, cmd); |
| 3360 | spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); | 3359 | spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); |
| 3361 | 3360 | ||
| 3362 | free: | ||
| 3363 | vha->hw->tgt.tgt_ops->free_cmd(cmd); | ||
| 3364 | return res; | 3361 | return res; |
| 3365 | } | 3362 | } |
| 3366 | EXPORT_SYMBOL(qlt_xmit_response); | 3363 | EXPORT_SYMBOL(qlt_xmit_response); |
| @@ -116,7 +116,6 @@ · 115 unmodified lines | |||
| 116 | (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ | 116 | (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ |
| 117 | QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0)) | 117 | QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0)) |
| 118 | #endif | 118 | #endif |
| 119 | #endif | ||
| 120 | 119 | ||
| 121 | #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ | 120 | #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ |
| 122 | ? le16_to_cpu((iocb)->u.isp2x.target.extended) \ | 121 | ? le16_to_cpu((iocb)->u.isp2x.target.extended) \ |
| @@ -244,6 +243,7 @@ struct ctio_to_2xxx { · 121 unmodified lines | |||
| 244 | #ifndef CTIO_RET_TYPE | 243 | #ifndef CTIO_RET_TYPE |
| 245 | #define CTIO_RET_TYPE 0x17 /* CTIO return entry */ | 244 | #define CTIO_RET_TYPE 0x17 /* CTIO return entry */ |
| 246 | #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ | 245 | #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ |
| 246 | #endif | ||
| 247 | 247 | ||
| 248 | struct fcp_hdr { | 248 | struct fcp_hdr { |
| 249 | uint8_t r_ctl; | 249 | uint8_t r_ctl; |
| @@ -644,7 +644,6 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) · 643 unmodified lines | |||
| 644 | { | 644 | { |
| 645 | struct qla_tgt_cmd *cmd = container_of(se_cmd, | 645 | struct qla_tgt_cmd *cmd = container_of(se_cmd, |
| 646 | struct qla_tgt_cmd, se_cmd); | 646 | struct qla_tgt_cmd, se_cmd); |
| 647 | struct scsi_qla_host *vha = cmd->vha; | ||
| 648 | 647 | ||
| 649 | if (cmd->aborted) { | 648 | if (cmd->aborted) { |
| 650 | /* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task | 649 | /* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task |
| @@ -657,7 +656,6 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) · 6 unmodified lines | |||
| 657 | cmd->se_cmd.transport_state, | 656 | cmd->se_cmd.transport_state, |
| 658 | cmd->se_cmd.t_state, | 657 | cmd->se_cmd.t_state, |
| 659 | cmd->se_cmd.se_cmd_flags); | 658 | cmd->se_cmd.se_cmd_flags); |
| 660 | vha->hw->tgt.tgt_ops->free_cmd(cmd); | ||
| 661 | return 0; | 659 | return 0; |
| 662 | } | 660 | } |
| 663 | 661 | ||
| @@ -685,7 +683,6 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) · 21 unmodified lines | |||
| 685 | { | 683 | { |
| 686 | struct qla_tgt_cmd *cmd = container_of(se_cmd, | 684 | struct qla_tgt_cmd *cmd = container_of(se_cmd, |
| 687 | struct qla_tgt_cmd, se_cmd); | 685 | struct qla_tgt_cmd, se_cmd); |
| 688 | struct scsi_qla_host *vha = cmd->vha; | ||
| 689 | int xmit_type = QLA_TGT_XMIT_STATUS; | 686 | int xmit_type = QLA_TGT_XMIT_STATUS; |
| 690 | 687 | ||
| 691 | if (cmd->aborted) { | 688 | if (cmd->aborted) { |
| @@ -699,7 +696,6 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) · 7 unmodified lines | |||
| 699 | cmd, kref_read(&cmd->se_cmd.cmd_kref), | 696 | cmd, kref_read(&cmd->se_cmd.cmd_kref), |
| 700 | cmd->se_cmd.transport_state, cmd->se_cmd.t_state, | 697 | cmd->se_cmd.transport_state, cmd->se_cmd.t_state, |
| 701 | cmd->se_cmd.se_cmd_flags); | 698 | cmd->se_cmd.se_cmd_flags); |
| 702 | vha->hw->tgt.tgt_ops->free_cmd(cmd); | ||
| 703 | return 0; | 699 | return 0; |
| 704 | } | 700 | } |
| 705 | cmd->bufflen = se_cmd->data_length; | 701 | cmd->bufflen = se_cmd->data_length; |
| @@ -280,27 +280,28 @@ static int sd_zbc_update_wp_offset_cb(struct blk_zone *zone, unsigned int idx, · 279 unmodified lines | |||
| 280 | static void sd_zbc_update_wp_offset_workfn(struct work_struct *work) | 280 | static void sd_zbc_update_wp_offset_workfn(struct work_struct *work) |
| 281 | { | 281 | { |
| 282 | struct scsi_disk *sdkp; | 282 | struct scsi_disk *sdkp; |
| 283 | unsigned long flags; | ||
| 283 | unsigned int zno; | 284 | unsigned int zno; |
| 284 | int ret; | 285 | int ret; |
| 285 | 286 | ||
| 286 | sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work); | 287 | sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work); |
| 287 | 288 | ||
| 288 | spin_lock_bh(&sdkp->zones_wp_offset_lock); | 289 | spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); |
| 289 | for (zno = 0; zno < sdkp->nr_zones; zno++) { | 290 | for (zno = 0; zno < sdkp->nr_zones; zno++) { |
| 290 | if (sdkp->zones_wp_offset[zno] != SD_ZBC_UPDATING_WP_OFST) | 291 | if (sdkp->zones_wp_offset[zno] != SD_ZBC_UPDATING_WP_OFST) |
| 291 | continue; | 292 | continue; |
| 292 | 293 | ||
| 293 | spin_unlock_bh(&sdkp->zones_wp_offset_lock); | 294 | spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); |
| 294 | ret = sd_zbc_do_report_zones(sdkp, sdkp->zone_wp_update_buf, | 295 | ret = sd_zbc_do_report_zones(sdkp, sdkp->zone_wp_update_buf, |
| 295 | SD_BUF_SIZE, | 296 | SD_BUF_SIZE, |
| 296 | zno * sdkp->zone_blocks, true); | 297 | zno * sdkp->zone_blocks, true); |
| 297 | spin_lock_bh(&sdkp->zones_wp_offset_lock); | 298 | spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); |
| 298 | if (!ret) | 299 | if (!ret) |
| 299 | sd_zbc_parse_report(sdkp, sdkp->zone_wp_update_buf + 64, | 300 | sd_zbc_parse_report(sdkp, sdkp->zone_wp_update_buf + 64, |
| 300 | zno, sd_zbc_update_wp_offset_cb, | 301 | zno, sd_zbc_update_wp_offset_cb, |
| 301 | sdkp); | 302 | sdkp); |
| 302 | } | 303 | } |
| 303 | spin_unlock_bh(&sdkp->zones_wp_offset_lock); | 304 | spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); |
| 304 | 305 | ||
| 305 | scsi_device_put(sdkp->device); | 306 | scsi_device_put(sdkp->device); |
| 306 | } | 307 | } |
| @@ -324,6 +325,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba, · 17 unmodified lines | |||
| 324 | struct request *rq = cmd->request; | 325 | struct request *rq = cmd->request; |
| 325 | struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); | 326 | struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); |
| 326 | unsigned int wp_offset, zno = blk_rq_zone_no(rq); | 327 | unsigned int wp_offset, zno = blk_rq_zone_no(rq); |
| 328 | unsigned long flags; | ||
| 327 | blk_status_t ret; | 329 | blk_status_t ret; |
| 328 | 330 | ||
| 329 | ret = sd_zbc_cmnd_checks(cmd); | 331 | ret = sd_zbc_cmnd_checks(cmd); |
| @@ -337,7 +339,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba, · 7 unmodified lines | |||
| 337 | if (!blk_req_zone_write_trylock(rq)) | 339 | if (!blk_req_zone_write_trylock(rq)) |
| 338 | return BLK_STS_ZONE_RESOURCE; | 340 | return BLK_STS_ZONE_RESOURCE; |
| 339 | 341 | ||
| 340 | spin_lock_bh(&sdkp->zones_wp_offset_lock); | 342 | spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); |
| 341 | wp_offset = sdkp->zones_wp_offset[zno]; | 343 | wp_offset = sdkp->zones_wp_offset[zno]; |
| 342 | switch (wp_offset) { | 344 | switch (wp_offset) { |
| 343 | case SD_ZBC_INVALID_WP_OFST: | 345 | case SD_ZBC_INVALID_WP_OFST: |
| @@ -366,7 +368,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba, · 22 unmodified lines | |||
| 366 | 368 | ||
| 367 | *lba += wp_offset; | 369 | *lba += wp_offset; |
| 368 | } | 370 | } |
| 369 | spin_unlock_bh(&sdkp->zones_wp_offset_lock); | 371 | spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); |
| 370 | if (ret) | 372 | if (ret) |
| 371 | blk_req_zone_write_unlock(rq); | 373 | blk_req_zone_write_unlock(rq); |
| 372 | return ret; | 374 | return ret; |
| @@ -445,6 +447,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, · 72 unmodified lines | |||
| 445 | struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); | 447 | struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); |
| 446 | unsigned int zno = blk_rq_zone_no(rq); | 448 | unsigned int zno = blk_rq_zone_no(rq); |
| 447 | enum req_opf op = req_op(rq); | 449 | enum req_opf op = req_op(rq); |
| 450 | unsigned long flags; | ||
| 448 | 451 | ||
| 449 | /* | 452 | /* |
| 450 | * If we got an error for a command that needs updating the write | 453 | * If we got an error for a command that needs updating the write |
| @@ -452,7 +455,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, · 1 unmodified line | |||
| 452 | * invalid to force an update from disk the next time a zone append | 455 | * invalid to force an update from disk the next time a zone append |
| 453 | * command is issued. | 456 | * command is issued. |
| 454 | */ | 457 | */ |
| 455 | spin_lock_bh(&sdkp->zones_wp_offset_lock); | 458 | spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); |
| 456 | 459 | ||
| 457 | if (result && op != REQ_OP_ZONE_RESET_ALL) { | 460 | if (result && op != REQ_OP_ZONE_RESET_ALL) { |
| 458 | if (op == REQ_OP_ZONE_APPEND) { | 461 | if (op == REQ_OP_ZONE_APPEND) { |
| @@ -496,7 +499,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, · 37 unmodified lines | |||
| 496 | } | 499 | } |
| 497 | 500 | ||
| 498 | unlock_wp_offset: | 501 | unlock_wp_offset: |
| 499 | spin_unlock_bh(&sdkp->zones_wp_offset_lock); | 502 | spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); |
| 500 | 503 | ||
| 501 | return good_bytes; | 504 | return good_bytes; |
| 502 | } | 505 | } |
| @@ -48,7 +48,6 @@ · 47 unmodified lines | |||
| 48 | MODULE_AUTHOR("Microsemi"); | 48 | MODULE_AUTHOR("Microsemi"); |
| 49 | MODULE_DESCRIPTION("Driver for Microsemi Smart Family Controller version " | 49 | MODULE_DESCRIPTION("Driver for Microsemi Smart Family Controller version " |
| 50 | DRIVER_VERSION); | 50 | DRIVER_VERSION); |
| 51 | MODULE_SUPPORTED_DEVICE("Microsemi Smart Family Controllers"); | ||
| 52 | MODULE_VERSION(DRIVER_VERSION); | 51 | MODULE_VERSION(DRIVER_VERSION); |
| 53 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
| 54 | 53 | ||
| @@ -1269,8 +1269,8 @@ static int st_open(struct inode *inode, struct file *filp) · 1268 unmodified lines | |||
| 1269 | spin_lock(&st_use_lock); | 1269 | spin_lock(&st_use_lock); |
| 1270 | if (STp->in_use) { | 1270 | if (STp->in_use) { |
| 1271 | spin_unlock(&st_use_lock); | 1271 | spin_unlock(&st_use_lock); |
| 1272 | scsi_tape_put(STp); | ||
| 1273 | DEBC_printk(STp, "Device already in use.\n"); | 1272 | DEBC_printk(STp, "Device already in use.\n"); |
| 1273 | scsi_tape_put(STp); | ||
| 1274 | return (-EBUSY); | 1274 | return (-EBUSY); |
| 1275 | } | 1275 | } |
| 1276 | 1276 | ||
| @@ -911,7 +911,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm) · 910 unmodified lines | |||
| 911 | if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc) | 911 | if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc) |
| 912 | return; | 912 | return; |
| 913 | 913 | ||
| 914 | if (lpm & !hba->vreg_info.vcc->enabled) | 914 | if (lpm && !hba->vreg_info.vcc->enabled) |
| 915 | regulator_set_mode(hba->vreg_info.vccq2->reg, | 915 | regulator_set_mode(hba->vreg_info.vccq2->reg, |
| 916 | REGULATOR_MODE_IDLE); | 916 | REGULATOR_MODE_IDLE); |
| 917 | else if (!lpm) | 917 | else if (!lpm) |
| @@ -30,7 +30,6 @@ · 29 unmodified lines | |||
| 30 | MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>"); | 30 | MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>"); |
| 31 | MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); | 31 | MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); |
| 32 | MODULE_LICENSE("GPL v2"); | 32 | MODULE_LICENSE("GPL v2"); |
| 33 | MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}"); | ||
| 34 | 33 | ||
| 35 | static void maple_dma_handler(struct work_struct *work); | 34 | static void maple_dma_handler(struct work_struct *work); |
| 36 | static void maple_vblank_handler(struct work_struct *work); | 35 | static void maple_vblank_handler(struct work_struct *work); |
| @@ -332,7 +332,7 @@ static const struct omap_prm_data dra7_prm_data[] = { · 331 unmodified lines | |||
| 332 | { | 332 | { |
| 333 | .name = "l3init", .base = 0x4ae07300, | 333 | .name = "l3init", .base = 0x4ae07300, |
| 334 | .pwrstctrl = 0x0, .pwrstst = 0x4, .dmap = &omap_prm_alwon, | 334 | .pwrstctrl = 0x0, .pwrstst = 0x4, .dmap = &omap_prm_alwon, |
| 335 | .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_012, | 335 | .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_01, |
| 336 | .clkdm_name = "pcie" | 336 | .clkdm_name = "pcie" |
| 337 | }, | 337 | }, |
| 338 | { | 338 | { |
| @@ -830,8 +830,12 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev, · 491 unmodified lines | |||
| 830 | reset->prm->data->name, id); | 830 | reset->prm->data->name, id); |
| 831 | 831 | ||
| 832 | exit: | 832 | exit: |
| 833 | if (reset->clkdm) | 833 | if (reset->clkdm) { |
| 834 | /* At least dra7 iva needs a delay before clkdm idle */ | ||
| 835 | if (has_rstst) | ||
| 836 | udelay(1); | ||
| 834 | pdata->clkdm_allow_idle(reset->clkdm); | 837 | pdata->clkdm_allow_idle(reset->clkdm); |
| 838 | } | ||
| 835 | 839 | ||
| 836 | return ret; | 840 | return ret; |
| 837 | } | 841 | } |
| @@ -1433,6 +1433,7 @@ static int cqspi_probe(struct platform_device *pdev) · 1432 unmodified lines | |||
| 1433 | cqspi = spi_master_get_devdata(master); | 1433 | cqspi = spi_master_get_devdata(master); |
| 1434 | 1434 | ||
| 1435 | cqspi->pdev = pdev; | 1435 | cqspi->pdev = pdev; |
| 1436 | platform_set_drvdata(pdev, cqspi); | ||
| 1436 | 1437 | ||
| 1437 | /* Obtain configuration from OF. */ | 1438 | /* Obtain configuration from OF. */ |
| 1438 | ret = cqspi_of_get_pdata(cqspi); | 1439 | ret = cqspi_of_get_pdata(cqspi); |
| @@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, · 1280 unmodified lines | |||
| 1281 | devpriv->amcc + AMCC_OP_REG_INTCSR); | 1281 | devpriv->amcc + AMCC_OP_REG_INTCSR); |
| 1282 | 1282 | ||
| 1283 | ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, | 1283 | ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, |
| 1284 | dev->board_name, dev); | 1284 | "cb_pcidas", dev); |
| 1285 | if (ret) { | 1285 | if (ret) { |
| 1286 | dev_dbg(dev->class_dev, "unable to allocate irq %d\n", | 1286 | dev_dbg(dev->class_dev, "unable to allocate irq %d\n", |
| 1287 | pcidev->irq); | 1287 | pcidev->irq); |
| @@ -4035,7 +4035,7 @@ static int auto_attach(struct comedi_device *dev, · 4034 unmodified lines | |||
| 4035 | init_stc_registers(dev); | 4035 | init_stc_registers(dev); |
| 4036 | 4036 | ||
| 4037 | retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, | 4037 | retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, |
| 4038 | dev->board_name, dev); | 4038 | "cb_pcidas64", dev); |
| 4039 | if (retval) { | 4039 | if (retval) { |
| 4040 | dev_dbg(dev->class_dev, "unable to allocate irq %u\n", | 4040 | dev_dbg(dev->class_dev, "unable to allocate irq %u\n", |
| 4041 | pcidev->irq); | 4041 | pcidev->irq); |
| @@ -877,5 +877,4 @@ module_comedi_usb_driver(vmk80xx_driver, vmk80xx_usb_driver); · 876 unmodified lines | |||
| 877 | 877 | ||
| 878 | MODULE_AUTHOR("Manuel Gebele <forensixs@gmx.de>"); | 878 | MODULE_AUTHOR("Manuel Gebele <forensixs@gmx.de>"); |
| 879 | MODULE_DESCRIPTION("Velleman USB Board Low-Level Driver"); | 879 | MODULE_DESCRIPTION("Velleman USB Board Low-Level Driver"); |
| 880 | MODULE_SUPPORTED_DEVICE("K8055/K8061 aka VM110/VM140"); | ||
| 881 | MODULE_LICENSE("GPL"); | 880 | MODULE_LICENSE("GPL"); |
| @@ -150,7 +150,7 @@ struct vnt_cts { · 149 unmodified lines | |||
| 150 | u16 reserved; | 150 | u16 reserved; |
| 151 | struct ieee80211_cts data; | 151 | struct ieee80211_cts data; |
| 152 | u16 reserved2; | 152 | u16 reserved2; |
| 153 | } __packed; | 153 | } __packed __aligned(2); |
| 154 | 154 | ||
| 155 | struct vnt_cts_fb { | 155 | struct vnt_cts_fb { |
| 156 | struct vnt_phy_field b; | 156 | struct vnt_phy_field b; |
| @@ -160,7 +160,7 @@ struct vnt_cts_fb { · 3 unmodified lines | |||
| 160 | __le16 cts_duration_ba_f1; | 160 | __le16 cts_duration_ba_f1; |
| 161 | struct ieee80211_cts data; | 161 | struct ieee80211_cts data; |
| 162 | u16 reserved2; | 162 | u16 reserved2; |
| 163 | } __packed; | 163 | } __packed __aligned(2); |
| 164 | 164 | ||
| 165 | struct vnt_tx_fifo_head { | 165 | struct vnt_tx_fifo_head { |
| 166 | u8 tx_key[WLAN_KEY_LEN_CCMP]; | 166 | u8 tx_key[WLAN_KEY_LEN_CCMP]; |
| @@ -882,7 +882,6 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, · 881 unmodified lines | |||
| 882 | if (!bio) { | 882 | if (!bio) { |
| 883 | new_bio: | 883 | new_bio: |
| 884 | nr_vecs = bio_max_segs(nr_pages); | 884 | nr_vecs = bio_max_segs(nr_pages); |
| 885 | nr_pages -= nr_vecs; | ||
| 886 | /* | 885 | /* |
| 887 | * Calls bio_kmalloc() and sets bio->bi_end_io() | 886 | * Calls bio_kmalloc() and sets bio->bi_end_io() |
| 888 | */ | 887 | */ |
| @@ -939,6 +938,14 @@ new_bio: · 50 unmodified lines | |||
| 939 | 938 | ||
| 940 | return 0; | 939 | return 0; |
| 941 | fail: | 940 | fail: |
| 941 | if (bio) | ||
| 942 | bio_put(bio); | ||
| 943 | while (req->bio) { | ||
| 944 | bio = req->bio; | ||
| 945 | req->bio = bio->bi_next; | ||
| 946 | bio_put(bio); | ||
| 947 | } | ||
| 948 | req->biotail = NULL; | ||
| 942 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 949 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 943 | } | 950 | } |
| 944 | 951 | ||
| @@ -747,7 +747,6 @@ module_platform_driver(optee_driver); · 746 unmodified lines | |||
| 747 | 747 | ||
| 748 | MODULE_AUTHOR("Linaro"); | 748 | MODULE_AUTHOR("Linaro"); |
| 749 | MODULE_DESCRIPTION("OP-TEE driver"); | 749 | MODULE_DESCRIPTION("OP-TEE driver"); |
| 750 | MODULE_SUPPORTED_DEVICE(""); | ||
| 751 | MODULE_VERSION("1.0"); | 750 | MODULE_VERSION("1.0"); |
| 752 | MODULE_LICENSE("GPL v2"); | 751 | MODULE_LICENSE("GPL v2"); |
| 753 | MODULE_ALIAS("platform:optee"); | 752 | MODULE_ALIAS("platform:optee"); |
| @@ -674,6 +674,9 @@ void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, · 673 unmodified lines | |||
| 674 | { | 674 | { |
| 675 | struct cooling_dev_stats *stats = cdev->stats; | 675 | struct cooling_dev_stats *stats = cdev->stats; |
| 676 | 676 | ||
| 677 | if (!stats) | ||
| 678 | return; | ||
| 679 | |||
| 677 | spin_lock(&stats->lock); | 680 | spin_lock(&stats->lock); |
| 678 | 681 | ||
| 679 | if (stats->state == new_state) | 682 | if (stats->state == new_state) |
| @@ -768,12 +768,6 @@ static int tb_init_port(struct tb_port *port) · 767 unmodified lines | |||
| 768 | 768 | ||
| 769 | tb_dump_port(port->sw->tb, &port->config); | 769 | tb_dump_port(port->sw->tb, &port->config); |
| 770 | 770 | ||
| 771 | /* Control port does not need HopID allocation */ | ||
| 772 | if (port->port) { | ||
| 773 | ida_init(&port->in_hopids); | ||
| 774 | ida_init(&port->out_hopids); | ||
| 775 | } | ||
| 776 | |||
| 777 | INIT_LIST_HEAD(&port->list); | 771 | INIT_LIST_HEAD(&port->list); |
| 778 | return 0; | 772 | return 0; |
| 779 | 773 | ||
| @@ -1842,10 +1836,8 @@ static void tb_switch_release(struct device *dev) · 1062 unmodified lines | |||
| 1842 | dma_port_free(sw->dma_port); | 1836 | dma_port_free(sw->dma_port); |
| 1843 | 1837 | ||
| 1844 | tb_switch_for_each_port(sw, port) { | 1838 | tb_switch_for_each_port(sw, port) { |
| 1845 | if (!port->disabled) { | 1839 | ida_destroy(&port->in_hopids); |
| 1846 | ida_destroy(&port->in_hopids); | 1840 | ida_destroy(&port->out_hopids); |
| 1847 | ida_destroy(&port->out_hopids); | ||
| 1848 | } | ||
| 1849 | } | 1841 | } |
| 1850 | 1842 | ||
| 1851 | kfree(sw->uuid); | 1843 | kfree(sw->uuid); |
| @@ -2025,6 +2017,12 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent, · 173 unmodified lines | |||
| 2025 | /* minimum setup for tb_find_cap and tb_drom_read to work */ | 2017 | /* minimum setup for tb_find_cap and tb_drom_read to work */ |
| 2026 | sw->ports[i].sw = sw; | 2018 | sw->ports[i].sw = sw; |
| 2027 | sw->ports[i].port = i; | 2019 | sw->ports[i].port = i; |
| 2020 | |||
| 2021 | /* Control port does not need HopID allocation */ | ||
| 2022 | if (i) { | ||
| 2023 | ida_init(&sw->ports[i].in_hopids); | ||
| 2024 | ida_init(&sw->ports[i].out_hopids); | ||
| 2025 | } | ||
| 2028 | } | 2026 | } |
| 2029 | 2027 | ||
| 2030 | ret = tb_switch_find_vse_cap(sw, TB_VSE_CAP_PLUG_EVENTS); | 2028 | ret = tb_switch_find_vse_cap(sw, TB_VSE_CAP_PLUG_EVENTS); |
| @@ -138,6 +138,10 @@ static void tb_discover_tunnels(struct tb_switch *sw) · 137 unmodified lines | |||
| 138 | parent->boot = true; | 138 | parent->boot = true; |
| 139 | parent = tb_switch_parent(parent); | 139 | parent = tb_switch_parent(parent); |
| 140 | } | 140 | } |
| 141 | } else if (tb_tunnel_is_dp(tunnel)) { | ||
| 142 | /* Keep the domain from powering down */ | ||
| 143 | pm_runtime_get_sync(&tunnel->src_port->sw->dev); | ||
| 144 | pm_runtime_get_sync(&tunnel->dst_port->sw->dev); | ||
| 141 | } | 145 | } |
| 142 | 146 | ||
| 143 | list_add_tail(&tunnel->list, &tcm->tunnel_list); | 147 | list_add_tail(&tunnel->list, &tcm->tunnel_list); |
| @@ -1639,8 +1639,6 @@ module_exit(icom_exit); · 1638 unmodified lines | |||
| 1639 | 1639 | ||
| 1640 | MODULE_AUTHOR("Michael Anderson <mjanders@us.ibm.com>"); | 1640 | MODULE_AUTHOR("Michael Anderson <mjanders@us.ibm.com>"); |
| 1641 | MODULE_DESCRIPTION("IBM iSeries Serial IOA driver"); | 1641 | MODULE_DESCRIPTION("IBM iSeries Serial IOA driver"); |
| 1642 | MODULE_SUPPORTED_DEVICE | ||
| 1643 | ("IBM iSeries 2745, 2771, 2772, 2742, 2793 and 2805 Communications adapters"); | ||
| 1644 | MODULE_LICENSE("GPL"); | 1642 | MODULE_LICENSE("GPL"); |
| 1645 | MODULE_FIRMWARE("icom_call_setup.bin"); | 1643 | MODULE_FIRMWARE("icom_call_setup.bin"); |
| 1646 | MODULE_FIRMWARE("icom_res_dce.bin"); | 1644 | MODULE_FIRMWARE("icom_res_dce.bin"); |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | |||
| 19 | MODULE_AUTHOR("Digi International, https://www.digi.com"); | 19 | MODULE_AUTHOR("Digi International, https://www.digi.com"); |
| 20 | MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line"); | 20 | MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line"); |
| 21 | MODULE_LICENSE("GPL"); | 21 | MODULE_LICENSE("GPL"); |
| 22 | MODULE_SUPPORTED_DEVICE("jsm"); | ||
| 23 | 22 | ||
| 24 | #define JSM_DRIVER_NAME "jsm" | 23 | #define JSM_DRIVER_NAME "jsm" |
| 25 | #define NR_PORTS 32 | 24 | #define NR_PORTS 32 |
| @@ -2197,7 +2197,10 @@ static int cdnsp_queue_isoc_tx(struct cdnsp_device *pdev, · 2196 unmodified lines | |||
| 2197 | * inverted in the first TDs isoc TRB. | 2197 | * inverted in the first TDs isoc TRB. |
| 2198 | */ | 2198 | */ |
| 2199 | field = TRB_TYPE(TRB_ISOC) | TRB_TLBPC(last_burst_pkt) | | 2199 | field = TRB_TYPE(TRB_ISOC) | TRB_TLBPC(last_burst_pkt) | |
| 2200 | start_cycle ? 0 : 1 | TRB_SIA | TRB_TBC(burst_count); | 2200 | TRB_SIA | TRB_TBC(burst_count); |
| 2201 | |||
| 2202 | if (!start_cycle) | ||
| 2203 | field |= TRB_CYCLE; | ||
| 2201 | 2204 | ||
| 2202 | /* Fill the rest of the TRB fields, and remaining normal TRBs. */ | 2205 | /* Fill the rest of the TRB fields, and remaining normal TRBs. */ |
| 2203 | for (i = 0; i < trbs_per_td; i++) { | 2206 | for (i = 0; i < trbs_per_td; i++) { |
| @@ -783,8 +783,6 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) · 782 unmodified lines | |||
| 783 | 783 | ||
| 784 | trace_dwc3_gadget_ep_disable(dep); | 784 | trace_dwc3_gadget_ep_disable(dep); |
| 785 | 785 | ||
| 786 | dwc3_remove_requests(dwc, dep); | ||
| 787 | |||
| 788 | /* make sure HW endpoint isn't stalled */ | 786 | /* make sure HW endpoint isn't stalled */ |
| 789 | if (dep->flags & DWC3_EP_STALL) | 787 | if (dep->flags & DWC3_EP_STALL) |
| 790 | __dwc3_gadget_ep_set_halt(dep, 0, false); | 788 | __dwc3_gadget_ep_set_halt(dep, 0, false); |
| @@ -803,6 +801,8 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) · 12 unmodified lines | |||
| 803 | dep->endpoint.desc = NULL; | 801 | dep->endpoint.desc = NULL; |
| 804 | } | 802 | } |
| 805 | 803 | ||
| 804 | dwc3_remove_requests(dwc, dep); | ||
| 805 | |||
| 806 | return 0; | 806 | return 0; |
| 807 | } | 807 | } |
| 808 | 808 | ||
| @@ -1617,7 +1617,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) · 808 unmodified lines | |||
| 1617 | { | 1617 | { |
| 1618 | struct dwc3 *dwc = dep->dwc; | 1618 | struct dwc3 *dwc = dep->dwc; |
| 1619 | 1619 | ||
| 1620 | if (!dep->endpoint.desc || !dwc->pullups_connected) { | 1620 | if (!dep->endpoint.desc || !dwc->pullups_connected || !dwc->connected) { |
| 1621 | dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", | 1621 | dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", |
| 1622 | dep->name); | 1622 | dep->name); |
| 1623 | return -ESHUTDOWN; | 1623 | return -ESHUTDOWN; |
| @@ -2247,6 +2247,7 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 623 unmodified lines | |||
| 2247 | if (!is_on) { | 2247 | if (!is_on) { |
| 2248 | u32 count; | 2248 | u32 count; |
| 2249 | 2249 | ||
| 2250 | dwc->connected = false; | ||
| 2250 | /* | 2251 | /* |
| 2251 | * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a | 2252 | * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a |
| 2252 | * Section 4.1.8 Table 4-7, it states that for a device-initiated | 2253 | * Section 4.1.8 Table 4-7, it states that for a device-initiated |
| @@ -2271,7 +2272,6 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 18 unmodified lines | |||
| 2271 | dwc->ev_buf->lpos = (dwc->ev_buf->lpos + count) % | 2272 | dwc->ev_buf->lpos = (dwc->ev_buf->lpos + count) % |
| 2272 | dwc->ev_buf->length; | 2273 | dwc->ev_buf->length; |
| 2273 | } | 2274 | } |
| 2274 | dwc->connected = false; | ||
| 2275 | } else { | 2275 | } else { |
| 2276 | __dwc3_gadget_start(dwc); | 2276 | __dwc3_gadget_start(dwc); |
| 2277 | } | 2277 | } |
| @@ -3321,8 +3321,6 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) · 1043 unmodified lines | |||
| 3321 | { | 3321 | { |
| 3322 | u32 reg; | 3322 | u32 reg; |
| 3323 | 3323 | ||
| 3324 | dwc->connected = true; | ||
| 3325 | |||
| 3326 | /* | 3324 | /* |
| 3327 | * WORKAROUND: DWC3 revisions <1.88a have an issue which | 3325 | * WORKAROUND: DWC3 revisions <1.88a have an issue which |
| 3328 | * would cause a missing Disconnect Event if there's a | 3326 | * would cause a missing Disconnect Event if there's a |
| @@ -3362,6 +3360,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) · 33 unmodified lines | |||
| 3362 | * transfers." | 3360 | * transfers." |
| 3363 | */ | 3361 | */ |
| 3364 | dwc3_stop_active_transfers(dwc); | 3362 | dwc3_stop_active_transfers(dwc); |
| 3363 | dwc->connected = true; | ||
| 3365 | 3364 | ||
| 3366 | reg = dwc3_readl(dwc->regs, DWC3_DCTL); | 3365 | reg = dwc3_readl(dwc->regs, DWC3_DCTL); |
| 3367 | reg &= ~DWC3_DCTL_TSTCTRL_MASK; | 3366 | reg &= ~DWC3_DCTL_TSTCTRL_MASK; |
| @@ -97,6 +97,8 @@ struct gadget_config_name { · 96 unmodified lines | |||
| 97 | struct list_head list; | 97 | struct list_head list; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | #define USB_MAX_STRING_WITH_NULL_LEN (USB_MAX_STRING_LEN+1) | ||
| 101 | |||
| 100 | static int usb_string_copy(const char *s, char **s_copy) | 102 | static int usb_string_copy(const char *s, char **s_copy) |
| 101 | { | 103 | { |
| 102 | int ret; | 104 | int ret; |
| @@ -106,12 +108,16 @@ static int usb_string_copy(const char *s, char **s_copy) · 3 unmodified lines | |||
| 106 | if (ret > USB_MAX_STRING_LEN) | 108 | if (ret > USB_MAX_STRING_LEN) |
| 107 | return -EOVERFLOW; | 109 | return -EOVERFLOW; |
| 108 | 110 | ||
| 109 | str = kstrdup(s, GFP_KERNEL); | 111 | if (copy) { |
| 110 | if (!str) | 112 | str = copy; |
| 111 | return -ENOMEM; | 113 | } else { |
| 114 | str = kmalloc(USB_MAX_STRING_WITH_NULL_LEN, GFP_KERNEL); | ||
| 115 | if (!str) | ||
| 116 | return -ENOMEM; | ||
| 117 | } | ||
| 118 | strcpy(str, s); | ||
| 112 | if (str[ret - 1] == '\n') | 119 | if (str[ret - 1] == '\n') |
| 113 | str[ret - 1] = '\0'; | 120 | str[ret - 1] = '\0'; |
| 114 | kfree(copy); | ||
| 115 | *s_copy = str; | 121 | *s_copy = str; |
| 116 | return 0; | 122 | return 0; |
| 117 | } | 123 | } |
| @@ -117,7 +117,6 @@ MODULE_DEVICE_TABLE(usb, ld_usb_table); · 116 unmodified lines | |||
| 117 | MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); | 117 | MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); |
| 118 | MODULE_DESCRIPTION("LD USB Driver"); | 118 | MODULE_DESCRIPTION("LD USB Driver"); |
| 119 | MODULE_LICENSE("GPL"); | 119 | MODULE_LICENSE("GPL"); |
| 120 | MODULE_SUPPORTED_DEVICE("LD USB Devices"); | ||
| 121 | 120 | ||
| 122 | /* All interrupt in transfers are collected in a ring buffer to | 121 | /* All interrupt in transfers are collected in a ring buffer to |
| 123 | * avoid racing conditions and get better performance of the driver. | 122 | * avoid racing conditions and get better performance of the driver. |
| @@ -656,6 +656,13 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) · 655 unmodified lines | |||
| 656 | need_auto_sense = 1; | 656 | need_auto_sense = 1; |
| 657 | } | 657 | } |
| 658 | 658 | ||
| 659 | /* Some devices (Kindle) require another command after SYNC CACHE */ | ||
| 660 | if ((us->fflags & US_FL_SENSE_AFTER_SYNC) && | ||
| 661 | srb->cmnd[0] == SYNCHRONIZE_CACHE) { | ||
| 662 | usb_stor_dbg(us, "-- sense after SYNC CACHE\n"); | ||
| 663 | need_auto_sense = 1; | ||
| 664 | } | ||
| 665 | |||
| 659 | /* | 666 | /* |
| 660 | * If we have a failure, we're going to do a REQUEST_SENSE | 667 | * If we have a failure, we're going to do a REQUEST_SENSE |
| 661 | * automatically. Note that we differentiate between a command | 668 | * automatically. Note that we differentiate between a command |
| @@ -2211,6 +2211,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, · 2210 unmodified lines | |||
| 2211 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2211 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 2212 | US_FL_NO_READ_DISC_INFO ), | 2212 | US_FL_NO_READ_DISC_INFO ), |
| 2213 | 2213 | ||
| 2214 | /* | ||
| 2215 | * Reported by Matthias Schwarzott <zzam@gentoo.org> | ||
| 2216 | * The Amazon Kindle treats SYNCHRONIZE CACHE as an indication that | ||
| 2217 | * the host may be finished with it, and automatically ejects its | ||
| 2218 | * emulated media unless it receives another command within one second. | ||
| 2219 | */ | ||
| 2220 | UNUSUAL_DEV( 0x1949, 0x0004, 0x0000, 0x9999, | ||
| 2221 | "Amazon", | ||
| 2222 | "Kindle", | ||
| 2223 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 2224 | US_FL_SENSE_AFTER_SYNC ), | ||
| 2225 | |||
| 2214 | /* | 2226 | /* |
| 2215 | * Reported by Oliver Neukum <oneukum@suse.com> | 2227 | * Reported by Oliver Neukum <oneukum@suse.com> |
| 2216 | * This device morphes spontaneously into another device if the access | 2228 | * This device morphes spontaneously into another device if the access |
| @@ -942,6 +942,7 @@ static int tcpm_set_current_limit(struct tcpm_port *port, u32 max_ma, u32 mv) · 941 unmodified lines | |||
| 942 | 942 | ||
| 943 | port->supply_voltage = mv; | 943 | port->supply_voltage = mv; |
| 944 | port->current_limit = max_ma; | 944 | port->current_limit = max_ma; |
| 945 | power_supply_changed(port->psy); | ||
| 945 | 946 | ||
| 946 | if (port->tcpc->set_current_limit) | 947 | if (port->tcpc->set_current_limit) |
| 947 | ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv); | 948 | ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv); |
| @@ -2928,6 +2929,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, · 1980 unmodified lines | |||
| 2928 | 2929 | ||
| 2929 | port->pps_data.supported = false; | 2930 | port->pps_data.supported = false; |
| 2930 | port->usb_type = POWER_SUPPLY_USB_TYPE_PD; | 2931 | port->usb_type = POWER_SUPPLY_USB_TYPE_PD; |
| 2932 | power_supply_changed(port->psy); | ||
| 2931 | 2933 | ||
| 2932 | /* | 2934 | /* |
| 2933 | * Select the source PDO providing the most power which has a | 2935 | * Select the source PDO providing the most power which has a |
| @@ -2952,6 +2954,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, · 18 unmodified lines | |||
| 2952 | port->pps_data.supported = true; | 2954 | port->pps_data.supported = true; |
| 2953 | port->usb_type = | 2955 | port->usb_type = |
| 2954 | POWER_SUPPLY_USB_TYPE_PD_PPS; | 2956 | POWER_SUPPLY_USB_TYPE_PD_PPS; |
| 2957 | power_supply_changed(port->psy); | ||
| 2955 | } | 2958 | } |
| 2956 | continue; | 2959 | continue; |
| 2957 | default: | 2960 | default: |
| @@ -3109,6 +3112,7 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) · 151 unmodified lines | |||
| 3109 | port->pps_data.out_volt)); | 3112 | port->pps_data.out_volt)); |
| 3110 | port->pps_data.op_curr = min(port->pps_data.max_curr, | 3113 | port->pps_data.op_curr = min(port->pps_data.max_curr, |
| 3111 | port->pps_data.op_curr); | 3114 | port->pps_data.op_curr); |
| 3115 | power_supply_changed(port->psy); | ||
| 3112 | } | 3116 | } |
| 3113 | 3117 | ||
| 3114 | return src_pdo; | 3118 | return src_pdo; |
| @@ -3344,6 +3348,7 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge) · 229 unmodified lines | |||
| 3344 | return ret; | 3348 | return ret; |
| 3345 | } | 3349 | } |
| 3346 | port->vbus_charge = charge; | 3350 | port->vbus_charge = charge; |
| 3351 | power_supply_changed(port->psy); | ||
| 3347 | return 0; | 3352 | return 0; |
| 3348 | } | 3353 | } |
| 3349 | 3354 | ||
| @@ -3523,6 +3528,7 @@ static void tcpm_reset_port(struct tcpm_port *port) · 173 unmodified lines | |||
| 3523 | port->try_src_count = 0; | 3528 | port->try_src_count = 0; |
| 3524 | port->try_snk_count = 0; | 3529 | port->try_snk_count = 0; |
| 3525 | port->usb_type = POWER_SUPPLY_USB_TYPE_C; | 3530 | port->usb_type = POWER_SUPPLY_USB_TYPE_C; |
| 3531 | power_supply_changed(port->psy); | ||
| 3526 | port->nr_sink_caps = 0; | 3532 | port->nr_sink_caps = 0; |
| 3527 | port->sink_cap_done = false; | 3533 | port->sink_cap_done = false; |
| 3528 | if (port->tcpc->enable_frs) | 3534 | if (port->tcpc->enable_frs) |
| @@ -5167,7 +5173,7 @@ static void tcpm_enable_frs_work(struct kthread_work *work) · 1638 unmodified lines | |||
| 5167 | goto unlock; | 5173 | goto unlock; |
| 5168 | 5174 | ||
| 5169 | /* Send when the state machine is idle */ | 5175 | /* Send when the state machine is idle */ |
| 5170 | if (port->state != SNK_READY || port->vdm_state != VDM_STATE_DONE || port->send_discover) | 5176 | if (port->state != SNK_READY || port->vdm_sm_running || port->send_discover) |
| 5171 | goto resched; | 5177 | goto resched; |
| 5172 | 5178 | ||
| 5173 | port->upcoming_state = GET_SINK_CAP; | 5179 | port->upcoming_state = GET_SINK_CAP; |
| @@ -5905,7 +5911,7 @@ static int tcpm_psy_set_prop(struct power_supply *psy, · 731 unmodified lines | |||
| 5905 | ret = -EINVAL; | 5911 | ret = -EINVAL; |
| 5906 | break; | 5912 | break; |
| 5907 | } | 5913 | } |
| 5908 | 5914 | power_supply_changed(port->psy); | |
| 5909 | return ret; | 5915 | return ret; |
| 5910 | } | 5916 | } |
| 5911 | 5917 | ||
| @@ -6058,6 +6064,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) · 146 unmodified lines | |||
| 6058 | err = devm_tcpm_psy_register(port); | 6064 | err = devm_tcpm_psy_register(port); |
| 6059 | if (err) | 6065 | if (err) |
| 6060 | goto out_role_sw_put; | 6066 | goto out_role_sw_put; |
| 6067 | power_supply_changed(port->psy); | ||
| 6061 | 6068 | ||
| 6062 | port->typec_port = typec_register_port(port->dev, &port->typec_caps); | 6069 | port->typec_port = typec_register_port(port->dev, &port->typec_caps); |
| 6063 | if (IS_ERR(port->typec_port)) { | 6070 | if (IS_ERR(port->typec_port)) { |
| @@ -64,7 +64,6 @@ enum { · 63 unmodified lines | |||
| 64 | struct tps6598x_rx_identity_reg { | 64 | struct tps6598x_rx_identity_reg { |
| 65 | u8 status; | 65 | u8 status; |
| 66 | struct usb_pd_identity identity; | 66 | struct usb_pd_identity identity; |
| 67 | u32 vdo[3]; | ||
| 68 | } __packed; | 67 | } __packed; |
| 69 | 68 | ||
| 70 | /* Standard Task return codes */ | 69 | /* Standard Task return codes */ |
| @@ -174,7 +174,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, · 173 unmodified lines | |||
| 174 | 174 | ||
| 175 | udc->ud.tcp_socket = socket; | 175 | udc->ud.tcp_socket = socket; |
| 176 | udc->ud.tcp_rx = tcp_rx; | 176 | udc->ud.tcp_rx = tcp_rx; |
| 177 | udc->ud.tcp_rx = tcp_tx; | 177 | udc->ud.tcp_tx = tcp_tx; |
| 178 | udc->ud.status = SDEV_ST_USED; | 178 | udc->ud.status = SDEV_ST_USED; |
| 179 | 179 | ||
| 180 | spin_unlock_irq(&udc->ud.lock); | 180 | spin_unlock_irq(&udc->ud.lock); |
| @@ -431,8 +431,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 430 unmodified lines | |||
| 431 | } | 431 | } |
| 432 | 432 | ||
| 433 | adapter = vdpa_alloc_device(struct ifcvf_adapter, vdpa, | 433 | adapter = vdpa_alloc_device(struct ifcvf_adapter, vdpa, |
| 434 | dev, &ifc_vdpa_ops, | 434 | dev, &ifc_vdpa_ops, NULL); |
| 435 | IFCVF_MAX_QUEUE_PAIRS * 2, NULL); | ||
| 436 | if (adapter == NULL) { | 435 | if (adapter == NULL) { |
| 437 | IFCVF_ERR(pdev, "Failed to allocate vDPA structure"); | 436 | IFCVF_ERR(pdev, "Failed to allocate vDPA structure"); |
| 438 | return -ENOMEM; | 437 | return -ENOMEM; |
| @@ -456,7 +455,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 17 unmodified lines | |||
| 456 | for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) | 455 | for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) |
| 457 | vf->vring[i].irq = -EINVAL; | 456 | vf->vring[i].irq = -EINVAL; |
| 458 | 457 | ||
| 459 | ret = vdpa_register_device(&adapter->vdpa); | 458 | ret = vdpa_register_device(&adapter->vdpa, IFCVF_MAX_QUEUE_PAIRS * 2); |
| 460 | if (ret) { | 459 | if (ret) { |
| 461 | IFCVF_ERR(pdev, "Failed to register ifcvf to vdpa bus"); | 460 | IFCVF_ERR(pdev, "Failed to register ifcvf to vdpa bus"); |
| 462 | goto err; | 461 | goto err; |
| @@ -1982,7 +1982,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, · 1981 unmodified lines | |||
| 1982 | max_vqs = min_t(u32, max_vqs, MLX5_MAX_SUPPORTED_VQS); | 1982 | max_vqs = min_t(u32, max_vqs, MLX5_MAX_SUPPORTED_VQS); |
| 1983 | 1983 | ||
| 1984 | ndev = vdpa_alloc_device(struct mlx5_vdpa_net, mvdev.vdev, mdev->device, &mlx5_vdpa_ops, | 1984 | ndev = vdpa_alloc_device(struct mlx5_vdpa_net, mvdev.vdev, mdev->device, &mlx5_vdpa_ops, |
| 1985 | 2 * mlx5_vdpa_max_qps(max_vqs), NULL); | 1985 | NULL); |
| 1986 | if (IS_ERR(ndev)) | 1986 | if (IS_ERR(ndev)) |
| 1987 | return PTR_ERR(ndev); | 1987 | return PTR_ERR(ndev); |
| 1988 | 1988 | ||
| @@ -2009,7 +2009,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, · 20 unmodified lines | |||
| 2009 | if (err) | 2009 | if (err) |
| 2010 | goto err_res; | 2010 | goto err_res; |
| 2011 | 2011 | ||
| 2012 | err = vdpa_register_device(&mvdev->vdev); | 2012 | err = vdpa_register_device(&mvdev->vdev, 2 * mlx5_vdpa_max_qps(max_vqs)); |
| 2013 | if (err) | 2013 | if (err) |
| 2014 | goto err_reg; | 2014 | goto err_reg; |
| 2015 | 2015 | ||
| @@ -69,7 +69,6 @@ static void vdpa_release_dev(struct device *d) · 68 unmodified lines | |||
| 69 | * initialized but before registered. | 69 | * initialized but before registered. |
| 70 | * @parent: the parent device | 70 | * @parent: the parent device |
| 71 | * @config: the bus operations that is supported by this device | 71 | * @config: the bus operations that is supported by this device |
| 72 | * @nvqs: number of virtqueues supported by this device | ||
| 73 | * @size: size of the parent structure that contains private data | 72 | * @size: size of the parent structure that contains private data |
| 74 | * @name: name of the vdpa device; optional. | 73 | * @name: name of the vdpa device; optional. |
| 75 | * | 74 | * |
| @@ -81,7 +80,7 @@ static void vdpa_release_dev(struct device *d) · 5 unmodified lines | |||
| 81 | */ | 80 | */ |
| 82 | struct vdpa_device *__vdpa_alloc_device(struct device *parent, | 81 | struct vdpa_device *__vdpa_alloc_device(struct device *parent, |
| 83 | const struct vdpa_config_ops *config, | 82 | const struct vdpa_config_ops *config, |
| 84 | int nvqs, size_t size, const char *name) | 83 | size_t size, const char *name) |
| 85 | { | 84 | { |
| 86 | struct vdpa_device *vdev; | 85 | struct vdpa_device *vdev; |
| 87 | int err = -EINVAL; | 86 | int err = -EINVAL; |
| @@ -107,7 +106,6 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent, · 19 unmodified lines | |||
| 107 | vdev->index = err; | 106 | vdev->index = err; |
| 108 | vdev->config = config; | 107 | vdev->config = config; |
| 109 | vdev->features_valid = false; | 108 | vdev->features_valid = false; |
| 110 | vdev->nvqs = nvqs; | ||
| 111 | 109 | ||
| 112 | if (name) | 110 | if (name) |
| 113 | err = dev_set_name(&vdev->dev, "%s", name); | 111 | err = dev_set_name(&vdev->dev, "%s", name); |
| @@ -136,10 +134,12 @@ static int vdpa_name_match(struct device *dev, const void *data) · 22 unmodified lines | |||
| 136 | return (strcmp(dev_name(&vdev->dev), data) == 0); | 134 | return (strcmp(dev_name(&vdev->dev), data) == 0); |
| 137 | } | 135 | } |
| 138 | 136 | ||
| 139 | static int __vdpa_register_device(struct vdpa_device *vdev) | 137 | static int __vdpa_register_device(struct vdpa_device *vdev, int nvqs) |
| 140 | { | 138 | { |
| 141 | struct device *dev; | 139 | struct device *dev; |
| 142 | 140 | ||
| 141 | vdev->nvqs = nvqs; | ||
| 142 | |||
| 143 | lockdep_assert_held(&vdpa_dev_mutex); | 143 | lockdep_assert_held(&vdpa_dev_mutex); |
| 144 | dev = bus_find_device(&vdpa_bus, NULL, dev_name(&vdev->dev), vdpa_name_match); | 144 | dev = bus_find_device(&vdpa_bus, NULL, dev_name(&vdev->dev), vdpa_name_match); |
| 145 | if (dev) { | 145 | if (dev) { |
| @@ -155,15 +155,16 @@ static int __vdpa_register_device(struct vdpa_device *vdev) · 9 unmodified lines | |||
| 155 | * Caller must invoke this routine in the management device dev_add() | 155 | * Caller must invoke this routine in the management device dev_add() |
| 156 | * callback after setting up valid mgmtdev for this vdpa device. | 156 | * callback after setting up valid mgmtdev for this vdpa device. |
| 157 | * @vdev: the vdpa device to be registered to vDPA bus | 157 | * @vdev: the vdpa device to be registered to vDPA bus |
| 158 | * @nvqs: number of virtqueues supported by this device | ||
| 158 | * | 159 | * |
| 159 | * Returns an error when fail to add device to vDPA bus | 160 | * Returns an error when fail to add device to vDPA bus |
| 160 | */ | 161 | */ |
| 161 | int _vdpa_register_device(struct vdpa_device *vdev) | 162 | int _vdpa_register_device(struct vdpa_device *vdev, int nvqs) |
| 162 | { | 163 | { |
| 163 | if (!vdev->mdev) | 164 | if (!vdev->mdev) |
| 164 | return -EINVAL; | 165 | return -EINVAL; |
| 165 | 166 | ||
| 166 | return __vdpa_register_device(vdev); | 167 | return __vdpa_register_device(vdev, nvqs); |
| 167 | } | 168 | } |
| 168 | EXPORT_SYMBOL_GPL(_vdpa_register_device); | 169 | EXPORT_SYMBOL_GPL(_vdpa_register_device); |
| 169 | 170 | ||
| @@ -171,15 +172,16 @@ EXPORT_SYMBOL_GPL(_vdpa_register_device); · 1 unmodified line | |||
| 171 | * vdpa_register_device - register a vDPA device | 172 | * vdpa_register_device - register a vDPA device |
| 172 | * Callers must have a succeed call of vdpa_alloc_device() before. | 173 | * Callers must have a succeed call of vdpa_alloc_device() before. |
| 173 | * @vdev: the vdpa device to be registered to vDPA bus | 174 | * @vdev: the vdpa device to be registered to vDPA bus |
| 175 | * @nvqs: number of virtqueues supported by this device | ||
| 174 | * | 176 | * |
| 175 | * Returns an error when fail to add to vDPA bus | 177 | * Returns an error when fail to add to vDPA bus |
| 176 | */ | 178 | */ |
| 177 | int vdpa_register_device(struct vdpa_device *vdev) | 179 | int vdpa_register_device(struct vdpa_device *vdev, int nvqs) |
| 178 | { | 180 | { |
| 179 | int err; | 181 | int err; |
| 180 | 182 | ||
| 181 | mutex_lock(&vdpa_dev_mutex); | 183 | mutex_lock(&vdpa_dev_mutex); |
| 182 | err = __vdpa_register_device(vdev); | 184 | err = __vdpa_register_device(vdev, nvqs); |
| 183 | mutex_unlock(&vdpa_dev_mutex); | 185 | mutex_unlock(&vdpa_dev_mutex); |
| 184 | return err; | 186 | return err; |
| 185 | } | 187 | } |
| @@ -235,7 +235,7 @@ struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr) · 234 unmodified lines | |||
| 235 | ops = &vdpasim_config_ops; | 235 | ops = &vdpasim_config_ops; |
| 236 | 236 | ||
| 237 | vdpasim = vdpa_alloc_device(struct vdpasim, vdpa, NULL, ops, | 237 | vdpasim = vdpa_alloc_device(struct vdpasim, vdpa, NULL, ops, |
| 238 | dev_attr->nvqs, dev_attr->name); | 238 | dev_attr->name); |
| 239 | if (!vdpasim) | 239 | if (!vdpasim) |
| 240 | goto err_alloc; | 240 | goto err_alloc; |
| 241 | 241 | ||
| @@ -110,8 +110,7 @@ out: · 109 unmodified lines | |||
| 110 | 110 | ||
| 111 | static void vdpasim_net_get_config(struct vdpasim *vdpasim, void *config) | 111 | static void vdpasim_net_get_config(struct vdpasim *vdpasim, void *config) |
| 112 | { | 112 | { |
| 113 | struct virtio_net_config *net_config = | 113 | struct virtio_net_config *net_config = config; |
| 114 | (struct virtio_net_config *)config; | ||
| 115 | 114 | ||
| 116 | net_config->mtu = cpu_to_vdpasim16(vdpasim, 1500); | 115 | net_config->mtu = cpu_to_vdpasim16(vdpasim, 1500); |
| 117 | net_config->status = cpu_to_vdpasim16(vdpasim, VIRTIO_NET_S_LINK_UP); | 116 | net_config->status = cpu_to_vdpasim16(vdpasim, VIRTIO_NET_S_LINK_UP); |
| @@ -147,7 +146,7 @@ static int vdpasim_net_dev_add(struct vdpa_mgmt_dev *mdev, const char *name) · 29 unmodified lines | |||
| 147 | if (IS_ERR(simdev)) | 146 | if (IS_ERR(simdev)) |
| 148 | return PTR_ERR(simdev); | 147 | return PTR_ERR(simdev); |
| 149 | 148 | ||
| 150 | ret = _vdpa_register_device(&simdev->vdpa); | 149 | ret = _vdpa_register_device(&simdev->vdpa, VDPASIM_NET_VQ_NUM); |
| 151 | if (ret) | 150 | if (ret) |
| 152 | goto reg_err; | 151 | goto reg_err; |
| 153 | 152 | ||
| @@ -21,8 +21,8 @@ config VFIO_VIRQFD · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | menuconfig VFIO | 22 | menuconfig VFIO |
| 23 | tristate "VFIO Non-Privileged userspace driver framework" | 23 | tristate "VFIO Non-Privileged userspace driver framework" |
| 24 | depends on IOMMU_API | 24 | select IOMMU_API |
| 25 | select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64) | 25 | select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64) |
| 26 | help | 26 | help |
| 27 | VFIO provides a framework for secure userspace device drivers. | 27 | VFIO provides a framework for secure userspace device drivers. |
| 28 | See Documentation/driver-api/vfio.rst for more details. | 28 | See Documentation/driver-api/vfio.rst for more details. |
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | config VFIO_PLATFORM | 2 | config VFIO_PLATFORM |
| 3 | tristate "VFIO support for platform devices" | 3 | tristate "VFIO support for platform devices" |
| 4 | depends on VFIO && EVENTFD && (ARM || ARM64) | 4 | depends on VFIO && EVENTFD && (ARM || ARM64 || COMPILE_TEST) |
| 5 | select VFIO_VIRQFD | 5 | select VFIO_VIRQFD |
| 6 | help | 6 | help |
| 7 | Support for platform devices with VFIO. This is required to make | 7 | Support for platform devices with VFIO. This is required to make |
| @@ -12,7 +12,7 @@ config VFIO_PLATFORM · 4 unmodified lines | |||
| 12 | 12 | ||
| 13 | config VFIO_AMBA | 13 | config VFIO_AMBA |
| 14 | tristate "VFIO support for AMBA devices" | 14 | tristate "VFIO support for AMBA devices" |
| 15 | depends on VFIO_PLATFORM && ARM_AMBA | 15 | depends on VFIO_PLATFORM && (ARM_AMBA || COMPILE_TEST) |
| 16 | help | 16 | help |
| 17 | Support for ARM AMBA devices with VFIO. This is required to make | 17 | Support for ARM AMBA devices with VFIO. This is required to make |
| 18 | use of ARM AMBA devices present on the system using the VFIO | 18 | use of ARM AMBA devices present on the system using the VFIO |
| @@ -189,7 +189,7 @@ static struct vfio_dma *vfio_find_dma(struct vfio_iommu *iommu, · 188 unmodified lines | |||
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static struct rb_node *vfio_find_dma_first_node(struct vfio_iommu *iommu, | 191 | static struct rb_node *vfio_find_dma_first_node(struct vfio_iommu *iommu, |
| 192 | dma_addr_t start, size_t size) | 192 | dma_addr_t start, u64 size) |
| 193 | { | 193 | { |
| 194 | struct rb_node *res = NULL; | 194 | struct rb_node *res = NULL; |
| 195 | struct rb_node *node = iommu->dma_list.rb_node; | 195 | struct rb_node *node = iommu->dma_list.rb_node; |
| @@ -785,7 +785,12 @@ static int vfio_pin_page_external(struct vfio_dma *dma, unsigned long vaddr, · 589 unmodified lines | |||
| 785 | return -ENODEV; | 785 | return -ENODEV; |
| 786 | 786 | ||
| 787 | ret = vaddr_get_pfns(mm, vaddr, 1, dma->prot, pfn_base, pages); | 787 | ret = vaddr_get_pfns(mm, vaddr, 1, dma->prot, pfn_base, pages); |
| 788 | if (ret == 1 && do_accounting && !is_invalid_reserved_pfn(*pfn_base)) { | 788 | if (ret != 1) |
| 789 | goto out; | ||
| 790 | |||
| 791 | ret = 0; | ||
| 792 | |||
| 793 | if (do_accounting && !is_invalid_reserved_pfn(*pfn_base)) { | ||
| 789 | ret = vfio_lock_acct(dma, 1, true); | 794 | ret = vfio_lock_acct(dma, 1, true); |
| 790 | if (ret) { | 795 | if (ret) { |
| 791 | put_pfn(*pfn_base, dma->prot); | 796 | put_pfn(*pfn_base, dma->prot); |
| @@ -797,6 +802,7 @@ static int vfio_pin_page_external(struct vfio_dma *dma, unsigned long vaddr, · 5 unmodified lines | |||
| 797 | } | 802 | } |
| 798 | } | 803 | } |
| 799 | 804 | ||
| 805 | out: | ||
| 800 | mmput(mm); | 806 | mmput(mm); |
| 801 | return ret; | 807 | return ret; |
| 802 | } | 808 | } |
| @@ -1288,7 +1294,7 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu, · 485 unmodified lines | |||
| 1288 | int ret = -EINVAL, retries = 0; | 1294 | int ret = -EINVAL, retries = 0; |
| 1289 | unsigned long pgshift; | 1295 | unsigned long pgshift; |
| 1290 | dma_addr_t iova = unmap->iova; | 1296 | dma_addr_t iova = unmap->iova; |
| 1291 | unsigned long size = unmap->size; | 1297 | u64 size = unmap->size; |
| 1292 | bool unmap_all = unmap->flags & VFIO_DMA_UNMAP_FLAG_ALL; | 1298 | bool unmap_all = unmap->flags & VFIO_DMA_UNMAP_FLAG_ALL; |
| 1293 | bool invalidate_vaddr = unmap->flags & VFIO_DMA_UNMAP_FLAG_VADDR; | 1299 | bool invalidate_vaddr = unmap->flags & VFIO_DMA_UNMAP_FLAG_VADDR; |
| 1294 | struct rb_node *n, *first_n; | 1300 | struct rb_node *n, *first_n; |
| @@ -1304,14 +1310,12 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu, · 9 unmodified lines | |||
| 1304 | if (unmap_all) { | 1310 | if (unmap_all) { |
| 1305 | if (iova || size) | 1311 | if (iova || size) |
| 1306 | goto unlock; | 1312 | goto unlock; |
| 1307 | size = SIZE_MAX; | 1313 | size = U64_MAX; |
| 1308 | } else if (!size || size & (pgsize - 1)) { | 1314 | } else if (!size || size & (pgsize - 1) || |
| 1315 | iova + size - 1 < iova || size > SIZE_MAX) { | ||
| 1309 | goto unlock; | 1316 | goto unlock; |
| 1310 | } | 1317 | } |
| 1311 | 1318 | ||
| 1312 | if (iova + size - 1 < iova || size > SIZE_MAX) | ||
| 1313 | goto unlock; | ||
| 1314 | |||
| 1315 | /* When dirty tracking is enabled, allow only min supported pgsize */ | 1319 | /* When dirty tracking is enabled, allow only min supported pgsize */ |
| 1316 | if ((unmap->flags & VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP) && | 1320 | if ((unmap->flags & VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP) && |
| 1317 | (!iommu->dirty_page_tracking || (bitmap->pgsize != pgsize))) { | 1321 | (!iommu->dirty_page_tracking || (bitmap->pgsize != pgsize))) { |
| @@ -308,8 +308,10 @@ static long vhost_vdpa_get_vring_num(struct vhost_vdpa *v, u16 __user *argp) · 307 unmodified lines | |||
| 308 | 308 | ||
| 309 | static void vhost_vdpa_config_put(struct vhost_vdpa *v) | 309 | static void vhost_vdpa_config_put(struct vhost_vdpa *v) |
| 310 | { | 310 | { |
| 311 | if (v->config_ctx) | 311 | if (v->config_ctx) { |
| 312 | eventfd_ctx_put(v->config_ctx); | 312 | eventfd_ctx_put(v->config_ctx); |
| 313 | v->config_ctx = NULL; | ||
| 314 | } | ||
| 313 | } | 315 | } |
| 314 | 316 | ||
| 315 | static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp) | 317 | static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp) |
| @@ -329,8 +331,12 @@ static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp) · 13 unmodified lines | |||
| 329 | if (!IS_ERR_OR_NULL(ctx)) | 331 | if (!IS_ERR_OR_NULL(ctx)) |
| 330 | eventfd_ctx_put(ctx); | 332 | eventfd_ctx_put(ctx); |
| 331 | 333 | ||
| 332 | if (IS_ERR(v->config_ctx)) | 334 | if (IS_ERR(v->config_ctx)) { |
| 333 | return PTR_ERR(v->config_ctx); | 335 | long ret = PTR_ERR(v->config_ctx); |
| 336 | |||
| 337 | v->config_ctx = NULL; | ||
| 338 | return ret; | ||
| 339 | } | ||
| 334 | 340 | ||
| 335 | v->vdpa->config->set_config_cb(v->vdpa, &cb); | 341 | v->vdpa->config->set_config_cb(v->vdpa, &cb); |
| 336 | 342 | ||
| @@ -900,14 +906,10 @@ err: · 563 unmodified lines | |||
| 900 | 906 | ||
| 901 | static void vhost_vdpa_clean_irq(struct vhost_vdpa *v) | 907 | static void vhost_vdpa_clean_irq(struct vhost_vdpa *v) |
| 902 | { | 908 | { |
| 903 | struct vhost_virtqueue *vq; | ||
| 904 | int i; | 909 | int i; |
| 905 | 910 | ||
| 906 | for (i = 0; i < v->nvqs; i++) { | 911 | for (i = 0; i < v->nvqs; i++) |
| 907 | vq = &v->vqs[i]; | 912 | vhost_vdpa_unsetup_vq_irq(v, i); |
| 908 | if (vq->call_ctx.producer.irq) | ||
| 909 | irq_bypass_unregister_producer(&vq->call_ctx.producer); | ||
| 910 | } | ||
| 911 | } | 913 | } |
| 912 | 914 | ||
| 913 | static int vhost_vdpa_release(struct inode *inode, struct file *filep) | 915 | static int vhost_vdpa_release(struct inode *inode, struct file *filep) |
| @@ -332,8 +332,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, · 331 unmodified lines | |||
| 332 | vq->error_ctx = NULL; | 332 | vq->error_ctx = NULL; |
| 333 | vq->kick = NULL; | 333 | vq->kick = NULL; |
| 334 | vq->log_ctx = NULL; | 334 | vq->log_ctx = NULL; |
| 335 | vhost_reset_is_le(vq); | ||
| 336 | vhost_disable_cross_endian(vq); | 335 | vhost_disable_cross_endian(vq); |
| 336 | vhost_reset_is_le(vq); | ||
| 337 | vq->busyloop_timeout = 0; | 337 | vq->busyloop_timeout = 0; |
| 338 | vq->umem = NULL; | 338 | vq->umem = NULL; |
| 339 | vq->iotlb = NULL; | 339 | vq->iotlb = NULL; |
| @@ -141,15 +141,14 @@ void virtio_config_changed(struct virtio_device *dev) · 140 unmodified lines | |||
| 141 | } | 141 | } |
| 142 | EXPORT_SYMBOL_GPL(virtio_config_changed); | 142 | EXPORT_SYMBOL_GPL(virtio_config_changed); |
| 143 | 143 | ||
| 144 | void virtio_config_disable(struct virtio_device *dev) | 144 | static void virtio_config_disable(struct virtio_device *dev) |
| 145 | { | 145 | { |
| 146 | spin_lock_irq(&dev->config_lock); | 146 | spin_lock_irq(&dev->config_lock); |
| 147 | dev->config_enabled = false; | 147 | dev->config_enabled = false; |
| 148 | spin_unlock_irq(&dev->config_lock); | 148 | spin_unlock_irq(&dev->config_lock); |
| 149 | } | 149 | } |
| 150 | EXPORT_SYMBOL_GPL(virtio_config_disable); | ||
| 151 | 150 | ||
| 152 | void virtio_config_enable(struct virtio_device *dev) | 151 | static void virtio_config_enable(struct virtio_device *dev) |
| 153 | { | 152 | { |
| 154 | spin_lock_irq(&dev->config_lock); | 153 | spin_lock_irq(&dev->config_lock); |
| 155 | dev->config_enabled = true; | 154 | dev->config_enabled = true; |
| @@ -158,7 +157,6 @@ void virtio_config_enable(struct virtio_device *dev) · 2 unmodified lines | |||
| 158 | dev->config_change_pending = false; | 157 | dev->config_change_pending = false; |
| 159 | spin_unlock_irq(&dev->config_lock); | 158 | spin_unlock_irq(&dev->config_lock); |
| 160 | } | 159 | } |
| 161 | EXPORT_SYMBOL_GPL(virtio_config_enable); | ||
| 162 | 160 | ||
| 163 | void virtio_add_status(struct virtio_device *dev, unsigned int status) | 161 | void virtio_add_status(struct virtio_device *dev, unsigned int status) |
| 164 | { | 162 | { |
| @@ -548,8 +548,7 @@ static void virtio_mmio_release_dev(struct device *_d) · 547 unmodified lines | |||
| 548 | { | 548 | { |
| 549 | struct virtio_device *vdev = | 549 | struct virtio_device *vdev = |
| 550 | container_of(_d, struct virtio_device, dev); | 550 | container_of(_d, struct virtio_device, dev); |
| 551 | struct virtio_mmio_device *vm_dev = | 551 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); |
| 552 | container_of(vdev, struct virtio_mmio_device, vdev); | ||
| 553 | struct platform_device *pdev = vm_dev->pdev; | 552 | struct platform_device *pdev = vm_dev->pdev; |
| 554 | 553 | ||
| 555 | devm_kfree(&pdev->dev, vm_dev); | 554 | devm_kfree(&pdev->dev, vm_dev); |
| @@ -273,7 +273,6 @@ module_exit(cpu5wdt_exit_module); · 272 unmodified lines | |||
| 273 | 273 | ||
| 274 | MODULE_AUTHOR("Heiko Ronsdorf <hero@ihg.uni-duisburg.de>"); | 274 | MODULE_AUTHOR("Heiko Ronsdorf <hero@ihg.uni-duisburg.de>"); |
| 275 | MODULE_DESCRIPTION("sma cpu5 watchdog driver"); | 275 | MODULE_DESCRIPTION("sma cpu5 watchdog driver"); |
| 276 | MODULE_SUPPORTED_DEVICE("sma cpu5 watchdog"); | ||
| 277 | MODULE_LICENSE("GPL"); | 276 | MODULE_LICENSE("GPL"); |
| 278 | 277 | ||
| 279 | module_param_hw(port, int, ioport, 0); | 278 | module_param_hw(port, int, ioport, 0); |
| @@ -172,7 +172,6 @@ MODULE_PARM_DESC(wd2_timeout, "Default watchdog2 timeout in 1/10secs"); · 171 unmodified lines | |||
| 172 | MODULE_AUTHOR("Eric Brower <ebrower@usa.net>"); | 172 | MODULE_AUTHOR("Eric Brower <ebrower@usa.net>"); |
| 173 | MODULE_DESCRIPTION("Hardware watchdog driver for Sun Microsystems CP1400/1500"); | 173 | MODULE_DESCRIPTION("Hardware watchdog driver for Sun Microsystems CP1400/1500"); |
| 174 | MODULE_LICENSE("GPL"); | 174 | MODULE_LICENSE("GPL"); |
| 175 | MODULE_SUPPORTED_DEVICE("watchdog"); | ||
| 176 | 175 | ||
| 177 | static void cpwd_writew(u16 val, void __iomem *addr) | 176 | static void cpwd_writew(u16 val, void __iomem *addr) |
| 178 | { | 177 | { |
| @@ -46,7 +46,6 @@ · 45 unmodified lines | |||
| 46 | 46 | ||
| 47 | MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); | 47 | MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); |
| 48 | MODULE_DESCRIPTION("Hardware watchdog driver for Sun RIO"); | 48 | MODULE_DESCRIPTION("Hardware watchdog driver for Sun RIO"); |
| 49 | MODULE_SUPPORTED_DEVICE("watchdog"); | ||
| 50 | MODULE_LICENSE("GPL"); | 49 | MODULE_LICENSE("GPL"); |
| 51 | 50 | ||
| 52 | #define DRIVER_NAME "riowd" | 51 | #define DRIVER_NAME "riowd" |
| @@ -50,11 +50,11 @@ config XEN_BALLOON_MEMORY_HOTPLUG · 49 unmodified lines | |||
| 50 | 50 | ||
| 51 | SUBSYSTEM=="memory", ACTION=="add", RUN+="/bin/sh -c '[ -f /sys$devpath/state ] && echo online > /sys$devpath/state'" | 51 | SUBSYSTEM=="memory", ACTION=="add", RUN+="/bin/sh -c '[ -f /sys$devpath/state ] && echo online > /sys$devpath/state'" |
| 52 | 52 | ||
| 53 | config XEN_BALLOON_MEMORY_HOTPLUG_LIMIT | 53 | config XEN_MEMORY_HOTPLUG_LIMIT |
| 54 | int "Hotplugged memory limit (in GiB) for a PV guest" | 54 | int "Hotplugged memory limit (in GiB) for a PV guest" |
| 55 | default 512 | 55 | default 512 |
| 56 | depends on XEN_HAVE_PVMMU | 56 | depends on XEN_HAVE_PVMMU |
| 57 | depends on XEN_BALLOON_MEMORY_HOTPLUG | 57 | depends on MEMORY_HOTPLUG |
| 58 | help | 58 | help |
| 59 | Maxmium amount of memory (in GiB) that a PV guest can be | 59 | Maxmium amount of memory (in GiB) that a PV guest can be |
| 60 | expanded to when using memory hotplug. | 60 | expanded to when using memory hotplug. |
| @@ -851,8 +851,7 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) · 850 unmodified lines | |||
| 851 | fscache_wait_on_page_write(vnode->cache, vmf->page); | 851 | fscache_wait_on_page_write(vnode->cache, vmf->page); |
| 852 | #endif | 852 | #endif |
| 853 | 853 | ||
| 854 | if (PageWriteback(vmf->page) && | 854 | if (wait_on_page_writeback_killable(vmf->page)) |
| 855 | wait_on_page_bit_killable(vmf->page, PG_writeback) < 0) | ||
| 856 | return VM_FAULT_RETRY; | 855 | return VM_FAULT_RETRY; |
| 857 | 856 | ||
| 858 | if (lock_page_killable(vmf->page) < 0) | 857 | if (lock_page_killable(vmf->page) < 0) |
| @@ -1240,13 +1240,13 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate) · 1239 unmodified lines | |||
| 1240 | 1240 | ||
| 1241 | lockdep_assert_held(&bdev->bd_mutex); | 1241 | lockdep_assert_held(&bdev->bd_mutex); |
| 1242 | 1242 | ||
| 1243 | clear_bit(GD_NEED_PART_SCAN, &bdev->bd_disk->state); | ||
| 1244 | |||
| 1245 | rescan: | 1243 | rescan: |
| 1246 | ret = blk_drop_partitions(bdev); | 1244 | ret = blk_drop_partitions(bdev); |
| 1247 | if (ret) | 1245 | if (ret) |
| 1248 | return ret; | 1246 | return ret; |
| 1249 | 1247 | ||
| 1248 | clear_bit(GD_NEED_PART_SCAN, &disk->state); | ||
| 1249 | |||
| 1250 | /* | 1250 | /* |
| 1251 | * Historically we only set the capacity to zero for devices that | 1251 | * Historically we only set the capacity to zero for devices that |
| 1252 | * support partitions (independ of actually having partitions created). | 1252 | * support partitions (independ of actually having partitions created). |
| @@ -7,10 +7,12 @@ subdir-ccflags-y += -Wmissing-format-attribute · 6 unmodified lines | |||
| 7 | subdir-ccflags-y += -Wmissing-prototypes | 7 | subdir-ccflags-y += -Wmissing-prototypes |
| 8 | subdir-ccflags-y += -Wold-style-definition | 8 | subdir-ccflags-y += -Wold-style-definition |
| 9 | subdir-ccflags-y += -Wmissing-include-dirs | 9 | subdir-ccflags-y += -Wmissing-include-dirs |
| 10 | subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable) | 10 | condflags := \ |
| 11 | subdir-ccflags-y += $(call cc-option, -Wunused-const-variable) | 11 | $(call cc-option, -Wunused-but-set-variable) \ |
| 12 | subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned) | 12 | $(call cc-option, -Wunused-const-variable) \ |
| 13 | subdir-ccflags-y += $(call cc-option, -Wstringop-truncation) | 13 | $(call cc-option, -Wpacked-not-aligned) \ |
| 14 | $(call cc-option, -Wstringop-truncation) | ||
| 15 | subdir-ccflags-y += $(condflags) | ||
| 14 | # The following turn off the warnings enabled by -Wextra | 16 | # The following turn off the warnings enabled by -Wextra |
| 15 | subdir-ccflags-y += -Wno-missing-field-initializers | 17 | subdir-ccflags-y += -Wno-missing-field-initializers |
| 16 | subdir-ccflags-y += -Wno-sign-compare | 18 | subdir-ccflags-y += -Wno-sign-compare |
| @@ -1365,7 +1365,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq) · 1364 unmodified lines | |||
| 1365 | "failed to read tree block %llu from get_old_root", | 1365 | "failed to read tree block %llu from get_old_root", |
| 1366 | logical); | 1366 | logical); |
| 1367 | } else { | 1367 | } else { |
| 1368 | btrfs_tree_read_lock(old); | ||
| 1368 | eb = btrfs_clone_extent_buffer(old); | 1369 | eb = btrfs_clone_extent_buffer(old); |
| 1370 | btrfs_tree_read_unlock(old); | ||
| 1369 | free_extent_buffer(old); | 1371 | free_extent_buffer(old); |
| 1370 | } | 1372 | } |
| 1371 | } else if (old_root) { | 1373 | } else if (old_root) { |
| @@ -81,6 +81,9 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info) · 80 unmodified lines | |||
| 81 | struct btrfs_dev_replace_item *ptr; | 81 | struct btrfs_dev_replace_item *ptr; |
| 82 | u64 src_devid; | 82 | u64 src_devid; |
| 83 | 83 | ||
| 84 | if (!dev_root) | ||
| 85 | return 0; | ||
| 86 | |||
| 84 | path = btrfs_alloc_path(); | 87 | path = btrfs_alloc_path(); |
| 85 | if (!path) { | 88 | if (!path) { |
| 86 | ret = -ENOMEM; | 89 | ret = -ENOMEM; |
| @@ -2387,8 +2387,9 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info) · 2386 unmodified lines | |||
| 2387 | } else { | 2387 | } else { |
| 2388 | set_bit(BTRFS_ROOT_TRACK_DIRTY, &root->state); | 2388 | set_bit(BTRFS_ROOT_TRACK_DIRTY, &root->state); |
| 2389 | fs_info->dev_root = root; | 2389 | fs_info->dev_root = root; |
| 2390 | btrfs_init_devices_late(fs_info); | ||
| 2391 | } | 2390 | } |
| 2391 | /* Initialize fs_info for all devices in any case */ | ||
| 2392 | btrfs_init_devices_late(fs_info); | ||
| 2392 | 2393 | ||
| 2393 | /* If IGNOREDATACSUMS is set don't bother reading the csum root. */ | 2394 | /* If IGNOREDATACSUMS is set don't bother reading the csum root. */ |
| 2394 | if (!btrfs_test_opt(fs_info, IGNOREDATACSUMS)) { | 2395 | if (!btrfs_test_opt(fs_info, IGNOREDATACSUMS)) { |
| @@ -3009,6 +3010,21 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info) · 614 unmodified lines | |||
| 3009 | } | 3010 | } |
| 3010 | } | 3011 | } |
| 3011 | 3012 | ||
| 3013 | /* | ||
| 3014 | * btrfs_find_orphan_roots() is responsible for finding all the dead | ||
| 3015 | * roots (with 0 refs), flag them with BTRFS_ROOT_DEAD_TREE and load | ||
| 3016 | * them into the fs_info->fs_roots_radix tree. This must be done before | ||
| 3017 | * calling btrfs_orphan_cleanup() on the tree root. If we don't do it | ||
| 3018 | * first, then btrfs_orphan_cleanup() will delete a dead root's orphan | ||
| 3019 | * item before the root's tree is deleted - this means that if we unmount | ||
| 3020 | * or crash before the deletion completes, on the next mount we will not | ||
| 3021 | * delete what remains of the tree because the orphan item does not | ||
| 3022 | * exists anymore, which is what tells us we have a pending deletion. | ||
| 3023 | */ | ||
| 3024 | ret = btrfs_find_orphan_roots(fs_info); | ||
| 3025 | if (ret) | ||
| 3026 | goto out; | ||
| 3027 | |||
| 3012 | ret = btrfs_cleanup_fs_roots(fs_info); | 3028 | ret = btrfs_cleanup_fs_roots(fs_info); |
| 3013 | if (ret) | 3029 | if (ret) |
| 3014 | goto out; | 3030 | goto out; |
| @@ -3068,7 +3084,6 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info) · 53 unmodified lines | |||
| 3068 | } | 3084 | } |
| 3069 | } | 3085 | } |
| 3070 | 3086 | ||
| 3071 | ret = btrfs_find_orphan_roots(fs_info); | ||
| 3072 | out: | 3087 | out: |
| 3073 | return ret; | 3088 | return ret; |
| 3074 | } | 3089 | } |
| @@ -3323,6 +3323,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, · 3322 unmodified lines | |||
| 3323 | 3323 | ||
| 3324 | if (last_ref && btrfs_header_generation(buf) == trans->transid) { | 3324 | if (last_ref && btrfs_header_generation(buf) == trans->transid) { |
| 3325 | struct btrfs_block_group *cache; | 3325 | struct btrfs_block_group *cache; |
| 3326 | bool must_pin = false; | ||
| 3326 | 3327 | ||
| 3327 | if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) { | 3328 | if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) { |
| 3328 | ret = check_ref_cleanup(trans, buf->start); | 3329 | ret = check_ref_cleanup(trans, buf->start); |
| @@ -3340,7 +3341,27 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, · 11 unmodified lines | |||
| 3340 | goto out; | 3341 | goto out; |
| 3341 | } | 3342 | } |
| 3342 | 3343 | ||
| 3343 | if (btrfs_is_zoned(fs_info)) { | 3344 | /* |
| 3345 | * If this is a leaf and there are tree mod log users, we may | ||
| 3346 | * have recorded mod log operations that point to this leaf. | ||
| 3347 | * So we must make sure no one reuses this leaf's extent before | ||
| 3348 | * mod log operations are applied to a node, otherwise after | ||
| 3349 | * rewinding a node using the mod log operations we get an | ||
| 3350 | * inconsistent btree, as the leaf's extent may now be used as | ||
| 3351 | * a node or leaf for another different btree. | ||
| 3352 | * We are safe from races here because at this point no other | ||
| 3353 | * node or root points to this extent buffer, so if after this | ||
| 3354 | * check a new tree mod log user joins, it will not be able to | ||
| 3355 | * find a node pointing to this leaf and record operations that | ||
| 3356 | * point to this leaf. | ||
| 3357 | */ | ||
| 3358 | if (btrfs_header_level(buf) == 0) { | ||
| 3359 | read_lock(&fs_info->tree_mod_log_lock); | ||
| 3360 | must_pin = !list_empty(&fs_info->tree_mod_seq_list); | ||
| 3361 | read_unlock(&fs_info->tree_mod_log_lock); | ||
| 3362 | } | ||
| 3363 | |||
| 3364 | if (must_pin || btrfs_is_zoned(fs_info)) { | ||
| 3344 | btrfs_redirty_list_add(trans->transaction, buf); | 3365 | btrfs_redirty_list_add(trans->transaction, buf); |
| 3345 | pin_down_extent(trans, cache, buf->start, buf->len, 1); | 3366 | pin_down_extent(trans, cache, buf->start, buf->len, 1); |
| 3346 | btrfs_put_block_group(cache); | 3367 | btrfs_put_block_group(cache); |
| @@ -2885,6 +2885,35 @@ static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len) · 2884 unmodified lines | |||
| 2885 | btrfs_subpage_end_reader(fs_info, page, start, len); | 2885 | btrfs_subpage_end_reader(fs_info, page, start, len); |
| 2886 | } | 2886 | } |
| 2887 | 2887 | ||
| 2888 | /* | ||
| 2889 | * Find extent buffer for a givne bytenr. | ||
| 2890 | * | ||
| 2891 | * This is for end_bio_extent_readpage(), thus we can't do any unsafe locking | ||
| 2892 | * in endio context. | ||
| 2893 | */ | ||
| 2894 | static struct extent_buffer *find_extent_buffer_readpage( | ||
| 2895 | struct btrfs_fs_info *fs_info, struct page *page, u64 bytenr) | ||
| 2896 | { | ||
| 2897 | struct extent_buffer *eb; | ||
| 2898 | |||
| 2899 | /* | ||
| 2900 | * For regular sectorsize, we can use page->private to grab extent | ||
| 2901 | * buffer | ||
| 2902 | */ | ||
| 2903 | if (fs_info->sectorsize == PAGE_SIZE) { | ||
| 2904 | ASSERT(PagePrivate(page) && page->private); | ||
| 2905 | return (struct extent_buffer *)page->private; | ||
| 2906 | } | ||
| 2907 | |||
| 2908 | /* For subpage case, we need to lookup buffer radix tree */ | ||
| 2909 | rcu_read_lock(); | ||
| 2910 | eb = radix_tree_lookup(&fs_info->buffer_radix, | ||
| 2911 | bytenr >> fs_info->sectorsize_bits); | ||
| 2912 | rcu_read_unlock(); | ||
| 2913 | ASSERT(eb); | ||
| 2914 | return eb; | ||
| 2915 | } | ||
| 2916 | |||
| 2888 | /* | 2917 | /* |
| 2889 | * after a readpage IO is done, we need to: | 2918 | * after a readpage IO is done, we need to: |
| 2890 | * clear the uptodate bits on error | 2919 | * clear the uptodate bits on error |
| @@ -2996,7 +3025,7 @@ static void end_bio_extent_readpage(struct bio *bio) · 105 unmodified lines | |||
| 2996 | } else { | 3025 | } else { |
| 2997 | struct extent_buffer *eb; | 3026 | struct extent_buffer *eb; |
| 2998 | 3027 | ||
| 2999 | eb = (struct extent_buffer *)page->private; | 3028 | eb = find_extent_buffer_readpage(fs_info, page, start); |
| 3000 | set_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags); | 3029 | set_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags); |
| 3001 | eb->read_mirror = mirror; | 3030 | eb->read_mirror = mirror; |
| 3002 | atomic_dec(&eb->io_pages); | 3031 | atomic_dec(&eb->io_pages); |
| @@ -3020,7 +3049,7 @@ readpage_ok: · 17 unmodified lines | |||
| 3020 | */ | 3049 | */ |
| 3021 | if (page->index == end_index && i_size <= end) { | 3050 | if (page->index == end_index && i_size <= end) { |
| 3022 | u32 zero_start = max(offset_in_page(i_size), | 3051 | u32 zero_start = max(offset_in_page(i_size), |
| 3023 | offset_in_page(end)); | 3052 | offset_in_page(start)); |
| 3024 | 3053 | ||
| 3025 | zero_user_segment(page, zero_start, | 3054 | zero_user_segment(page, zero_start, |
| 3026 | offset_in_page(end) + 1); | 3055 | offset_in_page(end) + 1); |
| @@ -3099,11 +3099,13 @@ void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start, · 3098 unmodified lines | |||
| 3099 | * @bio_offset: offset to the beginning of the bio (in bytes) | 3099 | * @bio_offset: offset to the beginning of the bio (in bytes) |
| 3100 | * @page: page where is the data to be verified | 3100 | * @page: page where is the data to be verified |
| 3101 | * @pgoff: offset inside the page | 3101 | * @pgoff: offset inside the page |
| 3102 | * @start: logical offset in the file | ||
| 3102 | * | 3103 | * |
| 3103 | * The length of such check is always one sector size. | 3104 | * The length of such check is always one sector size. |
| 3104 | */ | 3105 | */ |
| 3105 | static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio, | 3106 | static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio, |
| 3106 | u32 bio_offset, struct page *page, u32 pgoff) | 3107 | u32 bio_offset, struct page *page, u32 pgoff, |
| 3108 | u64 start) | ||
| 3107 | { | 3109 | { |
| 3108 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 3110 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
| 3109 | SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); | 3111 | SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); |
| @@ -3130,8 +3132,8 @@ static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio, · 20 unmodified lines | |||
| 3130 | kunmap_atomic(kaddr); | 3132 | kunmap_atomic(kaddr); |
| 3131 | return 0; | 3133 | return 0; |
| 3132 | zeroit: | 3134 | zeroit: |
| 3133 | btrfs_print_data_csum_error(BTRFS_I(inode), page_offset(page) + pgoff, | 3135 | btrfs_print_data_csum_error(BTRFS_I(inode), start, csum, csum_expected, |
| 3134 | csum, csum_expected, io_bio->mirror_num); | 3136 | io_bio->mirror_num); |
| 3135 | if (io_bio->device) | 3137 | if (io_bio->device) |
| 3136 | btrfs_dev_stat_inc_and_print(io_bio->device, | 3138 | btrfs_dev_stat_inc_and_print(io_bio->device, |
| 3137 | BTRFS_DEV_STAT_CORRUPTION_ERRS); | 3139 | BTRFS_DEV_STAT_CORRUPTION_ERRS); |
| @@ -3184,7 +3186,8 @@ int btrfs_verify_data_csum(struct btrfs_io_bio *io_bio, u32 bio_offset, · 46 unmodified lines | |||
| 3184 | pg_off += sectorsize, bio_offset += sectorsize) { | 3186 | pg_off += sectorsize, bio_offset += sectorsize) { |
| 3185 | int ret; | 3187 | int ret; |
| 3186 | 3188 | ||
| 3187 | ret = check_data_csum(inode, io_bio, bio_offset, page, pg_off); | 3189 | ret = check_data_csum(inode, io_bio, bio_offset, page, pg_off, |
| 3190 | page_offset(page) + pg_off); | ||
| 3188 | if (ret < 0) | 3191 | if (ret < 0) |
| 3189 | return -EIO; | 3192 | return -EIO; |
| 3190 | } | 3193 | } |
| @@ -7910,7 +7913,8 @@ static blk_status_t btrfs_check_read_dio_bio(struct inode *inode, · 4719 unmodified lines | |||
| 7910 | ASSERT(pgoff < PAGE_SIZE); | 7913 | ASSERT(pgoff < PAGE_SIZE); |
| 7911 | if (uptodate && | 7914 | if (uptodate && |
| 7912 | (!csum || !check_data_csum(inode, io_bio, | 7915 | (!csum || !check_data_csum(inode, io_bio, |
| 7913 | bio_offset, bvec.bv_page, pgoff))) { | 7916 | bio_offset, bvec.bv_page, |
| 7917 | pgoff, start))) { | ||
| 7914 | clean_io_failure(fs_info, failure_tree, io_tree, | 7918 | clean_io_failure(fs_info, failure_tree, io_tree, |
| 7915 | start, bvec.bv_page, | 7919 | start, bvec.bv_page, |
| 7916 | btrfs_ino(BTRFS_I(inode)), | 7920 | btrfs_ino(BTRFS_I(inode)), |
| @@ -8169,10 +8173,6 @@ static blk_qc_t btrfs_submit_direct(struct inode *inode, struct iomap *iomap, · 252 unmodified lines | |||
| 8169 | bio->bi_end_io = btrfs_end_dio_bio; | 8173 | bio->bi_end_io = btrfs_end_dio_bio; |
| 8170 | btrfs_io_bio(bio)->logical = file_offset; | 8174 | btrfs_io_bio(bio)->logical = file_offset; |
| 8171 | 8175 | ||
| 8172 | WARN_ON_ONCE(write && btrfs_is_zoned(fs_info) && | ||
| 8173 | fs_info->max_zone_append_size && | ||
| 8174 | bio_op(bio) != REQ_OP_ZONE_APPEND); | ||
| 8175 | |||
| 8176 | if (bio_op(bio) == REQ_OP_ZONE_APPEND) { | 8176 | if (bio_op(bio) == REQ_OP_ZONE_APPEND) { |
| 8177 | status = extract_ordered_extent(BTRFS_I(inode), bio, | 8177 | status = extract_ordered_extent(BTRFS_I(inode), bio, |
| 8178 | file_offset); | 8178 | file_offset); |
| @@ -9008,7 +9008,7 @@ int __init btrfs_init_cachep(void) · 829 unmodified lines | |||
| 9008 | 9008 | ||
| 9009 | btrfs_free_space_bitmap_cachep = kmem_cache_create("btrfs_free_space_bitmap", | 9009 | btrfs_free_space_bitmap_cachep = kmem_cache_create("btrfs_free_space_bitmap", |
| 9010 | PAGE_SIZE, PAGE_SIZE, | 9010 | PAGE_SIZE, PAGE_SIZE, |
| 9011 | SLAB_RED_ZONE, NULL); | 9011 | SLAB_MEM_SPREAD, NULL); |
| 9012 | if (!btrfs_free_space_bitmap_cachep) | 9012 | if (!btrfs_free_space_bitmap_cachep) |
| 9013 | goto fail; | 9013 | goto fail; |
| 9014 | 9014 | ||
| @@ -9877,6 +9877,7 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent( · 862 unmodified lines | |||
| 9877 | struct btrfs_path *path; | 9877 | struct btrfs_path *path; |
| 9878 | u64 start = ins->objectid; | 9878 | u64 start = ins->objectid; |
| 9879 | u64 len = ins->offset; | 9879 | u64 len = ins->offset; |
| 9880 | int qgroup_released; | ||
| 9880 | int ret; | 9881 | int ret; |
| 9881 | 9882 | ||
| 9882 | memset(&stack_fi, 0, sizeof(stack_fi)); | 9883 | memset(&stack_fi, 0, sizeof(stack_fi)); |
| @@ -9889,16 +9890,16 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent( · 6 unmodified lines | |||
| 9889 | btrfs_set_stack_file_extent_compression(&stack_fi, BTRFS_COMPRESS_NONE); | 9890 | btrfs_set_stack_file_extent_compression(&stack_fi, BTRFS_COMPRESS_NONE); |
| 9890 | /* Encryption and other encoding is reserved and all 0 */ | 9891 | /* Encryption and other encoding is reserved and all 0 */ |
| 9891 | 9892 | ||
| 9892 | ret = btrfs_qgroup_release_data(inode, file_offset, len); | 9893 | qgroup_released = btrfs_qgroup_release_data(inode, file_offset, len); |
| 9893 | if (ret < 0) | 9894 | if (qgroup_released < 0) |
| 9894 | return ERR_PTR(ret); | 9895 | return ERR_PTR(qgroup_released); |
| 9895 | 9896 | ||
| 9896 | if (trans) { | 9897 | if (trans) { |
| 9897 | ret = insert_reserved_file_extent(trans, inode, | 9898 | ret = insert_reserved_file_extent(trans, inode, |
| 9898 | file_offset, &stack_fi, | 9899 | file_offset, &stack_fi, |
| 9899 | true, ret); | 9900 | true, qgroup_released); |
| 9900 | if (ret) | 9901 | if (ret) |
| 9901 | return ERR_PTR(ret); | 9902 | goto free_qgroup; |
| 9902 | return trans; | 9903 | return trans; |
| 9903 | } | 9904 | } |
| 9904 | 9905 | ||
| @@ -9909,21 +9910,35 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent( · 4 unmodified lines | |||
| 9909 | extent_info.file_offset = file_offset; | 9910 | extent_info.file_offset = file_offset; |
| 9910 | extent_info.extent_buf = (char *)&stack_fi; | 9911 | extent_info.extent_buf = (char *)&stack_fi; |
| 9911 | extent_info.is_new_extent = true; | 9912 | extent_info.is_new_extent = true; |
| 9912 | extent_info.qgroup_reserved = ret; | 9913 | extent_info.qgroup_reserved = qgroup_released; |
| 9913 | extent_info.insertions = 0; | 9914 | extent_info.insertions = 0; |
| 9914 | 9915 | ||
| 9915 | path = btrfs_alloc_path(); | 9916 | path = btrfs_alloc_path(); |
| 9916 | if (!path) | 9917 | if (!path) { |
| 9917 | return ERR_PTR(-ENOMEM); | 9918 | ret = -ENOMEM; |
| 9919 | goto free_qgroup; | ||
| 9920 | } | ||
| 9918 | 9921 | ||
| 9919 | ret = btrfs_replace_file_extents(&inode->vfs_inode, path, file_offset, | 9922 | ret = btrfs_replace_file_extents(&inode->vfs_inode, path, file_offset, |
| 9920 | file_offset + len - 1, &extent_info, | 9923 | file_offset + len - 1, &extent_info, |
| 9921 | &trans); | 9924 | &trans); |
| 9922 | btrfs_free_path(path); | 9925 | btrfs_free_path(path); |
| 9923 | if (ret) | 9926 | if (ret) |
| 9924 | return ERR_PTR(ret); | 9927 | goto free_qgroup; |
| 9925 | |||
| 9926 | return trans; | 9928 | return trans; |
| 9929 | |||
| 9930 | free_qgroup: | ||
| 9931 | /* | ||
| 9932 | * We have released qgroup data range at the beginning of the function, | ||
| 9933 | * and normally qgroup_released bytes will be freed when committing | ||
| 9934 | * transaction. | ||
| 9935 | * But if we error out early, we have to free what we have released | ||
| 9936 | * or we leak qgroup data reservation. | ||
| 9937 | */ | ||
| 9938 | btrfs_qgroup_free_refroot(inode->root->fs_info, | ||
| 9939 | inode->root->root_key.objectid, qgroup_released, | ||
| 9940 | BTRFS_QGROUP_RSV_DATA); | ||
| 9941 | return ERR_PTR(ret); | ||
| 9927 | } | 9942 | } |
| 9928 | 9943 | ||
| 9929 | static int __btrfs_prealloc_file_range(struct inode *inode, int mode, | 9944 | static int __btrfs_prealloc_file_range(struct inode *inode, int mode, |
| @@ -226,7 +226,6 @@ static void __del_qgroup_rb(struct btrfs_fs_info *fs_info, · 225 unmodified lines | |||
| 226 | { | 226 | { |
| 227 | struct btrfs_qgroup_list *list; | 227 | struct btrfs_qgroup_list *list; |
| 228 | 228 | ||
| 229 | btrfs_sysfs_del_one_qgroup(fs_info, qgroup); | ||
| 230 | list_del(&qgroup->dirty); | 229 | list_del(&qgroup->dirty); |
| 231 | while (!list_empty(&qgroup->groups)) { | 230 | while (!list_empty(&qgroup->groups)) { |
| 232 | list = list_first_entry(&qgroup->groups, | 231 | list = list_first_entry(&qgroup->groups, |
| @@ -243,7 +242,6 @@ static void __del_qgroup_rb(struct btrfs_fs_info *fs_info, · 10 unmodified lines | |||
| 243 | list_del(&list->next_member); | 242 | list_del(&list->next_member); |
| 244 | kfree(list); | 243 | kfree(list); |
| 245 | } | 244 | } |
| 246 | kfree(qgroup); | ||
| 247 | } | 245 | } |
| 248 | 246 | ||
| 249 | /* must be called with qgroup_lock held */ | 247 | /* must be called with qgroup_lock held */ |
| @@ -569,6 +567,8 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info) · 319 unmodified lines | |||
| 569 | qgroup = rb_entry(n, struct btrfs_qgroup, node); | 567 | qgroup = rb_entry(n, struct btrfs_qgroup, node); |
| 570 | rb_erase(n, &fs_info->qgroup_tree); | 568 | rb_erase(n, &fs_info->qgroup_tree); |
| 571 | __del_qgroup_rb(fs_info, qgroup); | 569 | __del_qgroup_rb(fs_info, qgroup); |
| 570 | btrfs_sysfs_del_one_qgroup(fs_info, qgroup); | ||
| 571 | kfree(qgroup); | ||
| 572 | } | 572 | } |
| 573 | /* | 573 | /* |
| 574 | * We call btrfs_free_qgroup_config() when unmounting | 574 | * We call btrfs_free_qgroup_config() when unmounting |
| @@ -1578,6 +1578,14 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid) · 1003 unmodified lines | |||
| 1578 | spin_lock(&fs_info->qgroup_lock); | 1578 | spin_lock(&fs_info->qgroup_lock); |
| 1579 | del_qgroup_rb(fs_info, qgroupid); | 1579 | del_qgroup_rb(fs_info, qgroupid); |
| 1580 | spin_unlock(&fs_info->qgroup_lock); | 1580 | spin_unlock(&fs_info->qgroup_lock); |
| 1581 | |||
| 1582 | /* | ||
| 1583 | * Remove the qgroup from sysfs now without holding the qgroup_lock | ||
| 1584 | * spinlock, since the sysfs_remove_group() function needs to take | ||
| 1585 | * the mutex kernfs_mutex through kernfs_remove_by_name_ns(). | ||
| 1586 | */ | ||
| 1587 | btrfs_sysfs_del_one_qgroup(fs_info, qgroup); | ||
| 1588 | kfree(qgroup); | ||
| 1581 | out: | 1589 | out: |
| 1582 | mutex_unlock(&fs_info->qgroup_ioctl_lock); | 1590 | mutex_unlock(&fs_info->qgroup_ioctl_lock); |
| 1583 | return ret; | 1591 | return ret; |
| @@ -209,7 +209,7 @@ int btree_readahead_hook(struct extent_buffer *eb, int err) · 208 unmodified lines | |||
| 209 | /* find extent */ | 209 | /* find extent */ |
| 210 | spin_lock(&fs_info->reada_lock); | 210 | spin_lock(&fs_info->reada_lock); |
| 211 | re = radix_tree_lookup(&fs_info->reada_tree, | 211 | re = radix_tree_lookup(&fs_info->reada_tree, |
| 212 | eb->start >> PAGE_SHIFT); | 212 | eb->start >> fs_info->sectorsize_bits); |
| 213 | if (re) | 213 | if (re) |
| 214 | re->refcnt++; | 214 | re->refcnt++; |
| 215 | spin_unlock(&fs_info->reada_lock); | 215 | spin_unlock(&fs_info->reada_lock); |
| @@ -240,7 +240,7 @@ static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical, · 24 unmodified lines | |||
| 240 | zone = NULL; | 240 | zone = NULL; |
| 241 | spin_lock(&fs_info->reada_lock); | 241 | spin_lock(&fs_info->reada_lock); |
| 242 | ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, | 242 | ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, |
| 243 | logical >> PAGE_SHIFT, 1); | 243 | logical >> fs_info->sectorsize_bits, 1); |
| 244 | if (ret == 1 && logical >= zone->start && logical <= zone->end) { | 244 | if (ret == 1 && logical >= zone->start && logical <= zone->end) { |
| 245 | kref_get(&zone->refcnt); | 245 | kref_get(&zone->refcnt); |
| 246 | spin_unlock(&fs_info->reada_lock); | 246 | spin_unlock(&fs_info->reada_lock); |
| @@ -283,13 +283,13 @@ static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical, · 36 unmodified lines | |||
| 283 | 283 | ||
| 284 | spin_lock(&fs_info->reada_lock); | 284 | spin_lock(&fs_info->reada_lock); |
| 285 | ret = radix_tree_insert(&dev->reada_zones, | 285 | ret = radix_tree_insert(&dev->reada_zones, |
| 286 | (unsigned long)(zone->end >> PAGE_SHIFT), | 286 | (unsigned long)(zone->end >> fs_info->sectorsize_bits), |
| 287 | zone); | 287 | zone); |
| 288 | 288 | ||
| 289 | if (ret == -EEXIST) { | 289 | if (ret == -EEXIST) { |
| 290 | kfree(zone); | 290 | kfree(zone); |
| 291 | ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, | 291 | ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, |
| 292 | logical >> PAGE_SHIFT, 1); | 292 | logical >> fs_info->sectorsize_bits, 1); |
| 293 | if (ret == 1 && logical >= zone->start && logical <= zone->end) | 293 | if (ret == 1 && logical >= zone->start && logical <= zone->end) |
| 294 | kref_get(&zone->refcnt); | 294 | kref_get(&zone->refcnt); |
| 295 | else | 295 | else |
| @@ -315,7 +315,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info, · 19 unmodified lines | |||
| 315 | u64 length; | 315 | u64 length; |
| 316 | int real_stripes; | 316 | int real_stripes; |
| 317 | int nzones = 0; | 317 | int nzones = 0; |
| 318 | unsigned long index = logical >> PAGE_SHIFT; | 318 | unsigned long index = logical >> fs_info->sectorsize_bits; |
| 319 | int dev_replace_is_ongoing; | 319 | int dev_replace_is_ongoing; |
| 320 | int have_zone = 0; | 320 | int have_zone = 0; |
| 321 | 321 | ||
| @@ -497,7 +497,7 @@ static void reada_extent_put(struct btrfs_fs_info *fs_info, · 175 unmodified lines | |||
| 497 | struct reada_extent *re) | 497 | struct reada_extent *re) |
| 498 | { | 498 | { |
| 499 | int i; | 499 | int i; |
| 500 | unsigned long index = re->logical >> PAGE_SHIFT; | 500 | unsigned long index = re->logical >> fs_info->sectorsize_bits; |
| 501 | 501 | ||
| 502 | spin_lock(&fs_info->reada_lock); | 502 | spin_lock(&fs_info->reada_lock); |
| 503 | if (--re->refcnt) { | 503 | if (--re->refcnt) { |
| @@ -538,11 +538,12 @@ static void reada_extent_put(struct btrfs_fs_info *fs_info, · 34 unmodified lines | |||
| 538 | static void reada_zone_release(struct kref *kref) | 538 | static void reada_zone_release(struct kref *kref) |
| 539 | { | 539 | { |
| 540 | struct reada_zone *zone = container_of(kref, struct reada_zone, refcnt); | 540 | struct reada_zone *zone = container_of(kref, struct reada_zone, refcnt); |
| 541 | struct btrfs_fs_info *fs_info = zone->device->fs_info; | ||
| 541 | 542 | ||
| 542 | lockdep_assert_held(&zone->device->fs_info->reada_lock); | 543 | lockdep_assert_held(&fs_info->reada_lock); |
| 543 | 544 | ||
| 544 | radix_tree_delete(&zone->device->reada_zones, | 545 | radix_tree_delete(&zone->device->reada_zones, |
| 545 | zone->end >> PAGE_SHIFT); | 546 | zone->end >> fs_info->sectorsize_bits); |
| 546 | 547 | ||
| 547 | kfree(zone); | 548 | kfree(zone); |
| 548 | } | 549 | } |
| @@ -593,7 +594,7 @@ static int reada_add_block(struct reada_control *rc, u64 logical, · 44 unmodified lines | |||
| 593 | static void reada_peer_zones_set_lock(struct reada_zone *zone, int lock) | 594 | static void reada_peer_zones_set_lock(struct reada_zone *zone, int lock) |
| 594 | { | 595 | { |
| 595 | int i; | 596 | int i; |
| 596 | unsigned long index = zone->end >> PAGE_SHIFT; | 597 | unsigned long index = zone->end >> zone->device->fs_info->sectorsize_bits; |
| 597 | 598 | ||
| 598 | for (i = 0; i < zone->ndevs; ++i) { | 599 | for (i = 0; i < zone->ndevs; ++i) { |
| 599 | struct reada_zone *peer; | 600 | struct reada_zone *peer; |
| @@ -628,7 +629,7 @@ static int reada_pick_zone(struct btrfs_device *dev) · 28 unmodified lines | |||
| 628 | (void **)&zone, index, 1); | 629 | (void **)&zone, index, 1); |
| 629 | if (ret == 0) | 630 | if (ret == 0) |
| 630 | break; | 631 | break; |
| 631 | index = (zone->end >> PAGE_SHIFT) + 1; | 632 | index = (zone->end >> dev->fs_info->sectorsize_bits) + 1; |
| 632 | if (zone->locked) { | 633 | if (zone->locked) { |
| 633 | if (zone->elems > top_locked_elems) { | 634 | if (zone->elems > top_locked_elems) { |
| 634 | top_locked_elems = zone->elems; | 635 | top_locked_elems = zone->elems; |
| @@ -709,7 +710,7 @@ static int reada_start_machine_dev(struct btrfs_device *dev) · 74 unmodified lines | |||
| 709 | * plugging to speed things up | 710 | * plugging to speed things up |
| 710 | */ | 711 | */ |
| 711 | ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re, | 712 | ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re, |
| 712 | dev->reada_next >> PAGE_SHIFT, 1); | 713 | dev->reada_next >> fs_info->sectorsize_bits, 1); |
| 713 | if (ret == 0 || re->logical > dev->reada_curr_zone->end) { | 714 | if (ret == 0 || re->logical > dev->reada_curr_zone->end) { |
| 714 | ret = reada_pick_zone(dev); | 715 | ret = reada_pick_zone(dev); |
| 715 | if (!ret) { | 716 | if (!ret) { |
| @@ -718,7 +719,7 @@ static int reada_start_machine_dev(struct btrfs_device *dev) · 2 unmodified lines | |||
| 718 | } | 719 | } |
| 719 | re = NULL; | 720 | re = NULL; |
| 720 | ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re, | 721 | ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re, |
| 721 | dev->reada_next >> PAGE_SHIFT, 1); | 722 | dev->reada_next >> fs_info->sectorsize_bits, 1); |
| 722 | } | 723 | } |
| 723 | if (ret == 0) { | 724 | if (ret == 0) { |
| 724 | spin_unlock(&fs_info->reada_lock); | 725 | spin_unlock(&fs_info->reada_lock); |
| @@ -885,7 +886,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 160 unmodified lines | |||
| 885 | pr_cont(" curr off %llu", | 886 | pr_cont(" curr off %llu", |
| 886 | device->reada_next - zone->start); | 887 | device->reada_next - zone->start); |
| 887 | pr_cont("\n"); | 888 | pr_cont("\n"); |
| 888 | index = (zone->end >> PAGE_SHIFT) + 1; | 889 | index = (zone->end >> fs_info->sectorsize_bits) + 1; |
| 889 | } | 890 | } |
| 890 | cnt = 0; | 891 | cnt = 0; |
| 891 | index = 0; | 892 | index = 0; |
| @@ -910,7 +911,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 18 unmodified lines | |||
| 910 | } | 911 | } |
| 911 | } | 912 | } |
| 912 | pr_cont("\n"); | 913 | pr_cont("\n"); |
| 913 | index = (re->logical >> PAGE_SHIFT) + 1; | 914 | index = (re->logical >> fs_info->sectorsize_bits) + 1; |
| 914 | if (++cnt > 15) | 915 | if (++cnt > 15) |
| 915 | break; | 916 | break; |
| 916 | } | 917 | } |
| @@ -926,7 +927,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 9 unmodified lines | |||
| 926 | if (ret == 0) | 927 | if (ret == 0) |
| 927 | break; | 928 | break; |
| 928 | if (!re->scheduled) { | 929 | if (!re->scheduled) { |
| 929 | index = (re->logical >> PAGE_SHIFT) + 1; | 930 | index = (re->logical >> fs_info->sectorsize_bits) + 1; |
| 930 | continue; | 931 | continue; |
| 931 | } | 932 | } |
| 932 | pr_debug("re: logical %llu size %u list empty %d scheduled %d", | 933 | pr_debug("re: logical %llu size %u list empty %d scheduled %d", |
| @@ -942,7 +943,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 9 unmodified lines | |||
| 942 | } | 943 | } |
| 943 | } | 944 | } |
| 944 | pr_cont("\n"); | 945 | pr_cont("\n"); |
| 945 | index = (re->logical >> PAGE_SHIFT) + 1; | 946 | index = (re->logical >> fs_info->sectorsize_bits) + 1; |
| 946 | } | 947 | } |
| 947 | spin_unlock(&fs_info->reada_lock); | 948 | spin_unlock(&fs_info->reada_lock); |
| 948 | } | 949 | } |
| @@ -3169,10 +3169,6 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 3168 unmodified lines | |||
| 3169 | 3169 | ||
| 3170 | mutex_lock(&log_root_tree->log_mutex); | 3170 | mutex_lock(&log_root_tree->log_mutex); |
| 3171 | 3171 | ||
| 3172 | index2 = log_root_tree->log_transid % 2; | ||
| 3173 | list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]); | ||
| 3174 | root_log_ctx.log_transid = log_root_tree->log_transid; | ||
| 3175 | |||
| 3176 | if (btrfs_is_zoned(fs_info)) { | 3172 | if (btrfs_is_zoned(fs_info)) { |
| 3177 | if (!log_root_tree->node) { | 3173 | if (!log_root_tree->node) { |
| 3178 | ret = btrfs_alloc_log_tree_node(trans, log_root_tree); | 3174 | ret = btrfs_alloc_log_tree_node(trans, log_root_tree); |
| @@ -3183,6 +3179,10 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 4 unmodified lines | |||
| 3183 | } | 3179 | } |
| 3184 | } | 3180 | } |
| 3185 | 3181 | ||
| 3182 | index2 = log_root_tree->log_transid % 2; | ||
| 3183 | list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]); | ||
| 3184 | root_log_ctx.log_transid = log_root_tree->log_transid; | ||
| 3185 | |||
| 3186 | /* | 3186 | /* |
| 3187 | * Now we are safe to update the log_root_tree because we're under the | 3187 | * Now we are safe to update the log_root_tree because we're under the |
| 3188 | * log_mutex, and we're a current writer so we're holding the commit | 3188 | * log_mutex, and we're a current writer so we're holding the commit |
| @@ -7448,6 +7448,9 @@ static int btrfs_device_init_dev_stats(struct btrfs_device *device, · 7447 unmodified lines | |||
| 7448 | int item_size; | 7448 | int item_size; |
| 7449 | int i, ret, slot; | 7449 | int i, ret, slot; |
| 7450 | 7450 | ||
| 7451 | if (!device->fs_info->dev_root) | ||
| 7452 | return 0; | ||
| 7453 | |||
| 7451 | key.objectid = BTRFS_DEV_STATS_OBJECTID; | 7454 | key.objectid = BTRFS_DEV_STATS_OBJECTID; |
| 7452 | key.type = BTRFS_PERSISTENT_ITEM_KEY; | 7455 | key.type = BTRFS_PERSISTENT_ITEM_KEY; |
| 7453 | key.offset = device->devid; | 7456 | key.offset = device->devid; |
| @@ -118,6 +118,12 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) · 117 unmodified lines | |||
| 118 | cache->mnt = path.mnt; | 118 | cache->mnt = path.mnt; |
| 119 | root = path.dentry; | 119 | root = path.dentry; |
| 120 | 120 | ||
| 121 | ret = -EINVAL; | ||
| 122 | if (mnt_user_ns(path.mnt) != &init_user_ns) { | ||
| 123 | pr_warn("File cache on idmapped mounts not supported"); | ||
| 124 | goto error_unsupported; | ||
| 125 | } | ||
| 126 | |||
| 121 | /* check parameters */ | 127 | /* check parameters */ |
| 122 | ret = -EOPNOTSUPP; | 128 | ret = -EOPNOTSUPP; |
| 123 | if (d_is_negative(root) || | 129 | if (d_is_negative(root) || |
| @@ -24,17 +24,16 @@ static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode, · 23 unmodified lines | |||
| 24 | container_of(wait, struct cachefiles_one_read, monitor); | 24 | container_of(wait, struct cachefiles_one_read, monitor); |
| 25 | struct cachefiles_object *object; | 25 | struct cachefiles_object *object; |
| 26 | struct fscache_retrieval *op = monitor->op; | 26 | struct fscache_retrieval *op = monitor->op; |
| 27 | struct wait_bit_key *key = _key; | 27 | struct wait_page_key *key = _key; |
| 28 | struct page *page = wait->private; | 28 | struct page *page = wait->private; |
| 29 | 29 | ||
| 30 | ASSERT(key); | 30 | ASSERT(key); |
| 31 | 31 | ||
| 32 | _enter("{%lu},%u,%d,{%p,%u}", | 32 | _enter("{%lu},%u,%d,{%p,%u}", |
| 33 | monitor->netfs_page->index, mode, sync, | 33 | monitor->netfs_page->index, mode, sync, |
| 34 | key->flags, key->bit_nr); | 34 | key->page, key->bit_nr); |
| 35 | 35 | ||
| 36 | if (key->flags != &page->flags || | 36 | if (key->page != page || key->bit_nr != PG_locked) |
| 37 | key->bit_nr != PG_locked) | ||
| 38 | return 0; | 37 | return 0; |
| 39 | 38 | ||
| 40 | _debug("--- monitor %p %lx ---", page, page->flags); | 39 | _debug("--- monitor %p %lx ---", page, page->flags); |
| @@ -248,7 +248,7 @@ nlmsg_fail: · 247 unmodified lines | |||
| 248 | 248 | ||
| 249 | /* | 249 | /* |
| 250 | * Try to find a matching registration for the tcon's server name and share name. | 250 | * Try to find a matching registration for the tcon's server name and share name. |
| 251 | * Calls to this funciton must be protected by cifs_swnreg_idr_mutex. | 251 | * Calls to this function must be protected by cifs_swnreg_idr_mutex. |
| 252 | * TODO Try to avoid memory allocations | 252 | * TODO Try to avoid memory allocations |
| 253 | */ | 253 | */ |
| 254 | static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon) | 254 | static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon) |
| @@ -1118,7 +1118,6 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl, · 1117 unmodified lines | |||
| 1118 | /* Retain old ACEs which we can retain */ | 1118 | /* Retain old ACEs which we can retain */ |
| 1119 | for (i = 0; i < src_num_aces; ++i) { | 1119 | for (i = 0; i < src_num_aces; ++i) { |
| 1120 | pntace = (struct cifs_ace *) (acl_base + size); | 1120 | pntace = (struct cifs_ace *) (acl_base + size); |
| 1121 | pnntace = (struct cifs_ace *) (nacl_base + nsize); | ||
| 1122 | 1121 | ||
| 1123 | if (!new_aces_set && (pntace->flags & INHERITED_ACE)) { | 1122 | if (!new_aces_set && (pntace->flags & INHERITED_ACE)) { |
| 1124 | /* Place the new ACEs in between existing explicit and inherited */ | 1123 | /* Place the new ACEs in between existing explicit and inherited */ |
| @@ -1131,14 +1130,17 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl, · 6 unmodified lines | |||
| 1131 | } | 1130 | } |
| 1132 | 1131 | ||
| 1133 | /* If it's any one of the ACE we're replacing, skip! */ | 1132 | /* If it's any one of the ACE we're replacing, skip! */ |
| 1134 | if ((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) || | 1133 | if (((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) || |
| 1135 | (compare_sids(&pntace->sid, pownersid) == 0) || | 1134 | (compare_sids(&pntace->sid, pownersid) == 0) || |
| 1136 | (compare_sids(&pntace->sid, pgrpsid) == 0) || | 1135 | (compare_sids(&pntace->sid, pgrpsid) == 0) || |
| 1137 | (compare_sids(&pntace->sid, &sid_everyone) == 0) || | 1136 | (compare_sids(&pntace->sid, &sid_everyone) == 0) || |
| 1138 | (compare_sids(&pntace->sid, &sid_authusers) == 0)) { | 1137 | (compare_sids(&pntace->sid, &sid_authusers) == 0))) { |
| 1139 | goto next_ace; | 1138 | goto next_ace; |
| 1140 | } | 1139 | } |
| 1141 | 1140 | ||
| 1141 | /* update the pointer to the next ACE to populate*/ | ||
| 1142 | pnntace = (struct cifs_ace *) (nacl_base + nsize); | ||
| 1143 | |||
| 1142 | nsize += cifs_copy_ace(pnntace, pntace, NULL); | 1144 | nsize += cifs_copy_ace(pnntace, pntace, NULL); |
| 1143 | num_aces++; | 1145 | num_aces++; |
| 1144 | 1146 | ||
| @@ -919,8 +919,8 @@ struct cifs_ses { · 918 unmodified lines | |||
| 919 | bool binding:1; /* are we binding the session? */ | 919 | bool binding:1; /* are we binding the session? */ |
| 920 | __u16 session_flags; | 920 | __u16 session_flags; |
| 921 | __u8 smb3signingkey[SMB3_SIGN_KEY_SIZE]; | 921 | __u8 smb3signingkey[SMB3_SIGN_KEY_SIZE]; |
| 922 | __u8 smb3encryptionkey[SMB3_SIGN_KEY_SIZE]; | 922 | __u8 smb3encryptionkey[SMB3_ENC_DEC_KEY_SIZE]; |
| 923 | __u8 smb3decryptionkey[SMB3_SIGN_KEY_SIZE]; | 923 | __u8 smb3decryptionkey[SMB3_ENC_DEC_KEY_SIZE]; |
| 924 | __u8 preauth_sha_hash[SMB2_PREAUTH_HASH_SIZE]; | 924 | __u8 preauth_sha_hash[SMB2_PREAUTH_HASH_SIZE]; |
| 925 | 925 | ||
| 926 | __u8 binding_preauth_sha_hash[SMB2_PREAUTH_HASH_SIZE]; | 926 | __u8 binding_preauth_sha_hash[SMB2_PREAUTH_HASH_SIZE]; |
| @@ -147,6 +147,11 @@ · 146 unmodified lines | |||
| 147 | */ | 147 | */ |
| 148 | #define SMB3_SIGN_KEY_SIZE (16) | 148 | #define SMB3_SIGN_KEY_SIZE (16) |
| 149 | 149 | ||
| 150 | /* | ||
| 151 | * Size of the smb3 encryption/decryption keys | ||
| 152 | */ | ||
| 153 | #define SMB3_ENC_DEC_KEY_SIZE (32) | ||
| 154 | |||
| 150 | #define CIFS_CLIENT_CHALLENGE_SIZE (8) | 155 | #define CIFS_CLIENT_CHALLENGE_SIZE (8) |
| 151 | #define CIFS_SERVER_CHALLENGE_SIZE (8) | 156 | #define CIFS_SERVER_CHALLENGE_SIZE (8) |
| 152 | #define CIFS_HMAC_MD5_HASH_SIZE (16) | 157 | #define CIFS_HMAC_MD5_HASH_SIZE (16) |
| @@ -165,6 +165,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, · 164 unmodified lines | |||
| 165 | goto posix_open_ret; | 165 | goto posix_open_ret; |
| 166 | } | 166 | } |
| 167 | } else { | 167 | } else { |
| 168 | cifs_revalidate_mapping(*pinode); | ||
| 168 | cifs_fattr_to_inode(*pinode, &fattr); | 169 | cifs_fattr_to_inode(*pinode, &fattr); |
| 169 | } | 170 | } |
| 170 | 171 | ||
| @@ -1196,9 +1196,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, · 1195 unmodified lines | |||
| 1196 | pr_warn_once("Witness protocol support is experimental\n"); | 1196 | pr_warn_once("Witness protocol support is experimental\n"); |
| 1197 | break; | 1197 | break; |
| 1198 | case Opt_rootfs: | 1198 | case Opt_rootfs: |
| 1199 | #ifdef CONFIG_CIFS_ROOT | 1199 | #ifndef CONFIG_CIFS_ROOT |
| 1200 | ctx->rootfs = true; | 1200 | cifs_dbg(VFS, "rootfs support requires CONFIG_CIFS_ROOT config option\n"); |
| 1201 | goto cifs_parse_mount_err; | ||
| 1201 | #endif | 1202 | #endif |
| 1203 | ctx->rootfs = true; | ||
| 1202 | break; | 1204 | break; |
| 1203 | case Opt_posixpaths: | 1205 | case Opt_posixpaths: |
| 1204 | if (result.negated) | 1206 | if (result.negated) |
| @@ -2395,7 +2395,7 @@ int cifs_getattr(struct user_namespace *mnt_userns, const struct path *path, · 2394 unmodified lines | |||
| 2395 | * We need to be sure that all dirty pages are written and the server | 2395 | * We need to be sure that all dirty pages are written and the server |
| 2396 | * has actual ctime, mtime and file length. | 2396 | * has actual ctime, mtime and file length. |
| 2397 | */ | 2397 | */ |
| 2398 | if ((request_mask & (STATX_CTIME | STATX_MTIME | STATX_SIZE)) && | 2398 | if ((request_mask & (STATX_CTIME | STATX_MTIME | STATX_SIZE | STATX_BLOCKS)) && |
| 2399 | !CIFS_CACHE_READ(CIFS_I(inode)) && | 2399 | !CIFS_CACHE_READ(CIFS_I(inode)) && |
| 2400 | inode->i_mapping && inode->i_mapping->nrpages != 0) { | 2400 | inode->i_mapping && inode->i_mapping->nrpages != 0) { |
| 2401 | rc = filemap_fdatawait(inode->i_mapping); | 2401 | rc = filemap_fdatawait(inode->i_mapping); |
| @@ -2585,6 +2585,14 @@ set_size_out: · 183 unmodified lines | |||
| 2585 | if (rc == 0) { | 2585 | if (rc == 0) { |
| 2586 | cifsInode->server_eof = attrs->ia_size; | 2586 | cifsInode->server_eof = attrs->ia_size; |
| 2587 | cifs_setsize(inode, attrs->ia_size); | 2587 | cifs_setsize(inode, attrs->ia_size); |
| 2588 | /* | ||
| 2589 | * i_blocks is not related to (i_size / i_blksize), but instead | ||
| 2590 | * 512 byte (2**9) size is required for calculating num blocks. | ||
| 2591 | * Until we can query the server for actual allocation size, | ||
| 2592 | * this is best estimate we have for blocks allocated for a file | ||
| 2593 | * Number of blocks must be rounded up so size 1 is not 0 blocks | ||
| 2594 | */ | ||
| 2595 | inode->i_blocks = (512 - 1 + attrs->ia_size) >> 9; | ||
| 2588 | 2596 | ||
| 2589 | /* | 2597 | /* |
| 2590 | * The man page of truncate says if the size changed, | 2598 | * The man page of truncate says if the size changed, |
| @@ -58,6 +58,7 @@ · 57 unmodified lines | |||
| 58 | #define SMB2_HMACSHA256_SIZE (32) | 58 | #define SMB2_HMACSHA256_SIZE (32) |
| 59 | #define SMB2_CMACAES_SIZE (16) | 59 | #define SMB2_CMACAES_SIZE (16) |
| 60 | #define SMB3_SIGNKEY_SIZE (16) | 60 | #define SMB3_SIGNKEY_SIZE (16) |
| 61 | #define SMB3_GCM128_CRYPTKEY_SIZE (16) | ||
| 61 | #define SMB3_GCM256_CRYPTKEY_SIZE (32) | 62 | #define SMB3_GCM256_CRYPTKEY_SIZE (32) |
| 62 | 63 | ||
| 63 | /* Maximum buffer size value we can send with 1 credit */ | 64 | /* Maximum buffer size value we can send with 1 credit */ |
| @@ -754,8 +754,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) · 753 unmodified lines | |||
| 754 | } | 754 | } |
| 755 | } | 755 | } |
| 756 | spin_unlock(&cifs_tcp_ses_lock); | 756 | spin_unlock(&cifs_tcp_ses_lock); |
| 757 | cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n"); | 757 | cifs_dbg(FYI, "No file id matched, oplock break ignored\n"); |
| 758 | return false; | 758 | return true; |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | void | 761 | void |
| @@ -2038,6 +2038,7 @@ smb2_duplicate_extents(const unsigned int xid, · 2037 unmodified lines | |||
| 2038 | { | 2038 | { |
| 2039 | int rc; | 2039 | int rc; |
| 2040 | unsigned int ret_data_len; | 2040 | unsigned int ret_data_len; |
| 2041 | struct inode *inode; | ||
| 2041 | struct duplicate_extents_to_file dup_ext_buf; | 2042 | struct duplicate_extents_to_file dup_ext_buf; |
| 2042 | struct cifs_tcon *tcon = tlink_tcon(trgtfile->tlink); | 2043 | struct cifs_tcon *tcon = tlink_tcon(trgtfile->tlink); |
| 2043 | 2044 | ||
| @@ -2054,10 +2055,21 @@ smb2_duplicate_extents(const unsigned int xid, · 10 unmodified lines | |||
| 2054 | cifs_dbg(FYI, "Duplicate extents: src off %lld dst off %lld len %lld\n", | 2055 | cifs_dbg(FYI, "Duplicate extents: src off %lld dst off %lld len %lld\n", |
| 2055 | src_off, dest_off, len); | 2056 | src_off, dest_off, len); |
| 2056 | 2057 | ||
| 2057 | rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false); | 2058 | inode = d_inode(trgtfile->dentry); |
| 2058 | if (rc) | 2059 | if (inode->i_size < dest_off + len) { |
| 2059 | goto duplicate_extents_out; | 2060 | rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false); |
| 2061 | if (rc) | ||
| 2062 | goto duplicate_extents_out; | ||
| 2060 | 2063 | ||
| 2064 | /* | ||
| 2065 | * Although also could set plausible allocation size (i_blocks) | ||
| 2066 | * here in addition to setting the file size, in reflink | ||
| 2067 | * it is likely that the target file is sparse. Its allocation | ||
| 2068 | * size will be queried on next revalidate, but it is important | ||
| 2069 | * to make sure that file's cached size is updated immediately | ||
| 2070 | */ | ||
| 2071 | cifs_setsize(inode, dest_off + len); | ||
| 2072 | } | ||
| 2061 | rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid, | 2073 | rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid, |
| 2062 | trgtfile->fid.volatile_fid, | 2074 | trgtfile->fid.volatile_fid, |
| 2063 | FSCTL_DUPLICATE_EXTENTS_TO_FILE, | 2075 | FSCTL_DUPLICATE_EXTENTS_TO_FILE, |
| @@ -4158,7 +4170,7 @@ smb2_get_enc_key(struct TCP_Server_Info *server, __u64 ses_id, int enc, u8 *key) · 2094 unmodified lines | |||
| 4158 | if (ses->Suid == ses_id) { | 4170 | if (ses->Suid == ses_id) { |
| 4159 | ses_enc_key = enc ? ses->smb3encryptionkey : | 4171 | ses_enc_key = enc ? ses->smb3encryptionkey : |
| 4160 | ses->smb3decryptionkey; | 4172 | ses->smb3decryptionkey; |
| 4161 | memcpy(key, ses_enc_key, SMB3_SIGN_KEY_SIZE); | 4173 | memcpy(key, ses_enc_key, SMB3_ENC_DEC_KEY_SIZE); |
| 4162 | spin_unlock(&cifs_tcp_ses_lock); | 4174 | spin_unlock(&cifs_tcp_ses_lock); |
| 4163 | return 0; | 4175 | return 0; |
| 4164 | } | 4176 | } |
| @@ -4185,7 +4197,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst, · 20 unmodified lines | |||
| 4185 | int rc = 0; | 4197 | int rc = 0; |
| 4186 | struct scatterlist *sg; | 4198 | struct scatterlist *sg; |
| 4187 | u8 sign[SMB2_SIGNATURE_SIZE] = {}; | 4199 | u8 sign[SMB2_SIGNATURE_SIZE] = {}; |
| 4188 | u8 key[SMB3_SIGN_KEY_SIZE]; | 4200 | u8 key[SMB3_ENC_DEC_KEY_SIZE]; |
| 4189 | struct aead_request *req; | 4201 | struct aead_request *req; |
| 4190 | char *iv; | 4202 | char *iv; |
| 4191 | unsigned int iv_len; | 4203 | unsigned int iv_len; |
| @@ -4209,10 +4221,11 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst, · 17 unmodified lines | |||
| 4209 | tfm = enc ? server->secmech.ccmaesencrypt : | 4221 | tfm = enc ? server->secmech.ccmaesencrypt : |
| 4210 | server->secmech.ccmaesdecrypt; | 4222 | server->secmech.ccmaesdecrypt; |
| 4211 | 4223 | ||
| 4212 | if (server->cipher_type == SMB2_ENCRYPTION_AES256_GCM) | 4224 | if ((server->cipher_type == SMB2_ENCRYPTION_AES256_CCM) || |
| 4225 | (server->cipher_type == SMB2_ENCRYPTION_AES256_GCM)) | ||
| 4213 | rc = crypto_aead_setkey(tfm, key, SMB3_GCM256_CRYPTKEY_SIZE); | 4226 | rc = crypto_aead_setkey(tfm, key, SMB3_GCM256_CRYPTKEY_SIZE); |
| 4214 | else | 4227 | else |
| 4215 | rc = crypto_aead_setkey(tfm, key, SMB3_SIGN_KEY_SIZE); | 4228 | rc = crypto_aead_setkey(tfm, key, SMB3_GCM128_CRYPTKEY_SIZE); |
| 4216 | 4229 | ||
| 4217 | if (rc) { | 4230 | if (rc) { |
| 4218 | cifs_server_dbg(VFS, "%s: Failed to set aead key %d\n", __func__, rc); | 4231 | cifs_server_dbg(VFS, "%s: Failed to set aead key %d\n", __func__, rc); |
| @@ -298,7 +298,8 @@ static int generate_key(struct cifs_ses *ses, struct kvec label, · 297 unmodified lines | |||
| 298 | { | 298 | { |
| 299 | unsigned char zero = 0x0; | 299 | unsigned char zero = 0x0; |
| 300 | __u8 i[4] = {0, 0, 0, 1}; | 300 | __u8 i[4] = {0, 0, 0, 1}; |
| 301 | __u8 L[4] = {0, 0, 0, 128}; | 301 | __u8 L128[4] = {0, 0, 0, 128}; |
| 302 | __u8 L256[4] = {0, 0, 1, 0}; | ||
| 302 | int rc = 0; | 303 | int rc = 0; |
| 303 | unsigned char prfhash[SMB2_HMACSHA256_SIZE]; | 304 | unsigned char prfhash[SMB2_HMACSHA256_SIZE]; |
| 304 | unsigned char *hashptr = prfhash; | 305 | unsigned char *hashptr = prfhash; |
| @@ -354,8 +355,14 @@ static int generate_key(struct cifs_ses *ses, struct kvec label, · 49 unmodified lines | |||
| 354 | goto smb3signkey_ret; | 355 | goto smb3signkey_ret; |
| 355 | } | 356 | } |
| 356 | 357 | ||
| 357 | rc = crypto_shash_update(&server->secmech.sdeschmacsha256->shash, | 358 | if ((server->cipher_type == SMB2_ENCRYPTION_AES256_CCM) || |
| 358 | L, 4); | 359 | (server->cipher_type == SMB2_ENCRYPTION_AES256_GCM)) { |
| 360 | rc = crypto_shash_update(&server->secmech.sdeschmacsha256->shash, | ||
| 361 | L256, 4); | ||
| 362 | } else { | ||
| 363 | rc = crypto_shash_update(&server->secmech.sdeschmacsha256->shash, | ||
| 364 | L128, 4); | ||
| 365 | } | ||
| 359 | if (rc) { | 366 | if (rc) { |
| 360 | cifs_server_dbg(VFS, "%s: Could not update with L\n", __func__); | 367 | cifs_server_dbg(VFS, "%s: Could not update with L\n", __func__); |
| 361 | goto smb3signkey_ret; | 368 | goto smb3signkey_ret; |
| @@ -390,6 +397,9 @@ generate_smb3signingkey(struct cifs_ses *ses, · 28 unmodified lines | |||
| 390 | const struct derivation_triplet *ptriplet) | 397 | const struct derivation_triplet *ptriplet) |
| 391 | { | 398 | { |
| 392 | int rc; | 399 | int rc; |
| 400 | #ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS | ||
| 401 | struct TCP_Server_Info *server = ses->server; | ||
| 402 | #endif | ||
| 393 | 403 | ||
| 394 | /* | 404 | /* |
| 395 | * All channels use the same encryption/decryption keys but | 405 | * All channels use the same encryption/decryption keys but |
| @@ -422,11 +432,11 @@ generate_smb3signingkey(struct cifs_ses *ses, · 26 unmodified lines | |||
| 422 | rc = generate_key(ses, ptriplet->encryption.label, | 432 | rc = generate_key(ses, ptriplet->encryption.label, |
| 423 | ptriplet->encryption.context, | 433 | ptriplet->encryption.context, |
| 424 | ses->smb3encryptionkey, | 434 | ses->smb3encryptionkey, |
| 425 | SMB3_SIGN_KEY_SIZE); | 435 | SMB3_ENC_DEC_KEY_SIZE); |
| 426 | rc = generate_key(ses, ptriplet->decryption.label, | 436 | rc = generate_key(ses, ptriplet->decryption.label, |
| 427 | ptriplet->decryption.context, | 437 | ptriplet->decryption.context, |
| 428 | ses->smb3decryptionkey, | 438 | ses->smb3decryptionkey, |
| 429 | SMB3_SIGN_KEY_SIZE); | 439 | SMB3_ENC_DEC_KEY_SIZE); |
| 430 | if (rc) | 440 | if (rc) |
| 431 | return rc; | 441 | return rc; |
| 432 | } | 442 | } |
| @@ -442,14 +452,23 @@ generate_smb3signingkey(struct cifs_ses *ses, · 9 unmodified lines | |||
| 442 | */ | 452 | */ |
| 443 | cifs_dbg(VFS, "Session Id %*ph\n", (int)sizeof(ses->Suid), | 453 | cifs_dbg(VFS, "Session Id %*ph\n", (int)sizeof(ses->Suid), |
| 444 | &ses->Suid); | 454 | &ses->Suid); |
| 455 | cifs_dbg(VFS, "Cipher type %d\n", server->cipher_type); | ||
| 445 | cifs_dbg(VFS, "Session Key %*ph\n", | 456 | cifs_dbg(VFS, "Session Key %*ph\n", |
| 446 | SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response); | 457 | SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response); |
| 447 | cifs_dbg(VFS, "Signing Key %*ph\n", | 458 | cifs_dbg(VFS, "Signing Key %*ph\n", |
| 448 | SMB3_SIGN_KEY_SIZE, ses->smb3signingkey); | 459 | SMB3_SIGN_KEY_SIZE, ses->smb3signingkey); |
| 449 | cifs_dbg(VFS, "ServerIn Key %*ph\n", | 460 | if ((server->cipher_type == SMB2_ENCRYPTION_AES256_CCM) || |
| 450 | SMB3_SIGN_KEY_SIZE, ses->smb3encryptionkey); | 461 | (server->cipher_type == SMB2_ENCRYPTION_AES256_GCM)) { |
| 451 | cifs_dbg(VFS, "ServerOut Key %*ph\n", | 462 | cifs_dbg(VFS, "ServerIn Key %*ph\n", |
| 452 | SMB3_SIGN_KEY_SIZE, ses->smb3decryptionkey); | 463 | SMB3_GCM256_CRYPTKEY_SIZE, ses->smb3encryptionkey); |
| 464 | cifs_dbg(VFS, "ServerOut Key %*ph\n", | ||
| 465 | SMB3_GCM256_CRYPTKEY_SIZE, ses->smb3decryptionkey); | ||
| 466 | } else { | ||
| 467 | cifs_dbg(VFS, "ServerIn Key %*ph\n", | ||
| 468 | SMB3_GCM128_CRYPTKEY_SIZE, ses->smb3encryptionkey); | ||
| 469 | cifs_dbg(VFS, "ServerOut Key %*ph\n", | ||
| 470 | SMB3_GCM128_CRYPTKEY_SIZE, ses->smb3decryptionkey); | ||
| 471 | } | ||
| 453 | #endif | 472 | #endif |
| 454 | return rc; | 473 | return rc; |
| 455 | } | 474 | } |
| @@ -1196,9 +1196,12 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 1195 unmodified lines | |||
| 1196 | /* | 1196 | /* |
| 1197 | * Compounding is never used during session establish. | 1197 | * Compounding is never used during session establish. |
| 1198 | */ | 1198 | */ |
| 1199 | if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) | 1199 | if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) { |
| 1200 | mutex_lock(&server->srv_mutex); | ||
| 1200 | smb311_update_preauth_hash(ses, rqst[0].rq_iov, | 1201 | smb311_update_preauth_hash(ses, rqst[0].rq_iov, |
| 1201 | rqst[0].rq_nvec); | 1202 | rqst[0].rq_nvec); |
| 1203 | mutex_unlock(&server->srv_mutex); | ||
| 1204 | } | ||
| 1202 | 1205 | ||
| 1203 | for (i = 0; i < num_rqst; i++) { | 1206 | for (i = 0; i < num_rqst; i++) { |
| 1204 | rc = wait_for_response(server, midQ[i]); | 1207 | rc = wait_for_response(server, midQ[i]); |
| @@ -1266,7 +1269,9 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 61 unmodified lines | |||
| 1266 | .iov_base = resp_iov[0].iov_base, | 1269 | .iov_base = resp_iov[0].iov_base, |
| 1267 | .iov_len = resp_iov[0].iov_len | 1270 | .iov_len = resp_iov[0].iov_len |
| 1268 | }; | 1271 | }; |
| 1272 | mutex_lock(&server->srv_mutex); | ||
| 1269 | smb311_update_preauth_hash(ses, &iov, 1); | 1273 | smb311_update_preauth_hash(ses, &iov, 1); |
| 1274 | mutex_unlock(&server->srv_mutex); | ||
| 1270 | } | 1275 | } |
| 1271 | 1276 | ||
| 1272 | out: | 1277 | out: |
| @@ -626,27 +626,41 @@ int ext4_claim_free_clusters(struct ext4_sb_info *sbi, · 625 unmodified lines | |||
| 626 | 626 | ||
| 627 | /** | 627 | /** |
| 628 | * ext4_should_retry_alloc() - check if a block allocation should be retried | 628 | * ext4_should_retry_alloc() - check if a block allocation should be retried |
| 629 | * @sb: super block | 629 | * @sb: superblock |
| 630 | * @retries: number of attemps has been made | 630 | * @retries: number of retry attempts made so far |
| 631 | * | 631 | * |
| 632 | * ext4_should_retry_alloc() is called when ENOSPC is returned, and if | 632 | * ext4_should_retry_alloc() is called when ENOSPC is returned while |
| 633 | * it is profitable to retry the operation, this function will wait | 633 | * attempting to allocate blocks. If there's an indication that a pending |
| 634 | * for the current or committing transaction to complete, and then | 634 | * journal transaction might free some space and allow another attempt to |
| 635 | * return TRUE. We will only retry once. | 635 | * succeed, this function will wait for the current or committing transaction |
| 636 | * to complete and then return TRUE. | ||
| 636 | */ | 637 | */ |
| 637 | int ext4_should_retry_alloc(struct super_block *sb, int *retries) | 638 | int ext4_should_retry_alloc(struct super_block *sb, int *retries) |
| 638 | { | 639 | { |
| 639 | if (!ext4_has_free_clusters(EXT4_SB(sb), 1, 0) || | 640 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
| 640 | (*retries)++ > 1 || | 641 | |
| 641 | !EXT4_SB(sb)->s_journal) | 642 | if (!sbi->s_journal) |
| 642 | return 0; | 643 | return 0; |
| 643 | 644 | ||
| 644 | smp_mb(); | 645 | if (++(*retries) > 3) { |
| 645 | if (EXT4_SB(sb)->s_mb_free_pending == 0) | 646 | percpu_counter_inc(&sbi->s_sra_exceeded_retry_limit); |
| 646 | return 0; | 647 | return 0; |
| 648 | } | ||
| 647 | 649 | ||
| 650 | /* | ||
| 651 | * if there's no indication that blocks are about to be freed it's | ||
| 652 | * possible we just missed a transaction commit that did so | ||
| 653 | */ | ||
| 654 | smp_mb(); | ||
| 655 | if (sbi->s_mb_free_pending == 0) | ||
| 656 | return ext4_has_free_clusters(sbi, 1, 0); | ||
| 657 | |||
| 658 | /* | ||
| 659 | * it's possible we've just missed a transaction commit here, | ||
| 660 | * so ignore the returned status | ||
| 661 | */ | ||
| 648 | jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); | 662 | jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); |
| 649 | jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal); | 663 | (void) jbd2_journal_force_commit_nested(sbi->s_journal); |
| 650 | return 1; | 664 | return 1; |
| 651 | } | 665 | } |
| 652 | 666 | ||
| @@ -1484,6 +1484,7 @@ struct ext4_sb_info { · 1483 unmodified lines | |||
| 1484 | struct percpu_counter s_freeinodes_counter; | 1484 | struct percpu_counter s_freeinodes_counter; |
| 1485 | struct percpu_counter s_dirs_counter; | 1485 | struct percpu_counter s_dirs_counter; |
| 1486 | struct percpu_counter s_dirtyclusters_counter; | 1486 | struct percpu_counter s_dirtyclusters_counter; |
| 1487 | struct percpu_counter s_sra_exceeded_retry_limit; | ||
| 1487 | struct blockgroup_lock *s_blockgroup_lock; | 1488 | struct blockgroup_lock *s_blockgroup_lock; |
| 1488 | struct proc_dir_entry *s_proc; | 1489 | struct proc_dir_entry *s_proc; |
| 1489 | struct kobject s_kobj; | 1490 | struct kobject s_kobj; |
| @@ -2793,6 +2794,8 @@ void __ext4_fc_track_link(handle_t *handle, struct inode *inode, · 1303 unmodified lines | |||
| 2793 | struct dentry *dentry); | 2794 | struct dentry *dentry); |
| 2794 | void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry); | 2795 | void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry); |
| 2795 | void ext4_fc_track_link(handle_t *handle, struct dentry *dentry); | 2796 | void ext4_fc_track_link(handle_t *handle, struct dentry *dentry); |
| 2797 | void __ext4_fc_track_create(handle_t *handle, struct inode *inode, | ||
| 2798 | struct dentry *dentry); | ||
| 2796 | void ext4_fc_track_create(handle_t *handle, struct dentry *dentry); | 2799 | void ext4_fc_track_create(handle_t *handle, struct dentry *dentry); |
| 2797 | void ext4_fc_track_inode(handle_t *handle, struct inode *inode); | 2800 | void ext4_fc_track_inode(handle_t *handle, struct inode *inode); |
| 2798 | void ext4_fc_mark_ineligible(struct super_block *sb, int reason); | 2801 | void ext4_fc_mark_ineligible(struct super_block *sb, int reason); |
| @@ -4382,7 +4382,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, · 4381 unmodified lines | |||
| 4382 | { | 4382 | { |
| 4383 | struct inode *inode = file_inode(file); | 4383 | struct inode *inode = file_inode(file); |
| 4384 | handle_t *handle; | 4384 | handle_t *handle; |
| 4385 | int ret, ret2 = 0, ret3 = 0; | 4385 | int ret = 0, ret2 = 0, ret3 = 0; |
| 4386 | int retries = 0; | 4386 | int retries = 0; |
| 4387 | int depth = 0; | 4387 | int depth = 0; |
| 4388 | struct ext4_map_blocks map; | 4388 | struct ext4_map_blocks map; |
| @@ -513,10 +513,10 @@ void ext4_fc_track_link(handle_t *handle, struct dentry *dentry) · 512 unmodified lines | |||
| 513 | __ext4_fc_track_link(handle, d_inode(dentry), dentry); | 513 | __ext4_fc_track_link(handle, d_inode(dentry), dentry); |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | void ext4_fc_track_create(handle_t *handle, struct dentry *dentry) | 516 | void __ext4_fc_track_create(handle_t *handle, struct inode *inode, |
| 517 | struct dentry *dentry) | ||
| 517 | { | 518 | { |
| 518 | struct __track_dentry_update_args args; | 519 | struct __track_dentry_update_args args; |
| 519 | struct inode *inode = d_inode(dentry); | ||
| 520 | int ret; | 520 | int ret; |
| 521 | 521 | ||
| 522 | args.dentry = dentry; | 522 | args.dentry = dentry; |
| @@ -527,6 +527,11 @@ void ext4_fc_track_create(handle_t *handle, struct dentry *dentry) · 4 unmodified lines | |||
| 527 | trace_ext4_fc_track_create(inode, dentry, ret); | 527 | trace_ext4_fc_track_create(inode, dentry, ret); |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | void ext4_fc_track_create(handle_t *handle, struct dentry *dentry) | ||
| 531 | { | ||
| 532 | __ext4_fc_track_create(handle, d_inode(dentry), dentry); | ||
| 533 | } | ||
| 534 | |||
| 530 | /* __track_fn for inode tracking */ | 535 | /* __track_fn for inode tracking */ |
| 531 | static int __track_inode(struct inode *inode, void *arg, bool update) | 536 | static int __track_inode(struct inode *inode, void *arg, bool update) |
| 532 | { | 537 | { |
| @@ -1938,13 +1938,13 @@ static int __ext4_journalled_writepage(struct page *page, · 1937 unmodified lines | |||
| 1938 | if (!ret) | 1938 | if (!ret) |
| 1939 | ret = err; | 1939 | ret = err; |
| 1940 | 1940 | ||
| 1941 | if (!ext4_has_inline_data(inode)) | ||
| 1942 | ext4_walk_page_buffers(NULL, page_bufs, 0, len, | ||
| 1943 | NULL, bput_one); | ||
| 1944 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); | 1941 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); |
| 1945 | out: | 1942 | out: |
| 1946 | unlock_page(page); | 1943 | unlock_page(page); |
| 1947 | out_no_pagelock: | 1944 | out_no_pagelock: |
| 1945 | if (!inline_data && page_bufs) | ||
| 1946 | ext4_walk_page_buffers(NULL, page_bufs, 0, len, | ||
| 1947 | NULL, bput_one); | ||
| 1948 | brelse(inode_bh); | 1948 | brelse(inode_bh); |
| 1949 | return ret; | 1949 | return ret; |
| 1950 | } | 1950 | } |
| @@ -5026,7 +5026,7 @@ static int ext4_do_update_inode(handle_t *handle, · 3075 unmodified lines | |||
| 5026 | struct ext4_inode_info *ei = EXT4_I(inode); | 5026 | struct ext4_inode_info *ei = EXT4_I(inode); |
| 5027 | struct buffer_head *bh = iloc->bh; | 5027 | struct buffer_head *bh = iloc->bh; |
| 5028 | struct super_block *sb = inode->i_sb; | 5028 | struct super_block *sb = inode->i_sb; |
| 5029 | int err = 0, rc, block; | 5029 | int err = 0, block; |
| 5030 | int need_datasync = 0, set_large_file = 0; | 5030 | int need_datasync = 0, set_large_file = 0; |
| 5031 | uid_t i_uid; | 5031 | uid_t i_uid; |
| 5032 | gid_t i_gid; | 5032 | gid_t i_gid; |
| @@ -5138,9 +5138,9 @@ static int ext4_do_update_inode(handle_t *handle, · 105 unmodified lines | |||
| 5138 | bh->b_data); | 5138 | bh->b_data); |
| 5139 | 5139 | ||
| 5140 | BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); | 5140 | BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); |
| 5141 | rc = ext4_handle_dirty_metadata(handle, NULL, bh); | 5141 | err = ext4_handle_dirty_metadata(handle, NULL, bh); |
| 5142 | if (!err) | 5142 | if (err) |
| 5143 | err = rc; | 5143 | goto out_brelse; |
| 5144 | ext4_clear_inode_state(inode, EXT4_STATE_NEW); | 5144 | ext4_clear_inode_state(inode, EXT4_STATE_NEW); |
| 5145 | if (set_large_file) { | 5145 | if (set_large_file) { |
| 5146 | BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access"); | 5146 | BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access"); |
| @@ -5387,8 +5387,10 @@ int ext4_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, · 240 unmodified lines | |||
| 5387 | inode->i_gid = attr->ia_gid; | 5387 | inode->i_gid = attr->ia_gid; |
| 5388 | error = ext4_mark_inode_dirty(handle, inode); | 5388 | error = ext4_mark_inode_dirty(handle, inode); |
| 5389 | ext4_journal_stop(handle); | 5389 | ext4_journal_stop(handle); |
| 5390 | if (unlikely(error)) | 5390 | if (unlikely(error)) { |
| 5391 | ext4_fc_stop_update(inode); | ||
| 5391 | return error; | 5392 | return error; |
| 5393 | } | ||
| 5392 | } | 5394 | } |
| 5393 | 5395 | ||
| 5394 | if (attr->ia_valid & ATTR_SIZE) { | 5396 | if (attr->ia_valid & ATTR_SIZE) { |
| @@ -2709,8 +2709,15 @@ static int ext4_mb_init_backend(struct super_block *sb) · 2708 unmodified lines | |||
| 2709 | } | 2709 | } |
| 2710 | 2710 | ||
| 2711 | if (ext4_has_feature_flex_bg(sb)) { | 2711 | if (ext4_has_feature_flex_bg(sb)) { |
| 2712 | /* a single flex group is supposed to be read by a single IO */ | 2712 | /* a single flex group is supposed to be read by a single IO. |
| 2713 | sbi->s_mb_prefetch = min(1 << sbi->s_es->s_log_groups_per_flex, | 2713 | * 2 ^ s_log_groups_per_flex != UINT_MAX as s_mb_prefetch is |
| 2714 | * unsigned integer, so the maximum shift is 32. | ||
| 2715 | */ | ||
| 2716 | if (sbi->s_es->s_log_groups_per_flex >= 32) { | ||
| 2717 | ext4_msg(sb, KERN_ERR, "too many log groups per flexible block group"); | ||
| 2718 | goto err_freesgi; | ||
| 2719 | } | ||
| 2720 | sbi->s_mb_prefetch = min_t(uint, 1 << sbi->s_es->s_log_groups_per_flex, | ||
| 2714 | BLK_MAX_SEGMENT_SIZE >> (sb->s_blocksize_bits - 9)); | 2721 | BLK_MAX_SEGMENT_SIZE >> (sb->s_blocksize_bits - 9)); |
| 2715 | sbi->s_mb_prefetch *= 8; /* 8 prefetch IOs in flight at most */ | 2722 | sbi->s_mb_prefetch *= 8; /* 8 prefetch IOs in flight at most */ |
| 2716 | } else { | 2723 | } else { |
| @@ -3613,6 +3613,31 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent, · 3612 unmodified lines | |||
| 3613 | return retval; | 3613 | return retval; |
| 3614 | } | 3614 | } |
| 3615 | 3615 | ||
| 3616 | static void ext4_resetent(handle_t *handle, struct ext4_renament *ent, | ||
| 3617 | unsigned ino, unsigned file_type) | ||
| 3618 | { | ||
| 3619 | struct ext4_renament old = *ent; | ||
| 3620 | int retval = 0; | ||
| 3621 | |||
| 3622 | /* | ||
| 3623 | * old->de could have moved from under us during make indexed dir, | ||
| 3624 | * so the old->de may no longer valid and need to find it again | ||
| 3625 | * before reset old inode info. | ||
| 3626 | */ | ||
| 3627 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); | ||
| 3628 | if (IS_ERR(old.bh)) | ||
| 3629 | retval = PTR_ERR(old.bh); | ||
| 3630 | if (!old.bh) | ||
| 3631 | retval = -ENOENT; | ||
| 3632 | if (retval) { | ||
| 3633 | ext4_std_error(old.dir->i_sb, retval); | ||
| 3634 | return; | ||
| 3635 | } | ||
| 3636 | |||
| 3637 | ext4_setent(handle, &old, ino, file_type); | ||
| 3638 | brelse(old.bh); | ||
| 3639 | } | ||
| 3640 | |||
| 3616 | static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, | 3641 | static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, |
| 3617 | const struct qstr *d_name) | 3642 | const struct qstr *d_name) |
| 3618 | { | 3643 | { |
| @@ -3774,14 +3799,14 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 155 unmodified lines | |||
| 3774 | */ | 3799 | */ |
| 3775 | retval = -ENOENT; | 3800 | retval = -ENOENT; |
| 3776 | if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino) | 3801 | if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino) |
| 3777 | goto end_rename; | 3802 | goto release_bh; |
| 3778 | 3803 | ||
| 3779 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, | 3804 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, |
| 3780 | &new.de, &new.inlined); | 3805 | &new.de, &new.inlined); |
| 3781 | if (IS_ERR(new.bh)) { | 3806 | if (IS_ERR(new.bh)) { |
| 3782 | retval = PTR_ERR(new.bh); | 3807 | retval = PTR_ERR(new.bh); |
| 3783 | new.bh = NULL; | 3808 | new.bh = NULL; |
| 3784 | goto end_rename; | 3809 | goto release_bh; |
| 3785 | } | 3810 | } |
| 3786 | if (new.bh) { | 3811 | if (new.bh) { |
| 3787 | if (!new.inode) { | 3812 | if (!new.inode) { |
| @@ -3798,15 +3823,13 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 10 unmodified lines | |||
| 3798 | handle = ext4_journal_start(old.dir, EXT4_HT_DIR, credits); | 3823 | handle = ext4_journal_start(old.dir, EXT4_HT_DIR, credits); |
| 3799 | if (IS_ERR(handle)) { | 3824 | if (IS_ERR(handle)) { |
| 3800 | retval = PTR_ERR(handle); | 3825 | retval = PTR_ERR(handle); |
| 3801 | handle = NULL; | 3826 | goto release_bh; |
| 3802 | goto end_rename; | ||
| 3803 | } | 3827 | } |
| 3804 | } else { | 3828 | } else { |
| 3805 | whiteout = ext4_whiteout_for_rename(mnt_userns, &old, credits, &handle); | 3829 | whiteout = ext4_whiteout_for_rename(mnt_userns, &old, credits, &handle); |
| 3806 | if (IS_ERR(whiteout)) { | 3830 | if (IS_ERR(whiteout)) { |
| 3807 | retval = PTR_ERR(whiteout); | 3831 | retval = PTR_ERR(whiteout); |
| 3808 | whiteout = NULL; | 3832 | goto release_bh; |
| 3809 | goto end_rename; | ||
| 3810 | } | 3833 | } |
| 3811 | } | 3834 | } |
| 3812 | 3835 | ||
| @@ -3850,6 +3873,7 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 37 unmodified lines | |||
| 3850 | retval = ext4_mark_inode_dirty(handle, whiteout); | 3873 | retval = ext4_mark_inode_dirty(handle, whiteout); |
| 3851 | if (unlikely(retval)) | 3874 | if (unlikely(retval)) |
| 3852 | goto end_rename; | 3875 | goto end_rename; |
| 3876 | |||
| 3853 | } | 3877 | } |
| 3854 | if (!new.bh) { | 3878 | if (!new.bh) { |
| 3855 | retval = ext4_add_entry(handle, new.dentry, old.inode); | 3879 | retval = ext4_add_entry(handle, new.dentry, old.inode); |
| @@ -3923,6 +3947,8 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 67 unmodified lines | |||
| 3923 | ext4_fc_track_unlink(handle, new.dentry); | 3947 | ext4_fc_track_unlink(handle, new.dentry); |
| 3924 | __ext4_fc_track_link(handle, old.inode, new.dentry); | 3948 | __ext4_fc_track_link(handle, old.inode, new.dentry); |
| 3925 | __ext4_fc_track_unlink(handle, old.inode, old.dentry); | 3949 | __ext4_fc_track_unlink(handle, old.inode, old.dentry); |
| 3950 | if (whiteout) | ||
| 3951 | __ext4_fc_track_create(handle, whiteout, old.dentry); | ||
| 3926 | } | 3952 | } |
| 3927 | 3953 | ||
| 3928 | if (new.inode) { | 3954 | if (new.inode) { |
| @@ -3937,19 +3963,21 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 8 unmodified lines | |||
| 3937 | end_rename: | 3963 | end_rename: |
| 3938 | if (whiteout) { | 3964 | if (whiteout) { |
| 3939 | if (retval) { | 3965 | if (retval) { |
| 3940 | ext4_setent(handle, &old, | 3966 | ext4_resetent(handle, &old, |
| 3941 | old.inode->i_ino, old_file_type); | 3967 | old.inode->i_ino, old_file_type); |
| 3942 | drop_nlink(whiteout); | 3968 | drop_nlink(whiteout); |
| 3969 | ext4_orphan_add(handle, whiteout); | ||
| 3943 | } | 3970 | } |
| 3944 | unlock_new_inode(whiteout); | 3971 | unlock_new_inode(whiteout); |
| 3972 | ext4_journal_stop(handle); | ||
| 3945 | iput(whiteout); | 3973 | iput(whiteout); |
| 3946 | 3974 | } else { | |
| 3975 | ext4_journal_stop(handle); | ||
| 3947 | } | 3976 | } |
| 3977 | release_bh: | ||
| 3948 | brelse(old.dir_bh); | 3978 | brelse(old.dir_bh); |
| 3949 | brelse(old.bh); | 3979 | brelse(old.bh); |
| 3950 | brelse(new.bh); | 3980 | brelse(new.bh); |
| 3951 | if (handle) | ||
| 3952 | ext4_journal_stop(handle); | ||
| 3953 | return retval; | 3981 | return retval; |
| 3954 | } | 3982 | } |
| 3955 | 3983 | ||
| @@ -1210,6 +1210,7 @@ static void ext4_put_super(struct super_block *sb) · 1209 unmodified lines | |||
| 1210 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | 1210 | percpu_counter_destroy(&sbi->s_freeinodes_counter); |
| 1211 | percpu_counter_destroy(&sbi->s_dirs_counter); | 1211 | percpu_counter_destroy(&sbi->s_dirs_counter); |
| 1212 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); | 1212 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
| 1213 | percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit); | ||
| 1213 | percpu_free_rwsem(&sbi->s_writepages_rwsem); | 1214 | percpu_free_rwsem(&sbi->s_writepages_rwsem); |
| 1214 | #ifdef CONFIG_QUOTA | 1215 | #ifdef CONFIG_QUOTA |
| 1215 | for (i = 0; i < EXT4_MAXQUOTAS; i++) | 1216 | for (i = 0; i < EXT4_MAXQUOTAS; i++) |
| @@ -5011,6 +5012,9 @@ no_journal: · 3795 unmodified lines | |||
| 5011 | if (!err) | 5012 | if (!err) |
| 5012 | err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0, | 5013 | err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0, |
| 5013 | GFP_KERNEL); | 5014 | GFP_KERNEL); |
| 5015 | if (!err) | ||
| 5016 | err = percpu_counter_init(&sbi->s_sra_exceeded_retry_limit, 0, | ||
| 5017 | GFP_KERNEL); | ||
| 5014 | if (!err) | 5018 | if (!err) |
| 5015 | err = percpu_init_rwsem(&sbi->s_writepages_rwsem); | 5019 | err = percpu_init_rwsem(&sbi->s_writepages_rwsem); |
| 5016 | 5020 | ||
| @@ -5124,6 +5128,7 @@ failed_mount6: · 107 unmodified lines | |||
| 5124 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | 5128 | percpu_counter_destroy(&sbi->s_freeinodes_counter); |
| 5125 | percpu_counter_destroy(&sbi->s_dirs_counter); | 5129 | percpu_counter_destroy(&sbi->s_dirs_counter); |
| 5126 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); | 5130 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
| 5131 | percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit); | ||
| 5127 | percpu_free_rwsem(&sbi->s_writepages_rwsem); | 5132 | percpu_free_rwsem(&sbi->s_writepages_rwsem); |
| 5128 | failed_mount5: | 5133 | failed_mount5: |
| 5129 | ext4_ext_release(sb); | 5134 | ext4_ext_release(sb); |
| @@ -5149,8 +5154,8 @@ failed_mount_wq: · 19 unmodified lines | |||
| 5149 | failed_mount3a: | 5154 | failed_mount3a: |
| 5150 | ext4_es_unregister_shrinker(sbi); | 5155 | ext4_es_unregister_shrinker(sbi); |
| 5151 | failed_mount3: | 5156 | failed_mount3: |
| 5152 | del_timer_sync(&sbi->s_err_report); | ||
| 5153 | flush_work(&sbi->s_error_work); | 5157 | flush_work(&sbi->s_error_work); |
| 5158 | del_timer_sync(&sbi->s_err_report); | ||
| 5154 | if (sbi->s_mmp_tsk) | 5159 | if (sbi->s_mmp_tsk) |
| 5155 | kthread_stop(sbi->s_mmp_tsk); | 5160 | kthread_stop(sbi->s_mmp_tsk); |
| 5156 | failed_mount2: | 5161 | failed_mount2: |
| @@ -24,6 +24,7 @@ typedef enum { · 23 unmodified lines | |||
| 24 | attr_session_write_kbytes, | 24 | attr_session_write_kbytes, |
| 25 | attr_lifetime_write_kbytes, | 25 | attr_lifetime_write_kbytes, |
| 26 | attr_reserved_clusters, | 26 | attr_reserved_clusters, |
| 27 | attr_sra_exceeded_retry_limit, | ||
| 27 | attr_inode_readahead, | 28 | attr_inode_readahead, |
| 28 | attr_trigger_test_error, | 29 | attr_trigger_test_error, |
| 29 | attr_first_error_time, | 30 | attr_first_error_time, |
| @@ -202,6 +203,7 @@ EXT4_ATTR_FUNC(delayed_allocation_blocks, 0444); · 172 unmodified lines | |||
| 202 | EXT4_ATTR_FUNC(session_write_kbytes, 0444); | 203 | EXT4_ATTR_FUNC(session_write_kbytes, 0444); |
| 203 | EXT4_ATTR_FUNC(lifetime_write_kbytes, 0444); | 204 | EXT4_ATTR_FUNC(lifetime_write_kbytes, 0444); |
| 204 | EXT4_ATTR_FUNC(reserved_clusters, 0644); | 205 | EXT4_ATTR_FUNC(reserved_clusters, 0644); |
| 206 | EXT4_ATTR_FUNC(sra_exceeded_retry_limit, 0444); | ||
| 205 | 207 | ||
| 206 | EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead, | 208 | EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead, |
| 207 | ext4_sb_info, s_inode_readahead_blks); | 209 | ext4_sb_info, s_inode_readahead_blks); |
| @@ -251,6 +253,7 @@ static struct attribute *ext4_attrs[] = { · 43 unmodified lines | |||
| 251 | ATTR_LIST(session_write_kbytes), | 253 | ATTR_LIST(session_write_kbytes), |
| 252 | ATTR_LIST(lifetime_write_kbytes), | 254 | ATTR_LIST(lifetime_write_kbytes), |
| 253 | ATTR_LIST(reserved_clusters), | 255 | ATTR_LIST(reserved_clusters), |
| 256 | ATTR_LIST(sra_exceeded_retry_limit), | ||
| 254 | ATTR_LIST(inode_readahead_blks), | 257 | ATTR_LIST(inode_readahead_blks), |
| 255 | ATTR_LIST(inode_goal), | 258 | ATTR_LIST(inode_goal), |
| 256 | ATTR_LIST(mb_stats), | 259 | ATTR_LIST(mb_stats), |
| @@ -374,6 +377,10 @@ static ssize_t ext4_attr_show(struct kobject *kobj, · 117 unmodified lines | |||
| 374 | return snprintf(buf, PAGE_SIZE, "%llu\n", | 377 | return snprintf(buf, PAGE_SIZE, "%llu\n", |
| 375 | (unsigned long long) | 378 | (unsigned long long) |
| 376 | atomic64_read(&sbi->s_resv_clusters)); | 379 | atomic64_read(&sbi->s_resv_clusters)); |
| 380 | case attr_sra_exceeded_retry_limit: | ||
| 381 | return snprintf(buf, PAGE_SIZE, "%llu\n", | ||
| 382 | (unsigned long long) | ||
| 383 | percpu_counter_sum(&sbi->s_sra_exceeded_retry_limit)); | ||
| 377 | case attr_inode_readahead: | 384 | case attr_inode_readahead: |
| 378 | case attr_pointer_ui: | 385 | case attr_pointer_ui: |
| 379 | if (!ptr) | 386 | if (!ptr) |
| @@ -201,55 +201,76 @@ static int ext4_end_enable_verity(struct file *filp, const void *desc, · 200 unmodified lines | |||
| 201 | struct inode *inode = file_inode(filp); | 201 | struct inode *inode = file_inode(filp); |
| 202 | const int credits = 2; /* superblock and inode for ext4_orphan_del() */ | 202 | const int credits = 2; /* superblock and inode for ext4_orphan_del() */ |
| 203 | handle_t *handle; | 203 | handle_t *handle; |
| 204 | struct ext4_iloc iloc; | ||
| 204 | int err = 0; | 205 | int err = 0; |
| 205 | int err2; | ||
| 206 | 206 | ||
| 207 | if (desc != NULL) { | 207 | /* |
| 208 | /* Succeeded; write the verity descriptor. */ | 208 | * If an error already occurred (which fs/verity/ signals by passing |
| 209 | err = ext4_write_verity_descriptor(inode, desc, desc_size, | 209 | * desc == NULL), then only clean-up is needed. |
| 210 | merkle_tree_size); | 210 | */ |
| 211 | 211 | if (desc == NULL) | |
| 212 | /* Write all pages before clearing VERITY_IN_PROGRESS. */ | 212 | goto cleanup; |
| 213 | if (!err) | ||
| 214 | err = filemap_write_and_wait(inode->i_mapping); | ||
| 215 | } | ||
| 216 | 213 | ||
| 217 | /* If we failed, truncate anything we wrote past i_size. */ | 214 | /* Append the verity descriptor. */ |
| 218 | if (desc == NULL || err) | 215 | err = ext4_write_verity_descriptor(inode, desc, desc_size, |
| 219 | ext4_truncate(inode); | 216 | merkle_tree_size); |
| 217 | if (err) | ||
| 218 | goto cleanup; | ||
| 220 | 219 | ||
| 221 | /* | 220 | /* |
| 222 | * We must always clean up by clearing EXT4_STATE_VERITY_IN_PROGRESS and | 221 | * Write all pages (both data and verity metadata). Note that this must |
| 223 | * deleting the inode from the orphan list, even if something failed. | 222 | * happen before clearing EXT4_STATE_VERITY_IN_PROGRESS; otherwise pages |
| 224 | * If everything succeeded, we'll also set the verity bit in the same | 223 | * beyond i_size won't be written properly. For crash consistency, this |
| 225 | * transaction. | 224 | * also must happen before the verity inode flag gets persisted. |
| 226 | */ | 225 | */ |
| 226 | err = filemap_write_and_wait(inode->i_mapping); | ||
| 227 | if (err) | ||
| 228 | goto cleanup; | ||
| 227 | 229 | ||
| 228 | ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS); | 230 | /* |
| 231 | * Finally, set the verity inode flag and remove the inode from the | ||
| 232 | * orphan list (in a single transaction). | ||
| 233 | */ | ||
| 229 | 234 | ||
| 230 | handle = ext4_journal_start(inode, EXT4_HT_INODE, credits); | 235 | handle = ext4_journal_start(inode, EXT4_HT_INODE, credits); |
| 231 | if (IS_ERR(handle)) { | 236 | if (IS_ERR(handle)) { |
| 232 | ext4_orphan_del(NULL, inode); | 237 | err = PTR_ERR(handle); |
| 233 | return PTR_ERR(handle); | 238 | goto cleanup; |
| 234 | } | 239 | } |
| 235 | 240 | ||
| 236 | err2 = ext4_orphan_del(handle, inode); | 241 | err = ext4_orphan_del(handle, inode); |
| 237 | if (err2) | 242 | if (err) |
| 238 | goto out_stop; | 243 | goto stop_and_cleanup; |
| 239 | 244 | ||
| 240 | if (desc != NULL && !err) { | 245 | err = ext4_reserve_inode_write(handle, inode, &iloc); |
| 241 | struct ext4_iloc iloc; | 246 | if (err) |
| 247 | goto stop_and_cleanup; | ||
| 242 | 248 | ||
| 243 | err = ext4_reserve_inode_write(handle, inode, &iloc); | 249 | ext4_set_inode_flag(inode, EXT4_INODE_VERITY); |
| 244 | if (err) | 250 | ext4_set_inode_flags(inode, false); |
| 245 | goto out_stop; | 251 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); |
| 246 | ext4_set_inode_flag(inode, EXT4_INODE_VERITY); | 252 | if (err) |
| 247 | ext4_set_inode_flags(inode, false); | 253 | goto stop_and_cleanup; |
| 248 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); | 254 | |
| 249 | } | 255 | ext4_journal_stop(handle); |
| 250 | out_stop: | 256 | |
| 257 | ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS); | ||
| 258 | return 0; | ||
| 259 | |||
| 260 | stop_and_cleanup: | ||
| 251 | ext4_journal_stop(handle); | 261 | ext4_journal_stop(handle); |
| 252 | return err ?: err2; | 262 | cleanup: |
| 263 | /* | ||
| 264 | * Verity failed to be enabled, so clean up by truncating any verity | ||
| 265 | * metadata that was written beyond i_size (both from cache and from | ||
| 266 | * disk), removing the inode from the orphan list (if it wasn't done | ||
| 267 | * already), and clearing EXT4_STATE_VERITY_IN_PROGRESS. | ||
| 268 | */ | ||
| 269 | truncate_inode_pages(inode->i_mapping, inode->i_size); | ||
| 270 | ext4_truncate(inode); | ||
| 271 | ext4_orphan_del(NULL, inode); | ||
| 272 | ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS); | ||
| 273 | return err; | ||
| 253 | } | 274 | } |
| 254 | 275 | ||
| 255 | static int ext4_get_verity_descriptor_location(struct inode *inode, | 276 | static int ext4_get_verity_descriptor_location(struct inode *inode, |
| @@ -1462,6 +1462,9 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value, · 1461 unmodified lines | |||
| 1462 | if (!ce) | 1462 | if (!ce) |
| 1463 | return NULL; | 1463 | return NULL; |
| 1464 | 1464 | ||
| 1465 | WARN_ON_ONCE(ext4_handle_valid(journal_current_handle()) && | ||
| 1466 | !(current->flags & PF_MEMALLOC_NOFS)); | ||
| 1467 | |||
| 1465 | ea_data = kvmalloc(value_len, GFP_KERNEL); | 1468 | ea_data = kvmalloc(value_len, GFP_KERNEL); |
| 1466 | if (!ea_data) { | 1469 | if (!ea_data) { |
| 1467 | mb_cache_entry_put(ea_inode_cache, ce); | 1470 | mb_cache_entry_put(ea_inode_cache, ce); |
| @@ -2327,6 +2330,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, · 859 unmodified lines | |||
| 2327 | error = -ENOSPC; | 2330 | error = -ENOSPC; |
| 2328 | goto cleanup; | 2331 | goto cleanup; |
| 2329 | } | 2332 | } |
| 2333 | WARN_ON_ONCE(!(current->flags & PF_MEMALLOC_NOFS)); | ||
| 2330 | } | 2334 | } |
| 2331 | 2335 | ||
| 2332 | error = ext4_reserve_inode_write(handle, inode, &is.iloc); | 2336 | error = ext4_reserve_inode_write(handle, inode, &is.iloc); |
| @@ -2400,7 +2404,7 @@ retry_inode: · 67 unmodified lines | |||
| 2400 | * external inode if possible. | 2404 | * external inode if possible. |
| 2401 | */ | 2405 | */ |
| 2402 | if (ext4_has_feature_ea_inode(inode->i_sb) && | 2406 | if (ext4_has_feature_ea_inode(inode->i_sb) && |
| 2403 | !i.in_inode) { | 2407 | i.value_len && !i.in_inode) { |
| 2404 | i.in_inode = 1; | 2408 | i.in_inode = 1; |
| 2405 | goto retry_inode; | 2409 | goto retry_inode; |
| 2406 | } | 2410 | } |
| @@ -16,7 +16,6 @@ · 15 unmodified lines | |||
| 16 | #include <linux/rculist_nulls.h> | 16 | #include <linux/rculist_nulls.h> |
| 17 | #include <linux/cpu.h> | 17 | #include <linux/cpu.h> |
| 18 | #include <linux/tracehook.h> | 18 | #include <linux/tracehook.h> |
| 19 | #include <linux/freezer.h> | ||
| 20 | 19 | ||
| 21 | #include "../kernel/sched/sched.h" | 20 | #include "../kernel/sched/sched.h" |
| 22 | #include "io-wq.h" | 21 | #include "io-wq.h" |
| @@ -386,13 +385,14 @@ static struct io_wq_work *io_get_next_work(struct io_wqe *wqe) · 363 unmodified lines | |||
| 386 | return NULL; | 385 | return NULL; |
| 387 | } | 386 | } |
| 388 | 387 | ||
| 389 | static void io_flush_signals(void) | 388 | static bool io_flush_signals(void) |
| 390 | { | 389 | { |
| 391 | if (unlikely(test_tsk_thread_flag(current, TIF_NOTIFY_SIGNAL))) { | 390 | if (unlikely(test_thread_flag(TIF_NOTIFY_SIGNAL))) { |
| 392 | if (current->task_works) | 391 | __set_current_state(TASK_RUNNING); |
| 393 | task_work_run(); | 392 | tracehook_notify_signal(); |
| 394 | clear_tsk_thread_flag(current, TIF_NOTIFY_SIGNAL); | 393 | return true; |
| 395 | } | 394 | } |
| 395 | return false; | ||
| 396 | } | 396 | } |
| 397 | 397 | ||
| 398 | static void io_assign_current_work(struct io_worker *worker, | 398 | static void io_assign_current_work(struct io_worker *worker, |
| @@ -488,6 +488,8 @@ static int io_wqe_worker(void *data) · 89 unmodified lines | |||
| 488 | set_task_comm(current, buf); | 488 | set_task_comm(current, buf); |
| 489 | 489 | ||
| 490 | while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) { | 490 | while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) { |
| 491 | long ret; | ||
| 492 | |||
| 491 | set_current_state(TASK_INTERRUPTIBLE); | 493 | set_current_state(TASK_INTERRUPTIBLE); |
| 492 | loop: | 494 | loop: |
| 493 | raw_spin_lock_irq(&wqe->lock); | 495 | raw_spin_lock_irq(&wqe->lock); |
| @@ -497,11 +499,18 @@ loop: · 3 unmodified lines | |||
| 497 | } | 499 | } |
| 498 | __io_worker_idle(wqe, worker); | 500 | __io_worker_idle(wqe, worker); |
| 499 | raw_spin_unlock_irq(&wqe->lock); | 501 | raw_spin_unlock_irq(&wqe->lock); |
| 500 | io_flush_signals(); | 502 | if (io_flush_signals()) |
| 501 | if (schedule_timeout(WORKER_IDLE_TIMEOUT)) | ||
| 502 | continue; | 503 | continue; |
| 503 | if (fatal_signal_pending(current)) | 504 | ret = schedule_timeout(WORKER_IDLE_TIMEOUT); |
| 505 | if (signal_pending(current)) { | ||
| 506 | struct ksignal ksig; | ||
| 507 | |||
| 508 | if (!get_signal(&ksig)) | ||
| 509 | continue; | ||
| 504 | break; | 510 | break; |
| 511 | } | ||
| 512 | if (ret) | ||
| 513 | continue; | ||
| 505 | /* timed out, exit unless we're the fixed worker */ | 514 | /* timed out, exit unless we're the fixed worker */ |
| 506 | if (test_bit(IO_WQ_BIT_EXIT, &wq->state) || | 515 | if (test_bit(IO_WQ_BIT_EXIT, &wq->state) || |
| 507 | !(worker->flags & IO_WORKER_F_FIXED)) | 516 | !(worker->flags & IO_WORKER_F_FIXED)) |
| @@ -709,8 +718,13 @@ static int io_wq_manager(void *data) · 201 unmodified lines | |||
| 709 | set_current_state(TASK_INTERRUPTIBLE); | 718 | set_current_state(TASK_INTERRUPTIBLE); |
| 710 | io_wq_check_workers(wq); | 719 | io_wq_check_workers(wq); |
| 711 | schedule_timeout(HZ); | 720 | schedule_timeout(HZ); |
| 712 | if (fatal_signal_pending(current)) | 721 | if (signal_pending(current)) { |
| 722 | struct ksignal ksig; | ||
| 723 | |||
| 724 | if (!get_signal(&ksig)) | ||
| 725 | continue; | ||
| 713 | set_bit(IO_WQ_BIT_EXIT, &wq->state); | 726 | set_bit(IO_WQ_BIT_EXIT, &wq->state); |
| 727 | } | ||
| 714 | } while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)); | 728 | } while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)); |
| 715 | 729 | ||
| 716 | io_wq_check_workers(wq); | 730 | io_wq_check_workers(wq); |
| @@ -1057,7 +1071,11 @@ static void io_wq_destroy(struct io_wq *wq) · 340 unmodified lines | |||
| 1057 | 1071 | ||
| 1058 | for_each_node(node) { | 1072 | for_each_node(node) { |
| 1059 | struct io_wqe *wqe = wq->wqes[node]; | 1073 | struct io_wqe *wqe = wq->wqes[node]; |
| 1060 | WARN_ON_ONCE(!wq_list_empty(&wqe->work_list)); | 1074 | struct io_cb_cancel_data match = { |
| 1075 | .fn = io_wq_work_match_all, | ||
| 1076 | .cancel_all = true, | ||
| 1077 | }; | ||
| 1078 | io_wqe_cancel_pending_work(wqe, &match); | ||
| 1061 | kfree(wqe); | 1079 | kfree(wqe); |
| 1062 | } | 1080 | } |
| 1063 | io_wq_put_hash(wq->hash); | 1081 | io_wq_put_hash(wq->hash); |
| @@ -2,7 +2,6 @@ · 1 unmodified line | |||
| 2 | #define INTERNAL_IO_WQ_H | 2 | #define INTERNAL_IO_WQ_H |
| 3 | 3 | ||
| 4 | #include <linux/refcount.h> | 4 | #include <linux/refcount.h> |
| 5 | #include <linux/io_uring.h> | ||
| 6 | 5 | ||
| 7 | struct io_wq; | 6 | struct io_wq; |
| 8 | 7 | ||
| @@ -21,6 +20,15 @@ enum io_wq_cancel { · 12 unmodified lines | |||
| 21 | IO_WQ_CANCEL_NOTFOUND, /* work not found */ | 20 | IO_WQ_CANCEL_NOTFOUND, /* work not found */ |
| 22 | }; | 21 | }; |
| 23 | 22 | ||
| 23 | struct io_wq_work_node { | ||
| 24 | struct io_wq_work_node *next; | ||
| 25 | }; | ||
| 26 | |||
| 27 | struct io_wq_work_list { | ||
| 28 | struct io_wq_work_node *first; | ||
| 29 | struct io_wq_work_node *last; | ||
| 30 | }; | ||
| 31 | |||
| 24 | static inline void wq_list_add_after(struct io_wq_work_node *node, | 32 | static inline void wq_list_add_after(struct io_wq_work_node *node, |
| 25 | struct io_wq_work_node *pos, | 33 | struct io_wq_work_node *pos, |
| 26 | struct io_wq_work_list *list) | 34 | struct io_wq_work_list *list) |
| @@ -78,7 +78,6 @@ · 77 unmodified lines | |||
| 78 | #include <linux/task_work.h> | 78 | #include <linux/task_work.h> |
| 79 | #include <linux/pagemap.h> | 79 | #include <linux/pagemap.h> |
| 80 | #include <linux/io_uring.h> | 80 | #include <linux/io_uring.h> |
| 81 | #include <linux/freezer.h> | ||
| 82 | 81 | ||
| 83 | #define CREATE_TRACE_POINTS | 82 | #define CREATE_TRACE_POINTS |
| 84 | #include <trace/events/io_uring.h> | 83 | #include <trace/events/io_uring.h> |
| @@ -258,7 +257,8 @@ enum { · 173 unmodified lines | |||
| 258 | 257 | ||
| 259 | struct io_sq_data { | 258 | struct io_sq_data { |
| 260 | refcount_t refs; | 259 | refcount_t refs; |
| 261 | struct rw_semaphore rw_lock; | 260 | atomic_t park_pending; |
| 261 | struct mutex lock; | ||
| 262 | 262 | ||
| 263 | /* ctx's that are using this sqd */ | 263 | /* ctx's that are using this sqd */ |
| 264 | struct list_head ctx_list; | 264 | struct list_head ctx_list; |
| @@ -273,6 +273,7 @@ struct io_sq_data { · 8 unmodified lines | |||
| 273 | 273 | ||
| 274 | unsigned long state; | 274 | unsigned long state; |
| 275 | struct completion exited; | 275 | struct completion exited; |
| 276 | struct callback_head *park_task_work; | ||
| 276 | }; | 277 | }; |
| 277 | 278 | ||
| 278 | #define IO_IOPOLL_BATCH 8 | 279 | #define IO_IOPOLL_BATCH 8 |
| @@ -402,7 +403,7 @@ struct io_ring_ctx { · 123 unmodified lines | |||
| 402 | struct socket *ring_sock; | 403 | struct socket *ring_sock; |
| 403 | #endif | 404 | #endif |
| 404 | 405 | ||
| 405 | struct idr io_buffer_idr; | 406 | struct xarray io_buffers; |
| 406 | 407 | ||
| 407 | struct xarray personalities; | 408 | struct xarray personalities; |
| 408 | u32 pers_next; | 409 | u32 pers_next; |
| @@ -454,6 +455,22 @@ struct io_ring_ctx { · 45 unmodified lines | |||
| 454 | struct list_head tctx_list; | 455 | struct list_head tctx_list; |
| 455 | }; | 456 | }; |
| 456 | 457 | ||
| 458 | struct io_uring_task { | ||
| 459 | /* submission side */ | ||
| 460 | struct xarray xa; | ||
| 461 | struct wait_queue_head wait; | ||
| 462 | const struct io_ring_ctx *last; | ||
| 463 | struct io_wq *io_wq; | ||
| 464 | struct percpu_counter inflight; | ||
| 465 | atomic_t in_idle; | ||
| 466 | bool sqpoll; | ||
| 467 | |||
| 468 | spinlock_t task_lock; | ||
| 469 | struct io_wq_work_list task_list; | ||
| 470 | unsigned long task_state; | ||
| 471 | struct callback_head task_work; | ||
| 472 | }; | ||
| 473 | |||
| 457 | /* | 474 | /* |
| 458 | * First field must be the file pointer in all the | 475 | * First field must be the file pointer in all the |
| 459 | * iocb unions! See also 'struct kiocb' in <linux/fs.h> | 476 | * iocb unions! See also 'struct kiocb' in <linux/fs.h> |
| @@ -1077,8 +1094,6 @@ static bool io_match_task(struct io_kiocb *head, · 617 unmodified lines | |||
| 1077 | io_for_each_link(req, head) { | 1094 | io_for_each_link(req, head) { |
| 1078 | if (req->flags & REQ_F_INFLIGHT) | 1095 | if (req->flags & REQ_F_INFLIGHT) |
| 1079 | return true; | 1096 | return true; |
| 1080 | if (req->task->files == files) | ||
| 1081 | return true; | ||
| 1082 | } | 1097 | } |
| 1083 | return false; | 1098 | return false; |
| 1084 | } | 1099 | } |
| @@ -1135,7 +1150,7 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 50 unmodified lines | |||
| 1135 | init_waitqueue_head(&ctx->cq_wait); | 1150 | init_waitqueue_head(&ctx->cq_wait); |
| 1136 | INIT_LIST_HEAD(&ctx->cq_overflow_list); | 1151 | INIT_LIST_HEAD(&ctx->cq_overflow_list); |
| 1137 | init_completion(&ctx->ref_comp); | 1152 | init_completion(&ctx->ref_comp); |
| 1138 | idr_init(&ctx->io_buffer_idr); | 1153 | xa_init_flags(&ctx->io_buffers, XA_FLAGS_ALLOC1); |
| 1139 | xa_init_flags(&ctx->personalities, XA_FLAGS_ALLOC1); | 1154 | xa_init_flags(&ctx->personalities, XA_FLAGS_ALLOC1); |
| 1140 | mutex_init(&ctx->uring_lock); | 1155 | mutex_init(&ctx->uring_lock); |
| 1141 | init_waitqueue_head(&ctx->wait); | 1156 | init_waitqueue_head(&ctx->wait); |
| @@ -1221,16 +1236,16 @@ static void io_queue_async_work(struct io_kiocb *req) · 79 unmodified lines | |||
| 1221 | BUG_ON(!tctx); | 1236 | BUG_ON(!tctx); |
| 1222 | BUG_ON(!tctx->io_wq); | 1237 | BUG_ON(!tctx->io_wq); |
| 1223 | 1238 | ||
| 1224 | trace_io_uring_queue_async_work(ctx, io_wq_is_hashed(&req->work), req, | ||
| 1225 | &req->work, req->flags); | ||
| 1226 | /* init ->work of the whole link before punting */ | 1239 | /* init ->work of the whole link before punting */ |
| 1227 | io_prep_async_link(req); | 1240 | io_prep_async_link(req); |
| 1241 | trace_io_uring_queue_async_work(ctx, io_wq_is_hashed(&req->work), req, | ||
| 1242 | &req->work, req->flags); | ||
| 1228 | io_wq_enqueue(tctx->io_wq, &req->work); | 1243 | io_wq_enqueue(tctx->io_wq, &req->work); |
| 1229 | if (link) | 1244 | if (link) |
| 1230 | io_queue_linked_timeout(link); | 1245 | io_queue_linked_timeout(link); |
| 1231 | } | 1246 | } |
| 1232 | 1247 | ||
| 1233 | static void io_kill_timeout(struct io_kiocb *req) | 1248 | static void io_kill_timeout(struct io_kiocb *req, int status) |
| 1234 | { | 1249 | { |
| 1235 | struct io_timeout_data *io = req->async_data; | 1250 | struct io_timeout_data *io = req->async_data; |
| 1236 | int ret; | 1251 | int ret; |
| @@ -1240,31 +1255,11 @@ static void io_kill_timeout(struct io_kiocb *req) · 3 unmodified lines | |||
| 1240 | atomic_set(&req->ctx->cq_timeouts, | 1255 | atomic_set(&req->ctx->cq_timeouts, |
| 1241 | atomic_read(&req->ctx->cq_timeouts) + 1); | 1256 | atomic_read(&req->ctx->cq_timeouts) + 1); |
| 1242 | list_del_init(&req->timeout.list); | 1257 | list_del_init(&req->timeout.list); |
| 1243 | io_cqring_fill_event(req, 0); | 1258 | io_cqring_fill_event(req, status); |
| 1244 | io_put_req_deferred(req, 1); | 1259 | io_put_req_deferred(req, 1); |
| 1245 | } | 1260 | } |
| 1246 | } | 1261 | } |
| 1247 | 1262 | ||
| 1248 | /* | ||
| 1249 | * Returns true if we found and killed one or more timeouts | ||
| 1250 | */ | ||
| 1251 | static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk, | ||
| 1252 | struct files_struct *files) | ||
| 1253 | { | ||
| 1254 | struct io_kiocb *req, *tmp; | ||
| 1255 | int canceled = 0; | ||
| 1256 | |||
| 1257 | spin_lock_irq(&ctx->completion_lock); | ||
| 1258 | list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) { | ||
| 1259 | if (io_match_task(req, tsk, files)) { | ||
| 1260 | io_kill_timeout(req); | ||
| 1261 | canceled++; | ||
| 1262 | } | ||
| 1263 | } | ||
| 1264 | spin_unlock_irq(&ctx->completion_lock); | ||
| 1265 | return canceled != 0; | ||
| 1266 | } | ||
| 1267 | |||
| 1268 | static void __io_queue_deferred(struct io_ring_ctx *ctx) | 1263 | static void __io_queue_deferred(struct io_ring_ctx *ctx) |
| 1269 | { | 1264 | { |
| 1270 | do { | 1265 | do { |
| @@ -1309,7 +1304,7 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx) · 38 unmodified lines | |||
| 1309 | break; | 1304 | break; |
| 1310 | 1305 | ||
| 1311 | list_del_init(&req->timeout.list); | 1306 | list_del_init(&req->timeout.list); |
| 1312 | io_kill_timeout(req); | 1307 | io_kill_timeout(req, 0); |
| 1313 | } while (!list_empty(&ctx->timeout_list)); | 1308 | } while (!list_empty(&ctx->timeout_list)); |
| 1314 | 1309 | ||
| 1315 | ctx->cq_last_tm_flush = seq; | 1310 | ctx->cq_last_tm_flush = seq; |
| @@ -1550,14 +1545,17 @@ static void io_req_complete_post(struct io_kiocb *req, long res, · 234 unmodified lines | |||
| 1550 | io_put_task(req->task, 1); | 1545 | io_put_task(req->task, 1); |
| 1551 | list_add(&req->compl.list, &cs->locked_free_list); | 1546 | list_add(&req->compl.list, &cs->locked_free_list); |
| 1552 | cs->locked_free_nr++; | 1547 | cs->locked_free_nr++; |
| 1553 | } else | 1548 | } else { |
| 1554 | req = NULL; | 1549 | if (!percpu_ref_tryget(&ctx->refs)) |
| 1550 | req = NULL; | ||
| 1551 | } | ||
| 1555 | io_commit_cqring(ctx); | 1552 | io_commit_cqring(ctx); |
| 1556 | spin_unlock_irqrestore(&ctx->completion_lock, flags); | 1553 | spin_unlock_irqrestore(&ctx->completion_lock, flags); |
| 1557 | io_cqring_ev_posted(ctx); | ||
| 1558 | 1554 | ||
| 1559 | if (req) | 1555 | if (req) { |
| 1556 | io_cqring_ev_posted(ctx); | ||
| 1560 | percpu_ref_put(&ctx->refs); | 1557 | percpu_ref_put(&ctx->refs); |
| 1558 | } | ||
| 1561 | } | 1559 | } |
| 1562 | 1560 | ||
| 1563 | static void io_req_complete_state(struct io_kiocb *req, long res, | 1561 | static void io_req_complete_state(struct io_kiocb *req, long res, |
| @@ -1925,17 +1923,44 @@ static int io_req_task_work_add(struct io_kiocb *req) · 361 unmodified lines | |||
| 1925 | return ret; | 1923 | return ret; |
| 1926 | } | 1924 | } |
| 1927 | 1925 | ||
| 1928 | static void io_req_task_work_add_fallback(struct io_kiocb *req, | 1926 | static bool io_run_task_work_head(struct callback_head **work_head) |
| 1929 | task_work_func_t cb) | 1927 | { |
| 1928 | struct callback_head *work, *next; | ||
| 1929 | bool executed = false; | ||
| 1930 | |||
| 1931 | do { | ||
| 1932 | work = xchg(work_head, NULL); | ||
| 1933 | if (!work) | ||
| 1934 | break; | ||
| 1935 | |||
| 1936 | do { | ||
| 1937 | next = work->next; | ||
| 1938 | work->func(work); | ||
| 1939 | work = next; | ||
| 1940 | cond_resched(); | ||
| 1941 | } while (work); | ||
| 1942 | executed = true; | ||
| 1943 | } while (1); | ||
| 1944 | |||
| 1945 | return executed; | ||
| 1946 | } | ||
| 1947 | |||
| 1948 | static void io_task_work_add_head(struct callback_head **work_head, | ||
| 1949 | struct callback_head *task_work) | ||
| 1930 | { | 1950 | { |
| 1931 | struct io_ring_ctx *ctx = req->ctx; | ||
| 1932 | struct callback_head *head; | 1951 | struct callback_head *head; |
| 1933 | 1952 | ||
| 1934 | init_task_work(&req->task_work, cb); | ||
| 1935 | do { | 1953 | do { |
| 1936 | head = READ_ONCE(ctx->exit_task_work); | 1954 | head = READ_ONCE(*work_head); |
| 1937 | req->task_work.next = head; | 1955 | task_work->next = head; |
| 1938 | } while (cmpxchg(&ctx->exit_task_work, head, &req->task_work) != head); | 1956 | } while (cmpxchg(work_head, head, task_work) != head); |
| 1957 | } | ||
| 1958 | |||
| 1959 | static void io_req_task_work_add_fallback(struct io_kiocb *req, | ||
| 1960 | task_work_func_t cb) | ||
| 1961 | { | ||
| 1962 | init_task_work(&req->task_work, cb); | ||
| 1963 | io_task_work_add_head(&req->ctx->exit_task_work, &req->task_work); | ||
| 1939 | } | 1964 | } |
| 1940 | 1965 | ||
| 1941 | static void __io_req_task_cancel(struct io_kiocb *req, int error) | 1966 | static void __io_req_task_cancel(struct io_kiocb *req, int error) |
| @@ -2476,13 +2501,12 @@ static void __io_complete_rw(struct io_kiocb *req, long res, long res2, · 534 unmodified lines | |||
| 2476 | { | 2501 | { |
| 2477 | int cflags = 0; | 2502 | int cflags = 0; |
| 2478 | 2503 | ||
| 2504 | if (req->rw.kiocb.ki_flags & IOCB_WRITE) | ||
| 2505 | kiocb_end_write(req); | ||
| 2479 | if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_reissue(req)) | 2506 | if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_reissue(req)) |
| 2480 | return; | 2507 | return; |
| 2481 | if (res != req->result) | 2508 | if (res != req->result) |
| 2482 | req_set_fail_links(req); | 2509 | req_set_fail_links(req); |
| 2483 | |||
| 2484 | if (req->rw.kiocb.ki_flags & IOCB_WRITE) | ||
| 2485 | kiocb_end_write(req); | ||
| 2486 | if (req->flags & REQ_F_BUFFER_SELECTED) | 2510 | if (req->flags & REQ_F_BUFFER_SELECTED) |
| 2487 | cflags = io_put_rw_kbuf(req); | 2511 | cflags = io_put_rw_kbuf(req); |
| 2488 | __io_req_complete(req, issue_flags, res, cflags); | 2512 | __io_req_complete(req, issue_flags, res, cflags); |
| @@ -2843,7 +2867,7 @@ static struct io_buffer *io_buffer_select(struct io_kiocb *req, size_t *len, · 354 unmodified lines | |||
| 2843 | 2867 | ||
| 2844 | lockdep_assert_held(&req->ctx->uring_lock); | 2868 | lockdep_assert_held(&req->ctx->uring_lock); |
| 2845 | 2869 | ||
| 2846 | head = idr_find(&req->ctx->io_buffer_idr, bgid); | 2870 | head = xa_load(&req->ctx->io_buffers, bgid); |
| 2847 | if (head) { | 2871 | if (head) { |
| 2848 | if (!list_empty(&head->list)) { | 2872 | if (!list_empty(&head->list)) { |
| 2849 | kbuf = list_last_entry(&head->list, struct io_buffer, | 2873 | kbuf = list_last_entry(&head->list, struct io_buffer, |
| @@ -2851,7 +2875,7 @@ static struct io_buffer *io_buffer_select(struct io_kiocb *req, size_t *len, · 1 unmodified line | |||
| 2851 | list_del(&kbuf->list); | 2875 | list_del(&kbuf->list); |
| 2852 | } else { | 2876 | } else { |
| 2853 | kbuf = head; | 2877 | kbuf = head; |
| 2854 | idr_remove(&req->ctx->io_buffer_idr, bgid); | 2878 | xa_erase(&req->ctx->io_buffers, bgid); |
| 2855 | } | 2879 | } |
| 2856 | if (*len > kbuf->len) | 2880 | if (*len > kbuf->len) |
| 2857 | *len = kbuf->len; | 2881 | *len = kbuf->len; |
| @@ -3892,7 +3916,7 @@ static int __io_remove_buffers(struct io_ring_ctx *ctx, struct io_buffer *buf, · 1034 unmodified lines | |||
| 3892 | } | 3916 | } |
| 3893 | i++; | 3917 | i++; |
| 3894 | kfree(buf); | 3918 | kfree(buf); |
| 3895 | idr_remove(&ctx->io_buffer_idr, bgid); | 3919 | xa_erase(&ctx->io_buffers, bgid); |
| 3896 | 3920 | ||
| 3897 | return i; | 3921 | return i; |
| 3898 | } | 3922 | } |
| @@ -3910,7 +3934,7 @@ static int io_remove_buffers(struct io_kiocb *req, unsigned int issue_flags) · 11 unmodified lines | |||
| 3910 | lockdep_assert_held(&ctx->uring_lock); | 3934 | lockdep_assert_held(&ctx->uring_lock); |
| 3911 | 3935 | ||
| 3912 | ret = -ENOENT; | 3936 | ret = -ENOENT; |
| 3913 | head = idr_find(&ctx->io_buffer_idr, p->bgid); | 3937 | head = xa_load(&ctx->io_buffers, p->bgid); |
| 3914 | if (head) | 3938 | if (head) |
| 3915 | ret = __io_remove_buffers(ctx, head, p->bgid, p->nbufs); | 3939 | ret = __io_remove_buffers(ctx, head, p->bgid, p->nbufs); |
| 3916 | if (ret < 0) | 3940 | if (ret < 0) |
| @@ -3930,6 +3954,7 @@ static int io_remove_buffers(struct io_kiocb *req, unsigned int issue_flags) · 13 unmodified lines | |||
| 3930 | static int io_provide_buffers_prep(struct io_kiocb *req, | 3954 | static int io_provide_buffers_prep(struct io_kiocb *req, |
| 3931 | const struct io_uring_sqe *sqe) | 3955 | const struct io_uring_sqe *sqe) |
| 3932 | { | 3956 | { |
| 3957 | unsigned long size; | ||
| 3933 | struct io_provide_buf *p = &req->pbuf; | 3958 | struct io_provide_buf *p = &req->pbuf; |
| 3934 | u64 tmp; | 3959 | u64 tmp; |
| 3935 | 3960 | ||
| @@ -3943,7 +3968,8 @@ static int io_provide_buffers_prep(struct io_kiocb *req, · 7 unmodified lines | |||
| 3943 | p->addr = READ_ONCE(sqe->addr); | 3968 | p->addr = READ_ONCE(sqe->addr); |
| 3944 | p->len = READ_ONCE(sqe->len); | 3969 | p->len = READ_ONCE(sqe->len); |
| 3945 | 3970 | ||
| 3946 | if (!access_ok(u64_to_user_ptr(p->addr), (p->len * p->nbufs))) | 3971 | size = (unsigned long)p->len * p->nbufs; |
| 3972 | if (!access_ok(u64_to_user_ptr(p->addr), size)) | ||
| 3947 | return -EFAULT; | 3973 | return -EFAULT; |
| 3948 | 3974 | ||
| 3949 | p->bgid = READ_ONCE(sqe->buf_group); | 3975 | p->bgid = READ_ONCE(sqe->buf_group); |
| @@ -3993,21 +4019,14 @@ static int io_provide_buffers(struct io_kiocb *req, unsigned int issue_flags) · 43 unmodified lines | |||
| 3993 | 4019 | ||
| 3994 | lockdep_assert_held(&ctx->uring_lock); | 4020 | lockdep_assert_held(&ctx->uring_lock); |
| 3995 | 4021 | ||
| 3996 | list = head = idr_find(&ctx->io_buffer_idr, p->bgid); | 4022 | list = head = xa_load(&ctx->io_buffers, p->bgid); |
| 3997 | 4023 | ||
| 3998 | ret = io_add_buffers(p, &head); | 4024 | ret = io_add_buffers(p, &head); |
| 3999 | if (ret < 0) | 4025 | if (ret >= 0 && !list) { |
| 4000 | goto out; | 4026 | ret = xa_insert(&ctx->io_buffers, p->bgid, head, GFP_KERNEL); |
| 4001 | 4027 | if (ret < 0) | |
| 4002 | if (!list) { | ||
| 4003 | ret = idr_alloc(&ctx->io_buffer_idr, head, p->bgid, p->bgid + 1, | ||
| 4004 | GFP_KERNEL); | ||
| 4005 | if (ret < 0) { | ||
| 4006 | __io_remove_buffers(ctx, head, p->bgid, -1U); | 4028 | __io_remove_buffers(ctx, head, p->bgid, -1U); |
| 4007 | goto out; | ||
| 4008 | } | ||
| 4009 | } | 4029 | } |
| 4010 | out: | ||
| 4011 | if (ret < 0) | 4030 | if (ret < 0) |
| 4012 | req_set_fail_links(req); | 4031 | req_set_fail_links(req); |
| 4013 | 4032 | ||
| @@ -4345,6 +4364,7 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags) · 331 unmodified lines | |||
| 4345 | struct io_async_msghdr iomsg, *kmsg; | 4364 | struct io_async_msghdr iomsg, *kmsg; |
| 4346 | struct socket *sock; | 4365 | struct socket *sock; |
| 4347 | unsigned flags; | 4366 | unsigned flags; |
| 4367 | int min_ret = 0; | ||
| 4348 | int ret; | 4368 | int ret; |
| 4349 | 4369 | ||
| 4350 | sock = sock_from_file(req->file); | 4370 | sock = sock_from_file(req->file); |
| @@ -4359,12 +4379,15 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags) · 8 unmodified lines | |||
| 4359 | kmsg = &iomsg; | 4379 | kmsg = &iomsg; |
| 4360 | } | 4380 | } |
| 4361 | 4381 | ||
| 4362 | flags = req->sr_msg.msg_flags; | 4382 | flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; |
| 4363 | if (flags & MSG_DONTWAIT) | 4383 | if (flags & MSG_DONTWAIT) |
| 4364 | req->flags |= REQ_F_NOWAIT; | 4384 | req->flags |= REQ_F_NOWAIT; |
| 4365 | else if (issue_flags & IO_URING_F_NONBLOCK) | 4385 | else if (issue_flags & IO_URING_F_NONBLOCK) |
| 4366 | flags |= MSG_DONTWAIT; | 4386 | flags |= MSG_DONTWAIT; |
| 4367 | 4387 | ||
| 4388 | if (flags & MSG_WAITALL) | ||
| 4389 | min_ret = iov_iter_count(&kmsg->msg.msg_iter); | ||
| 4390 | |||
| 4368 | ret = __sys_sendmsg_sock(sock, &kmsg->msg, flags); | 4391 | ret = __sys_sendmsg_sock(sock, &kmsg->msg, flags); |
| 4369 | if ((issue_flags & IO_URING_F_NONBLOCK) && ret == -EAGAIN) | 4392 | if ((issue_flags & IO_URING_F_NONBLOCK) && ret == -EAGAIN) |
| 4370 | return io_setup_async_msg(req, kmsg); | 4393 | return io_setup_async_msg(req, kmsg); |
| @@ -4375,7 +4398,7 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags) · 4 unmodified lines | |||
| 4375 | if (kmsg->free_iov) | 4398 | if (kmsg->free_iov) |
| 4376 | kfree(kmsg->free_iov); | 4399 | kfree(kmsg->free_iov); |
| 4377 | req->flags &= ~REQ_F_NEED_CLEANUP; | 4400 | req->flags &= ~REQ_F_NEED_CLEANUP; |
| 4378 | if (ret < 0) | 4401 | if (ret < min_ret) |
| 4379 | req_set_fail_links(req); | 4402 | req_set_fail_links(req); |
| 4380 | __io_req_complete(req, issue_flags, ret, 0); | 4403 | __io_req_complete(req, issue_flags, ret, 0); |
| 4381 | return 0; | 4404 | return 0; |
| @@ -4388,6 +4411,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) · 6 unmodified lines | |||
| 4388 | struct iovec iov; | 4411 | struct iovec iov; |
| 4389 | struct socket *sock; | 4412 | struct socket *sock; |
| 4390 | unsigned flags; | 4413 | unsigned flags; |
| 4414 | int min_ret = 0; | ||
| 4391 | int ret; | 4415 | int ret; |
| 4392 | 4416 | ||
| 4393 | sock = sock_from_file(req->file); | 4417 | sock = sock_from_file(req->file); |
| @@ -4403,12 +4427,15 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) · 9 unmodified lines | |||
| 4403 | msg.msg_controllen = 0; | 4427 | msg.msg_controllen = 0; |
| 4404 | msg.msg_namelen = 0; | 4428 | msg.msg_namelen = 0; |
| 4405 | 4429 | ||
| 4406 | flags = req->sr_msg.msg_flags; | 4430 | flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; |
| 4407 | if (flags & MSG_DONTWAIT) | 4431 | if (flags & MSG_DONTWAIT) |
| 4408 | req->flags |= REQ_F_NOWAIT; | 4432 | req->flags |= REQ_F_NOWAIT; |
| 4409 | else if (issue_flags & IO_URING_F_NONBLOCK) | 4433 | else if (issue_flags & IO_URING_F_NONBLOCK) |
| 4410 | flags |= MSG_DONTWAIT; | 4434 | flags |= MSG_DONTWAIT; |
| 4411 | 4435 | ||
| 4436 | if (flags & MSG_WAITALL) | ||
| 4437 | min_ret = iov_iter_count(&msg.msg_iter); | ||
| 4438 | |||
| 4412 | msg.msg_flags = flags; | 4439 | msg.msg_flags = flags; |
| 4413 | ret = sock_sendmsg(sock, &msg); | 4440 | ret = sock_sendmsg(sock, &msg); |
| 4414 | if ((issue_flags & IO_URING_F_NONBLOCK) && ret == -EAGAIN) | 4441 | if ((issue_flags & IO_URING_F_NONBLOCK) && ret == -EAGAIN) |
| @@ -4416,7 +4443,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) · 1 unmodified line | |||
| 4416 | if (ret == -ERESTARTSYS) | 4443 | if (ret == -ERESTARTSYS) |
| 4417 | ret = -EINTR; | 4444 | ret = -EINTR; |
| 4418 | 4445 | ||
| 4419 | if (ret < 0) | 4446 | if (ret < min_ret) |
| 4420 | req_set_fail_links(req); | 4447 | req_set_fail_links(req); |
| 4421 | __io_req_complete(req, issue_flags, ret, 0); | 4448 | __io_req_complete(req, issue_flags, ret, 0); |
| 4422 | return 0; | 4449 | return 0; |
| @@ -4568,6 +4595,7 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags) · 145 unmodified lines | |||
| 4568 | struct socket *sock; | 4595 | struct socket *sock; |
| 4569 | struct io_buffer *kbuf; | 4596 | struct io_buffer *kbuf; |
| 4570 | unsigned flags; | 4597 | unsigned flags; |
| 4598 | int min_ret = 0; | ||
| 4571 | int ret, cflags = 0; | 4599 | int ret, cflags = 0; |
| 4572 | bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; | 4600 | bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; |
| 4573 | 4601 | ||
| @@ -4593,12 +4621,15 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags) · 19 unmodified lines | |||
| 4593 | 1, req->sr_msg.len); | 4621 | 1, req->sr_msg.len); |
| 4594 | } | 4622 | } |
| 4595 | 4623 | ||
| 4596 | flags = req->sr_msg.msg_flags; | 4624 | flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; |
| 4597 | if (flags & MSG_DONTWAIT) | 4625 | if (flags & MSG_DONTWAIT) |
| 4598 | req->flags |= REQ_F_NOWAIT; | 4626 | req->flags |= REQ_F_NOWAIT; |
| 4599 | else if (force_nonblock) | 4627 | else if (force_nonblock) |
| 4600 | flags |= MSG_DONTWAIT; | 4628 | flags |= MSG_DONTWAIT; |
| 4601 | 4629 | ||
| 4630 | if (flags & MSG_WAITALL) | ||
| 4631 | min_ret = iov_iter_count(&kmsg->msg.msg_iter); | ||
| 4632 | |||
| 4602 | ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.umsg, | 4633 | ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.umsg, |
| 4603 | kmsg->uaddr, flags); | 4634 | kmsg->uaddr, flags); |
| 4604 | if (force_nonblock && ret == -EAGAIN) | 4635 | if (force_nonblock && ret == -EAGAIN) |
| @@ -4612,7 +4643,7 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags) · 7 unmodified lines | |||
| 4612 | if (kmsg->free_iov) | 4643 | if (kmsg->free_iov) |
| 4613 | kfree(kmsg->free_iov); | 4644 | kfree(kmsg->free_iov); |
| 4614 | req->flags &= ~REQ_F_NEED_CLEANUP; | 4645 | req->flags &= ~REQ_F_NEED_CLEANUP; |
| 4615 | if (ret < 0) | 4646 | if (ret < min_ret || ((flags & MSG_WAITALL) && (kmsg->msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)))) |
| 4616 | req_set_fail_links(req); | 4647 | req_set_fail_links(req); |
| 4617 | __io_req_complete(req, issue_flags, ret, cflags); | 4648 | __io_req_complete(req, issue_flags, ret, cflags); |
| 4618 | return 0; | 4649 | return 0; |
| @@ -4627,6 +4658,7 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) · 8 unmodified lines | |||
| 4627 | struct socket *sock; | 4658 | struct socket *sock; |
| 4628 | struct iovec iov; | 4659 | struct iovec iov; |
| 4629 | unsigned flags; | 4660 | unsigned flags; |
| 4661 | int min_ret = 0; | ||
| 4630 | int ret, cflags = 0; | 4662 | int ret, cflags = 0; |
| 4631 | bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; | 4663 | bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; |
| 4632 | 4664 | ||
| @@ -4652,12 +4684,15 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) · 19 unmodified lines | |||
| 4652 | msg.msg_iocb = NULL; | 4684 | msg.msg_iocb = NULL; |
| 4653 | msg.msg_flags = 0; | 4685 | msg.msg_flags = 0; |
| 4654 | 4686 | ||
| 4655 | flags = req->sr_msg.msg_flags; | 4687 | flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; |
| 4656 | if (flags & MSG_DONTWAIT) | 4688 | if (flags & MSG_DONTWAIT) |
| 4657 | req->flags |= REQ_F_NOWAIT; | 4689 | req->flags |= REQ_F_NOWAIT; |
| 4658 | else if (force_nonblock) | 4690 | else if (force_nonblock) |
| 4659 | flags |= MSG_DONTWAIT; | 4691 | flags |= MSG_DONTWAIT; |
| 4660 | 4692 | ||
| 4693 | if (flags & MSG_WAITALL) | ||
| 4694 | min_ret = iov_iter_count(&msg.msg_iter); | ||
| 4695 | |||
| 4661 | ret = sock_recvmsg(sock, &msg, flags); | 4696 | ret = sock_recvmsg(sock, &msg, flags); |
| 4662 | if (force_nonblock && ret == -EAGAIN) | 4697 | if (force_nonblock && ret == -EAGAIN) |
| 4663 | return -EAGAIN; | 4698 | return -EAGAIN; |
| @@ -4666,7 +4701,7 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) · 2 unmodified lines | |||
| 4666 | out_free: | 4701 | out_free: |
| 4667 | if (req->flags & REQ_F_BUFFER_SELECTED) | 4702 | if (req->flags & REQ_F_BUFFER_SELECTED) |
| 4668 | cflags = io_put_recv_kbuf(req); | 4703 | cflags = io_put_recv_kbuf(req); |
| 4669 | if (ret < 0) | 4704 | if (ret < min_ret || ((flags & MSG_WAITALL) && (msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)))) |
| 4670 | req_set_fail_links(req); | 4705 | req_set_fail_links(req); |
| 4671 | __io_req_complete(req, issue_flags, ret, cflags); | 4706 | __io_req_complete(req, issue_flags, ret, cflags); |
| 4672 | return 0; | 4707 | return 0; |
| @@ -4763,7 +4798,6 @@ static int io_connect(struct io_kiocb *req, unsigned int issue_flags) · 90 unmodified lines | |||
| 4763 | ret = -ENOMEM; | 4798 | ret = -ENOMEM; |
| 4764 | goto out; | 4799 | goto out; |
| 4765 | } | 4800 | } |
| 4766 | io = req->async_data; | ||
| 4767 | memcpy(req->async_data, &__io, sizeof(__io)); | 4801 | memcpy(req->async_data, &__io, sizeof(__io)); |
| 4768 | return -EAGAIN; | 4802 | return -EAGAIN; |
| 4769 | } | 4803 | } |
| @@ -5526,7 +5560,8 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe, · 756 unmodified lines | |||
| 5526 | 5560 | ||
| 5527 | data->mode = io_translate_timeout_mode(flags); | 5561 | data->mode = io_translate_timeout_mode(flags); |
| 5528 | hrtimer_init(&data->timer, CLOCK_MONOTONIC, data->mode); | 5562 | hrtimer_init(&data->timer, CLOCK_MONOTONIC, data->mode); |
| 5529 | io_req_track_inflight(req); | 5563 | if (is_timeout_link) |
| 5564 | io_req_track_inflight(req); | ||
| 5530 | return 0; | 5565 | return 0; |
| 5531 | } | 5566 | } |
| 5532 | 5567 | ||
| @@ -6204,7 +6239,6 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer) · 671 unmodified lines | |||
| 6204 | spin_unlock_irqrestore(&ctx->completion_lock, flags); | 6239 | spin_unlock_irqrestore(&ctx->completion_lock, flags); |
| 6205 | 6240 | ||
| 6206 | if (prev) { | 6241 | if (prev) { |
| 6207 | req_set_fail_links(prev); | ||
| 6208 | io_async_find_and_cancel(ctx, req, prev->user_data, -ETIME); | 6242 | io_async_find_and_cancel(ctx, req, prev->user_data, -ETIME); |
| 6209 | io_put_req_deferred(prev, 1); | 6243 | io_put_req_deferred(prev, 1); |
| 6210 | } else { | 6244 | } else { |
| @@ -6423,8 +6457,6 @@ static int io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, · 212 unmodified lines | |||
| 6423 | ret = io_init_req(ctx, req, sqe); | 6457 | ret = io_init_req(ctx, req, sqe); |
| 6424 | if (unlikely(ret)) { | 6458 | if (unlikely(ret)) { |
| 6425 | fail_req: | 6459 | fail_req: |
| 6426 | io_put_req(req); | ||
| 6427 | io_req_complete(req, ret); | ||
| 6428 | if (link->head) { | 6460 | if (link->head) { |
| 6429 | /* fail even hard links since we don't submit */ | 6461 | /* fail even hard links since we don't submit */ |
| 6430 | link->head->flags |= REQ_F_FAIL_LINK; | 6462 | link->head->flags |= REQ_F_FAIL_LINK; |
| @@ -6432,6 +6464,8 @@ fail_req: · 1 unmodified line | |||
| 6432 | io_req_complete(link->head, -ECANCELED); | 6464 | io_req_complete(link->head, -ECANCELED); |
| 6433 | link->head = NULL; | 6465 | link->head = NULL; |
| 6434 | } | 6466 | } |
| 6467 | io_put_req(req); | ||
| 6468 | io_req_complete(req, ret); | ||
| 6435 | return ret; | 6469 | return ret; |
| 6436 | } | 6470 | } |
| 6437 | ret = io_req_prep(req, sqe); | 6471 | ret = io_req_prep(req, sqe); |
| @@ -6694,22 +6728,27 @@ static int io_sq_thread(void *data) · 256 unmodified lines | |||
| 6694 | set_cpus_allowed_ptr(current, cpu_online_mask); | 6728 | set_cpus_allowed_ptr(current, cpu_online_mask); |
| 6695 | current->flags |= PF_NO_SETAFFINITY; | 6729 | current->flags |= PF_NO_SETAFFINITY; |
| 6696 | 6730 | ||
| 6697 | down_read(&sqd->rw_lock); | 6731 | mutex_lock(&sqd->lock); |
| 6698 | |||
| 6699 | while (!test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) { | 6732 | while (!test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) { |
| 6700 | int ret; | 6733 | int ret; |
| 6701 | bool cap_entries, sqt_spin, needs_sched; | 6734 | bool cap_entries, sqt_spin, needs_sched; |
| 6702 | 6735 | ||
| 6703 | if (test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state)) { | 6736 | if (test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state)) { |
| 6704 | up_read(&sqd->rw_lock); | 6737 | mutex_unlock(&sqd->lock); |
| 6705 | cond_resched(); | 6738 | cond_resched(); |
| 6706 | down_read(&sqd->rw_lock); | 6739 | mutex_lock(&sqd->lock); |
| 6707 | io_run_task_work(); | 6740 | io_run_task_work(); |
| 6741 | io_run_task_work_head(&sqd->park_task_work); | ||
| 6708 | timeout = jiffies + sqd->sq_thread_idle; | 6742 | timeout = jiffies + sqd->sq_thread_idle; |
| 6709 | continue; | 6743 | continue; |
| 6710 | } | 6744 | } |
| 6711 | if (fatal_signal_pending(current)) | 6745 | if (signal_pending(current)) { |
| 6746 | struct ksignal ksig; | ||
| 6747 | |||
| 6748 | if (!get_signal(&ksig)) | ||
| 6749 | continue; | ||
| 6712 | break; | 6750 | break; |
| 6751 | } | ||
| 6713 | sqt_spin = false; | 6752 | sqt_spin = false; |
| 6714 | cap_entries = !list_is_singular(&sqd->ctx_list); | 6753 | cap_entries = !list_is_singular(&sqd->ctx_list); |
| 6715 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) { | 6754 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) { |
| @@ -6750,32 +6789,27 @@ static int io_sq_thread(void *data) · 34 unmodified lines | |||
| 6750 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) | 6789 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) |
| 6751 | io_ring_set_wakeup_flag(ctx); | 6790 | io_ring_set_wakeup_flag(ctx); |
| 6752 | 6791 | ||
| 6753 | up_read(&sqd->rw_lock); | 6792 | mutex_unlock(&sqd->lock); |
| 6754 | schedule(); | 6793 | schedule(); |
| 6755 | down_read(&sqd->rw_lock); | 6794 | mutex_lock(&sqd->lock); |
| 6756 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) | 6795 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) |
| 6757 | io_ring_clear_wakeup_flag(ctx); | 6796 | io_ring_clear_wakeup_flag(ctx); |
| 6758 | } | 6797 | } |
| 6759 | 6798 | ||
| 6760 | finish_wait(&sqd->wait, &wait); | 6799 | finish_wait(&sqd->wait, &wait); |
| 6800 | io_run_task_work_head(&sqd->park_task_work); | ||
| 6761 | timeout = jiffies + sqd->sq_thread_idle; | 6801 | timeout = jiffies + sqd->sq_thread_idle; |
| 6762 | } | 6802 | } |
| 6763 | up_read(&sqd->rw_lock); | ||
| 6764 | down_write(&sqd->rw_lock); | ||
| 6765 | /* | ||
| 6766 | * someone may have parked and added a cancellation task_work, run | ||
| 6767 | * it first because we don't want it in io_uring_cancel_sqpoll() | ||
| 6768 | */ | ||
| 6769 | io_run_task_work(); | ||
| 6770 | 6803 | ||
| 6771 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) | 6804 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) |
| 6772 | io_uring_cancel_sqpoll(ctx); | 6805 | io_uring_cancel_sqpoll(ctx); |
| 6773 | sqd->thread = NULL; | 6806 | sqd->thread = NULL; |
| 6774 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) | 6807 | list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) |
| 6775 | io_ring_set_wakeup_flag(ctx); | 6808 | io_ring_set_wakeup_flag(ctx); |
| 6776 | up_write(&sqd->rw_lock); | 6809 | mutex_unlock(&sqd->lock); |
| 6777 | 6810 | ||
| 6778 | io_run_task_work(); | 6811 | io_run_task_work(); |
| 6812 | io_run_task_work_head(&sqd->park_task_work); | ||
| 6779 | complete(&sqd->exited); | 6813 | complete(&sqd->exited); |
| 6780 | do_exit(0); | 6814 | do_exit(0); |
| 6781 | } | 6815 | } |
| @@ -6821,7 +6855,7 @@ static int io_run_task_work_sig(void) · 39 unmodified lines | |||
| 6821 | return 1; | 6855 | return 1; |
| 6822 | if (!signal_pending(current)) | 6856 | if (!signal_pending(current)) |
| 6823 | return 0; | 6857 | return 0; |
| 6824 | if (test_tsk_thread_flag(current, TIF_NOTIFY_SIGNAL)) | 6858 | if (test_thread_flag(TIF_NOTIFY_SIGNAL)) |
| 6825 | return -ERESTARTSYS; | 6859 | return -ERESTARTSYS; |
| 6826 | return -EINTR; | 6860 | return -EINTR; |
| 6827 | } | 6861 | } |
| @@ -7075,23 +7109,28 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) · 247 unmodified lines | |||
| 7075 | } | 7109 | } |
| 7076 | 7110 | ||
| 7077 | static void io_sq_thread_unpark(struct io_sq_data *sqd) | 7111 | static void io_sq_thread_unpark(struct io_sq_data *sqd) |
| 7078 | __releases(&sqd->rw_lock) | 7112 | __releases(&sqd->lock) |
| 7079 | { | 7113 | { |
| 7080 | WARN_ON_ONCE(sqd->thread == current); | 7114 | WARN_ON_ONCE(sqd->thread == current); |
| 7081 | 7115 | ||
| 7116 | /* | ||
| 7117 | * Do the dance but not conditional clear_bit() because it'd race with | ||
| 7118 | * other threads incrementing park_pending and setting the bit. | ||
| 7119 | */ | ||
| 7082 | clear_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state); | 7120 | clear_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state); |
| 7083 | up_write(&sqd->rw_lock); | 7121 | if (atomic_dec_return(&sqd->park_pending)) |
| 7122 | set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state); | ||
| 7123 | mutex_unlock(&sqd->lock); | ||
| 7084 | } | 7124 | } |
| 7085 | 7125 | ||
| 7086 | static void io_sq_thread_park(struct io_sq_data *sqd) | 7126 | static void io_sq_thread_park(struct io_sq_data *sqd) |
| 7087 | __acquires(&sqd->rw_lock) | 7127 | __acquires(&sqd->lock) |
| 7088 | { | 7128 | { |
| 7089 | WARN_ON_ONCE(sqd->thread == current); | 7129 | WARN_ON_ONCE(sqd->thread == current); |
| 7090 | 7130 | ||
| 7131 | atomic_inc(&sqd->park_pending); | ||
| 7091 | set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state); | 7132 | set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state); |
| 7092 | down_write(&sqd->rw_lock); | 7133 | mutex_lock(&sqd->lock); |
| 7093 | /* set again for consistency, in case concurrent parks are happening */ | ||
| 7094 | set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state); | ||
| 7095 | if (sqd->thread) | 7134 | if (sqd->thread) |
| 7096 | wake_up_process(sqd->thread); | 7135 | wake_up_process(sqd->thread); |
| 7097 | } | 7136 | } |
| @@ -7100,17 +7139,19 @@ static void io_sq_thread_stop(struct io_sq_data *sqd) · 2 unmodified lines | |||
| 7100 | { | 7139 | { |
| 7101 | WARN_ON_ONCE(sqd->thread == current); | 7140 | WARN_ON_ONCE(sqd->thread == current); |
| 7102 | 7141 | ||
| 7103 | down_write(&sqd->rw_lock); | 7142 | mutex_lock(&sqd->lock); |
| 7104 | set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state); | 7143 | set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state); |
| 7105 | if (sqd->thread) | 7144 | if (sqd->thread) |
| 7106 | wake_up_process(sqd->thread); | 7145 | wake_up_process(sqd->thread); |
| 7107 | up_write(&sqd->rw_lock); | 7146 | mutex_unlock(&sqd->lock); |
| 7108 | wait_for_completion(&sqd->exited); | 7147 | wait_for_completion(&sqd->exited); |
| 7109 | } | 7148 | } |
| 7110 | 7149 | ||
| 7111 | static void io_put_sq_data(struct io_sq_data *sqd) | 7150 | static void io_put_sq_data(struct io_sq_data *sqd) |
| 7112 | { | 7151 | { |
| 7113 | if (refcount_dec_and_test(&sqd->refs)) { | 7152 | if (refcount_dec_and_test(&sqd->refs)) { |
| 7153 | WARN_ON_ONCE(atomic_read(&sqd->park_pending)); | ||
| 7154 | |||
| 7114 | io_sq_thread_stop(sqd); | 7155 | io_sq_thread_stop(sqd); |
| 7115 | kfree(sqd); | 7156 | kfree(sqd); |
| 7116 | } | 7157 | } |
| @@ -7184,9 +7225,10 @@ static struct io_sq_data *io_get_sq_data(struct io_uring_params *p, · 67 unmodified lines | |||
| 7184 | if (!sqd) | 7225 | if (!sqd) |
| 7185 | return ERR_PTR(-ENOMEM); | 7226 | return ERR_PTR(-ENOMEM); |
| 7186 | 7227 | ||
| 7228 | atomic_set(&sqd->park_pending, 0); | ||
| 7187 | refcount_set(&sqd->refs, 1); | 7229 | refcount_set(&sqd->refs, 1); |
| 7188 | INIT_LIST_HEAD(&sqd->ctx_list); | 7230 | INIT_LIST_HEAD(&sqd->ctx_list); |
| 7189 | init_rwsem(&sqd->rw_lock); | 7231 | mutex_init(&sqd->lock); |
| 7190 | init_waitqueue_head(&sqd->wait); | 7232 | init_waitqueue_head(&sqd->wait); |
| 7191 | init_completion(&sqd->exited); | 7233 | init_completion(&sqd->exited); |
| 7192 | return sqd; | 7234 | return sqd; |
| @@ -7866,22 +7908,17 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 673 unmodified lines | |||
| 7866 | 7908 | ||
| 7867 | ret = 0; | 7909 | ret = 0; |
| 7868 | io_sq_thread_park(sqd); | 7910 | io_sq_thread_park(sqd); |
| 7911 | list_add(&ctx->sqd_list, &sqd->ctx_list); | ||
| 7912 | io_sqd_update_thread_idle(sqd); | ||
| 7869 | /* don't attach to a dying SQPOLL thread, would be racy */ | 7913 | /* don't attach to a dying SQPOLL thread, would be racy */ |
| 7870 | if (attached && !sqd->thread) { | 7914 | if (attached && !sqd->thread) |
| 7871 | ret = -ENXIO; | 7915 | ret = -ENXIO; |
| 7872 | } else { | ||
| 7873 | list_add(&ctx->sqd_list, &sqd->ctx_list); | ||
| 7874 | io_sqd_update_thread_idle(sqd); | ||
| 7875 | } | ||
| 7876 | io_sq_thread_unpark(sqd); | 7916 | io_sq_thread_unpark(sqd); |
| 7877 | 7917 | ||
| 7878 | if (ret < 0) { | 7918 | if (ret < 0) |
| 7879 | io_put_sq_data(sqd); | 7919 | goto err; |
| 7880 | ctx->sq_data = NULL; | 7920 | if (attached) |
| 7881 | return ret; | ||
| 7882 | } else if (attached) { | ||
| 7883 | return 0; | 7921 | return 0; |
| 7884 | } | ||
| 7885 | 7922 | ||
| 7886 | if (p->flags & IORING_SETUP_SQ_AFF) { | 7923 | if (p->flags & IORING_SETUP_SQ_AFF) { |
| 7887 | int cpu = p->sq_thread_cpu; | 7924 | int cpu = p->sq_thread_cpu; |
| @@ -8332,19 +8369,13 @@ static int io_eventfd_unregister(struct io_ring_ctx *ctx) · 444 unmodified lines | |||
| 8332 | return -ENXIO; | 8369 | return -ENXIO; |
| 8333 | } | 8370 | } |
| 8334 | 8371 | ||
| 8335 | static int __io_destroy_buffers(int id, void *p, void *data) | ||
| 8336 | { | ||
| 8337 | struct io_ring_ctx *ctx = data; | ||
| 8338 | struct io_buffer *buf = p; | ||
| 8339 | |||
| 8340 | __io_remove_buffers(ctx, buf, id, -1U); | ||
| 8341 | return 0; | ||
| 8342 | } | ||
| 8343 | |||
| 8344 | static void io_destroy_buffers(struct io_ring_ctx *ctx) | 8372 | static void io_destroy_buffers(struct io_ring_ctx *ctx) |
| 8345 | { | 8373 | { |
| 8346 | idr_for_each(&ctx->io_buffer_idr, __io_destroy_buffers, ctx); | 8374 | struct io_buffer *buf; |
| 8347 | idr_destroy(&ctx->io_buffer_idr); | 8375 | unsigned long index; |
| 8376 | |||
| 8377 | xa_for_each(&ctx->io_buffers, index, buf) | ||
| 8378 | __io_remove_buffers(ctx, buf, index, -1U); | ||
| 8348 | } | 8379 | } |
| 8349 | 8380 | ||
| 8350 | static void io_req_cache_free(struct list_head *list, struct task_struct *tsk) | 8381 | static void io_req_cache_free(struct list_head *list, struct task_struct *tsk) |
| @@ -8386,11 +8417,13 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx) · 35 unmodified lines | |||
| 8386 | { | 8417 | { |
| 8387 | /* | 8418 | /* |
| 8388 | * Some may use context even when all refs and requests have been put, | 8419 | * Some may use context even when all refs and requests have been put, |
| 8389 | * and they are free to do so while still holding uring_lock, see | 8420 | * and they are free to do so while still holding uring_lock or |
| 8390 | * __io_req_task_submit(). Wait for them to finish. | 8421 | * completion_lock, see __io_req_task_submit(). Wait for them to finish. |
| 8391 | */ | 8422 | */ |
| 8392 | mutex_lock(&ctx->uring_lock); | 8423 | mutex_lock(&ctx->uring_lock); |
| 8393 | mutex_unlock(&ctx->uring_lock); | 8424 | mutex_unlock(&ctx->uring_lock); |
| 8425 | spin_lock_irq(&ctx->completion_lock); | ||
| 8426 | spin_unlock_irq(&ctx->completion_lock); | ||
| 8394 | 8427 | ||
| 8395 | io_sq_thread_finish(ctx); | 8428 | io_sq_thread_finish(ctx); |
| 8396 | io_sqe_buffers_unregister(ctx); | 8429 | io_sqe_buffers_unregister(ctx); |
| @@ -8478,26 +8511,9 @@ static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id) · 81 unmodified lines | |||
| 8478 | return -EINVAL; | 8511 | return -EINVAL; |
| 8479 | } | 8512 | } |
| 8480 | 8513 | ||
| 8481 | static bool io_run_ctx_fallback(struct io_ring_ctx *ctx) | 8514 | static inline bool io_run_ctx_fallback(struct io_ring_ctx *ctx) |
| 8482 | { | 8515 | { |
| 8483 | struct callback_head *work, *next; | 8516 | return io_run_task_work_head(&ctx->exit_task_work); |
| 8484 | bool executed = false; | ||
| 8485 | |||
| 8486 | do { | ||
| 8487 | work = xchg(&ctx->exit_task_work, NULL); | ||
| 8488 | if (!work) | ||
| 8489 | break; | ||
| 8490 | |||
| 8491 | do { | ||
| 8492 | next = work->next; | ||
| 8493 | work->func(work); | ||
| 8494 | work = next; | ||
| 8495 | cond_resched(); | ||
| 8496 | } while (work); | ||
| 8497 | executed = true; | ||
| 8498 | } while (1); | ||
| 8499 | |||
| 8500 | return executed; | ||
| 8501 | } | 8517 | } |
| 8502 | 8518 | ||
| 8503 | struct io_tctx_exit { | 8519 | struct io_tctx_exit { |
| @@ -8529,6 +8545,14 @@ static void io_ring_exit_work(struct work_struct *work) · 25 unmodified lines | |||
| 8529 | struct io_tctx_node *node; | 8545 | struct io_tctx_node *node; |
| 8530 | int ret; | 8546 | int ret; |
| 8531 | 8547 | ||
| 8548 | /* prevent SQPOLL from submitting new requests */ | ||
| 8549 | if (ctx->sq_data) { | ||
| 8550 | io_sq_thread_park(ctx->sq_data); | ||
| 8551 | list_del_init(&ctx->sqd_list); | ||
| 8552 | io_sqd_update_thread_idle(ctx->sq_data); | ||
| 8553 | io_sq_thread_unpark(ctx->sq_data); | ||
| 8554 | } | ||
| 8555 | |||
| 8532 | /* | 8556 | /* |
| 8533 | * If we're doing polled IO and end up having requests being | 8557 | * If we're doing polled IO and end up having requests being |
| 8534 | * submitted async (out-of-line), then completions can come in while | 8558 | * submitted async (out-of-line), then completions can come in while |
| @@ -8565,6 +8589,28 @@ static void io_ring_exit_work(struct work_struct *work) · 30 unmodified lines | |||
| 8565 | io_ring_ctx_free(ctx); | 8589 | io_ring_ctx_free(ctx); |
| 8566 | } | 8590 | } |
| 8567 | 8591 | ||
| 8592 | /* Returns true if we found and killed one or more timeouts */ | ||
| 8593 | static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk, | ||
| 8594 | struct files_struct *files) | ||
| 8595 | { | ||
| 8596 | struct io_kiocb *req, *tmp; | ||
| 8597 | int canceled = 0; | ||
| 8598 | |||
| 8599 | spin_lock_irq(&ctx->completion_lock); | ||
| 8600 | list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) { | ||
| 8601 | if (io_match_task(req, tsk, files)) { | ||
| 8602 | io_kill_timeout(req, -ECANCELED); | ||
| 8603 | canceled++; | ||
| 8604 | } | ||
| 8605 | } | ||
| 8606 | io_commit_cqring(ctx); | ||
| 8607 | spin_unlock_irq(&ctx->completion_lock); | ||
| 8608 | |||
| 8609 | if (canceled != 0) | ||
| 8610 | io_cqring_ev_posted(ctx); | ||
| 8611 | return canceled != 0; | ||
| 8612 | } | ||
| 8613 | |||
| 8568 | static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) | 8614 | static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) |
| 8569 | { | 8615 | { |
| 8570 | unsigned long index; | 8616 | unsigned long index; |
| @@ -8879,7 +8925,7 @@ static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx) · 308 unmodified lines | |||
| 8879 | if (task) { | 8925 | if (task) { |
| 8880 | init_completion(&work.completion); | 8926 | init_completion(&work.completion); |
| 8881 | init_task_work(&work.task_work, io_sqpoll_cancel_cb); | 8927 | init_task_work(&work.task_work, io_sqpoll_cancel_cb); |
| 8882 | WARN_ON_ONCE(task_work_add(task, &work.task_work, TWA_SIGNAL)); | 8928 | io_task_work_add_head(&sqd->park_task_work, &work.task_work); |
| 8883 | wake_up_process(task); | 8929 | wake_up_process(task); |
| 8884 | } | 8930 | } |
| 8885 | io_sq_thread_unpark(sqd); | 8931 | io_sq_thread_unpark(sqd); |
| @@ -170,6 +170,16 @@ int iomap_swapfile_activate(struct swap_info_struct *sis, · 169 unmodified lines | |||
| 170 | return ret; | 170 | return ret; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | /* | ||
| 174 | * If this swapfile doesn't contain even a single page-aligned | ||
| 175 | * contiguous range of blocks, reject this useless swapfile to | ||
| 176 | * prevent confusion later on. | ||
| 177 | */ | ||
| 178 | if (isi.nr_pages == 0) { | ||
| 179 | pr_warn("swapon: Cannot find a single usable page in file.\n"); | ||
| 180 | return -EINVAL; | ||
| 181 | } | ||
| 182 | |||
| 173 | *pagespan = 1 + isi.highest_ppage - isi.lowest_ppage; | 183 | *pagespan = 1 + isi.highest_ppage - isi.lowest_ppage; |
| 174 | sis->max = isi.nr_pages; | 184 | sis->max = isi.nr_pages; |
| 175 | sis->pages = isi.nr_pages - 1; | 185 | sis->pages = isi.nr_pages - 1; |
| @@ -1055,10 +1055,9 @@ static long do_restart_poll(struct restart_block *restart_block) · 1054 unmodified lines | |||
| 1055 | 1055 | ||
| 1056 | ret = do_sys_poll(ufds, nfds, to); | 1056 | ret = do_sys_poll(ufds, nfds, to); |
| 1057 | 1057 | ||
| 1058 | if (ret == -ERESTARTNOHAND) { | 1058 | if (ret == -ERESTARTNOHAND) |
| 1059 | restart_block->fn = do_restart_poll; | 1059 | ret = set_restart_fn(restart_block, do_restart_poll); |
| 1060 | ret = -ERESTART_RESTARTBLOCK; | 1060 | |
| 1061 | } | ||
| 1062 | return ret; | 1061 | return ret; |
| 1063 | } | 1062 | } |
| 1064 | 1063 | ||
| @@ -1080,7 +1079,6 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, · 15 unmodified lines | |||
| 1080 | struct restart_block *restart_block; | 1079 | struct restart_block *restart_block; |
| 1081 | 1080 | ||
| 1082 | restart_block = ¤t->restart_block; | 1081 | restart_block = ¤t->restart_block; |
| 1083 | restart_block->fn = do_restart_poll; | ||
| 1084 | restart_block->poll.ufds = ufds; | 1082 | restart_block->poll.ufds = ufds; |
| 1085 | restart_block->poll.nfds = nfds; | 1083 | restart_block->poll.nfds = nfds; |
| 1086 | 1084 | ||
| @@ -1091,7 +1089,7 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, · 4 unmodified lines | |||
| 1091 | } else | 1089 | } else |
| 1092 | restart_block->poll.has_timeout = 0; | 1090 | restart_block->poll.has_timeout = 0; |
| 1093 | 1091 | ||
| 1094 | ret = -ERESTART_RESTARTBLOCK; | 1092 | ret = set_restart_fn(restart_block, do_restart_poll); |
| 1095 | } | 1093 | } |
| 1096 | return ret; | 1094 | return ret; |
| 1097 | } | 1095 | } |
| @@ -152,14 +152,18 @@ __le64 *squashfs_read_inode_lookup_table(struct super_block *sb, · 151 unmodified lines | |||
| 152 | start = le64_to_cpu(table[n]); | 152 | start = le64_to_cpu(table[n]); |
| 153 | end = le64_to_cpu(table[n + 1]); | 153 | end = le64_to_cpu(table[n + 1]); |
| 154 | 154 | ||
| 155 | if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) { | 155 | if (start >= end |
| 156 | || (end - start) > | ||
| 157 | (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) { | ||
| 156 | kfree(table); | 158 | kfree(table); |
| 157 | return ERR_PTR(-EINVAL); | 159 | return ERR_PTR(-EINVAL); |
| 158 | } | 160 | } |
| 159 | } | 161 | } |
| 160 | 162 | ||
| 161 | start = le64_to_cpu(table[indexes - 1]); | 163 | start = le64_to_cpu(table[indexes - 1]); |
| 162 | if (start >= lookup_table_start || (lookup_table_start - start) > SQUASHFS_METADATA_SIZE) { | 164 | if (start >= lookup_table_start || |
| 165 | (lookup_table_start - start) > | ||
| 166 | (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) { | ||
| 163 | kfree(table); | 167 | kfree(table); |
| 164 | return ERR_PTR(-EINVAL); | 168 | return ERR_PTR(-EINVAL); |
| 165 | } | 169 | } |
| @@ -97,14 +97,16 @@ __le64 *squashfs_read_id_index_table(struct super_block *sb, · 96 unmodified lines | |||
| 97 | start = le64_to_cpu(table[n]); | 97 | start = le64_to_cpu(table[n]); |
| 98 | end = le64_to_cpu(table[n + 1]); | 98 | end = le64_to_cpu(table[n + 1]); |
| 99 | 99 | ||
| 100 | if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) { | 100 | if (start >= end || (end - start) > |
| 101 | (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) { | ||
| 101 | kfree(table); | 102 | kfree(table); |
| 102 | return ERR_PTR(-EINVAL); | 103 | return ERR_PTR(-EINVAL); |
| 103 | } | 104 | } |
| 104 | } | 105 | } |
| 105 | 106 | ||
| 106 | start = le64_to_cpu(table[indexes - 1]); | 107 | start = le64_to_cpu(table[indexes - 1]); |
| 107 | if (start >= id_table_start || (id_table_start - start) > SQUASHFS_METADATA_SIZE) { | 108 | if (start >= id_table_start || (id_table_start - start) > |
| 109 | (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) { | ||
| 108 | kfree(table); | 110 | kfree(table); |
| 109 | return ERR_PTR(-EINVAL); | 111 | return ERR_PTR(-EINVAL); |
| 110 | } | 112 | } |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | /* size of metadata (inode and directory) blocks */ | 18 | /* size of metadata (inode and directory) blocks */ |
| 19 | #define SQUASHFS_METADATA_SIZE 8192 | 19 | #define SQUASHFS_METADATA_SIZE 8192 |
| 20 | #define SQUASHFS_BLOCK_OFFSET 2 | ||
| 20 | 21 | ||
| 21 | /* default size of block device I/O */ | 22 | /* default size of block device I/O */ |
| 22 | #ifdef CONFIG_SQUASHFS_4K_DEVBLK_SIZE | 23 | #ifdef CONFIG_SQUASHFS_4K_DEVBLK_SIZE |
| @@ -109,14 +109,16 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 table_start, · 108 unmodified lines | |||
| 109 | start = le64_to_cpu(table[n]); | 109 | start = le64_to_cpu(table[n]); |
| 110 | end = le64_to_cpu(table[n + 1]); | 110 | end = le64_to_cpu(table[n + 1]); |
| 111 | 111 | ||
| 112 | if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) { | 112 | if (start >= end || (end - start) > |
| 113 | (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) { | ||
| 113 | kfree(table); | 114 | kfree(table); |
| 114 | return ERR_PTR(-EINVAL); | 115 | return ERR_PTR(-EINVAL); |
| 115 | } | 116 | } |
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | start = le64_to_cpu(table[indexes - 1]); | 119 | start = le64_to_cpu(table[indexes - 1]); |
| 119 | if (start >= table_start || (table_start - start) > SQUASHFS_METADATA_SIZE) { | 120 | if (start >= table_start || (table_start - start) > |
| 121 | (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) { | ||
| 120 | kfree(table); | 122 | kfree(table); |
| 121 | return ERR_PTR(-EINVAL); | 123 | return ERR_PTR(-EINVAL); |
| 122 | } | 124 | } |
| @@ -1007,9 +1007,10 @@ xfs_create( · 1006 unmodified lines | |||
| 1007 | /* | 1007 | /* |
| 1008 | * Make sure that we have allocated dquot(s) on disk. | 1008 | * Make sure that we have allocated dquot(s) on disk. |
| 1009 | */ | 1009 | */ |
| 1010 | error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, | 1010 | error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns), |
| 1011 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, | 1011 | fsgid_into_mnt(mnt_userns), prid, |
| 1012 | &udqp, &gdqp, &pdqp); | 1012 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, |
| 1013 | &udqp, &gdqp, &pdqp); | ||
| 1013 | if (error) | 1014 | if (error) |
| 1014 | return error; | 1015 | return error; |
| 1015 | 1016 | ||
| @@ -1157,9 +1158,10 @@ xfs_create_tmpfile( · 141 unmodified lines | |||
| 1157 | /* | 1158 | /* |
| 1158 | * Make sure that we have allocated dquot(s) on disk. | 1159 | * Make sure that we have allocated dquot(s) on disk. |
| 1159 | */ | 1160 | */ |
| 1160 | error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, | 1161 | error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns), |
| 1161 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, | 1162 | fsgid_into_mnt(mnt_userns), prid, |
| 1162 | &udqp, &gdqp, &pdqp); | 1163 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, |
| 1164 | &udqp, &gdqp, &pdqp); | ||
| 1163 | if (error) | 1165 | if (error) |
| 1164 | return error; | 1166 | return error; |
| 1165 | 1167 | ||
| @@ -168,6 +168,12 @@ xfs_bulkstat_one( · 167 unmodified lines | |||
| 168 | }; | 168 | }; |
| 169 | int error; | 169 | int error; |
| 170 | 170 | ||
| 171 | if (breq->mnt_userns != &init_user_ns) { | ||
| 172 | xfs_warn_ratelimited(breq->mp, | ||
| 173 | "bulkstat not supported inside of idmapped mounts."); | ||
| 174 | return -EINVAL; | ||
| 175 | } | ||
| 176 | |||
| 171 | ASSERT(breq->icount == 1); | 177 | ASSERT(breq->icount == 1); |
| 172 | 178 | ||
| 173 | bc.buf = kmem_zalloc(sizeof(struct xfs_bulkstat), | 179 | bc.buf = kmem_zalloc(sizeof(struct xfs_bulkstat), |
| @@ -634,6 +634,47 @@ xfs_check_summary_counts( · 633 unmodified lines | |||
| 634 | return xfs_initialize_perag_data(mp, mp->m_sb.sb_agcount); | 634 | return xfs_initialize_perag_data(mp, mp->m_sb.sb_agcount); |
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | /* | ||
| 638 | * Flush and reclaim dirty inodes in preparation for unmount. Inodes and | ||
| 639 | * internal inode structures can be sitting in the CIL and AIL at this point, | ||
| 640 | * so we need to unpin them, write them back and/or reclaim them before unmount | ||
| 641 | * can proceed. | ||
| 642 | * | ||
| 643 | * An inode cluster that has been freed can have its buffer still pinned in | ||
| 644 | * memory because the transaction is still sitting in a iclog. The stale inodes | ||
| 645 | * on that buffer will be pinned to the buffer until the transaction hits the | ||
| 646 | * disk and the callbacks run. Pushing the AIL will skip the stale inodes and | ||
| 647 | * may never see the pinned buffer, so nothing will push out the iclog and | ||
| 648 | * unpin the buffer. | ||
| 649 | * | ||
| 650 | * Hence we need to force the log to unpin everything first. However, log | ||
| 651 | * forces don't wait for the discards they issue to complete, so we have to | ||
| 652 | * explicitly wait for them to complete here as well. | ||
| 653 | * | ||
| 654 | * Then we can tell the world we are unmounting so that error handling knows | ||
| 655 | * that the filesystem is going away and we should error out anything that we | ||
| 656 | * have been retrying in the background. This will prevent never-ending | ||
| 657 | * retries in AIL pushing from hanging the unmount. | ||
| 658 | * | ||
| 659 | * Finally, we can push the AIL to clean all the remaining dirty objects, then | ||
| 660 | * reclaim the remaining inodes that are still in memory at this point in time. | ||
| 661 | */ | ||
| 662 | static void | ||
| 663 | xfs_unmount_flush_inodes( | ||
| 664 | struct xfs_mount *mp) | ||
| 665 | { | ||
| 666 | xfs_log_force(mp, XFS_LOG_SYNC); | ||
| 667 | xfs_extent_busy_wait_all(mp); | ||
| 668 | flush_workqueue(xfs_discard_wq); | ||
| 669 | |||
| 670 | mp->m_flags |= XFS_MOUNT_UNMOUNTING; | ||
| 671 | |||
| 672 | xfs_ail_push_all_sync(mp->m_ail); | ||
| 673 | cancel_delayed_work_sync(&mp->m_reclaim_work); | ||
| 674 | xfs_reclaim_inodes(mp); | ||
| 675 | xfs_health_unmount(mp); | ||
| 676 | } | ||
| 677 | |||
| 637 | /* | 678 | /* |
| 638 | * This function does the following on an initial mount of a file system: | 679 | * This function does the following on an initial mount of a file system: |
| 639 | * - reads the superblock from disk and init the mount struct | 680 | * - reads the superblock from disk and init the mount struct |
| @@ -1008,7 +1049,7 @@ xfs_mountfs( · 368 unmodified lines | |||
| 1008 | /* Clean out dquots that might be in memory after quotacheck. */ | 1049 | /* Clean out dquots that might be in memory after quotacheck. */ |
| 1009 | xfs_qm_unmount(mp); | 1050 | xfs_qm_unmount(mp); |
| 1010 | /* | 1051 | /* |
| 1011 | * Cancel all delayed reclaim work and reclaim the inodes directly. | 1052 | * Flush all inode reclamation work and flush the log. |
| 1012 | * We have to do this /after/ rtunmount and qm_unmount because those | 1053 | * We have to do this /after/ rtunmount and qm_unmount because those |
| 1013 | * two will have scheduled delayed reclaim for the rt/quota inodes. | 1054 | * two will have scheduled delayed reclaim for the rt/quota inodes. |
| 1014 | * | 1055 | * |
| @@ -1018,11 +1059,8 @@ xfs_mountfs( · 3 unmodified lines | |||
| 1018 | * qm_unmount_quotas and therefore rely on qm_unmount to release the | 1059 | * qm_unmount_quotas and therefore rely on qm_unmount to release the |
| 1019 | * quota inodes. | 1060 | * quota inodes. |
| 1020 | */ | 1061 | */ |
| 1021 | cancel_delayed_work_sync(&mp->m_reclaim_work); | 1062 | xfs_unmount_flush_inodes(mp); |
| 1022 | xfs_reclaim_inodes(mp); | ||
| 1023 | xfs_health_unmount(mp); | ||
| 1024 | out_log_dealloc: | 1063 | out_log_dealloc: |
| 1025 | mp->m_flags |= XFS_MOUNT_UNMOUNTING; | ||
| 1026 | xfs_log_mount_cancel(mp); | 1064 | xfs_log_mount_cancel(mp); |
| 1027 | out_fail_wait: | 1065 | out_fail_wait: |
| 1028 | if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) | 1066 | if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) |
| @@ -1063,47 +1101,7 @@ xfs_unmountfs( · 34 unmodified lines | |||
| 1063 | xfs_rtunmount_inodes(mp); | 1101 | xfs_rtunmount_inodes(mp); |
| 1064 | xfs_irele(mp->m_rootip); | 1102 | xfs_irele(mp->m_rootip); |
| 1065 | 1103 | ||
| 1066 | /* | 1104 | xfs_unmount_flush_inodes(mp); |
| 1067 | * We can potentially deadlock here if we have an inode cluster | ||
| 1068 | * that has been freed has its buffer still pinned in memory because | ||
| 1069 | * the transaction is still sitting in a iclog. The stale inodes | ||
| 1070 | * on that buffer will be pinned to the buffer until the | ||
| 1071 | * transaction hits the disk and the callbacks run. Pushing the AIL will | ||
| 1072 | * skip the stale inodes and may never see the pinned buffer, so | ||
| 1073 | * nothing will push out the iclog and unpin the buffer. Hence we | ||
| 1074 | * need to force the log here to ensure all items are flushed into the | ||
| 1075 | * AIL before we go any further. | ||
| 1076 | */ | ||
| 1077 | xfs_log_force(mp, XFS_LOG_SYNC); | ||
| 1078 | |||
| 1079 | /* | ||
| 1080 | * Wait for all busy extents to be freed, including completion of | ||
| 1081 | * any discard operation. | ||
| 1082 | */ | ||
| 1083 | xfs_extent_busy_wait_all(mp); | ||
| 1084 | flush_workqueue(xfs_discard_wq); | ||
| 1085 | |||
| 1086 | /* | ||
| 1087 | * We now need to tell the world we are unmounting. This will allow | ||
| 1088 | * us to detect that the filesystem is going away and we should error | ||
| 1089 | * out anything that we have been retrying in the background. This will | ||
| 1090 | * prevent neverending retries in AIL pushing from hanging the unmount. | ||
| 1091 | */ | ||
| 1092 | mp->m_flags |= XFS_MOUNT_UNMOUNTING; | ||
| 1093 | |||
| 1094 | /* | ||
| 1095 | * Flush all pending changes from the AIL. | ||
| 1096 | */ | ||
| 1097 | xfs_ail_push_all_sync(mp->m_ail); | ||
| 1098 | |||
| 1099 | /* | ||
| 1100 | * Reclaim all inodes. At this point there should be no dirty inodes and | ||
| 1101 | * none should be pinned or locked. Stop background inode reclaim here | ||
| 1102 | * if it is still running. | ||
| 1103 | */ | ||
| 1104 | cancel_delayed_work_sync(&mp->m_reclaim_work); | ||
| 1105 | xfs_reclaim_inodes(mp); | ||
| 1106 | xfs_health_unmount(mp); | ||
| 1107 | 1105 | ||
| 1108 | xfs_qm_unmount(mp); | 1106 | xfs_qm_unmount(mp); |
| 1109 | 1107 | ||
| @@ -182,7 +182,8 @@ xfs_symlink( · 181 unmodified lines | |||
| 182 | /* | 182 | /* |
| 183 | * Make sure that we have allocated dquot(s) on disk. | 183 | * Make sure that we have allocated dquot(s) on disk. |
| 184 | */ | 184 | */ |
| 185 | error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, | 185 | error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns), |
| 186 | fsgid_into_mnt(mnt_userns), prid, | ||
| 186 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, | 187 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, |
| 187 | &udqp, &gdqp, &pdqp); | 188 | &udqp, &gdqp, &pdqp); |
| 188 | if (error) | 189 | if (error) |
| @@ -165,6 +165,21 @@ static int zonefs_writepages(struct address_space *mapping, · 164 unmodified lines | |||
| 165 | return iomap_writepages(mapping, wbc, &wpc, &zonefs_writeback_ops); | 165 | return iomap_writepages(mapping, wbc, &wpc, &zonefs_writeback_ops); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | static int zonefs_swap_activate(struct swap_info_struct *sis, | ||
| 169 | struct file *swap_file, sector_t *span) | ||
| 170 | { | ||
| 171 | struct inode *inode = file_inode(swap_file); | ||
| 172 | struct zonefs_inode_info *zi = ZONEFS_I(inode); | ||
| 173 | |||
| 174 | if (zi->i_ztype != ZONEFS_ZTYPE_CNV) { | ||
| 175 | zonefs_err(inode->i_sb, | ||
| 176 | "swap file: not a conventional zone file\n"); | ||
| 177 | return -EINVAL; | ||
| 178 | } | ||
| 179 | |||
| 180 | return iomap_swapfile_activate(sis, swap_file, span, &zonefs_iomap_ops); | ||
| 181 | } | ||
| 182 | |||
| 168 | static const struct address_space_operations zonefs_file_aops = { | 183 | static const struct address_space_operations zonefs_file_aops = { |
| 169 | .readpage = zonefs_readpage, | 184 | .readpage = zonefs_readpage, |
| 170 | .readahead = zonefs_readahead, | 185 | .readahead = zonefs_readahead, |
| @@ -177,6 +192,7 @@ static const struct address_space_operations zonefs_file_aops = { · 6 unmodified lines | |||
| 177 | .is_partially_uptodate = iomap_is_partially_uptodate, | 192 | .is_partially_uptodate = iomap_is_partially_uptodate, |
| 178 | .error_remove_page = generic_error_remove_page, | 193 | .error_remove_page = generic_error_remove_page, |
| 179 | .direct_IO = noop_direct_IO, | 194 | .direct_IO = noop_direct_IO, |
| 195 | .swap_activate = zonefs_swap_activate, | ||
| 180 | }; | 196 | }; |
| 181 | 197 | ||
| 182 | static void zonefs_update_stats(struct inode *inode, loff_t new_isize) | 198 | static void zonefs_update_stats(struct inode *inode, loff_t new_isize) |
| @@ -727,6 +743,68 @@ out_release: · 544 unmodified lines | |||
| 727 | return ret; | 743 | return ret; |
| 728 | } | 744 | } |
| 729 | 745 | ||
| 746 | /* | ||
| 747 | * Do not exceed the LFS limits nor the file zone size. If pos is under the | ||
| 748 | * limit it becomes a short access. If it exceeds the limit, return -EFBIG. | ||
| 749 | */ | ||
| 750 | static loff_t zonefs_write_check_limits(struct file *file, loff_t pos, | ||
| 751 | loff_t count) | ||
| 752 | { | ||
| 753 | struct inode *inode = file_inode(file); | ||
| 754 | struct zonefs_inode_info *zi = ZONEFS_I(inode); | ||
| 755 | loff_t limit = rlimit(RLIMIT_FSIZE); | ||
| 756 | loff_t max_size = zi->i_max_size; | ||
| 757 | |||
| 758 | if (limit != RLIM_INFINITY) { | ||
| 759 | if (pos >= limit) { | ||
| 760 | send_sig(SIGXFSZ, current, 0); | ||
| 761 | return -EFBIG; | ||
| 762 | } | ||
| 763 | count = min(count, limit - pos); | ||
| 764 | } | ||
| 765 | |||
| 766 | if (!(file->f_flags & O_LARGEFILE)) | ||
| 767 | max_size = min_t(loff_t, MAX_NON_LFS, max_size); | ||
| 768 | |||
| 769 | if (unlikely(pos >= max_size)) | ||
| 770 | return -EFBIG; | ||
| 771 | |||
| 772 | return min(count, max_size - pos); | ||
| 773 | } | ||
| 774 | |||
| 775 | static ssize_t zonefs_write_checks(struct kiocb *iocb, struct iov_iter *from) | ||
| 776 | { | ||
| 777 | struct file *file = iocb->ki_filp; | ||
| 778 | struct inode *inode = file_inode(file); | ||
| 779 | struct zonefs_inode_info *zi = ZONEFS_I(inode); | ||
| 780 | loff_t count; | ||
| 781 | |||
| 782 | if (IS_SWAPFILE(inode)) | ||
| 783 | return -ETXTBSY; | ||
| 784 | |||
| 785 | if (!iov_iter_count(from)) | ||
| 786 | return 0; | ||
| 787 | |||
| 788 | if ((iocb->ki_flags & IOCB_NOWAIT) && !(iocb->ki_flags & IOCB_DIRECT)) | ||
| 789 | return -EINVAL; | ||
| 790 | |||
| 791 | if (iocb->ki_flags & IOCB_APPEND) { | ||
| 792 | if (zi->i_ztype != ZONEFS_ZTYPE_SEQ) | ||
| 793 | return -EINVAL; | ||
| 794 | mutex_lock(&zi->i_truncate_mutex); | ||
| 795 | iocb->ki_pos = zi->i_wpoffset; | ||
| 796 | mutex_unlock(&zi->i_truncate_mutex); | ||
| 797 | } | ||
| 798 | |||
| 799 | count = zonefs_write_check_limits(file, iocb->ki_pos, | ||
| 800 | iov_iter_count(from)); | ||
| 801 | if (count < 0) | ||
| 802 | return count; | ||
| 803 | |||
| 804 | iov_iter_truncate(from, count); | ||
| 805 | return iov_iter_count(from); | ||
| 806 | } | ||
| 807 | |||
| 730 | /* | 808 | /* |
| 731 | * Handle direct writes. For sequential zone files, this is the only possible | 809 | * Handle direct writes. For sequential zone files, this is the only possible |
| 732 | * write path. For these files, check that the user is issuing writes | 810 | * write path. For these files, check that the user is issuing writes |
| @@ -744,8 +822,7 @@ static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from) · 11 unmodified lines | |||
| 744 | struct super_block *sb = inode->i_sb; | 822 | struct super_block *sb = inode->i_sb; |
| 745 | bool sync = is_sync_kiocb(iocb); | 823 | bool sync = is_sync_kiocb(iocb); |
| 746 | bool append = false; | 824 | bool append = false; |
| 747 | size_t count; | 825 | ssize_t ret, count; |
| 748 | ssize_t ret; | ||
| 749 | 826 | ||
| 750 | /* | 827 | /* |
| 751 | * For async direct IOs to sequential zone files, refuse IOCB_NOWAIT | 828 | * For async direct IOs to sequential zone files, refuse IOCB_NOWAIT |
| @@ -763,12 +840,11 @@ static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from) · 11 unmodified lines | |||
| 763 | inode_lock(inode); | 840 | inode_lock(inode); |
| 764 | } | 841 | } |
| 765 | 842 | ||
| 766 | ret = generic_write_checks(iocb, from); | 843 | count = zonefs_write_checks(iocb, from); |
| 767 | if (ret <= 0) | 844 | if (count <= 0) { |
| 845 | ret = count; | ||
| 768 | goto inode_unlock; | 846 | goto inode_unlock; |
| 769 | 847 | } | |
| 770 | iov_iter_truncate(from, zi->i_max_size - iocb->ki_pos); | ||
| 771 | count = iov_iter_count(from); | ||
| 772 | 848 | ||
| 773 | if ((iocb->ki_pos | count) & (sb->s_blocksize - 1)) { | 849 | if ((iocb->ki_pos | count) & (sb->s_blocksize - 1)) { |
| 774 | ret = -EINVAL; | 850 | ret = -EINVAL; |
| @@ -828,12 +904,10 @@ static ssize_t zonefs_file_buffered_write(struct kiocb *iocb, · 53 unmodified lines | |||
| 828 | inode_lock(inode); | 904 | inode_lock(inode); |
| 829 | } | 905 | } |
| 830 | 906 | ||
| 831 | ret = generic_write_checks(iocb, from); | 907 | ret = zonefs_write_checks(iocb, from); |
| 832 | if (ret <= 0) | 908 | if (ret <= 0) |
| 833 | goto inode_unlock; | 909 | goto inode_unlock; |
| 834 | 910 | ||
| 835 | iov_iter_truncate(from, zi->i_max_size - iocb->ki_pos); | ||
| 836 | |||
| 837 | ret = iomap_file_buffered_write(iocb, from, &zonefs_iomap_ops); | 911 | ret = iomap_file_buffered_write(iocb, from, &zonefs_iomap_ops); |
| 838 | if (ret > 0) | 912 | if (ret > 0) |
| 839 | iocb->ki_pos += ret; | 913 | iocb->ki_pos += ret; |
| @@ -966,9 +1040,7 @@ static int zonefs_open_zone(struct inode *inode) · 126 unmodified lines | |||
| 966 | 1040 | ||
| 967 | mutex_lock(&zi->i_truncate_mutex); | 1041 | mutex_lock(&zi->i_truncate_mutex); |
| 968 | 1042 | ||
| 969 | zi->i_wr_refcnt++; | 1043 | if (!zi->i_wr_refcnt) { |
| 970 | if (zi->i_wr_refcnt == 1) { | ||
| 971 | |||
| 972 | if (atomic_inc_return(&sbi->s_open_zones) > sbi->s_max_open_zones) { | 1044 | if (atomic_inc_return(&sbi->s_open_zones) > sbi->s_max_open_zones) { |
| 973 | atomic_dec(&sbi->s_open_zones); | 1045 | atomic_dec(&sbi->s_open_zones); |
| 974 | ret = -EBUSY; | 1046 | ret = -EBUSY; |
| @@ -978,7 +1050,6 @@ static int zonefs_open_zone(struct inode *inode) · 3 unmodified lines | |||
| 978 | if (i_size_read(inode) < zi->i_max_size) { | 1050 | if (i_size_read(inode) < zi->i_max_size) { |
| 979 | ret = zonefs_zone_mgmt(inode, REQ_OP_ZONE_OPEN); | 1051 | ret = zonefs_zone_mgmt(inode, REQ_OP_ZONE_OPEN); |
| 980 | if (ret) { | 1052 | if (ret) { |
| 981 | zi->i_wr_refcnt--; | ||
| 982 | atomic_dec(&sbi->s_open_zones); | 1053 | atomic_dec(&sbi->s_open_zones); |
| 983 | goto unlock; | 1054 | goto unlock; |
| 984 | } | 1055 | } |
| @@ -986,6 +1057,8 @@ static int zonefs_open_zone(struct inode *inode) · 1 unmodified line | |||
| 986 | } | 1057 | } |
| 987 | } | 1058 | } |
| 988 | 1059 | ||
| 1060 | zi->i_wr_refcnt++; | ||
| 1061 | |||
| 989 | unlock: | 1062 | unlock: |
| 990 | mutex_unlock(&zi->i_truncate_mutex); | 1063 | mutex_unlock(&zi->i_truncate_mutex); |
| 991 | 1064 | ||
| @@ -233,6 +233,7 @@ struct acpi_pnp_type { · 232 unmodified lines | |||
| 233 | 233 | ||
| 234 | struct acpi_device_pnp { | 234 | struct acpi_device_pnp { |
| 235 | acpi_bus_id bus_id; /* Object name */ | 235 | acpi_bus_id bus_id; /* Object name */ |
| 236 | int instance_no; /* Instance number of this object */ | ||
| 236 | struct acpi_pnp_type type; /* ID type */ | 237 | struct acpi_pnp_type type; /* ID type */ |
| 237 | acpi_bus_address bus_address; /* _ADR */ | 238 | acpi_bus_address bus_address; /* _ADR */ |
| 238 | char *unique_id; /* _UID */ | 239 | char *unique_id; /* _UID */ |
| @@ -612,9 +612,11 @@ static inline void ttm_bo_pin(struct ttm_buffer_object *bo) · 611 unmodified lines | |||
| 612 | static inline void ttm_bo_unpin(struct ttm_buffer_object *bo) | 612 | static inline void ttm_bo_unpin(struct ttm_buffer_object *bo) |
| 613 | { | 613 | { |
| 614 | dma_resv_assert_held(bo->base.resv); | 614 | dma_resv_assert_held(bo->base.resv); |
| 615 | WARN_ON_ONCE(!bo->pin_count); | ||
| 616 | WARN_ON_ONCE(!kref_read(&bo->kref)); | 615 | WARN_ON_ONCE(!kref_read(&bo->kref)); |
| 617 | --bo->pin_count; | 616 | if (bo->pin_count) |
| 617 | --bo->pin_count; | ||
| 618 | else | ||
| 619 | WARN_ON_ONCE(true); | ||
| 618 | } | 620 | } |
| 619 | 621 | ||
| 620 | int ttm_mem_evict_first(struct ttm_bo_device *bdev, | 622 | int ttm_mem_evict_first(struct ttm_bo_device *bdev, |
| @@ -105,8 +105,19 @@ extern struct bus_type amba_bustype; · 104 unmodified lines | |||
| 105 | #define amba_get_drvdata(d) dev_get_drvdata(&d->dev) | 105 | #define amba_get_drvdata(d) dev_get_drvdata(&d->dev) |
| 106 | #define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) | 106 | #define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) |
| 107 | 107 | ||
| 108 | #ifdef CONFIG_ARM_AMBA | ||
| 108 | int amba_driver_register(struct amba_driver *); | 109 | int amba_driver_register(struct amba_driver *); |
| 109 | void amba_driver_unregister(struct amba_driver *); | 110 | void amba_driver_unregister(struct amba_driver *); |
| 111 | #else | ||
| 112 | static inline int amba_driver_register(struct amba_driver *drv) | ||
| 113 | { | ||
| 114 | return -EINVAL; | ||
| 115 | } | ||
| 116 | static inline void amba_driver_unregister(struct amba_driver *drv) | ||
| 117 | { | ||
| 118 | } | ||
| 119 | #endif | ||
| 120 | |||
| 110 | struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t); | 121 | struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t); |
| 111 | void amba_device_put(struct amba_device *); | 122 | void amba_device_put(struct amba_device *); |
| 112 | int amba_device_add(struct amba_device *, struct resource *); | 123 | int amba_device_add(struct amba_device *, struct resource *); |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <linux/capability.h> | 21 | #include <linux/capability.h> |
| 22 | #include <linux/sched/mm.h> | 22 | #include <linux/sched/mm.h> |
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/percpu-refcount.h> | ||
| 24 | 25 | ||
| 25 | struct bpf_verifier_env; | 26 | struct bpf_verifier_env; |
| 26 | struct bpf_verifier_log; | 27 | struct bpf_verifier_log; |
| @@ -556,7 +557,8 @@ struct bpf_tramp_progs { · 529 unmodified lines | |||
| 556 | * fentry = a set of program to run before calling original function | 557 | * fentry = a set of program to run before calling original function |
| 557 | * fexit = a set of program to run after original function | 558 | * fexit = a set of program to run after original function |
| 558 | */ | 559 | */ |
| 559 | int arch_prepare_bpf_trampoline(void *image, void *image_end, | 560 | struct bpf_tramp_image; |
| 561 | int arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, void *image_end, | ||
| 560 | const struct btf_func_model *m, u32 flags, | 562 | const struct btf_func_model *m, u32 flags, |
| 561 | struct bpf_tramp_progs *tprogs, | 563 | struct bpf_tramp_progs *tprogs, |
| 562 | void *orig_call); | 564 | void *orig_call); |
| @@ -565,6 +567,8 @@ u64 notrace __bpf_prog_enter(struct bpf_prog *prog); · 2 unmodified lines | |||
| 565 | void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start); | 567 | void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start); |
| 566 | u64 notrace __bpf_prog_enter_sleepable(struct bpf_prog *prog); | 568 | u64 notrace __bpf_prog_enter_sleepable(struct bpf_prog *prog); |
| 567 | void notrace __bpf_prog_exit_sleepable(struct bpf_prog *prog, u64 start); | 569 | void notrace __bpf_prog_exit_sleepable(struct bpf_prog *prog, u64 start); |
| 570 | void notrace __bpf_tramp_enter(struct bpf_tramp_image *tr); | ||
| 571 | void notrace __bpf_tramp_exit(struct bpf_tramp_image *tr); | ||
| 568 | 572 | ||
| 569 | struct bpf_ksym { | 573 | struct bpf_ksym { |
| 570 | unsigned long start; | 574 | unsigned long start; |
| @@ -583,6 +587,18 @@ enum bpf_tramp_prog_type { · 12 unmodified lines | |||
| 583 | BPF_TRAMP_REPLACE, /* more than MAX */ | 587 | BPF_TRAMP_REPLACE, /* more than MAX */ |
| 584 | }; | 588 | }; |
| 585 | 589 | ||
| 590 | struct bpf_tramp_image { | ||
| 591 | void *image; | ||
| 592 | struct bpf_ksym ksym; | ||
| 593 | struct percpu_ref pcref; | ||
| 594 | void *ip_after_call; | ||
| 595 | void *ip_epilogue; | ||
| 596 | union { | ||
| 597 | struct rcu_head rcu; | ||
| 598 | struct work_struct work; | ||
| 599 | }; | ||
| 600 | }; | ||
| 601 | |||
| 586 | struct bpf_trampoline { | 602 | struct bpf_trampoline { |
| 587 | /* hlist for trampoline_table */ | 603 | /* hlist for trampoline_table */ |
| 588 | struct hlist_node hlist; | 604 | struct hlist_node hlist; |
| @@ -605,9 +621,8 @@ struct bpf_trampoline { · 16 unmodified lines | |||
| 605 | /* Number of attached programs. A counter per kind. */ | 621 | /* Number of attached programs. A counter per kind. */ |
| 606 | int progs_cnt[BPF_TRAMP_MAX]; | 622 | int progs_cnt[BPF_TRAMP_MAX]; |
| 607 | /* Executable image of trampoline */ | 623 | /* Executable image of trampoline */ |
| 608 | void *image; | 624 | struct bpf_tramp_image *cur_image; |
| 609 | u64 selector; | 625 | u64 selector; |
| 610 | struct bpf_ksym ksym; | ||
| 611 | }; | 626 | }; |
| 612 | 627 | ||
| 613 | struct bpf_attach_target_info { | 628 | struct bpf_attach_target_info { |
| @@ -691,6 +706,8 @@ void bpf_image_ksym_add(void *data, struct bpf_ksym *ksym); · 77 unmodified lines | |||
| 691 | void bpf_image_ksym_del(struct bpf_ksym *ksym); | 706 | void bpf_image_ksym_del(struct bpf_ksym *ksym); |
| 692 | void bpf_ksym_add(struct bpf_ksym *ksym); | 707 | void bpf_ksym_add(struct bpf_ksym *ksym); |
| 693 | void bpf_ksym_del(struct bpf_ksym *ksym); | 708 | void bpf_ksym_del(struct bpf_ksym *ksym); |
| 709 | int bpf_jit_charge_modmem(u32 pages); | ||
| 710 | void bpf_jit_uncharge_modmem(u32 pages); | ||
| 694 | #else | 711 | #else |
| 695 | static inline int bpf_trampoline_link_prog(struct bpf_prog *prog, | 712 | static inline int bpf_trampoline_link_prog(struct bpf_prog *prog, |
| 696 | struct bpf_trampoline *tr) | 713 | struct bpf_trampoline *tr) |
| @@ -787,7 +804,6 @@ struct bpf_prog_aux { · 90 unmodified lines | |||
| 787 | bool func_proto_unreliable; | 804 | bool func_proto_unreliable; |
| 788 | bool sleepable; | 805 | bool sleepable; |
| 789 | bool tail_call_reachable; | 806 | bool tail_call_reachable; |
| 790 | enum bpf_tramp_prog_type trampoline_prog_type; | ||
| 791 | struct hlist_node tramp_hlist; | 807 | struct hlist_node tramp_hlist; |
| 792 | /* BTF_KIND_FUNC_PROTO for valid attach_btf_id */ | 808 | /* BTF_KIND_FUNC_PROTO for valid attach_btf_id */ |
| 793 | const struct btf_type *attach_func_proto; | 809 | const struct btf_type *attach_func_proto; |
| @@ -1093,7 +1109,7 @@ int bpf_prog_array_copy(struct bpf_prog_array *old_array, · 299 unmodified lines | |||
| 1093 | _ret; \ | 1109 | _ret; \ |
| 1094 | }) | 1110 | }) |
| 1095 | 1111 | ||
| 1096 | #define __BPF_PROG_RUN_ARRAY(array, ctx, func, check_non_null) \ | 1112 | #define __BPF_PROG_RUN_ARRAY(array, ctx, func, check_non_null, set_cg_storage) \ |
| 1097 | ({ \ | 1113 | ({ \ |
| 1098 | struct bpf_prog_array_item *_item; \ | 1114 | struct bpf_prog_array_item *_item; \ |
| 1099 | struct bpf_prog *_prog; \ | 1115 | struct bpf_prog *_prog; \ |
| @@ -1106,7 +1122,8 @@ int bpf_prog_array_copy(struct bpf_prog_array *old_array, · 6 unmodified lines | |||
| 1106 | goto _out; \ | 1122 | goto _out; \ |
| 1107 | _item = &_array->items[0]; \ | 1123 | _item = &_array->items[0]; \ |
| 1108 | while ((_prog = READ_ONCE(_item->prog))) { \ | 1124 | while ((_prog = READ_ONCE(_item->prog))) { \ |
| 1109 | bpf_cgroup_storage_set(_item->cgroup_storage); \ | 1125 | if (set_cg_storage) \ |
| 1126 | bpf_cgroup_storage_set(_item->cgroup_storage); \ | ||
| 1110 | _ret &= func(_prog, ctx); \ | 1127 | _ret &= func(_prog, ctx); \ |
| 1111 | _item++; \ | 1128 | _item++; \ |
| 1112 | } \ | 1129 | } \ |
| @@ -1153,10 +1170,10 @@ _out: \ · 40 unmodified lines | |||
| 1153 | }) | 1170 | }) |
| 1154 | 1171 | ||
| 1155 | #define BPF_PROG_RUN_ARRAY(array, ctx, func) \ | 1172 | #define BPF_PROG_RUN_ARRAY(array, ctx, func) \ |
| 1156 | __BPF_PROG_RUN_ARRAY(array, ctx, func, false) | 1173 | __BPF_PROG_RUN_ARRAY(array, ctx, func, false, true) |
| 1157 | 1174 | ||
| 1158 | #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func) \ | 1175 | #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func) \ |
| 1159 | __BPF_PROG_RUN_ARRAY(array, ctx, func, true) | 1176 | __BPF_PROG_RUN_ARRAY(array, ctx, func, true, false) |
| 1160 | 1177 | ||
| 1161 | #ifdef CONFIG_BPF_SYSCALL | 1178 | #ifdef CONFIG_BPF_SYSCALL |
| 1162 | DECLARE_PER_CPU(int, bpf_prog_active); | 1179 | DECLARE_PER_CPU(int, bpf_prog_active); |
| @@ -253,7 +253,11 @@ struct target_type { · 252 unmodified lines | |||
| 253 | #define dm_target_passes_integrity(type) ((type)->features & DM_TARGET_PASSES_INTEGRITY) | 253 | #define dm_target_passes_integrity(type) ((type)->features & DM_TARGET_PASSES_INTEGRITY) |
| 254 | 254 | ||
| 255 | /* | 255 | /* |
| 256 | * Indicates that a target supports host-managed zoned block devices. | 256 | * Indicates support for zoned block devices: |
| 257 | * - DM_TARGET_ZONED_HM: the target also supports host-managed zoned | ||
| 258 | * block devices but does not support combining different zoned models. | ||
| 259 | * - DM_TARGET_MIXED_ZONED_MODEL: the target supports combining multiple | ||
| 260 | * devices with different zoned models. | ||
| 257 | */ | 261 | */ |
| 258 | #ifdef CONFIG_BLK_DEV_ZONED | 262 | #ifdef CONFIG_BLK_DEV_ZONED |
| 259 | #define DM_TARGET_ZONED_HM 0x00000040 | 263 | #define DM_TARGET_ZONED_HM 0x00000040 |
| @@ -275,6 +279,15 @@ struct target_type { · 15 unmodified lines | |||
| 275 | #define DM_TARGET_PASSES_CRYPTO 0x00000100 | 279 | #define DM_TARGET_PASSES_CRYPTO 0x00000100 |
| 276 | #define dm_target_passes_crypto(type) ((type)->features & DM_TARGET_PASSES_CRYPTO) | 280 | #define dm_target_passes_crypto(type) ((type)->features & DM_TARGET_PASSES_CRYPTO) |
| 277 | 281 | ||
| 282 | #ifdef CONFIG_BLK_DEV_ZONED | ||
| 283 | #define DM_TARGET_MIXED_ZONED_MODEL 0x00000200 | ||
| 284 | #define dm_target_supports_mixed_zoned_model(type) \ | ||
| 285 | ((type)->features & DM_TARGET_MIXED_ZONED_MODEL) | ||
| 286 | #else | ||
| 287 | #define DM_TARGET_MIXED_ZONED_MODEL 0x00000000 | ||
| 288 | #define dm_target_supports_mixed_zoned_model(type) (false) | ||
| 289 | #endif | ||
| 290 | |||
| 278 | struct dm_target { | 291 | struct dm_target { |
| 279 | struct dm_table *table; | 292 | struct dm_table *table; |
| 280 | struct target_type *type; | 293 | struct target_type *type; |
| @@ -72,8 +72,10 @@ typedef void *efi_handle_t; · 71 unmodified lines | |||
| 72 | */ | 72 | */ |
| 73 | typedef guid_t efi_guid_t __aligned(__alignof__(u32)); | 73 | typedef guid_t efi_guid_t __aligned(__alignof__(u32)); |
| 74 | 74 | ||
| 75 | #define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ | 75 | #define EFI_GUID(a, b, c, d...) (efi_guid_t){ { \ |
| 76 | GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) | 76 | (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ |
| 77 | (b) & 0xff, ((b) >> 8) & 0xff, \ | ||
| 78 | (c) & 0xff, ((c) >> 8) & 0xff, d } } | ||
| 77 | 79 | ||
| 78 | /* | 80 | /* |
| 79 | * Generic EFI table header | 81 | * Generic EFI table header |
| @@ -113,6 +113,11 @@ static inline bool hugetlb_cgroup_disabled(void) · 112 unmodified lines | |||
| 113 | return !cgroup_subsys_enabled(hugetlb_cgrp_subsys); | 113 | return !cgroup_subsys_enabled(hugetlb_cgrp_subsys); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static inline void hugetlb_cgroup_put_rsvd_cgroup(struct hugetlb_cgroup *h_cg) | ||
| 117 | { | ||
| 118 | css_put(&h_cg->css); | ||
| 119 | } | ||
| 120 | |||
| 116 | extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, | 121 | extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, |
| 117 | struct hugetlb_cgroup **ptr); | 122 | struct hugetlb_cgroup **ptr); |
| 118 | extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, | 123 | extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, |
| @@ -138,7 +143,8 @@ extern void hugetlb_cgroup_uncharge_counter(struct resv_map *resv, · 19 unmodified lines | |||
| 138 | 143 | ||
| 139 | extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, | 144 | extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, |
| 140 | struct file_region *rg, | 145 | struct file_region *rg, |
| 141 | unsigned long nr_pages); | 146 | unsigned long nr_pages, |
| 147 | bool region_del); | ||
| 142 | 148 | ||
| 143 | extern void hugetlb_cgroup_file_init(void) __init; | 149 | extern void hugetlb_cgroup_file_init(void) __init; |
| 144 | extern void hugetlb_cgroup_migrate(struct page *oldhpage, | 150 | extern void hugetlb_cgroup_migrate(struct page *oldhpage, |
| @@ -147,7 +153,8 @@ extern void hugetlb_cgroup_migrate(struct page *oldhpage, · 2 unmodified lines | |||
| 147 | #else | 153 | #else |
| 148 | static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, | 154 | static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, |
| 149 | struct file_region *rg, | 155 | struct file_region *rg, |
| 150 | unsigned long nr_pages) | 156 | unsigned long nr_pages, |
| 157 | bool region_del) | ||
| 151 | { | 158 | { |
| 152 | } | 159 | } |
| 153 | 160 | ||
| @@ -185,6 +192,10 @@ static inline bool hugetlb_cgroup_disabled(void) · 31 unmodified lines | |||
| 185 | return true; | 192 | return true; |
| 186 | } | 193 | } |
| 187 | 194 | ||
| 195 | static inline void hugetlb_cgroup_put_rsvd_cgroup(struct hugetlb_cgroup *h_cg) | ||
| 196 | { | ||
| 197 | } | ||
| 198 | |||
| 188 | static inline int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, | 199 | static inline int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, |
| 189 | struct hugetlb_cgroup **ptr) | 200 | struct hugetlb_cgroup **ptr) |
| 190 | { | 201 | { |
| @@ -43,13 +43,14 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan, · 42 unmodified lines | |||
| 43 | if (likely(success)) { | 43 | if (likely(success)) { |
| 44 | struct vlan_pcpu_stats *pcpu_stats; | 44 | struct vlan_pcpu_stats *pcpu_stats; |
| 45 | 45 | ||
| 46 | pcpu_stats = this_cpu_ptr(vlan->pcpu_stats); | 46 | pcpu_stats = get_cpu_ptr(vlan->pcpu_stats); |
| 47 | u64_stats_update_begin(&pcpu_stats->syncp); | 47 | u64_stats_update_begin(&pcpu_stats->syncp); |
| 48 | pcpu_stats->rx_packets++; | 48 | pcpu_stats->rx_packets++; |
| 49 | pcpu_stats->rx_bytes += len; | 49 | pcpu_stats->rx_bytes += len; |
| 50 | if (multicast) | 50 | if (multicast) |
| 51 | pcpu_stats->rx_multicast++; | 51 | pcpu_stats->rx_multicast++; |
| 52 | u64_stats_update_end(&pcpu_stats->syncp); | 52 | u64_stats_update_end(&pcpu_stats->syncp); |
| 53 | put_cpu_ptr(vlan->pcpu_stats); | ||
| 53 | } else { | 54 | } else { |
| 54 | this_cpu_inc(vlan->pcpu_stats->rx_errors); | 55 | this_cpu_inc(vlan->pcpu_stats->rx_errors); |
| 55 | } | 56 | } |
| @@ -5,31 +5,6 @@ · 4 unmodified lines | |||
| 5 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
| 6 | #include <linux/xarray.h> | 6 | #include <linux/xarray.h> |
| 7 | 7 | ||
| 8 | struct io_wq_work_node { | ||
| 9 | struct io_wq_work_node *next; | ||
| 10 | }; | ||
| 11 | |||
| 12 | struct io_wq_work_list { | ||
| 13 | struct io_wq_work_node *first; | ||
| 14 | struct io_wq_work_node *last; | ||
| 15 | }; | ||
| 16 | |||
| 17 | struct io_uring_task { | ||
| 18 | /* submission side */ | ||
| 19 | struct xarray xa; | ||
| 20 | struct wait_queue_head wait; | ||
| 21 | void *last; | ||
| 22 | void *io_wq; | ||
| 23 | struct percpu_counter inflight; | ||
| 24 | atomic_t in_idle; | ||
| 25 | bool sqpoll; | ||
| 26 | |||
| 27 | spinlock_t task_lock; | ||
| 28 | struct io_wq_work_list task_list; | ||
| 29 | unsigned long task_state; | ||
| 30 | struct callback_head task_work; | ||
| 31 | }; | ||
| 32 | |||
| 33 | #if defined(CONFIG_IO_URING) | 8 | #if defined(CONFIG_IO_URING) |
| 34 | struct sock *io_uring_get_socket(struct file *file); | 9 | struct sock *io_uring_get_socket(struct file *file); |
| 35 | void __io_uring_task_cancel(void); | 10 | void __io_uring_task_cancel(void); |
| @@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size) · 459 unmodified lines | |||
| 460 | /* | 460 | /* |
| 461 | * Set the allocation direction to bottom-up or top-down. | 461 | * Set the allocation direction to bottom-up or top-down. |
| 462 | */ | 462 | */ |
| 463 | static inline __init void memblock_set_bottom_up(bool enable) | 463 | static inline __init_memblock void memblock_set_bottom_up(bool enable) |
| 464 | { | 464 | { |
| 465 | memblock.bottom_up = enable; | 465 | memblock.bottom_up = enable; |
| 466 | } | 466 | } |
| @@ -470,7 +470,7 @@ static inline __init void memblock_set_bottom_up(bool enable) · 3 unmodified lines | |||
| 470 | * if this is true, that said, memblock will allocate memory | 470 | * if this is true, that said, memblock will allocate memory |
| 471 | * in bottom-up direction. | 471 | * in bottom-up direction. |
| 472 | */ | 472 | */ |
| 473 | static inline __init bool memblock_bottom_up(void) | 473 | static inline __init_memblock bool memblock_bottom_up(void) |
| 474 | { | 474 | { |
| 475 | return memblock.bottom_up; | 475 | return memblock.bottom_up; |
| 476 | } | 476 | } |
| @@ -547,4 +547,11 @@ static inline const char *mlx5_qp_state_str(int state) · 546 unmodified lines | |||
| 547 | } | 547 | } |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | static inline int mlx5_get_qp_default_ts(struct mlx5_core_dev *dev) | ||
| 551 | { | ||
| 552 | return !MLX5_CAP_ROCE(dev, qp_ts_format) ? | ||
| 553 | MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING : | ||
| 554 | MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT; | ||
| 555 | } | ||
| 556 | |||
| 550 | #endif /* MLX5_QP_H */ | 557 | #endif /* MLX5_QP_H */ |
| @@ -1461,16 +1461,28 @@ static inline bool cpupid_match_pid(struct task_struct *task, int cpupid) · 1460 unmodified lines | |||
| 1461 | 1461 | ||
| 1462 | #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) | 1462 | #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) |
| 1463 | 1463 | ||
| 1464 | /* | ||
| 1465 | * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid | ||
| 1466 | * setting tags for all pages to native kernel tag value 0xff, as the default | ||
| 1467 | * value 0x00 maps to 0xff. | ||
| 1468 | */ | ||
| 1469 | |||
| 1464 | static inline u8 page_kasan_tag(const struct page *page) | 1470 | static inline u8 page_kasan_tag(const struct page *page) |
| 1465 | { | 1471 | { |
| 1466 | if (kasan_enabled()) | 1472 | u8 tag = 0xff; |
| 1467 | return (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; | 1473 | |
| 1468 | return 0xff; | 1474 | if (kasan_enabled()) { |
| 1475 | tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; | ||
| 1476 | tag ^= 0xff; | ||
| 1477 | } | ||
| 1478 | |||
| 1479 | return tag; | ||
| 1469 | } | 1480 | } |
| 1470 | 1481 | ||
| 1471 | static inline void page_kasan_tag_set(struct page *page, u8 tag) | 1482 | static inline void page_kasan_tag_set(struct page *page, u8 tag) |
| 1472 | { | 1483 | { |
| 1473 | if (kasan_enabled()) { | 1484 | if (kasan_enabled()) { |
| 1485 | tag ^= 0xff; | ||
| 1474 | page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); | 1486 | page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); |
| 1475 | page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; | 1487 | page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; |
| 1476 | } | 1488 | } |
| @@ -169,11 +169,11 @@ struct mmu_notifier_ops { · 168 unmodified lines | |||
| 169 | * the last refcount is dropped. | 169 | * the last refcount is dropped. |
| 170 | * | 170 | * |
| 171 | * If blockable argument is set to false then the callback cannot | 171 | * If blockable argument is set to false then the callback cannot |
| 172 | * sleep and has to return with -EAGAIN. 0 should be returned | 172 | * sleep and has to return with -EAGAIN if sleeping would be required. |
| 173 | * otherwise. Please note that if invalidate_range_start approves | 173 | * 0 should be returned otherwise. Please note that notifiers that can |
| 174 | * a non-blocking behavior then the same applies to | 174 | * fail invalidate_range_start are not allowed to implement |
| 175 | * invalidate_range_end. | 175 | * invalidate_range_end, as there is no mechanism for informing the |
| 176 | * | 176 | * notifier that its start failed. |
| 177 | */ | 177 | */ |
| 178 | int (*invalidate_range_start)(struct mmu_notifier *subscription, | 178 | int (*invalidate_range_start)(struct mmu_notifier *subscription, |
| 179 | const struct mmu_notifier_range *range); | 179 | const struct mmu_notifier_range *range); |
| @@ -30,9 +30,6 @@ · 29 unmodified lines | |||
| 30 | #include <linux/percpu.h> | 30 | #include <linux/percpu.h> |
| 31 | #include <asm/module.h> | 31 | #include <asm/module.h> |
| 32 | 32 | ||
| 33 | /* Not Yet Implemented */ | ||
| 34 | #define MODULE_SUPPORTED_DEVICE(name) | ||
| 35 | |||
| 36 | #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN | 33 | #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN |
| 37 | 34 | ||
| 38 | struct modversion_info { | 35 | struct modversion_info { |
| @@ -183,7 +183,7 @@ extern void mutex_lock_io(struct mutex *lock); · 182 unmodified lines | |||
| 183 | # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) | 183 | # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) |
| 184 | # define mutex_lock_killable_nested(lock, subclass) mutex_lock_killable(lock) | 184 | # define mutex_lock_killable_nested(lock, subclass) mutex_lock_killable(lock) |
| 185 | # define mutex_lock_nest_lock(lock, nest_lock) mutex_lock(lock) | 185 | # define mutex_lock_nest_lock(lock, nest_lock) mutex_lock(lock) |
| 186 | # define mutex_lock_io_nested(lock, subclass) mutex_lock(lock) | 186 | # define mutex_lock_io_nested(lock, subclass) mutex_lock_io(lock) |
| 187 | #endif | 187 | #endif |
| 188 | 188 | ||
| 189 | /* | 189 | /* |
| @@ -360,6 +360,7 @@ enum { · 359 unmodified lines | |||
| 360 | NAPI_STATE_IN_BUSY_POLL, /* sk_busy_loop() owns this NAPI */ | 360 | NAPI_STATE_IN_BUSY_POLL, /* sk_busy_loop() owns this NAPI */ |
| 361 | NAPI_STATE_PREFER_BUSY_POLL, /* prefer busy-polling over softirq processing*/ | 361 | NAPI_STATE_PREFER_BUSY_POLL, /* prefer busy-polling over softirq processing*/ |
| 362 | NAPI_STATE_THREADED, /* The poll is performed inside its own thread*/ | 362 | NAPI_STATE_THREADED, /* The poll is performed inside its own thread*/ |
| 363 | NAPI_STATE_SCHED_THREADED, /* Napi is currently scheduled in threaded mode */ | ||
| 363 | }; | 364 | }; |
| 364 | 365 | ||
| 365 | enum { | 366 | enum { |
| @@ -372,6 +373,7 @@ enum { · 6 unmodified lines | |||
| 372 | NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL), | 373 | NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL), |
| 373 | NAPIF_STATE_PREFER_BUSY_POLL = BIT(NAPI_STATE_PREFER_BUSY_POLL), | 374 | NAPIF_STATE_PREFER_BUSY_POLL = BIT(NAPI_STATE_PREFER_BUSY_POLL), |
| 374 | NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED), | 375 | NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED), |
| 376 | NAPIF_STATE_SCHED_THREADED = BIT(NAPI_STATE_SCHED_THREADED), | ||
| 375 | }; | 377 | }; |
| 376 | 378 | ||
| 377 | enum gro_result { | 379 | enum gro_result { |
| @@ -227,7 +227,7 @@ struct xt_table { · 226 unmodified lines | |||
| 227 | unsigned int valid_hooks; | 227 | unsigned int valid_hooks; |
| 228 | 228 | ||
| 229 | /* Man behind the curtain... */ | 229 | /* Man behind the curtain... */ |
| 230 | struct xt_table_info __rcu *private; | 230 | struct xt_table_info *private; |
| 231 | 231 | ||
| 232 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 232 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
| 233 | struct module *me; | 233 | struct module *me; |
| @@ -376,7 +376,7 @@ static inline unsigned int xt_write_recseq_begin(void) · 142 unmodified lines | |||
| 376 | * since addend is most likely 1 | 376 | * since addend is most likely 1 |
| 377 | */ | 377 | */ |
| 378 | __this_cpu_add(xt_recseq.sequence, addend); | 378 | __this_cpu_add(xt_recseq.sequence, addend); |
| 379 | smp_wmb(); | 379 | smp_mb(); |
| 380 | 380 | ||
| 381 | return addend; | 381 | return addend; |
| 382 | } | 382 | } |
| @@ -448,9 +448,6 @@ xt_get_per_cpu_counter(struct xt_counters *cnt, unsigned int cpu) · 65 unmodified lines | |||
| 448 | 448 | ||
| 449 | struct nf_hook_ops *xt_hook_ops_alloc(const struct xt_table *, nf_hookfn *); | 449 | struct nf_hook_ops *xt_hook_ops_alloc(const struct xt_table *, nf_hookfn *); |
| 450 | 450 | ||
| 451 | struct xt_table_info | ||
| 452 | *xt_table_get_private_protected(const struct xt_table *table); | ||
| 453 | |||
| 454 | #ifdef CONFIG_COMPAT | 451 | #ifdef CONFIG_COMPAT |
| 455 | #include <net/compat.h> | 452 | #include <net/compat.h> |
| 456 | 453 | ||
| @@ -559,7 +559,6 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma, · 558 unmodified lines | |||
| 559 | return pgoff; | 559 | return pgoff; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | /* This has the same layout as wait_bit_key - see fs/cachefiles/rdwr.c */ | ||
| 563 | struct wait_page_key { | 562 | struct wait_page_key { |
| 564 | struct page *page; | 563 | struct page *page; |
| 565 | int bit_nr; | 564 | int bit_nr; |
| @@ -683,6 +682,7 @@ static inline int wait_on_page_locked_killable(struct page *page) · 117 unmodified lines | |||
| 683 | 682 | ||
| 684 | int put_and_wait_on_page_locked(struct page *page, int state); | 683 | int put_and_wait_on_page_locked(struct page *page, int state); |
| 685 | void wait_on_page_writeback(struct page *page); | 684 | void wait_on_page_writeback(struct page *page); |
| 685 | int wait_on_page_writeback_killable(struct page *page); | ||
| 686 | extern void end_page_writeback(struct page *page); | 686 | extern void end_page_writeback(struct page *page); |
| 687 | void wait_for_stable_page(struct page *page); | 687 | void wait_for_stable_page(struct page *page); |
| 688 | 688 | ||
| @@ -23,6 +23,7 @@ enum timespec_type { · 22 unmodified lines | |||
| 23 | * System call restart block. | 23 | * System call restart block. |
| 24 | */ | 24 | */ |
| 25 | struct restart_block { | 25 | struct restart_block { |
| 26 | unsigned long arch_data; | ||
| 26 | long (*fn)(struct restart_block *); | 27 | long (*fn)(struct restart_block *); |
| 27 | union { | 28 | union { |
| 28 | /* For futex_wait and futex_wait_requeue_pi */ | 29 | /* For futex_wait and futex_wait_requeue_pi */ |
| @@ -285,6 +285,7 @@ struct nf_bridge_info { · 284 unmodified lines | |||
| 285 | struct tc_skb_ext { | 285 | struct tc_skb_ext { |
| 286 | __u32 chain; | 286 | __u32 chain; |
| 287 | __u16 mru; | 287 | __u16 mru; |
| 288 | bool post_ct; | ||
| 288 | }; | 289 | }; |
| 289 | #endif | 290 | #endif |
| 290 | 291 | ||
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 12 | #include <linux/bug.h> | 12 | #include <linux/bug.h> |
| 13 | #include <linux/restart_block.h> | 13 | #include <linux/restart_block.h> |
| 14 | #include <linux/errno.h> | ||
| 14 | 15 | ||
| 15 | #ifdef CONFIG_THREAD_INFO_IN_TASK | 16 | #ifdef CONFIG_THREAD_INFO_IN_TASK |
| 16 | /* | 17 | /* |
| @@ -59,6 +60,18 @@ enum syscall_work_bit { · 42 unmodified lines | |||
| 59 | 60 | ||
| 60 | #ifdef __KERNEL__ | 61 | #ifdef __KERNEL__ |
| 61 | 62 | ||
| 63 | #ifndef arch_set_restart_data | ||
| 64 | #define arch_set_restart_data(restart) do { } while (0) | ||
| 65 | #endif | ||
| 66 | |||
| 67 | static inline long set_restart_fn(struct restart_block *restart, | ||
| 68 | long (*fn)(struct restart_block *)) | ||
| 69 | { | ||
| 70 | restart->fn = fn; | ||
| 71 | arch_set_restart_data(restart); | ||
| 72 | return -ERESTART_RESTARTBLOCK; | ||
| 73 | } | ||
| 74 | |||
| 62 | #ifndef THREAD_ALIGN | 75 | #ifndef THREAD_ALIGN |
| 63 | #define THREAD_ALIGN THREAD_SIZE | 76 | #define THREAD_ALIGN THREAD_SIZE |
| 64 | #endif | 77 | #endif |
| @@ -86,6 +86,8 @@ · 85 unmodified lines | |||
| 86 | /* lies about caching, so always sync */ \ | 86 | /* lies about caching, so always sync */ \ |
| 87 | US_FLAG(NO_SAME, 0x40000000) \ | 87 | US_FLAG(NO_SAME, 0x40000000) \ |
| 88 | /* Cannot handle WRITE_SAME */ \ | 88 | /* Cannot handle WRITE_SAME */ \ |
| 89 | US_FLAG(SENSE_AFTER_SYNC, 0x80000000) \ | ||
| 90 | /* Do REQUEST_SENSE after SYNCHRONIZE_CACHE */ \ | ||
| 89 | 91 | ||
| 90 | #define US_FLAG(name, value) US_FL_##name = value , | 92 | #define US_FLAG(name, value) US_FL_##name = value , |
| 91 | enum { US_DO_ALL_FLAGS }; | 93 | enum { US_DO_ALL_FLAGS }; |
| @@ -14,5 +14,6 @@ struct umd_info { · 13 unmodified lines | |||
| 14 | int umd_load_blob(struct umd_info *info, const void *data, size_t len); | 14 | int umd_load_blob(struct umd_info *info, const void *data, size_t len); |
| 15 | int umd_unload_blob(struct umd_info *info); | 15 | int umd_unload_blob(struct umd_info *info); |
| 16 | int fork_usermode_driver(struct umd_info *info); | 16 | int fork_usermode_driver(struct umd_info *info); |
| 17 | void umd_cleanup_helper(struct umd_info *info); | ||
| 17 | 18 | ||
| 18 | #endif /* __LINUX_USERMODE_DRIVER_H__ */ | 19 | #endif /* __LINUX_USERMODE_DRIVER_H__ */ |
| @@ -250,20 +250,20 @@ struct vdpa_config_ops { · 249 unmodified lines | |||
| 250 | 250 | ||
| 251 | struct vdpa_device *__vdpa_alloc_device(struct device *parent, | 251 | struct vdpa_device *__vdpa_alloc_device(struct device *parent, |
| 252 | const struct vdpa_config_ops *config, | 252 | const struct vdpa_config_ops *config, |
| 253 | int nvqs, size_t size, const char *name); | 253 | size_t size, const char *name); |
| 254 | 254 | ||
| 255 | #define vdpa_alloc_device(dev_struct, member, parent, config, nvqs, name) \ | 255 | #define vdpa_alloc_device(dev_struct, member, parent, config, name) \ |
| 256 | container_of(__vdpa_alloc_device( \ | 256 | container_of(__vdpa_alloc_device( \ |
| 257 | parent, config, nvqs, \ | 257 | parent, config, \ |
| 258 | sizeof(dev_struct) + \ | 258 | sizeof(dev_struct) + \ |
| 259 | BUILD_BUG_ON_ZERO(offsetof( \ | 259 | BUILD_BUG_ON_ZERO(offsetof( \ |
| 260 | dev_struct, member)), name), \ | 260 | dev_struct, member)), name), \ |
| 261 | dev_struct, member) | 261 | dev_struct, member) |
| 262 | 262 | ||
| 263 | int vdpa_register_device(struct vdpa_device *vdev); | 263 | int vdpa_register_device(struct vdpa_device *vdev, int nvqs); |
| 264 | void vdpa_unregister_device(struct vdpa_device *vdev); | 264 | void vdpa_unregister_device(struct vdpa_device *vdev); |
| 265 | 265 | ||
| 266 | int _vdpa_register_device(struct vdpa_device *vdev); | 266 | int _vdpa_register_device(struct vdpa_device *vdev, int nvqs); |
| 267 | void _vdpa_unregister_device(struct vdpa_device *vdev); | 267 | void _vdpa_unregister_device(struct vdpa_device *vdev); |
| 268 | 268 | ||
| 269 | /** | 269 | /** |
| @@ -132,8 +132,6 @@ bool is_virtio_device(struct device *dev); · 131 unmodified lines | |||
| 132 | void virtio_break_device(struct virtio_device *dev); | 132 | void virtio_break_device(struct virtio_device *dev); |
| 133 | 133 | ||
| 134 | void virtio_config_changed(struct virtio_device *dev); | 134 | void virtio_config_changed(struct virtio_device *dev); |
| 135 | void virtio_config_disable(struct virtio_device *dev); | ||
| 136 | void virtio_config_enable(struct virtio_device *dev); | ||
| 137 | int virtio_finalize_features(struct virtio_device *dev); | 135 | int virtio_finalize_features(struct virtio_device *dev); |
| 138 | #ifdef CONFIG_PM_SLEEP | 136 | #ifdef CONFIG_PM_SLEEP |
| 139 | int virtio_device_freeze(struct virtio_device *dev); | 137 | int virtio_device_freeze(struct virtio_device *dev); |
| @@ -550,4 +550,15 @@ static inline void skb_dst_update_pmtu_no_confirm(struct sk_buff *skb, u32 mtu) · 549 unmodified lines | |||
| 550 | dst->ops->update_pmtu(dst, NULL, skb, mtu, false); | 550 | dst->ops->update_pmtu(dst, NULL, skb, mtu, false); |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie); | ||
| 554 | void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, | ||
| 555 | struct sk_buff *skb, u32 mtu, bool confirm_neigh); | ||
| 556 | void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk, | ||
| 557 | struct sk_buff *skb); | ||
| 558 | u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old); | ||
| 559 | struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst, | ||
| 560 | struct sk_buff *skb, | ||
| 561 | const void *daddr); | ||
| 562 | unsigned int dst_blackhole_mtu(const struct dst_entry *dst); | ||
| 563 | |||
| 553 | #endif /* _NET_DST_H */ | 564 | #endif /* _NET_DST_H */ |
| @@ -282,7 +282,7 @@ static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk) · 281 unmodified lines | |||
| 282 | return inet_csk_reqsk_queue_len(sk) >= sk->sk_max_ack_backlog; | 282 | return inet_csk_reqsk_queue_len(sk) >= sk->sk_max_ack_backlog; |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | void inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req); | 285 | bool inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req); |
| 286 | void inet_csk_reqsk_queue_drop_and_put(struct sock *sk, struct request_sock *req); | 286 | void inet_csk_reqsk_queue_drop_and_put(struct sock *sk, struct request_sock *req); |
| 287 | 287 | ||
| 288 | static inline void inet_csk_prepare_for_destroy_sock(struct sock *sk) | 288 | static inline void inet_csk_prepare_for_destroy_sock(struct sock *sk) |
| @@ -1536,6 +1536,7 @@ struct nft_trans_flowtable { · 1535 unmodified lines | |||
| 1536 | struct nft_flowtable *flowtable; | 1536 | struct nft_flowtable *flowtable; |
| 1537 | bool update; | 1537 | bool update; |
| 1538 | struct list_head hook_list; | 1538 | struct list_head hook_list; |
| 1539 | u32 flags; | ||
| 1539 | }; | 1540 | }; |
| 1540 | 1541 | ||
| 1541 | #define nft_trans_flowtable(trans) \ | 1542 | #define nft_trans_flowtable(trans) \ |
| @@ -1544,6 +1545,8 @@ struct nft_trans_flowtable { · 2 unmodified lines | |||
| 1544 | (((struct nft_trans_flowtable *)trans->data)->update) | 1545 | (((struct nft_trans_flowtable *)trans->data)->update) |
| 1545 | #define nft_trans_flowtable_hooks(trans) \ | 1546 | #define nft_trans_flowtable_hooks(trans) \ |
| 1546 | (((struct nft_trans_flowtable *)trans->data)->hook_list) | 1547 | (((struct nft_trans_flowtable *)trans->data)->hook_list) |
| 1548 | #define nft_trans_flowtable_flags(trans) \ | ||
| 1549 | (((struct nft_trans_flowtable *)trans->data)->flags) | ||
| 1547 | 1550 | ||
| 1548 | int __init nft_chain_filter_init(void); | 1551 | int __init nft_chain_filter_init(void); |
| 1549 | void nft_chain_filter_fini(void); | 1552 | void nft_chain_filter_fini(void); |
| @@ -410,6 +410,7 @@ static inline struct fib_nh *fib_info_nh(struct fib_info *fi, int nhsel) · 409 unmodified lines | |||
| 410 | int fib6_check_nexthop(struct nexthop *nh, struct fib6_config *cfg, | 410 | int fib6_check_nexthop(struct nexthop *nh, struct fib6_config *cfg, |
| 411 | struct netlink_ext_ack *extack); | 411 | struct netlink_ext_ack *extack); |
| 412 | 412 | ||
| 413 | /* Caller should either hold rcu_read_lock(), or RTNL. */ | ||
| 413 | static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) | 414 | static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) |
| 414 | { | 415 | { |
| 415 | struct nh_info *nhi; | 416 | struct nh_info *nhi; |
| @@ -430,6 +431,29 @@ static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) · 14 unmodified lines | |||
| 430 | return NULL; | 431 | return NULL; |
| 431 | } | 432 | } |
| 432 | 433 | ||
| 434 | /* Variant of nexthop_fib6_nh(). | ||
| 435 | * Caller should either hold rcu_read_lock_bh(), or RTNL. | ||
| 436 | */ | ||
| 437 | static inline struct fib6_nh *nexthop_fib6_nh_bh(struct nexthop *nh) | ||
| 438 | { | ||
| 439 | struct nh_info *nhi; | ||
| 440 | |||
| 441 | if (nh->is_group) { | ||
| 442 | struct nh_group *nh_grp; | ||
| 443 | |||
| 444 | nh_grp = rcu_dereference_bh_rtnl(nh->nh_grp); | ||
| 445 | nh = nexthop_mpath_select(nh_grp, 0); | ||
| 446 | if (!nh) | ||
| 447 | return NULL; | ||
| 448 | } | ||
| 449 | |||
| 450 | nhi = rcu_dereference_bh_rtnl(nh->nh_info); | ||
| 451 | if (nhi->family == AF_INET6) | ||
| 452 | return &nhi->fib6_nh; | ||
| 453 | |||
| 454 | return NULL; | ||
| 455 | } | ||
| 456 | |||
| 433 | static inline struct net_device *fib6_info_nh_dev(struct fib6_info *f6i) | 457 | static inline struct net_device *fib6_info_nh_dev(struct fib6_info *f6i) |
| 434 | { | 458 | { |
| 435 | struct fib6_nh *fib6_nh; | 459 | struct fib6_nh *fib6_nh; |
| @@ -168,7 +168,8 @@ static inline void red_set_vars(struct red_vars *v) · 167 unmodified lines | |||
| 168 | v->qcount = -1; | 168 | v->qcount = -1; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, u8 Scell_log) | 171 | static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, |
| 172 | u8 Scell_log, u8 *stab) | ||
| 172 | { | 173 | { |
| 173 | if (fls(qth_min) + Wlog > 32) | 174 | if (fls(qth_min) + Wlog > 32) |
| 174 | return false; | 175 | return false; |
| @@ -178,6 +179,13 @@ static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, u8 Scell_ · 3 unmodified lines | |||
| 178 | return false; | 179 | return false; |
| 179 | if (qth_max < qth_min) | 180 | if (qth_max < qth_min) |
| 180 | return false; | 181 | return false; |
| 182 | if (stab) { | ||
| 183 | int i; | ||
| 184 | |||
| 185 | for (i = 0; i < RED_STAB_SIZE; i++) | ||
| 186 | if (stab[i] >= 32) | ||
| 187 | return false; | ||
| 188 | } | ||
| 181 | return true; | 189 | return true; |
| 182 | } | 190 | } |
| 183 | 191 | ||
| @@ -287,7 +295,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(const struct red_parms · 103 unmodified lines | |||
| 287 | int shift; | 295 | int shift; |
| 288 | 296 | ||
| 289 | /* | 297 | /* |
| 290 | * The problem: ideally, average length queue recalcultion should | 298 | * The problem: ideally, average length queue recalculation should |
| 291 | * be done over constant clock intervals. This is too expensive, so | 299 | * be done over constant clock intervals. This is too expensive, so |
| 292 | * that the calculation is driven by outgoing packets. | 300 | * that the calculation is driven by outgoing packets. |
| 293 | * When the queue is idle we have to model this clock by hand. | 301 | * When the queue is idle we have to model this clock by hand. |
| @@ -33,6 +33,7 @@ static inline int rtnl_msg_family(const struct nlmsghdr *nlh) · 32 unmodified lines | |||
| 33 | * | 33 | * |
| 34 | * @list: Used internally | 34 | * @list: Used internally |
| 35 | * @kind: Identifier | 35 | * @kind: Identifier |
| 36 | * @netns_refund: Physical device, move to init_net on netns exit | ||
| 36 | * @maxtype: Highest device specific netlink attribute number | 37 | * @maxtype: Highest device specific netlink attribute number |
| 37 | * @policy: Netlink policy for device specific attribute validation | 38 | * @policy: Netlink policy for device specific attribute validation |
| 38 | * @validate: Optional validation function for netlink/changelink parameters | 39 | * @validate: Optional validation function for netlink/changelink parameters |
| @@ -64,6 +65,7 @@ struct rtnl_link_ops { · 25 unmodified lines | |||
| 64 | size_t priv_size; | 65 | size_t priv_size; |
| 65 | void (*setup)(struct net_device *dev); | 66 | void (*setup)(struct net_device *dev); |
| 66 | 67 | ||
| 68 | bool netns_refund; | ||
| 67 | unsigned int maxtype; | 69 | unsigned int maxtype; |
| 68 | const struct nla_policy *policy; | 70 | const struct nla_policy *policy; |
| 69 | int (*validate)(struct nlattr *tb[], | 71 | int (*validate)(struct nlattr *tb[], |
| @@ -936,7 +936,7 @@ static inline void sk_acceptq_added(struct sock *sk) · 935 unmodified lines | |||
| 936 | 936 | ||
| 937 | static inline bool sk_acceptq_is_full(const struct sock *sk) | 937 | static inline bool sk_acceptq_is_full(const struct sock *sk) |
| 938 | { | 938 | { |
| 939 | return READ_ONCE(sk->sk_ack_backlog) > READ_ONCE(sk->sk_max_ack_backlog); | 939 | return READ_ONCE(sk->sk_ack_backlog) >= READ_ONCE(sk->sk_max_ack_backlog); |
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | /* | 942 | /* |
| @@ -30,7 +30,7 @@ TRACE_EVENT(workqueue_queue_work, · 29 unmodified lines | |||
| 30 | TP_STRUCT__entry( | 30 | TP_STRUCT__entry( |
| 31 | __field( void *, work ) | 31 | __field( void *, work ) |
| 32 | __field( void *, function) | 32 | __field( void *, function) |
| 33 | __field( const char *, workqueue) | 33 | __string( workqueue, pwq->wq->name) |
| 34 | __field( unsigned int, req_cpu ) | 34 | __field( unsigned int, req_cpu ) |
| 35 | __field( unsigned int, cpu ) | 35 | __field( unsigned int, cpu ) |
| 36 | ), | 36 | ), |
| @@ -38,13 +38,13 @@ TRACE_EVENT(workqueue_queue_work, · 1 unmodified line | |||
| 38 | TP_fast_assign( | 38 | TP_fast_assign( |
| 39 | __entry->work = work; | 39 | __entry->work = work; |
| 40 | __entry->function = work->func; | 40 | __entry->function = work->func; |
| 41 | __entry->workqueue = pwq->wq->name; | 41 | __assign_str(workqueue, pwq->wq->name); |
| 42 | __entry->req_cpu = req_cpu; | 42 | __entry->req_cpu = req_cpu; |
| 43 | __entry->cpu = pwq->pool->cpu; | 43 | __entry->cpu = pwq->pool->cpu; |
| 44 | ), | 44 | ), |
| 45 | 45 | ||
| 46 | TP_printk("work struct=%p function=%ps workqueue=%s req_cpu=%u cpu=%u", | 46 | TP_printk("work struct=%p function=%ps workqueue=%s req_cpu=%u cpu=%u", |
| 47 | __entry->work, __entry->function, __entry->workqueue, | 47 | __entry->work, __entry->function, __get_str(workqueue), |
| 48 | __entry->req_cpu, __entry->cpu) | 48 | __entry->req_cpu, __entry->cpu) |
| 49 | ); | 49 | ); |
| 50 | 50 | ||
| @@ -3850,7 +3850,7 @@ union bpf_attr { · 3849 unmodified lines | |||
| 3850 | * | 3850 | * |
| 3851 | * long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags) | 3851 | * long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags) |
| 3852 | * Description | 3852 | * Description |
| 3853 | * Check ctx packet size against exceeding MTU of net device (based | 3853 | * Check packet size against exceeding MTU of net device (based |
| 3854 | * on *ifindex*). This helper will likely be used in combination | 3854 | * on *ifindex*). This helper will likely be used in combination |
| 3855 | * with helpers that adjust/change the packet size. | 3855 | * with helpers that adjust/change the packet size. |
| 3856 | * | 3856 | * |
| @@ -3867,6 +3867,14 @@ union bpf_attr { · 10 unmodified lines | |||
| 3867 | * against the current net device. This is practical if this isn't | 3867 | * against the current net device. This is practical if this isn't |
| 3868 | * used prior to redirect. | 3868 | * used prior to redirect. |
| 3869 | * | 3869 | * |
| 3870 | * On input *mtu_len* must be a valid pointer, else verifier will | ||
| 3871 | * reject BPF program. If the value *mtu_len* is initialized to | ||
| 3872 | * zero then the ctx packet size is use. When value *mtu_len* is | ||
| 3873 | * provided as input this specify the L3 length that the MTU check | ||
| 3874 | * is done against. Remember XDP and TC length operate at L2, but | ||
| 3875 | * this value is L3 as this correlate to MTU and IP-header tot_len | ||
| 3876 | * values which are L3 (similar behavior as bpf_fib_lookup). | ||
| 3877 | * | ||
| 3870 | * The Linux kernel route table can configure MTUs on a more | 3878 | * The Linux kernel route table can configure MTUs on a more |
| 3871 | * specific per route level, which is not provided by this helper. | 3879 | * specific per route level, which is not provided by this helper. |
| 3872 | * For route level MTU checks use the **bpf_fib_lookup**\ () | 3880 | * For route level MTU checks use the **bpf_fib_lookup**\ () |
| @@ -3891,11 +3899,9 @@ union bpf_attr { · 18 unmodified lines | |||
| 3891 | * | 3899 | * |
| 3892 | * On return *mtu_len* pointer contains the MTU value of the net | 3900 | * On return *mtu_len* pointer contains the MTU value of the net |
| 3893 | * device. Remember the net device configured MTU is the L3 size, | 3901 | * device. Remember the net device configured MTU is the L3 size, |
| 3894 | * which is returned here and XDP and TX length operate at L2. | 3902 | * which is returned here and XDP and TC length operate at L2. |
| 3895 | * Helper take this into account for you, but remember when using | 3903 | * Helper take this into account for you, but remember when using |
| 3896 | * MTU value in your BPF-code. On input *mtu_len* must be a valid | 3904 | * MTU value in your BPF-code. |
| 3897 | * pointer and be initialized (to zero), else verifier will reject | ||
| 3898 | * BPF program. | ||
| 3899 | * | 3905 | * |
| 3900 | * Return | 3906 | * Return |
| 3901 | * * 0 on success, and populate MTU value in *mtu_len* pointer. | 3907 | * * 0 on success, and populate MTU value in *mtu_len* pointer. |
| @@ -3,7 +3,6 @@ · 2 unmodified lines | |||
| 3 | #define __UAPI_PSAMPLE_H | 3 | #define __UAPI_PSAMPLE_H |
| 4 | 4 | ||
| 5 | enum { | 5 | enum { |
| 6 | /* sampled packet metadata */ | ||
| 7 | PSAMPLE_ATTR_IIFINDEX, | 6 | PSAMPLE_ATTR_IIFINDEX, |
| 8 | PSAMPLE_ATTR_OIFINDEX, | 7 | PSAMPLE_ATTR_OIFINDEX, |
| 9 | PSAMPLE_ATTR_ORIGSIZE, | 8 | PSAMPLE_ATTR_ORIGSIZE, |
| @@ -11,10 +10,8 @@ enum { · 1 unmodified line | |||
| 11 | PSAMPLE_ATTR_GROUP_SEQ, | 10 | PSAMPLE_ATTR_GROUP_SEQ, |
| 12 | PSAMPLE_ATTR_SAMPLE_RATE, | 11 | PSAMPLE_ATTR_SAMPLE_RATE, |
| 13 | PSAMPLE_ATTR_DATA, | 12 | PSAMPLE_ATTR_DATA, |
| 14 | PSAMPLE_ATTR_TUNNEL, | ||
| 15 | |||
| 16 | /* commands attributes */ | ||
| 17 | PSAMPLE_ATTR_GROUP_REFCOUNT, | 13 | PSAMPLE_ATTR_GROUP_REFCOUNT, |
| 14 | PSAMPLE_ATTR_TUNNEL, | ||
| 18 | 15 | ||
| 19 | __PSAMPLE_ATTR_MAX | 16 | __PSAMPLE_ATTR_MAX |
| 20 | }; | 17 | }; |
| @@ -109,7 +109,7 @@ static void *bpf_fd_inode_storage_lookup_elem(struct bpf_map *map, void *key) · 108 unmodified lines | |||
| 109 | fd = *(int *)key; | 109 | fd = *(int *)key; |
| 110 | f = fget_raw(fd); | 110 | f = fget_raw(fd); |
| 111 | if (!f) | 111 | if (!f) |
| 112 | return NULL; | 112 | return ERR_PTR(-EBADF); |
| 113 | 113 | ||
| 114 | sdata = inode_storage_lookup(f->f_inode, map, true); | 114 | sdata = inode_storage_lookup(f->f_inode, map, true); |
| 115 | fput(f); | 115 | fput(f); |
| @@ -430,7 +430,7 @@ static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, · 429 unmodified lines | |||
| 430 | 430 | ||
| 431 | tprogs[BPF_TRAMP_FENTRY].progs[0] = prog; | 431 | tprogs[BPF_TRAMP_FENTRY].progs[0] = prog; |
| 432 | tprogs[BPF_TRAMP_FENTRY].nr_progs = 1; | 432 | tprogs[BPF_TRAMP_FENTRY].nr_progs = 1; |
| 433 | err = arch_prepare_bpf_trampoline(image, | 433 | err = arch_prepare_bpf_trampoline(NULL, image, |
| 434 | st_map->image + PAGE_SIZE, | 434 | st_map->image + PAGE_SIZE, |
| 435 | &st_ops->func_models[i], 0, | 435 | &st_ops->func_models[i], 0, |
| 436 | tprogs, NULL); | 436 | tprogs, NULL); |
| @@ -827,7 +827,7 @@ static int __init bpf_jit_charge_init(void) · 826 unmodified lines | |||
| 827 | } | 827 | } |
| 828 | pure_initcall(bpf_jit_charge_init); | 828 | pure_initcall(bpf_jit_charge_init); |
| 829 | 829 | ||
| 830 | static int bpf_jit_charge_modmem(u32 pages) | 830 | int bpf_jit_charge_modmem(u32 pages) |
| 831 | { | 831 | { |
| 832 | if (atomic_long_add_return(pages, &bpf_jit_current) > | 832 | if (atomic_long_add_return(pages, &bpf_jit_current) > |
| 833 | (bpf_jit_limit >> PAGE_SHIFT)) { | 833 | (bpf_jit_limit >> PAGE_SHIFT)) { |
| @@ -840,7 +840,7 @@ static int bpf_jit_charge_modmem(u32 pages) · 6 unmodified lines | |||
| 840 | return 0; | 840 | return 0; |
| 841 | } | 841 | } |
| 842 | 842 | ||
| 843 | static void bpf_jit_uncharge_modmem(u32 pages) | 843 | void bpf_jit_uncharge_modmem(u32 pages) |
| 844 | { | 844 | { |
| 845 | atomic_long_sub(pages, &bpf_jit_current); | 845 | atomic_long_sub(pages, &bpf_jit_current); |
| 846 | } | 846 | } |
| @@ -60,9 +60,12 @@ static int finish(void) · 59 unmodified lines | |||
| 60 | &magic, sizeof(magic), &pos); | 60 | &magic, sizeof(magic), &pos); |
| 61 | if (n != sizeof(magic)) | 61 | if (n != sizeof(magic)) |
| 62 | return -EPIPE; | 62 | return -EPIPE; |
| 63 | |||
| 63 | tgid = umd_ops.info.tgid; | 64 | tgid = umd_ops.info.tgid; |
| 64 | wait_event(tgid->wait_pidfd, thread_group_exited(tgid)); | 65 | if (tgid) { |
| 65 | umd_ops.info.tgid = NULL; | 66 | wait_event(tgid->wait_pidfd, thread_group_exited(tgid)); |
| 67 | umd_cleanup_helper(&umd_ops.info); | ||
| 68 | } | ||
| 66 | return 0; | 69 | return 0; |
| 67 | } | 70 | } |
| 68 | 71 | ||
| @@ -80,10 +83,18 @@ static int __init load_umd(void) · 11 unmodified lines | |||
| 80 | 83 | ||
| 81 | static void __exit fini_umd(void) | 84 | static void __exit fini_umd(void) |
| 82 | { | 85 | { |
| 86 | struct pid *tgid; | ||
| 87 | |||
| 83 | bpf_preload_ops = NULL; | 88 | bpf_preload_ops = NULL; |
| 89 | |||
| 84 | /* kill UMD in case it's still there due to earlier error */ | 90 | /* kill UMD in case it's still there due to earlier error */ |
| 85 | kill_pid(umd_ops.info.tgid, SIGKILL, 1); | 91 | tgid = umd_ops.info.tgid; |
| 86 | umd_ops.info.tgid = NULL; | 92 | if (tgid) { |
| 93 | kill_pid(tgid, SIGKILL, 1); | ||
| 94 | |||
| 95 | wait_event(tgid->wait_pidfd, thread_group_exited(tgid)); | ||
| 96 | umd_cleanup_helper(&umd_ops.info); | ||
| 97 | } | ||
| 87 | umd_unload_blob(&umd_ops.info); | 98 | umd_unload_blob(&umd_ops.info); |
| 88 | } | 99 | } |
| 89 | late_initcall(load_umd); | 100 | late_initcall(load_umd); |
| @@ -854,6 +854,11 @@ static int map_create(union bpf_attr *attr) · 853 unmodified lines | |||
| 854 | err = PTR_ERR(btf); | 854 | err = PTR_ERR(btf); |
| 855 | goto free_map; | 855 | goto free_map; |
| 856 | } | 856 | } |
| 857 | if (btf_is_kernel(btf)) { | ||
| 858 | btf_put(btf); | ||
| 859 | err = -EACCES; | ||
| 860 | goto free_map; | ||
| 861 | } | ||
| 857 | map->btf = btf; | 862 | map->btf = btf; |
| 858 | 863 | ||
| 859 | if (attr->btf_value_type_id) { | 864 | if (attr->btf_value_type_id) { |
| @@ -57,19 +57,10 @@ void bpf_image_ksym_del(struct bpf_ksym *ksym) · 56 unmodified lines | |||
| 57 | PAGE_SIZE, true, ksym->name); | 57 | PAGE_SIZE, true, ksym->name); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | static void bpf_trampoline_ksym_add(struct bpf_trampoline *tr) | ||
| 61 | { | ||
| 62 | struct bpf_ksym *ksym = &tr->ksym; | ||
| 63 | |||
| 64 | snprintf(ksym->name, KSYM_NAME_LEN, "bpf_trampoline_%llu", tr->key); | ||
| 65 | bpf_image_ksym_add(tr->image, ksym); | ||
| 66 | } | ||
| 67 | |||
| 68 | static struct bpf_trampoline *bpf_trampoline_lookup(u64 key) | 60 | static struct bpf_trampoline *bpf_trampoline_lookup(u64 key) |
| 69 | { | 61 | { |
| 70 | struct bpf_trampoline *tr; | 62 | struct bpf_trampoline *tr; |
| 71 | struct hlist_head *head; | 63 | struct hlist_head *head; |
| 72 | void *image; | ||
| 73 | int i; | 64 | int i; |
| 74 | 65 | ||
| 75 | mutex_lock(&trampoline_mutex); | 66 | mutex_lock(&trampoline_mutex); |
| @@ -84,14 +75,6 @@ static struct bpf_trampoline *bpf_trampoline_lookup(u64 key) · 8 unmodified lines | |||
| 84 | if (!tr) | 75 | if (!tr) |
| 85 | goto out; | 76 | goto out; |
| 86 | 77 | ||
| 87 | /* is_root was checked earlier. No need for bpf_jit_charge_modmem() */ | ||
| 88 | image = bpf_jit_alloc_exec_page(); | ||
| 89 | if (!image) { | ||
| 90 | kfree(tr); | ||
| 91 | tr = NULL; | ||
| 92 | goto out; | ||
| 93 | } | ||
| 94 | |||
| 95 | tr->key = key; | 78 | tr->key = key; |
| 96 | INIT_HLIST_NODE(&tr->hlist); | 79 | INIT_HLIST_NODE(&tr->hlist); |
| 97 | hlist_add_head(&tr->hlist, head); | 80 | hlist_add_head(&tr->hlist, head); |
| @@ -99,9 +82,6 @@ static struct bpf_trampoline *bpf_trampoline_lookup(u64 key) · 1 unmodified line | |||
| 99 | mutex_init(&tr->mutex); | 82 | mutex_init(&tr->mutex); |
| 100 | for (i = 0; i < BPF_TRAMP_MAX; i++) | 83 | for (i = 0; i < BPF_TRAMP_MAX; i++) |
| 101 | INIT_HLIST_HEAD(&tr->progs_hlist[i]); | 84 | INIT_HLIST_HEAD(&tr->progs_hlist[i]); |
| 102 | tr->image = image; | ||
| 103 | INIT_LIST_HEAD_RCU(&tr->ksym.lnode); | ||
| 104 | bpf_trampoline_ksym_add(tr); | ||
| 105 | out: | 85 | out: |
| 106 | mutex_unlock(&trampoline_mutex); | 86 | mutex_unlock(&trampoline_mutex); |
| 107 | return tr; | 87 | return tr; |
| @@ -185,10 +165,142 @@ bpf_trampoline_get_progs(const struct bpf_trampoline *tr, int *total) · 77 unmodified lines | |||
| 185 | return tprogs; | 165 | return tprogs; |
| 186 | } | 166 | } |
| 187 | 167 | ||
| 168 | static void __bpf_tramp_image_put_deferred(struct work_struct *work) | ||
| 169 | { | ||
| 170 | struct bpf_tramp_image *im; | ||
| 171 | |||
| 172 | im = container_of(work, struct bpf_tramp_image, work); | ||
| 173 | bpf_image_ksym_del(&im->ksym); | ||
| 174 | bpf_jit_free_exec(im->image); | ||
| 175 | bpf_jit_uncharge_modmem(1); | ||
| 176 | percpu_ref_exit(&im->pcref); | ||
| 177 | kfree_rcu(im, rcu); | ||
| 178 | } | ||
| 179 | |||
| 180 | /* callback, fexit step 3 or fentry step 2 */ | ||
| 181 | static void __bpf_tramp_image_put_rcu(struct rcu_head *rcu) | ||
| 182 | { | ||
| 183 | struct bpf_tramp_image *im; | ||
| 184 | |||
| 185 | im = container_of(rcu, struct bpf_tramp_image, rcu); | ||
| 186 | INIT_WORK(&im->work, __bpf_tramp_image_put_deferred); | ||
| 187 | schedule_work(&im->work); | ||
| 188 | } | ||
| 189 | |||
| 190 | /* callback, fexit step 2. Called after percpu_ref_kill confirms. */ | ||
| 191 | static void __bpf_tramp_image_release(struct percpu_ref *pcref) | ||
| 192 | { | ||
| 193 | struct bpf_tramp_image *im; | ||
| 194 | |||
| 195 | im = container_of(pcref, struct bpf_tramp_image, pcref); | ||
| 196 | call_rcu_tasks(&im->rcu, __bpf_tramp_image_put_rcu); | ||
| 197 | } | ||
| 198 | |||
| 199 | /* callback, fexit or fentry step 1 */ | ||
| 200 | static void __bpf_tramp_image_put_rcu_tasks(struct rcu_head *rcu) | ||
| 201 | { | ||
| 202 | struct bpf_tramp_image *im; | ||
| 203 | |||
| 204 | im = container_of(rcu, struct bpf_tramp_image, rcu); | ||
| 205 | if (im->ip_after_call) | ||
| 206 | /* the case of fmod_ret/fexit trampoline and CONFIG_PREEMPTION=y */ | ||
| 207 | percpu_ref_kill(&im->pcref); | ||
| 208 | else | ||
| 209 | /* the case of fentry trampoline */ | ||
| 210 | call_rcu_tasks(&im->rcu, __bpf_tramp_image_put_rcu); | ||
| 211 | } | ||
| 212 | |||
| 213 | static void bpf_tramp_image_put(struct bpf_tramp_image *im) | ||
| 214 | { | ||
| 215 | /* The trampoline image that calls original function is using: | ||
| 216 | * rcu_read_lock_trace to protect sleepable bpf progs | ||
| 217 | * rcu_read_lock to protect normal bpf progs | ||
| 218 | * percpu_ref to protect trampoline itself | ||
| 219 | * rcu tasks to protect trampoline asm not covered by percpu_ref | ||
| 220 | * (which are few asm insns before __bpf_tramp_enter and | ||
| 221 | * after __bpf_tramp_exit) | ||
| 222 | * | ||
| 223 | * The trampoline is unreachable before bpf_tramp_image_put(). | ||
| 224 | * | ||
| 225 | * First, patch the trampoline to avoid calling into fexit progs. | ||
| 226 | * The progs will be freed even if the original function is still | ||
| 227 | * executing or sleeping. | ||
| 228 | * In case of CONFIG_PREEMPT=y use call_rcu_tasks() to wait on | ||
| 229 | * first few asm instructions to execute and call into | ||
| 230 | * __bpf_tramp_enter->percpu_ref_get. | ||
| 231 | * Then use percpu_ref_kill to wait for the trampoline and the original | ||
| 232 | * function to finish. | ||
| 233 | * Then use call_rcu_tasks() to make sure few asm insns in | ||
| 234 | * the trampoline epilogue are done as well. | ||
| 235 | * | ||
| 236 | * In !PREEMPT case the task that got interrupted in the first asm | ||
| 237 | * insns won't go through an RCU quiescent state which the | ||
| 238 | * percpu_ref_kill will be waiting for. Hence the first | ||
| 239 | * call_rcu_tasks() is not necessary. | ||
| 240 | */ | ||
| 241 | if (im->ip_after_call) { | ||
| 242 | int err = bpf_arch_text_poke(im->ip_after_call, BPF_MOD_JUMP, | ||
| 243 | NULL, im->ip_epilogue); | ||
| 244 | WARN_ON(err); | ||
| 245 | if (IS_ENABLED(CONFIG_PREEMPTION)) | ||
| 246 | call_rcu_tasks(&im->rcu, __bpf_tramp_image_put_rcu_tasks); | ||
| 247 | else | ||
| 248 | percpu_ref_kill(&im->pcref); | ||
| 249 | return; | ||
| 250 | } | ||
| 251 | |||
| 252 | /* The trampoline without fexit and fmod_ret progs doesn't call original | ||
| 253 | * function and doesn't use percpu_ref. | ||
| 254 | * Use call_rcu_tasks_trace() to wait for sleepable progs to finish. | ||
| 255 | * Then use call_rcu_tasks() to wait for the rest of trampoline asm | ||
| 256 | * and normal progs. | ||
| 257 | */ | ||
| 258 | call_rcu_tasks_trace(&im->rcu, __bpf_tramp_image_put_rcu_tasks); | ||
| 259 | } | ||
| 260 | |||
| 261 | static struct bpf_tramp_image *bpf_tramp_image_alloc(u64 key, u32 idx) | ||
| 262 | { | ||
| 263 | struct bpf_tramp_image *im; | ||
| 264 | struct bpf_ksym *ksym; | ||
| 265 | void *image; | ||
| 266 | int err = -ENOMEM; | ||
| 267 | |||
| 268 | im = kzalloc(sizeof(*im), GFP_KERNEL); | ||
| 269 | if (!im) | ||
| 270 | goto out; | ||
| 271 | |||
| 272 | err = bpf_jit_charge_modmem(1); | ||
| 273 | if (err) | ||
| 274 | goto out_free_im; | ||
| 275 | |||
| 276 | err = -ENOMEM; | ||
| 277 | im->image = image = bpf_jit_alloc_exec_page(); | ||
| 278 | if (!image) | ||
| 279 | goto out_uncharge; | ||
| 280 | |||
| 281 | err = percpu_ref_init(&im->pcref, __bpf_tramp_image_release, 0, GFP_KERNEL); | ||
| 282 | if (err) | ||
| 283 | goto out_free_image; | ||
| 284 | |||
| 285 | ksym = &im->ksym; | ||
| 286 | INIT_LIST_HEAD_RCU(&ksym->lnode); | ||
| 287 | snprintf(ksym->name, KSYM_NAME_LEN, "bpf_trampoline_%llu_%u", key, idx); | ||
| 288 | bpf_image_ksym_add(image, ksym); | ||
| 289 | return im; | ||
| 290 | |||
| 291 | out_free_image: | ||
| 292 | bpf_jit_free_exec(im->image); | ||
| 293 | out_uncharge: | ||
| 294 | bpf_jit_uncharge_modmem(1); | ||
| 295 | out_free_im: | ||
| 296 | kfree(im); | ||
| 297 | out: | ||
| 298 | return ERR_PTR(err); | ||
| 299 | } | ||
| 300 | |||
| 188 | static int bpf_trampoline_update(struct bpf_trampoline *tr) | 301 | static int bpf_trampoline_update(struct bpf_trampoline *tr) |
| 189 | { | 302 | { |
| 190 | void *old_image = tr->image + ((tr->selector + 1) & 1) * PAGE_SIZE/2; | 303 | struct bpf_tramp_image *im; |
| 191 | void *new_image = tr->image + (tr->selector & 1) * PAGE_SIZE/2; | ||
| 192 | struct bpf_tramp_progs *tprogs; | 304 | struct bpf_tramp_progs *tprogs; |
| 193 | u32 flags = BPF_TRAMP_F_RESTORE_REGS; | 305 | u32 flags = BPF_TRAMP_F_RESTORE_REGS; |
| 194 | int err, total; | 306 | int err, total; |
| @@ -198,41 +310,42 @@ static int bpf_trampoline_update(struct bpf_trampoline *tr) · 3 unmodified lines | |||
| 198 | return PTR_ERR(tprogs); | 310 | return PTR_ERR(tprogs); |
| 199 | 311 | ||
| 200 | if (total == 0) { | 312 | if (total == 0) { |
| 201 | err = unregister_fentry(tr, old_image); | 313 | err = unregister_fentry(tr, tr->cur_image->image); |
| 314 | bpf_tramp_image_put(tr->cur_image); | ||
| 315 | tr->cur_image = NULL; | ||
| 202 | tr->selector = 0; | 316 | tr->selector = 0; |
| 203 | goto out; | 317 | goto out; |
| 204 | } | 318 | } |
| 205 | 319 | ||
| 320 | im = bpf_tramp_image_alloc(tr->key, tr->selector); | ||
| 321 | if (IS_ERR(im)) { | ||
| 322 | err = PTR_ERR(im); | ||
| 323 | goto out; | ||
| 324 | } | ||
| 325 | |||
| 206 | if (tprogs[BPF_TRAMP_FEXIT].nr_progs || | 326 | if (tprogs[BPF_TRAMP_FEXIT].nr_progs || |
| 207 | tprogs[BPF_TRAMP_MODIFY_RETURN].nr_progs) | 327 | tprogs[BPF_TRAMP_MODIFY_RETURN].nr_progs) |
| 208 | flags = BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_SKIP_FRAME; | 328 | flags = BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_SKIP_FRAME; |
| 209 | 329 | ||
| 210 | /* Though the second half of trampoline page is unused a task could be | 330 | err = arch_prepare_bpf_trampoline(im, im->image, im->image + PAGE_SIZE, |
| 211 | * preempted in the middle of the first half of trampoline and two | ||
| 212 | * updates to trampoline would change the code from underneath the | ||
| 213 | * preempted task. Hence wait for tasks to voluntarily schedule or go | ||
| 214 | * to userspace. | ||
| 215 | * The same trampoline can hold both sleepable and non-sleepable progs. | ||
| 216 | * synchronize_rcu_tasks_trace() is needed to make sure all sleepable | ||
| 217 | * programs finish executing. | ||
| 218 | * Wait for these two grace periods together. | ||
| 219 | */ | ||
| 220 | synchronize_rcu_mult(call_rcu_tasks, call_rcu_tasks_trace); | ||
| 221 | |||
| 222 | err = arch_prepare_bpf_trampoline(new_image, new_image + PAGE_SIZE / 2, | ||
| 223 | &tr->func.model, flags, tprogs, | 331 | &tr->func.model, flags, tprogs, |
| 224 | tr->func.addr); | 332 | tr->func.addr); |
| 225 | if (err < 0) | 333 | if (err < 0) |
| 226 | goto out; | 334 | goto out; |
| 227 | 335 | ||
| 228 | if (tr->selector) | 336 | WARN_ON(tr->cur_image && tr->selector == 0); |
| 337 | WARN_ON(!tr->cur_image && tr->selector); | ||
| 338 | if (tr->cur_image) | ||
| 229 | /* progs already running at this address */ | 339 | /* progs already running at this address */ |
| 230 | err = modify_fentry(tr, old_image, new_image); | 340 | err = modify_fentry(tr, tr->cur_image->image, im->image); |
| 231 | else | 341 | else |
| 232 | /* first time registering */ | 342 | /* first time registering */ |
| 233 | err = register_fentry(tr, new_image); | 343 | err = register_fentry(tr, im->image); |
| 234 | if (err) | 344 | if (err) |
| 235 | goto out; | 345 | goto out; |
| 346 | if (tr->cur_image) | ||
| 347 | bpf_tramp_image_put(tr->cur_image); | ||
| 348 | tr->cur_image = im; | ||
| 236 | tr->selector++; | 349 | tr->selector++; |
| 237 | out: | 350 | out: |
| 238 | kfree(tprogs); | 351 | kfree(tprogs); |
| @@ -364,17 +477,12 @@ void bpf_trampoline_put(struct bpf_trampoline *tr) · 125 unmodified lines | |||
| 364 | goto out; | 477 | goto out; |
| 365 | if (WARN_ON_ONCE(!hlist_empty(&tr->progs_hlist[BPF_TRAMP_FEXIT]))) | 478 | if (WARN_ON_ONCE(!hlist_empty(&tr->progs_hlist[BPF_TRAMP_FEXIT]))) |
| 366 | goto out; | 479 | goto out; |
| 367 | bpf_image_ksym_del(&tr->ksym); | 480 | /* This code will be executed even when the last bpf_tramp_image |
| 368 | /* This code will be executed when all bpf progs (both sleepable and | 481 | * is alive. All progs are detached from the trampoline and the |
| 369 | * non-sleepable) went through | 482 | * trampoline image is patched with jmp into epilogue to skip |
| 370 | * bpf_prog_put()->call_rcu[_tasks_trace]()->bpf_prog_free_deferred(). | 483 | * fexit progs. The fentry-only trampoline will be freed via |
| 371 | * Hence no need for another synchronize_rcu_tasks_trace() here, | 484 | * multiple rcu callbacks. |
| 372 | * but synchronize_rcu_tasks() is still needed, since trampoline | ||
| 373 | * may not have had any sleepable programs and we need to wait | ||
| 374 | * for tasks to get out of trampoline code before freeing it. | ||
| 375 | */ | 485 | */ |
| 376 | synchronize_rcu_tasks(); | ||
| 377 | bpf_jit_free_exec(tr->image); | ||
| 378 | hlist_del(&tr->hlist); | 486 | hlist_del(&tr->hlist); |
| 379 | kfree(tr); | 487 | kfree(tr); |
| 380 | out: | 488 | out: |
| @@ -478,8 +586,18 @@ void notrace __bpf_prog_exit_sleepable(struct bpf_prog *prog, u64 start) · 97 unmodified lines | |||
| 478 | rcu_read_unlock_trace(); | 586 | rcu_read_unlock_trace(); |
| 479 | } | 587 | } |
| 480 | 588 | ||
| 589 | void notrace __bpf_tramp_enter(struct bpf_tramp_image *tr) | ||
| 590 | { | ||
| 591 | percpu_ref_get(&tr->pcref); | ||
| 592 | } | ||
| 593 | |||
| 594 | void notrace __bpf_tramp_exit(struct bpf_tramp_image *tr) | ||
| 595 | { | ||
| 596 | percpu_ref_put(&tr->pcref); | ||
| 597 | } | ||
| 598 | |||
| 481 | int __weak | 599 | int __weak |
| 482 | arch_prepare_bpf_trampoline(void *image, void *image_end, | 600 | arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, void *image_end, |
| 483 | const struct btf_func_model *m, u32 flags, | 601 | const struct btf_func_model *m, u32 flags, |
| 484 | struct bpf_tramp_progs *tprogs, | 602 | struct bpf_tramp_progs *tprogs, |
| 485 | void *orig_call) | 603 | void *orig_call) |
| @@ -5861,10 +5861,14 @@ static int retrieve_ptr_limit(const struct bpf_reg_state *ptr_reg, · 5860 unmodified lines | |||
| 5861 | { | 5861 | { |
| 5862 | bool mask_to_left = (opcode == BPF_ADD && off_is_neg) || | 5862 | bool mask_to_left = (opcode == BPF_ADD && off_is_neg) || |
| 5863 | (opcode == BPF_SUB && !off_is_neg); | 5863 | (opcode == BPF_SUB && !off_is_neg); |
| 5864 | u32 off; | 5864 | u32 off, max; |
| 5865 | 5865 | ||
| 5866 | switch (ptr_reg->type) { | 5866 | switch (ptr_reg->type) { |
| 5867 | case PTR_TO_STACK: | 5867 | case PTR_TO_STACK: |
| 5868 | /* Offset 0 is out-of-bounds, but acceptable start for the | ||
| 5869 | * left direction, see BPF_REG_FP. | ||
| 5870 | */ | ||
| 5871 | max = MAX_BPF_STACK + mask_to_left; | ||
| 5868 | /* Indirect variable offset stack access is prohibited in | 5872 | /* Indirect variable offset stack access is prohibited in |
| 5869 | * unprivileged mode so it's not handled here. | 5873 | * unprivileged mode so it's not handled here. |
| 5870 | */ | 5874 | */ |
| @@ -5872,16 +5876,17 @@ static int retrieve_ptr_limit(const struct bpf_reg_state *ptr_reg, · 1 unmodified line | |||
| 5872 | if (mask_to_left) | 5876 | if (mask_to_left) |
| 5873 | *ptr_limit = MAX_BPF_STACK + off; | 5877 | *ptr_limit = MAX_BPF_STACK + off; |
| 5874 | else | 5878 | else |
| 5875 | *ptr_limit = -off; | 5879 | *ptr_limit = -off - 1; |
| 5876 | return 0; | 5880 | return *ptr_limit >= max ? -ERANGE : 0; |
| 5877 | case PTR_TO_MAP_VALUE: | 5881 | case PTR_TO_MAP_VALUE: |
| 5882 | max = ptr_reg->map_ptr->value_size; | ||
| 5878 | if (mask_to_left) { | 5883 | if (mask_to_left) { |
| 5879 | *ptr_limit = ptr_reg->umax_value + ptr_reg->off; | 5884 | *ptr_limit = ptr_reg->umax_value + ptr_reg->off; |
| 5880 | } else { | 5885 | } else { |
| 5881 | off = ptr_reg->smin_value + ptr_reg->off; | 5886 | off = ptr_reg->smin_value + ptr_reg->off; |
| 5882 | *ptr_limit = ptr_reg->map_ptr->value_size - off; | 5887 | *ptr_limit = ptr_reg->map_ptr->value_size - off - 1; |
| 5883 | } | 5888 | } |
| 5884 | return 0; | 5889 | return *ptr_limit >= max ? -ERANGE : 0; |
| 5885 | default: | 5890 | default: |
| 5886 | return -EINVAL; | 5891 | return -EINVAL; |
| 5887 | } | 5892 | } |
| @@ -5934,6 +5939,7 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, · 46 unmodified lines | |||
| 5934 | u32 alu_state, alu_limit; | 5939 | u32 alu_state, alu_limit; |
| 5935 | struct bpf_reg_state tmp; | 5940 | struct bpf_reg_state tmp; |
| 5936 | bool ret; | 5941 | bool ret; |
| 5942 | int err; | ||
| 5937 | 5943 | ||
| 5938 | if (can_skip_alu_sanitation(env, insn)) | 5944 | if (can_skip_alu_sanitation(env, insn)) |
| 5939 | return 0; | 5945 | return 0; |
| @@ -5949,10 +5955,13 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, · 9 unmodified lines | |||
| 5949 | alu_state |= ptr_is_dst_reg ? | 5955 | alu_state |= ptr_is_dst_reg ? |
| 5950 | BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST; | 5956 | BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST; |
| 5951 | 5957 | ||
| 5952 | if (retrieve_ptr_limit(ptr_reg, &alu_limit, opcode, off_is_neg)) | 5958 | err = retrieve_ptr_limit(ptr_reg, &alu_limit, opcode, off_is_neg); |
| 5953 | return 0; | 5959 | if (err < 0) |
| 5954 | if (update_alu_sanitation_state(aux, alu_state, alu_limit)) | 5960 | return err; |
| 5955 | return -EACCES; | 5961 | |
| 5962 | err = update_alu_sanitation_state(aux, alu_state, alu_limit); | ||
| 5963 | if (err < 0) | ||
| 5964 | return err; | ||
| 5956 | do_sim: | 5965 | do_sim: |
| 5957 | /* Simulate and find potential out-of-bounds access under | 5966 | /* Simulate and find potential out-of-bounds access under |
| 5958 | * speculative execution from truncation as a result of | 5967 | * speculative execution from truncation as a result of |
| @@ -6103,7 +6112,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, · 144 unmodified lines | |||
| 6103 | case BPF_ADD: | 6112 | case BPF_ADD: |
| 6104 | ret = sanitize_ptr_alu(env, insn, ptr_reg, dst_reg, smin_val < 0); | 6113 | ret = sanitize_ptr_alu(env, insn, ptr_reg, dst_reg, smin_val < 0); |
| 6105 | if (ret < 0) { | 6114 | if (ret < 0) { |
| 6106 | verbose(env, "R%d tried to add from different maps or paths\n", dst); | 6115 | verbose(env, "R%d tried to add from different maps, paths, or prohibited types\n", dst); |
| 6107 | return ret; | 6116 | return ret; |
| 6108 | } | 6117 | } |
| 6109 | /* We can take a fixed offset as long as it doesn't overflow | 6118 | /* We can take a fixed offset as long as it doesn't overflow |
| @@ -6158,7 +6167,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, · 48 unmodified lines | |||
| 6158 | case BPF_SUB: | 6167 | case BPF_SUB: |
| 6159 | ret = sanitize_ptr_alu(env, insn, ptr_reg, dst_reg, smin_val < 0); | 6168 | ret = sanitize_ptr_alu(env, insn, ptr_reg, dst_reg, smin_val < 0); |
| 6160 | if (ret < 0) { | 6169 | if (ret < 0) { |
| 6161 | verbose(env, "R%d tried to sub from different maps or paths\n", dst); | 6170 | verbose(env, "R%d tried to sub from different maps, paths, or prohibited types\n", dst); |
| 6162 | return ret; | 6171 | return ret; |
| 6163 | } | 6172 | } |
| 6164 | if (dst_reg == off_reg) { | 6173 | if (dst_reg == off_reg) { |
| @@ -9056,6 +9065,10 @@ static int check_btf_info(struct bpf_verifier_env *env, · 2891 unmodified lines | |||
| 9056 | btf = btf_get_by_fd(attr->prog_btf_fd); | 9065 | btf = btf_get_by_fd(attr->prog_btf_fd); |
| 9057 | if (IS_ERR(btf)) | 9066 | if (IS_ERR(btf)) |
| 9058 | return PTR_ERR(btf); | 9067 | return PTR_ERR(btf); |
| 9068 | if (btf_is_kernel(btf)) { | ||
| 9069 | btf_put(btf); | ||
| 9070 | return -EACCES; | ||
| 9071 | } | ||
| 9059 | env->prog->aux->btf = btf; | 9072 | env->prog->aux->btf = btf; |
| 9060 | 9073 | ||
| 9061 | err = check_btf_func(env, attr, uattr); | 9074 | err = check_btf_func(env, attr, uattr); |
| @@ -11660,7 +11673,7 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env) · 2598 unmodified lines | |||
| 11660 | off_reg = issrc ? insn->src_reg : insn->dst_reg; | 11673 | off_reg = issrc ? insn->src_reg : insn->dst_reg; |
| 11661 | if (isneg) | 11674 | if (isneg) |
| 11662 | *patch++ = BPF_ALU64_IMM(BPF_MUL, off_reg, -1); | 11675 | *patch++ = BPF_ALU64_IMM(BPF_MUL, off_reg, -1); |
| 11663 | *patch++ = BPF_MOV32_IMM(BPF_REG_AX, aux->alu_limit - 1); | 11676 | *patch++ = BPF_MOV32_IMM(BPF_REG_AX, aux->alu_limit); |
| 11664 | *patch++ = BPF_ALU64_REG(BPF_SUB, BPF_REG_AX, off_reg); | 11677 | *patch++ = BPF_ALU64_REG(BPF_SUB, BPF_REG_AX, off_reg); |
| 11665 | *patch++ = BPF_ALU64_REG(BPF_OR, BPF_REG_AX, off_reg); | 11678 | *patch++ = BPF_ALU64_REG(BPF_OR, BPF_REG_AX, off_reg); |
| 11666 | *patch++ = BPF_ALU64_IMM(BPF_NEG, BPF_REG_AX, 0); | 11679 | *patch++ = BPF_ALU64_IMM(BPF_NEG, BPF_REG_AX, 0); |
| @@ -1948,8 +1948,14 @@ static __latent_entropy struct task_struct *copy_process( · 1947 unmodified lines | |||
| 1948 | p = dup_task_struct(current, node); | 1948 | p = dup_task_struct(current, node); |
| 1949 | if (!p) | 1949 | if (!p) |
| 1950 | goto fork_out; | 1950 | goto fork_out; |
| 1951 | if (args->io_thread) | 1951 | if (args->io_thread) { |
| 1952 | /* | ||
| 1953 | * Mark us an IO worker, and block any signal that isn't | ||
| 1954 | * fatal or STOP | ||
| 1955 | */ | ||
| 1952 | p->flags |= PF_IO_WORKER; | 1956 | p->flags |= PF_IO_WORKER; |
| 1957 | siginitsetinv(&p->blocked, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
| 1958 | } | ||
| 1953 | 1959 | ||
| 1954 | /* | 1960 | /* |
| 1955 | * This _must_ happen before we call free_task(), i.e. before we jump | 1961 | * This _must_ happen before we call free_task(), i.e. before we jump |
| @@ -2438,15 +2444,8 @@ struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node) · 482 unmodified lines | |||
| 2438 | .stack_size = (unsigned long)arg, | 2444 | .stack_size = (unsigned long)arg, |
| 2439 | .io_thread = 1, | 2445 | .io_thread = 1, |
| 2440 | }; | 2446 | }; |
| 2441 | struct task_struct *tsk; | ||
| 2442 | 2447 | ||
| 2443 | tsk = copy_process(NULL, 0, node, &args); | 2448 | return copy_process(NULL, 0, node, &args); |
| 2444 | if (!IS_ERR(tsk)) { | ||
| 2445 | sigfillset(&tsk->blocked); | ||
| 2446 | sigdelsetmask(&tsk->blocked, sigmask(SIGKILL)); | ||
| 2447 | tsk->flags |= PF_NOFREEZE; | ||
| 2448 | } | ||
| 2449 | return tsk; | ||
| 2450 | } | 2449 | } |
| 2451 | 2450 | ||
| 2452 | /* | 2451 | /* |
| @@ -2728,14 +2728,13 @@ retry: · 2727 unmodified lines | |||
| 2728 | goto out; | 2728 | goto out; |
| 2729 | 2729 | ||
| 2730 | restart = ¤t->restart_block; | 2730 | restart = ¤t->restart_block; |
| 2731 | restart->fn = futex_wait_restart; | ||
| 2732 | restart->futex.uaddr = uaddr; | 2731 | restart->futex.uaddr = uaddr; |
| 2733 | restart->futex.val = val; | 2732 | restart->futex.val = val; |
| 2734 | restart->futex.time = *abs_time; | 2733 | restart->futex.time = *abs_time; |
| 2735 | restart->futex.bitset = bitset; | 2734 | restart->futex.bitset = bitset; |
| 2736 | restart->futex.flags = flags | FLAGS_HAS_TIMEOUT; | 2735 | restart->futex.flags = flags | FLAGS_HAS_TIMEOUT; |
| 2737 | 2736 | ||
| 2738 | ret = -ERESTART_RESTARTBLOCK; | 2737 | ret = set_restart_fn(restart, futex_wait_restart); |
| 2739 | 2738 | ||
| 2740 | out: | 2739 | out: |
| 2741 | if (to) { | 2740 | if (to) { |
| @@ -75,7 +75,9 @@ struct gcov_fn_info { · 74 unmodified lines | |||
| 75 | 75 | ||
| 76 | u32 num_counters; | 76 | u32 num_counters; |
| 77 | u64 *counters; | 77 | u64 *counters; |
| 78 | #if CONFIG_CLANG_VERSION < 110000 | ||
| 78 | const char *function_name; | 79 | const char *function_name; |
| 80 | #endif | ||
| 79 | }; | 81 | }; |
| 80 | 82 | ||
| 81 | static struct gcov_info *current_info; | 83 | static struct gcov_info *current_info; |
| @@ -105,6 +107,7 @@ void llvm_gcov_init(llvm_gcov_callback writeout, llvm_gcov_callback flush) · 23 unmodified lines | |||
| 105 | } | 107 | } |
| 106 | EXPORT_SYMBOL(llvm_gcov_init); | 108 | EXPORT_SYMBOL(llvm_gcov_init); |
| 107 | 109 | ||
| 110 | #if CONFIG_CLANG_VERSION < 110000 | ||
| 108 | void llvm_gcda_start_file(const char *orig_filename, const char version[4], | 111 | void llvm_gcda_start_file(const char *orig_filename, const char version[4], |
| 109 | u32 checksum) | 112 | u32 checksum) |
| 110 | { | 113 | { |
| @@ -113,7 +116,17 @@ void llvm_gcda_start_file(const char *orig_filename, const char version[4], · 2 unmodified lines | |||
| 113 | current_info->checksum = checksum; | 116 | current_info->checksum = checksum; |
| 114 | } | 117 | } |
| 115 | EXPORT_SYMBOL(llvm_gcda_start_file); | 118 | EXPORT_SYMBOL(llvm_gcda_start_file); |
| 119 | #else | ||
| 120 | void llvm_gcda_start_file(const char *orig_filename, u32 version, u32 checksum) | ||
| 121 | { | ||
| 122 | current_info->filename = orig_filename; | ||
| 123 | current_info->version = version; | ||
| 124 | current_info->checksum = checksum; | ||
| 125 | } | ||
| 126 | EXPORT_SYMBOL(llvm_gcda_start_file); | ||
| 127 | #endif | ||
| 116 | 128 | ||
| 129 | #if CONFIG_CLANG_VERSION < 110000 | ||
| 117 | void llvm_gcda_emit_function(u32 ident, const char *function_name, | 130 | void llvm_gcda_emit_function(u32 ident, const char *function_name, |
| 118 | u32 func_checksum, u8 use_extra_checksum, u32 cfg_checksum) | 131 | u32 func_checksum, u8 use_extra_checksum, u32 cfg_checksum) |
| 119 | { | 132 | { |
| @@ -133,6 +146,24 @@ void llvm_gcda_emit_function(u32 ident, const char *function_name, · 13 unmodified lines | |||
| 133 | list_add_tail(&info->head, ¤t_info->functions); | 146 | list_add_tail(&info->head, ¤t_info->functions); |
| 134 | } | 147 | } |
| 135 | EXPORT_SYMBOL(llvm_gcda_emit_function); | 148 | EXPORT_SYMBOL(llvm_gcda_emit_function); |
| 149 | #else | ||
| 150 | void llvm_gcda_emit_function(u32 ident, u32 func_checksum, | ||
| 151 | u8 use_extra_checksum, u32 cfg_checksum) | ||
| 152 | { | ||
| 153 | struct gcov_fn_info *info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
| 154 | |||
| 155 | if (!info) | ||
| 156 | return; | ||
| 157 | |||
| 158 | INIT_LIST_HEAD(&info->head); | ||
| 159 | info->ident = ident; | ||
| 160 | info->checksum = func_checksum; | ||
| 161 | info->use_extra_checksum = use_extra_checksum; | ||
| 162 | info->cfg_checksum = cfg_checksum; | ||
| 163 | list_add_tail(&info->head, ¤t_info->functions); | ||
| 164 | } | ||
| 165 | EXPORT_SYMBOL(llvm_gcda_emit_function); | ||
| 166 | #endif | ||
| 136 | 167 | ||
| 137 | void llvm_gcda_emit_arcs(u32 num_counters, u64 *counters) | 168 | void llvm_gcda_emit_arcs(u32 num_counters, u64 *counters) |
| 138 | { | 169 | { |
| @@ -295,6 +326,7 @@ void gcov_info_add(struct gcov_info *dst, struct gcov_info *src) · 156 unmodified lines | |||
| 295 | } | 326 | } |
| 296 | } | 327 | } |
| 297 | 328 | ||
| 329 | #if CONFIG_CLANG_VERSION < 110000 | ||
| 298 | static struct gcov_fn_info *gcov_fn_info_dup(struct gcov_fn_info *fn) | 330 | static struct gcov_fn_info *gcov_fn_info_dup(struct gcov_fn_info *fn) |
| 299 | { | 331 | { |
| 300 | size_t cv_size; /* counter values size */ | 332 | size_t cv_size; /* counter values size */ |
| @@ -322,6 +354,28 @@ err_name: · 21 unmodified lines | |||
| 322 | kfree(fn_dup); | 354 | kfree(fn_dup); |
| 323 | return NULL; | 355 | return NULL; |
| 324 | } | 356 | } |
| 357 | #else | ||
| 358 | static struct gcov_fn_info *gcov_fn_info_dup(struct gcov_fn_info *fn) | ||
| 359 | { | ||
| 360 | size_t cv_size; /* counter values size */ | ||
| 361 | struct gcov_fn_info *fn_dup = kmemdup(fn, sizeof(*fn), | ||
| 362 | GFP_KERNEL); | ||
| 363 | if (!fn_dup) | ||
| 364 | return NULL; | ||
| 365 | INIT_LIST_HEAD(&fn_dup->head); | ||
| 366 | |||
| 367 | cv_size = fn->num_counters * sizeof(fn->counters[0]); | ||
| 368 | fn_dup->counters = vmalloc(cv_size); | ||
| 369 | if (!fn_dup->counters) { | ||
| 370 | kfree(fn_dup); | ||
| 371 | return NULL; | ||
| 372 | } | ||
| 373 | |||
| 374 | memcpy(fn_dup->counters, fn->counters, cv_size); | ||
| 375 | |||
| 376 | return fn_dup; | ||
| 377 | } | ||
| 378 | #endif | ||
| 325 | 379 | ||
| 326 | /** | 380 | /** |
| 327 | * gcov_info_dup - duplicate profiling data set | 381 | * gcov_info_dup - duplicate profiling data set |
| @@ -362,6 +416,7 @@ err: · 34 unmodified lines | |||
| 362 | * gcov_info_free - release memory for profiling data set duplicate | 416 | * gcov_info_free - release memory for profiling data set duplicate |
| 363 | * @info: profiling data set duplicate to free | 417 | * @info: profiling data set duplicate to free |
| 364 | */ | 418 | */ |
| 419 | #if CONFIG_CLANG_VERSION < 110000 | ||
| 365 | void gcov_info_free(struct gcov_info *info) | 420 | void gcov_info_free(struct gcov_info *info) |
| 366 | { | 421 | { |
| 367 | struct gcov_fn_info *fn, *tmp; | 422 | struct gcov_fn_info *fn, *tmp; |
| @@ -375,6 +430,20 @@ void gcov_info_free(struct gcov_info *info) · 7 unmodified lines | |||
| 375 | kfree(info->filename); | 430 | kfree(info->filename); |
| 376 | kfree(info); | 431 | kfree(info); |
| 377 | } | 432 | } |
| 433 | #else | ||
| 434 | void gcov_info_free(struct gcov_info *info) | ||
| 435 | { | ||
| 436 | struct gcov_fn_info *fn, *tmp; | ||
| 437 | |||
| 438 | list_for_each_entry_safe(fn, tmp, &info->functions, head) { | ||
| 439 | vfree(fn->counters); | ||
| 440 | list_del(&fn->head); | ||
| 441 | kfree(fn); | ||
| 442 | } | ||
| 443 | kfree(info->filename); | ||
| 444 | kfree(info); | ||
| 445 | } | ||
| 446 | #endif | ||
| 378 | 447 | ||
| 379 | #define ITER_STRIDE PAGE_SIZE | 448 | #define ITER_STRIDE PAGE_SIZE |
| 380 | 449 | ||
| @@ -159,7 +159,7 @@ static const struct irq_domain_ops irq_sim_domain_ops = { · 158 unmodified lines | |||
| 159 | * irq_domain_create_sim - Create a new interrupt simulator irq_domain and | 159 | * irq_domain_create_sim - Create a new interrupt simulator irq_domain and |
| 160 | * allocate a range of dummy interrupts. | 160 | * allocate a range of dummy interrupts. |
| 161 | * | 161 | * |
| 162 | * @fnode: struct fwnode_handle to be associated with this domain. | 162 | * @fwnode: struct fwnode_handle to be associated with this domain. |
| 163 | * @num_irqs: Number of interrupts to allocate. | 163 | * @num_irqs: Number of interrupts to allocate. |
| 164 | * | 164 | * |
| 165 | * On success: return a new irq_domain object. | 165 | * On success: return a new irq_domain object. |
| @@ -228,7 +228,7 @@ static void devm_irq_domain_release_sim(struct device *dev, void *res) · 62 unmodified lines | |||
| 228 | * a managed device. | 228 | * a managed device. |
| 229 | * | 229 | * |
| 230 | * @dev: Device to initialize the simulator object for. | 230 | * @dev: Device to initialize the simulator object for. |
| 231 | * @fnode: struct fwnode_handle to be associated with this domain. | 231 | * @fwnode: struct fwnode_handle to be associated with this domain. |
| 232 | * @num_irqs: Number of interrupts to allocate | 232 | * @num_irqs: Number of interrupts to allocate |
| 233 | * | 233 | * |
| 234 | * On success: return a new irq_domain object. | 234 | * On success: return a new irq_domain object. |
| @@ -1142,11 +1142,15 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action) · 1141 unmodified lines | |||
| 1142 | irqreturn_t ret; | 1142 | irqreturn_t ret; |
| 1143 | 1143 | ||
| 1144 | local_bh_disable(); | 1144 | local_bh_disable(); |
| 1145 | if (!IS_ENABLED(CONFIG_PREEMPT_RT)) | ||
| 1146 | local_irq_disable(); | ||
| 1145 | ret = action->thread_fn(action->irq, action->dev_id); | 1147 | ret = action->thread_fn(action->irq, action->dev_id); |
| 1146 | if (ret == IRQ_HANDLED) | 1148 | if (ret == IRQ_HANDLED) |
| 1147 | atomic_inc(&desc->threads_handled); | 1149 | atomic_inc(&desc->threads_handled); |
| 1148 | 1150 | ||
| 1149 | irq_finalize_oneshot(desc, action); | 1151 | irq_finalize_oneshot(desc, action); |
| 1152 | if (!IS_ENABLED(CONFIG_PREEMPT_RT)) | ||
| 1153 | local_irq_enable(); | ||
| 1150 | local_bh_enable(); | 1154 | local_bh_enable(); |
| 1151 | return ret; | 1155 | return ret; |
| 1152 | } | 1156 | } |
| @@ -407,6 +407,14 @@ static bool jump_label_can_update(struct jump_entry *entry, bool init) · 406 unmodified lines | |||
| 407 | return false; | 407 | return false; |
| 408 | 408 | ||
| 409 | if (!kernel_text_address(jump_entry_code(entry))) { | 409 | if (!kernel_text_address(jump_entry_code(entry))) { |
| 410 | /* | ||
| 411 | * This skips patching built-in __exit, which | ||
| 412 | * is part of init_section_contains() but is | ||
| 413 | * not part of kernel_text_address(). | ||
| 414 | * | ||
| 415 | * Skipping built-in __exit is fine since it | ||
| 416 | * will never be executed. | ||
| 417 | */ | ||
| 410 | WARN_ONCE(!jump_entry_is_init(entry), | 418 | WARN_ONCE(!jump_entry_is_init(entry), |
| 411 | "can't patch jump_label at %pS", | 419 | "can't patch jump_label at %pS", |
| 412 | (void *)jump_entry_code(entry)); | 420 | (void *)jump_entry_code(entry)); |
| @@ -98,7 +98,7 @@ static int __init em_debug_init(void) · 97 unmodified lines | |||
| 98 | 98 | ||
| 99 | return 0; | 99 | return 0; |
| 100 | } | 100 | } |
| 101 | core_initcall(em_debug_init); | 101 | fs_initcall(em_debug_init); |
| 102 | #else /* CONFIG_DEBUG_FS */ | 102 | #else /* CONFIG_DEBUG_FS */ |
| 103 | static void em_debug_create_pd(struct device *dev) {} | 103 | static void em_debug_create_pd(struct device *dev) {} |
| 104 | static void em_debug_remove_pd(struct device *dev) {} | 104 | static void em_debug_remove_pd(struct device *dev) {} |
| @@ -375,7 +375,7 @@ static int ptrace_attach(struct task_struct *task, long request, · 374 unmodified lines | |||
| 375 | audit_ptrace(task); | 375 | audit_ptrace(task); |
| 376 | 376 | ||
| 377 | retval = -EPERM; | 377 | retval = -EPERM; |
| 378 | if (unlikely(task->flags & (PF_KTHREAD | PF_IO_WORKER))) | 378 | if (unlikely(task->flags & PF_KTHREAD)) |
| 379 | goto out; | 379 | goto out; |
| 380 | if (same_thread_group(task, current)) | 380 | if (same_thread_group(task, current)) |
| 381 | goto out; | 381 | goto out; |
| @@ -244,8 +244,6 @@ void migrate_to_reboot_cpu(void) · 243 unmodified lines | |||
| 244 | void kernel_restart(char *cmd) | 244 | void kernel_restart(char *cmd) |
| 245 | { | 245 | { |
| 246 | kernel_restart_prepare(cmd); | 246 | kernel_restart_prepare(cmd); |
| 247 | if (pm_power_off_prepare) | ||
| 248 | pm_power_off_prepare(); | ||
| 249 | migrate_to_reboot_cpu(); | 247 | migrate_to_reboot_cpu(); |
| 250 | syscore_shutdown(); | 248 | syscore_shutdown(); |
| 251 | if (!cmd) | 249 | if (!cmd) |
| @@ -91,7 +91,7 @@ static bool sig_task_ignored(struct task_struct *t, int sig, bool force) · 90 unmodified lines | |||
| 91 | return true; | 91 | return true; |
| 92 | 92 | ||
| 93 | /* Only allow kernel generated signals to this kthread */ | 93 | /* Only allow kernel generated signals to this kthread */ |
| 94 | if (unlikely((t->flags & (PF_KTHREAD | PF_IO_WORKER)) && | 94 | if (unlikely((t->flags & PF_KTHREAD) && |
| 95 | (handler == SIG_KTHREAD_KERNEL) && !force)) | 95 | (handler == SIG_KTHREAD_KERNEL) && !force)) |
| 96 | return true; | 96 | return true; |
| 97 | 97 | ||
| @@ -1096,7 +1096,7 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc · 998 unmodified lines | |||
| 1096 | /* | 1096 | /* |
| 1097 | * Skip useless siginfo allocation for SIGKILL and kernel threads. | 1097 | * Skip useless siginfo allocation for SIGKILL and kernel threads. |
| 1098 | */ | 1098 | */ |
| 1099 | if ((sig == SIGKILL) || (t->flags & (PF_KTHREAD | PF_IO_WORKER))) | 1099 | if ((sig == SIGKILL) || (t->flags & PF_KTHREAD)) |
| 1100 | goto out_set; | 1100 | goto out_set; |
| 1101 | 1101 | ||
| 1102 | /* | 1102 | /* |
| @@ -2767,6 +2767,14 @@ relock: · 1664 unmodified lines | |||
| 2767 | do_coredump(&ksig->info); | 2767 | do_coredump(&ksig->info); |
| 2768 | } | 2768 | } |
| 2769 | 2769 | ||
| 2770 | /* | ||
| 2771 | * PF_IO_WORKER threads will catch and exit on fatal signals | ||
| 2772 | * themselves. They have cleanup that must be performed, so | ||
| 2773 | * we cannot call do_exit() on their behalf. | ||
| 2774 | */ | ||
| 2775 | if (current->flags & PF_IO_WORKER) | ||
| 2776 | goto out; | ||
| 2777 | |||
| 2770 | /* | 2778 | /* |
| 2771 | * Death signals, no core dump. | 2779 | * Death signals, no core dump. |
| 2772 | */ | 2780 | */ |
| @@ -2774,7 +2782,7 @@ relock: · 1 unmodified line | |||
| 2774 | /* NOTREACHED */ | 2782 | /* NOTREACHED */ |
| 2775 | } | 2783 | } |
| 2776 | spin_unlock_irq(&sighand->siglock); | 2784 | spin_unlock_irq(&sighand->siglock); |
| 2777 | 2785 | out: | |
| 2778 | ksig->sig = signr; | 2786 | ksig->sig = signr; |
| 2779 | 2787 | ||
| 2780 | if (!(ksig->ka.sa.sa_flags & SA_EXPOSE_TAGBITS)) | 2788 | if (!(ksig->ka.sa.sa_flags & SA_EXPOSE_TAGBITS)) |
| @@ -35,27 +35,30 @@ static inline void *static_call_addr(struct static_call_site *site) · 34 unmodified lines | |||
| 35 | return (void *)((long)site->addr + (long)&site->addr); | 35 | return (void *)((long)site->addr + (long)&site->addr); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | static inline unsigned long __static_call_key(const struct static_call_site *site) | ||
| 39 | { | ||
| 40 | return (long)site->key + (long)&site->key; | ||
| 41 | } | ||
| 38 | 42 | ||
| 39 | static inline struct static_call_key *static_call_key(const struct static_call_site *site) | 43 | static inline struct static_call_key *static_call_key(const struct static_call_site *site) |
| 40 | { | 44 | { |
| 41 | return (struct static_call_key *) | 45 | return (void *)(__static_call_key(site) & ~STATIC_CALL_SITE_FLAGS); |
| 42 | (((long)site->key + (long)&site->key) & ~STATIC_CALL_SITE_FLAGS); | ||
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | /* These assume the key is word-aligned. */ | 48 | /* These assume the key is word-aligned. */ |
| 46 | static inline bool static_call_is_init(struct static_call_site *site) | 49 | static inline bool static_call_is_init(struct static_call_site *site) |
| 47 | { | 50 | { |
| 48 | return ((long)site->key + (long)&site->key) & STATIC_CALL_SITE_INIT; | 51 | return __static_call_key(site) & STATIC_CALL_SITE_INIT; |
| 49 | } | 52 | } |
| 50 | 53 | ||
| 51 | static inline bool static_call_is_tail(struct static_call_site *site) | 54 | static inline bool static_call_is_tail(struct static_call_site *site) |
| 52 | { | 55 | { |
| 53 | return ((long)site->key + (long)&site->key) & STATIC_CALL_SITE_TAIL; | 56 | return __static_call_key(site) & STATIC_CALL_SITE_TAIL; |
| 54 | } | 57 | } |
| 55 | 58 | ||
| 56 | static inline void static_call_set_init(struct static_call_site *site) | 59 | static inline void static_call_set_init(struct static_call_site *site) |
| 57 | { | 60 | { |
| 58 | site->key = ((long)static_call_key(site) | STATIC_CALL_SITE_INIT) - | 61 | site->key = (__static_call_key(site) | STATIC_CALL_SITE_INIT) - |
| 59 | (long)&site->key; | 62 | (long)&site->key; |
| 60 | } | 63 | } |
| 61 | 64 | ||
| @@ -146,6 +149,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) · 84 unmodified lines | |||
| 146 | }; | 149 | }; |
| 147 | 150 | ||
| 148 | for (site_mod = &first; site_mod; site_mod = site_mod->next) { | 151 | for (site_mod = &first; site_mod; site_mod = site_mod->next) { |
| 152 | bool init = system_state < SYSTEM_RUNNING; | ||
| 149 | struct module *mod = site_mod->mod; | 153 | struct module *mod = site_mod->mod; |
| 150 | 154 | ||
| 151 | if (!site_mod->sites) { | 155 | if (!site_mod->sites) { |
| @@ -165,6 +169,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) · 13 unmodified lines | |||
| 165 | if (mod) { | 169 | if (mod) { |
| 166 | stop = mod->static_call_sites + | 170 | stop = mod->static_call_sites + |
| 167 | mod->num_static_call_sites; | 171 | mod->num_static_call_sites; |
| 172 | init = mod->state == MODULE_STATE_COMING; | ||
| 168 | } | 173 | } |
| 169 | #endif | 174 | #endif |
| 170 | 175 | ||
| @@ -172,25 +177,26 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) · 1 unmodified line | |||
| 172 | site < stop && static_call_key(site) == key; site++) { | 177 | site < stop && static_call_key(site) == key; site++) { |
| 173 | void *site_addr = static_call_addr(site); | 178 | void *site_addr = static_call_addr(site); |
| 174 | 179 | ||
| 175 | if (static_call_is_init(site)) { | 180 | if (!init && static_call_is_init(site)) |
| 176 | /* | 181 | continue; |
| 177 | * Don't write to call sites which were in | ||
| 178 | * initmem and have since been freed. | ||
| 179 | */ | ||
| 180 | if (!mod && system_state >= SYSTEM_RUNNING) | ||
| 181 | continue; | ||
| 182 | if (mod && !within_module_init((unsigned long)site_addr, mod)) | ||
| 183 | continue; | ||
| 184 | } | ||
| 185 | 182 | ||
| 186 | if (!kernel_text_address((unsigned long)site_addr)) { | 183 | if (!kernel_text_address((unsigned long)site_addr)) { |
| 187 | WARN_ONCE(1, "can't patch static call site at %pS", | 184 | /* |
| 185 | * This skips patching built-in __exit, which | ||
| 186 | * is part of init_section_contains() but is | ||
| 187 | * not part of kernel_text_address(). | ||
| 188 | * | ||
| 189 | * Skipping built-in __exit is fine since it | ||
| 190 | * will never be executed. | ||
| 191 | */ | ||
| 192 | WARN_ONCE(!static_call_is_init(site), | ||
| 193 | "can't patch static call site at %pS", | ||
| 188 | site_addr); | 194 | site_addr); |
| 189 | continue; | 195 | continue; |
| 190 | } | 196 | } |
| 191 | 197 | ||
| 192 | arch_static_call_transform(site_addr, NULL, func, | 198 | arch_static_call_transform(site_addr, NULL, func, |
| 193 | static_call_is_tail(site)); | 199 | static_call_is_tail(site)); |
| 194 | } | 200 | } |
| 195 | } | 201 | } |
| 196 | 202 | ||
| @@ -349,7 +355,7 @@ static int static_call_add_module(struct module *mod) · 152 unmodified lines | |||
| 349 | struct static_call_site *site; | 355 | struct static_call_site *site; |
| 350 | 356 | ||
| 351 | for (site = start; site != stop; site++) { | 357 | for (site = start; site != stop; site++) { |
| 352 | unsigned long s_key = (long)site->key + (long)&site->key; | 358 | unsigned long s_key = __static_call_key(site); |
| 353 | unsigned long addr = s_key & ~STATIC_CALL_SITE_FLAGS; | 359 | unsigned long addr = s_key & ~STATIC_CALL_SITE_FLAGS; |
| 354 | unsigned long key; | 360 | unsigned long key; |
| 355 | 361 | ||
| @@ -854,9 +854,9 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags, · 853 unmodified lines | |||
| 854 | if (flags == TIMER_ABSTIME) | 854 | if (flags == TIMER_ABSTIME) |
| 855 | return -ERESTARTNOHAND; | 855 | return -ERESTARTNOHAND; |
| 856 | 856 | ||
| 857 | restart->fn = alarm_timer_nsleep_restart; | ||
| 858 | restart->nanosleep.clockid = type; | 857 | restart->nanosleep.clockid = type; |
| 859 | restart->nanosleep.expires = exp; | 858 | restart->nanosleep.expires = exp; |
| 859 | set_restart_fn(restart, alarm_timer_nsleep_restart); | ||
| 860 | return ret; | 860 | return ret; |
| 861 | } | 861 | } |
| 862 | 862 | ||
| @@ -1957,9 +1957,9 @@ long hrtimer_nanosleep(ktime_t rqtp, const enum hrtimer_mode mode, · 1956 unmodified lines | |||
| 1957 | } | 1957 | } |
| 1958 | 1958 | ||
| 1959 | restart = ¤t->restart_block; | 1959 | restart = ¤t->restart_block; |
| 1960 | restart->fn = hrtimer_nanosleep_restart; | ||
| 1961 | restart->nanosleep.clockid = t.timer.base->clockid; | 1960 | restart->nanosleep.clockid = t.timer.base->clockid; |
| 1962 | restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer); | 1961 | restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer); |
| 1962 | set_restart_fn(restart, hrtimer_nanosleep_restart); | ||
| 1963 | out: | 1963 | out: |
| 1964 | destroy_hrtimer_on_stack(&t.timer); | 1964 | destroy_hrtimer_on_stack(&t.timer); |
| 1965 | return ret; | 1965 | return ret; |
| @@ -1480,8 +1480,8 @@ static int posix_cpu_nsleep(const clockid_t which_clock, int flags, · 1479 unmodified lines | |||
| 1480 | if (flags & TIMER_ABSTIME) | 1480 | if (flags & TIMER_ABSTIME) |
| 1481 | return -ERESTARTNOHAND; | 1481 | return -ERESTARTNOHAND; |
| 1482 | 1482 | ||
| 1483 | restart_block->fn = posix_cpu_nsleep_restart; | ||
| 1484 | restart_block->nanosleep.clockid = which_clock; | 1483 | restart_block->nanosleep.clockid = which_clock; |
| 1484 | set_restart_fn(restart_block, posix_cpu_nsleep_restart); | ||
| 1485 | } | 1485 | } |
| 1486 | return error; | 1486 | return error; |
| 1487 | } | 1487 | } |
| @@ -5045,6 +5045,20 @@ struct ftrace_direct_func *ftrace_find_direct_func(unsigned long addr) · 5044 unmodified lines | |||
| 5045 | return NULL; | 5045 | return NULL; |
| 5046 | } | 5046 | } |
| 5047 | 5047 | ||
| 5048 | static struct ftrace_direct_func *ftrace_alloc_direct_func(unsigned long addr) | ||
| 5049 | { | ||
| 5050 | struct ftrace_direct_func *direct; | ||
| 5051 | |||
| 5052 | direct = kmalloc(sizeof(*direct), GFP_KERNEL); | ||
| 5053 | if (!direct) | ||
| 5054 | return NULL; | ||
| 5055 | direct->addr = addr; | ||
| 5056 | direct->count = 0; | ||
| 5057 | list_add_rcu(&direct->next, &ftrace_direct_funcs); | ||
| 5058 | ftrace_direct_func_count++; | ||
| 5059 | return direct; | ||
| 5060 | } | ||
| 5061 | |||
| 5048 | /** | 5062 | /** |
| 5049 | * register_ftrace_direct - Call a custom trampoline directly | 5063 | * register_ftrace_direct - Call a custom trampoline directly |
| 5050 | * @ip: The address of the nop at the beginning of a function | 5064 | * @ip: The address of the nop at the beginning of a function |
| @@ -5120,15 +5134,11 @@ int register_ftrace_direct(unsigned long ip, unsigned long addr) · 69 unmodified lines | |||
| 5120 | 5134 | ||
| 5121 | direct = ftrace_find_direct_func(addr); | 5135 | direct = ftrace_find_direct_func(addr); |
| 5122 | if (!direct) { | 5136 | if (!direct) { |
| 5123 | direct = kmalloc(sizeof(*direct), GFP_KERNEL); | 5137 | direct = ftrace_alloc_direct_func(addr); |
| 5124 | if (!direct) { | 5138 | if (!direct) { |
| 5125 | kfree(entry); | 5139 | kfree(entry); |
| 5126 | goto out_unlock; | 5140 | goto out_unlock; |
| 5127 | } | 5141 | } |
| 5128 | direct->addr = addr; | ||
| 5129 | direct->count = 0; | ||
| 5130 | list_add_rcu(&direct->next, &ftrace_direct_funcs); | ||
| 5131 | ftrace_direct_func_count++; | ||
| 5132 | } | 5142 | } |
| 5133 | 5143 | ||
| 5134 | entry->ip = ip; | 5144 | entry->ip = ip; |
| @@ -5329,6 +5339,7 @@ int __weak ftrace_modify_direct_caller(struct ftrace_func_entry *entry, · 194 unmodified lines | |||
| 5329 | int modify_ftrace_direct(unsigned long ip, | 5339 | int modify_ftrace_direct(unsigned long ip, |
| 5330 | unsigned long old_addr, unsigned long new_addr) | 5340 | unsigned long old_addr, unsigned long new_addr) |
| 5331 | { | 5341 | { |
| 5342 | struct ftrace_direct_func *direct, *new_direct = NULL; | ||
| 5332 | struct ftrace_func_entry *entry; | 5343 | struct ftrace_func_entry *entry; |
| 5333 | struct dyn_ftrace *rec; | 5344 | struct dyn_ftrace *rec; |
| 5334 | int ret = -ENODEV; | 5345 | int ret = -ENODEV; |
| @@ -5344,6 +5355,20 @@ int modify_ftrace_direct(unsigned long ip, · 9 unmodified lines | |||
| 5344 | if (entry->direct != old_addr) | 5355 | if (entry->direct != old_addr) |
| 5345 | goto out_unlock; | 5356 | goto out_unlock; |
| 5346 | 5357 | ||
| 5358 | direct = ftrace_find_direct_func(old_addr); | ||
| 5359 | if (WARN_ON(!direct)) | ||
| 5360 | goto out_unlock; | ||
| 5361 | if (direct->count > 1) { | ||
| 5362 | ret = -ENOMEM; | ||
| 5363 | new_direct = ftrace_alloc_direct_func(new_addr); | ||
| 5364 | if (!new_direct) | ||
| 5365 | goto out_unlock; | ||
| 5366 | direct->count--; | ||
| 5367 | new_direct->count++; | ||
| 5368 | } else { | ||
| 5369 | direct->addr = new_addr; | ||
| 5370 | } | ||
| 5371 | |||
| 5347 | /* | 5372 | /* |
| 5348 | * If there's no other ftrace callback on the rec->ip location, | 5373 | * If there's no other ftrace callback on the rec->ip location, |
| 5349 | * then it can be changed directly by the architecture. | 5374 | * then it can be changed directly by the architecture. |
| @@ -5357,6 +5382,14 @@ int modify_ftrace_direct(unsigned long ip, · 7 unmodified lines | |||
| 5357 | ret = 0; | 5382 | ret = 0; |
| 5358 | } | 5383 | } |
| 5359 | 5384 | ||
| 5385 | if (unlikely(ret && new_direct)) { | ||
| 5386 | direct->count++; | ||
| 5387 | list_del_rcu(&new_direct->next); | ||
| 5388 | synchronize_rcu_tasks(); | ||
| 5389 | kfree(new_direct); | ||
| 5390 | ftrace_direct_func_count--; | ||
| 5391 | } | ||
| 5392 | |||
| 5360 | out_unlock: | 5393 | out_unlock: |
| 5361 | mutex_unlock(&ftrace_lock); | 5394 | mutex_unlock(&ftrace_lock); |
| 5362 | mutex_unlock(&direct_mutex); | 5395 | mutex_unlock(&direct_mutex); |
| @@ -139,13 +139,22 @@ static void umd_cleanup(struct subprocess_info *info) · 138 unmodified lines | |||
| 139 | struct umd_info *umd_info = info->data; | 139 | struct umd_info *umd_info = info->data; |
| 140 | 140 | ||
| 141 | /* cleanup if umh_setup() was successful but exec failed */ | 141 | /* cleanup if umh_setup() was successful but exec failed */ |
| 142 | if (info->retval) { | 142 | if (info->retval) |
| 143 | fput(umd_info->pipe_to_umh); | 143 | umd_cleanup_helper(umd_info); |
| 144 | fput(umd_info->pipe_from_umh); | 144 | } |
| 145 | put_pid(umd_info->tgid); | 145 | |
| 146 | umd_info->tgid = NULL; | 146 | /** |
| 147 | } | 147 | * umd_cleanup_helper - release the resources which were allocated in umd_setup |
| 148 | * @info: information about usermode driver | ||
| 149 | */ | ||
| 150 | void umd_cleanup_helper(struct umd_info *info) | ||
| 151 | { | ||
| 152 | fput(info->pipe_to_umh); | ||
| 153 | fput(info->pipe_from_umh); | ||
| 154 | put_pid(info->tgid); | ||
| 155 | info->tgid = NULL; | ||
| 148 | } | 156 | } |
| 157 | EXPORT_SYMBOL_GPL(umd_cleanup_helper); | ||
| 149 | 158 | ||
| 150 | /** | 159 | /** |
| 151 | * fork_usermode_driver - fork a usermode driver | 160 | * fork_usermode_driver - fork a usermode driver |
| @@ -232,4 +232,5 @@ u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c) · 231 unmodified lines | |||
| 232 | 232 | ||
| 233 | return res + div64_u64(a * b, c); | 233 | return res + div64_u64(a * b, c); |
| 234 | } | 234 | } |
| 235 | EXPORT_SYMBOL(mul_u64_u64_div_u64); | ||
| 235 | #endif | 236 | #endif |
| @@ -618,7 +618,7 @@ void __kmap_local_sched_out(void) · 617 unmodified lines | |||
| 618 | int idx; | 618 | int idx; |
| 619 | 619 | ||
| 620 | /* With debug all even slots are unmapped and act as guard */ | 620 | /* With debug all even slots are unmapped and act as guard */ |
| 621 | if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM) && !(i & 0x01)) { | 621 | if (IS_ENABLED(CONFIG_DEBUG_KMAP_LOCAL) && !(i & 0x01)) { |
| 622 | WARN_ON_ONCE(!pte_none(pteval)); | 622 | WARN_ON_ONCE(!pte_none(pteval)); |
| 623 | continue; | 623 | continue; |
| 624 | } | 624 | } |
| @@ -654,7 +654,7 @@ void __kmap_local_sched_in(void) · 29 unmodified lines | |||
| 654 | int idx; | 654 | int idx; |
| 655 | 655 | ||
| 656 | /* With debug all even slots are unmapped and act as guard */ | 656 | /* With debug all even slots are unmapped and act as guard */ |
| 657 | if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM) && !(i & 0x01)) { | 657 | if (IS_ENABLED(CONFIG_DEBUG_KMAP_LOCAL) && !(i & 0x01)) { |
| 658 | WARN_ON_ONCE(!pte_none(pteval)); | 658 | WARN_ON_ONCE(!pte_none(pteval)); |
| 659 | continue; | 659 | continue; |
| 660 | } | 660 | } |
| @@ -280,6 +280,17 @@ static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg, · 279 unmodified lines | |||
| 280 | nrg->reservation_counter = | 280 | nrg->reservation_counter = |
| 281 | &h_cg->rsvd_hugepage[hstate_index(h)]; | 281 | &h_cg->rsvd_hugepage[hstate_index(h)]; |
| 282 | nrg->css = &h_cg->css; | 282 | nrg->css = &h_cg->css; |
| 283 | /* | ||
| 284 | * The caller will hold exactly one h_cg->css reference for the | ||
| 285 | * whole contiguous reservation region. But this area might be | ||
| 286 | * scattered when there are already some file_regions reside in | ||
| 287 | * it. As a result, many file_regions may share only one css | ||
| 288 | * reference. In order to ensure that one file_region must hold | ||
| 289 | * exactly one h_cg->css reference, we should do css_get for | ||
| 290 | * each file_region and leave the reference held by caller | ||
| 291 | * untouched. | ||
| 292 | */ | ||
| 293 | css_get(&h_cg->css); | ||
| 283 | if (!resv->pages_per_hpage) | 294 | if (!resv->pages_per_hpage) |
| 284 | resv->pages_per_hpage = pages_per_huge_page(h); | 295 | resv->pages_per_hpage = pages_per_huge_page(h); |
| 285 | /* pages_per_hpage should be the same for all entries in | 296 | /* pages_per_hpage should be the same for all entries in |
| @@ -293,6 +304,14 @@ static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg, · 7 unmodified lines | |||
| 293 | #endif | 304 | #endif |
| 294 | } | 305 | } |
| 295 | 306 | ||
| 307 | static void put_uncharge_info(struct file_region *rg) | ||
| 308 | { | ||
| 309 | #ifdef CONFIG_CGROUP_HUGETLB | ||
| 310 | if (rg->css) | ||
| 311 | css_put(rg->css); | ||
| 312 | #endif | ||
| 313 | } | ||
| 314 | |||
| 296 | static bool has_same_uncharge_info(struct file_region *rg, | 315 | static bool has_same_uncharge_info(struct file_region *rg, |
| 297 | struct file_region *org) | 316 | struct file_region *org) |
| 298 | { | 317 | { |
| @@ -316,6 +335,7 @@ static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) · 17 unmodified lines | |||
| 316 | prg->to = rg->to; | 335 | prg->to = rg->to; |
| 317 | 336 | ||
| 318 | list_del(&rg->link); | 337 | list_del(&rg->link); |
| 338 | put_uncharge_info(rg); | ||
| 319 | kfree(rg); | 339 | kfree(rg); |
| 320 | 340 | ||
| 321 | rg = prg; | 341 | rg = prg; |
| @@ -327,6 +347,7 @@ static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) · 5 unmodified lines | |||
| 327 | nrg->from = rg->from; | 347 | nrg->from = rg->from; |
| 328 | 348 | ||
| 329 | list_del(&rg->link); | 349 | list_del(&rg->link); |
| 350 | put_uncharge_info(rg); | ||
| 330 | kfree(rg); | 351 | kfree(rg); |
| 331 | } | 352 | } |
| 332 | } | 353 | } |
| @@ -662,7 +683,7 @@ retry: · 329 unmodified lines | |||
| 662 | 683 | ||
| 663 | del += t - f; | 684 | del += t - f; |
| 664 | hugetlb_cgroup_uncharge_file_region( | 685 | hugetlb_cgroup_uncharge_file_region( |
| 665 | resv, rg, t - f); | 686 | resv, rg, t - f, false); |
| 666 | 687 | ||
| 667 | /* New entry for end of split region */ | 688 | /* New entry for end of split region */ |
| 668 | nrg->from = t; | 689 | nrg->from = t; |
| @@ -683,7 +704,7 @@ retry: · 14 unmodified lines | |||
| 683 | if (f <= rg->from && t >= rg->to) { /* Remove entire region */ | 704 | if (f <= rg->from && t >= rg->to) { /* Remove entire region */ |
| 684 | del += rg->to - rg->from; | 705 | del += rg->to - rg->from; |
| 685 | hugetlb_cgroup_uncharge_file_region(resv, rg, | 706 | hugetlb_cgroup_uncharge_file_region(resv, rg, |
| 686 | rg->to - rg->from); | 707 | rg->to - rg->from, true); |
| 687 | list_del(&rg->link); | 708 | list_del(&rg->link); |
| 688 | kfree(rg); | 709 | kfree(rg); |
| 689 | continue; | 710 | continue; |
| @@ -691,13 +712,13 @@ retry: · 1 unmodified line | |||
| 691 | 712 | ||
| 692 | if (f <= rg->from) { /* Trim beginning of region */ | 713 | if (f <= rg->from) { /* Trim beginning of region */ |
| 693 | hugetlb_cgroup_uncharge_file_region(resv, rg, | 714 | hugetlb_cgroup_uncharge_file_region(resv, rg, |
| 694 | t - rg->from); | 715 | t - rg->from, false); |
| 695 | 716 | ||
| 696 | del += t - rg->from; | 717 | del += t - rg->from; |
| 697 | rg->from = t; | 718 | rg->from = t; |
| 698 | } else { /* Trim end of region */ | 719 | } else { /* Trim end of region */ |
| 699 | hugetlb_cgroup_uncharge_file_region(resv, rg, | 720 | hugetlb_cgroup_uncharge_file_region(resv, rg, |
| 700 | rg->to - f); | 721 | rg->to - f, false); |
| 701 | 722 | ||
| 702 | del += rg->to - f; | 723 | del += rg->to - f; |
| 703 | rg->to = f; | 724 | rg->to = f; |
| @@ -5187,6 +5208,10 @@ bool hugetlb_reserve_pages(struct inode *inode, · 4483 unmodified lines | |||
| 5187 | */ | 5208 | */ |
| 5188 | long rsv_adjust; | 5209 | long rsv_adjust; |
| 5189 | 5210 | ||
| 5211 | /* | ||
| 5212 | * hugetlb_cgroup_uncharge_cgroup_rsvd() will put the | ||
| 5213 | * reference to h_cg->css. See comment below for detail. | ||
| 5214 | */ | ||
| 5190 | hugetlb_cgroup_uncharge_cgroup_rsvd( | 5215 | hugetlb_cgroup_uncharge_cgroup_rsvd( |
| 5191 | hstate_index(h), | 5216 | hstate_index(h), |
| 5192 | (chg - add) * pages_per_huge_page(h), h_cg); | 5217 | (chg - add) * pages_per_huge_page(h), h_cg); |
| @@ -5194,6 +5219,14 @@ bool hugetlb_reserve_pages(struct inode *inode, · 1 unmodified line | |||
| 5194 | rsv_adjust = hugepage_subpool_put_pages(spool, | 5219 | rsv_adjust = hugepage_subpool_put_pages(spool, |
| 5195 | chg - add); | 5220 | chg - add); |
| 5196 | hugetlb_acct_memory(h, -rsv_adjust); | 5221 | hugetlb_acct_memory(h, -rsv_adjust); |
| 5222 | } else if (h_cg) { | ||
| 5223 | /* | ||
| 5224 | * The file_regions will hold their own reference to | ||
| 5225 | * h_cg->css. So we should release the reference held | ||
| 5226 | * via hugetlb_cgroup_charge_cgroup_rsvd() when we are | ||
| 5227 | * done. | ||
| 5228 | */ | ||
| 5229 | hugetlb_cgroup_put_rsvd_cgroup(h_cg); | ||
| 5197 | } | 5230 | } |
| 5198 | } | 5231 | } |
| 5199 | return true; | 5232 | return true; |
| @@ -391,7 +391,8 @@ void hugetlb_cgroup_uncharge_counter(struct resv_map *resv, unsigned long start, · 390 unmodified lines | |||
| 391 | 391 | ||
| 392 | void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, | 392 | void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, |
| 393 | struct file_region *rg, | 393 | struct file_region *rg, |
| 394 | unsigned long nr_pages) | 394 | unsigned long nr_pages, |
| 395 | bool region_del) | ||
| 395 | { | 396 | { |
| 396 | if (hugetlb_cgroup_disabled() || !resv || !rg || !nr_pages) | 397 | if (hugetlb_cgroup_disabled() || !resv || !rg || !nr_pages) |
| 397 | return; | 398 | return; |
| @@ -400,7 +401,12 @@ void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, · 2 unmodified lines | |||
| 400 | !resv->reservation_counter) { | 401 | !resv->reservation_counter) { |
| 401 | page_counter_uncharge(rg->reservation_counter, | 402 | page_counter_uncharge(rg->reservation_counter, |
| 402 | nr_pages * resv->pages_per_hpage); | 403 | nr_pages * resv->pages_per_hpage); |
| 403 | css_put(rg->css); | 404 | /* |
| 405 | * Only do css_put(rg->css) when we delete the entire region | ||
| 406 | * because one file_region must hold exactly one css reference. | ||
| 407 | */ | ||
| 408 | if (region_del) | ||
| 409 | css_put(rg->css); | ||
| 404 | } | 410 | } |
| 405 | } | 411 | } |
| 406 | 412 | ||
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/debugfs.h> | 12 | #include <linux/debugfs.h> |
| 13 | #include <linux/kcsan-checks.h> | 13 | #include <linux/kcsan-checks.h> |
| 14 | #include <linux/kfence.h> | 14 | #include <linux/kfence.h> |
| 15 | #include <linux/kmemleak.h> | ||
| 15 | #include <linux/list.h> | 16 | #include <linux/list.h> |
| 16 | #include <linux/lockdep.h> | 17 | #include <linux/lockdep.h> |
| 17 | #include <linux/memblock.h> | 18 | #include <linux/memblock.h> |
| @@ -480,6 +481,14 @@ static bool __init kfence_init_pool(void) · 462 unmodified lines | |||
| 480 | addr += 2 * PAGE_SIZE; | 481 | addr += 2 * PAGE_SIZE; |
| 481 | } | 482 | } |
| 482 | 483 | ||
| 484 | /* | ||
| 485 | * The pool is live and will never be deallocated from this point on. | ||
| 486 | * Remove the pool object from the kmemleak object tree, as it would | ||
| 487 | * otherwise overlap with allocations returned by kfence_alloc(), which | ||
| 488 | * are registered with kmemleak through the slab post-alloc hook. | ||
| 489 | */ | ||
| 490 | kmemleak_free(__kfence_pool); | ||
| 491 | |||
| 483 | return true; | 492 | return true; |
| 484 | 493 | ||
| 485 | err: | 494 | err: |
| @@ -97,6 +97,7 @@ · 96 unmodified lines | |||
| 97 | #include <linux/atomic.h> | 97 | #include <linux/atomic.h> |
| 98 | 98 | ||
| 99 | #include <linux/kasan.h> | 99 | #include <linux/kasan.h> |
| 100 | #include <linux/kfence.h> | ||
| 100 | #include <linux/kmemleak.h> | 101 | #include <linux/kmemleak.h> |
| 101 | #include <linux/memory_hotplug.h> | 102 | #include <linux/memory_hotplug.h> |
| 102 | 103 | ||
| @@ -589,7 +590,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size, · 486 unmodified lines | |||
| 589 | atomic_set(&object->use_count, 1); | 590 | atomic_set(&object->use_count, 1); |
| 590 | object->flags = OBJECT_ALLOCATED; | 591 | object->flags = OBJECT_ALLOCATED; |
| 591 | object->pointer = ptr; | 592 | object->pointer = ptr; |
| 592 | object->size = size; | 593 | object->size = kfence_ksize((void *)ptr) ?: size; |
| 593 | object->excess_ref = 0; | 594 | object->excess_ref = 0; |
| 594 | object->min_count = min_count; | 595 | object->min_count = min_count; |
| 595 | object->count = 0; /* white color initially */ | 596 | object->count = 0; /* white color initially */ |
| @@ -501,10 +501,33 @@ static int mn_hlist_invalidate_range_start( · 500 unmodified lines | |||
| 501 | ""); | 501 | ""); |
| 502 | WARN_ON(mmu_notifier_range_blockable(range) || | 502 | WARN_ON(mmu_notifier_range_blockable(range) || |
| 503 | _ret != -EAGAIN); | 503 | _ret != -EAGAIN); |
| 504 | /* | ||
| 505 | * We call all the notifiers on any EAGAIN, | ||
| 506 | * there is no way for a notifier to know if | ||
| 507 | * its start method failed, thus a start that | ||
| 508 | * does EAGAIN can't also do end. | ||
| 509 | */ | ||
| 510 | WARN_ON(ops->invalidate_range_end); | ||
| 504 | ret = _ret; | 511 | ret = _ret; |
| 505 | } | 512 | } |
| 506 | } | 513 | } |
| 507 | } | 514 | } |
| 515 | |||
| 516 | if (ret) { | ||
| 517 | /* | ||
| 518 | * Must be non-blocking to get here. If there are multiple | ||
| 519 | * notifiers and one or more failed start, any that succeeded | ||
| 520 | * start are expecting their end to be called. Do so now. | ||
| 521 | */ | ||
| 522 | hlist_for_each_entry_rcu(subscription, &subscriptions->list, | ||
| 523 | hlist, srcu_read_lock_held(&srcu)) { | ||
| 524 | if (!subscription->ops->invalidate_range_end) | ||
| 525 | continue; | ||
| 526 | |||
| 527 | subscription->ops->invalidate_range_end(subscription, | ||
| 528 | range); | ||
| 529 | } | ||
| 530 | } | ||
| 508 | srcu_read_unlock(&srcu, id); | 531 | srcu_read_unlock(&srcu, id); |
| 509 | 532 | ||
| 510 | return ret; | 533 | return ret; |
| @@ -2833,6 +2833,22 @@ void wait_on_page_writeback(struct page *page) · 2832 unmodified lines | |||
| 2833 | } | 2833 | } |
| 2834 | EXPORT_SYMBOL_GPL(wait_on_page_writeback); | 2834 | EXPORT_SYMBOL_GPL(wait_on_page_writeback); |
| 2835 | 2835 | ||
| 2836 | /* | ||
| 2837 | * Wait for a page to complete writeback. Returns -EINTR if we get a | ||
| 2838 | * fatal signal while waiting. | ||
| 2839 | */ | ||
| 2840 | int wait_on_page_writeback_killable(struct page *page) | ||
| 2841 | { | ||
| 2842 | while (PageWriteback(page)) { | ||
| 2843 | trace_wait_on_page_writeback(page, page_mapping(page)); | ||
| 2844 | if (wait_on_page_bit_killable(page, PG_writeback)) | ||
| 2845 | return -EINTR; | ||
| 2846 | } | ||
| 2847 | |||
| 2848 | return 0; | ||
| 2849 | } | ||
| 2850 | EXPORT_SYMBOL_GPL(wait_on_page_writeback_killable); | ||
| 2851 | |||
| 2836 | /** | 2852 | /** |
| 2837 | * wait_for_stable_page() - wait for writeback to finish, if necessary. | 2853 | * wait_for_stable_page() - wait for writeback to finish, if necessary. |
| 2838 | * @page: The page to wait on. | 2854 | * @page: The page to wait on. |
| @@ -1346,8 +1346,22 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) · 1345 unmodified lines | |||
| 1346 | page = list_entry(pos, struct page, lru); | 1346 | page = list_entry(pos, struct page, lru); |
| 1347 | 1347 | ||
| 1348 | zhdr = page_address(page); | 1348 | zhdr = page_address(page); |
| 1349 | if (test_bit(PAGE_HEADLESS, &page->private)) | 1349 | if (test_bit(PAGE_HEADLESS, &page->private)) { |
| 1350 | /* | ||
| 1351 | * For non-headless pages, we wait to do this | ||
| 1352 | * until we have the page lock to avoid racing | ||
| 1353 | * with __z3fold_alloc(). Headless pages don't | ||
| 1354 | * have a lock (and __z3fold_alloc() will never | ||
| 1355 | * see them), but we still need to test and set | ||
| 1356 | * PAGE_CLAIMED to avoid racing with | ||
| 1357 | * z3fold_free(), so just do it now before | ||
| 1358 | * leaving the loop. | ||
| 1359 | */ | ||
| 1360 | if (test_and_set_bit(PAGE_CLAIMED, &page->private)) | ||
| 1361 | continue; | ||
| 1362 | |||
| 1350 | break; | 1363 | break; |
| 1364 | } | ||
| 1351 | 1365 | ||
| 1352 | if (kref_get_unless_zero(&zhdr->refcount) == 0) { | 1366 | if (kref_get_unless_zero(&zhdr->refcount) == 0) { |
| 1353 | zhdr = NULL; | 1367 | zhdr = NULL; |
| @@ -702,7 +702,6 @@ MODULE_LICENSE("GPL"); · 701 unmodified lines | |||
| 702 | 702 | ||
| 703 | MODULE_AUTHOR(BATADV_DRIVER_AUTHOR); | 703 | MODULE_AUTHOR(BATADV_DRIVER_AUTHOR); |
| 704 | MODULE_DESCRIPTION(BATADV_DRIVER_DESC); | 704 | MODULE_DESCRIPTION(BATADV_DRIVER_DESC); |
| 705 | MODULE_SUPPORTED_DEVICE(BATADV_DRIVER_DEVICE); | ||
| 706 | MODULE_VERSION(BATADV_SOURCE_VERSION); | 705 | MODULE_VERSION(BATADV_SOURCE_VERSION); |
| 707 | MODULE_ALIAS_RTNL_LINK("batadv"); | 706 | MODULE_ALIAS_RTNL_LINK("batadv"); |
| 708 | MODULE_ALIAS_GENL_FAMILY(BATADV_NL_NAME); | 707 | MODULE_ALIAS_GENL_FAMILY(BATADV_NL_NAME); |
| @@ -128,6 +128,8 @@ br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) · 127 unmodified lines | |||
| 128 | { | 128 | { |
| 129 | if (!fdb->dst) | 129 | if (!fdb->dst) |
| 130 | return; | 130 | return; |
| 131 | if (test_bit(BR_FDB_LOCAL, &fdb->flags)) | ||
| 132 | return; | ||
| 131 | 133 | ||
| 132 | switch (type) { | 134 | switch (type) { |
| 133 | case RTM_DELNEIGH: | 135 | case RTM_DELNEIGH: |
| @@ -196,7 +196,7 @@ static int isotp_send_fc(struct sock *sk, int ae, u8 flowstatus) · 195 unmodified lines | |||
| 196 | nskb->dev = dev; | 196 | nskb->dev = dev; |
| 197 | can_skb_set_owner(nskb, sk); | 197 | can_skb_set_owner(nskb, sk); |
| 198 | ncf = (struct canfd_frame *)nskb->data; | 198 | ncf = (struct canfd_frame *)nskb->data; |
| 199 | skb_put(nskb, so->ll.mtu); | 199 | skb_put_zero(nskb, so->ll.mtu); |
| 200 | 200 | ||
| 201 | /* create & send flow control reply */ | 201 | /* create & send flow control reply */ |
| 202 | ncf->can_id = so->txid; | 202 | ncf->can_id = so->txid; |
| @@ -215,8 +215,7 @@ static int isotp_send_fc(struct sock *sk, int ae, u8 flowstatus) · 12 unmodified lines | |||
| 215 | if (ae) | 215 | if (ae) |
| 216 | ncf->data[0] = so->opt.ext_address; | 216 | ncf->data[0] = so->opt.ext_address; |
| 217 | 217 | ||
| 218 | if (so->ll.mtu == CANFD_MTU) | 218 | ncf->flags = so->ll.tx_flags; |
| 219 | ncf->flags = so->ll.tx_flags; | ||
| 220 | 219 | ||
| 221 | can_send_ret = can_send(nskb, 1); | 220 | can_send_ret = can_send(nskb, 1); |
| 222 | if (can_send_ret) | 221 | if (can_send_ret) |
| @@ -780,7 +779,7 @@ isotp_tx_burst: · 557 unmodified lines | |||
| 780 | can_skb_prv(skb)->skbcnt = 0; | 779 | can_skb_prv(skb)->skbcnt = 0; |
| 781 | 780 | ||
| 782 | cf = (struct canfd_frame *)skb->data; | 781 | cf = (struct canfd_frame *)skb->data; |
| 783 | skb_put(skb, so->ll.mtu); | 782 | skb_put_zero(skb, so->ll.mtu); |
| 784 | 783 | ||
| 785 | /* create consecutive frame */ | 784 | /* create consecutive frame */ |
| 786 | isotp_fill_dataframe(cf, so, ae, 0); | 785 | isotp_fill_dataframe(cf, so, ae, 0); |
| @@ -790,8 +789,7 @@ isotp_tx_burst: · 3 unmodified lines | |||
| 790 | so->tx.sn %= 16; | 789 | so->tx.sn %= 16; |
| 791 | so->tx.bs++; | 790 | so->tx.bs++; |
| 792 | 791 | ||
| 793 | if (so->ll.mtu == CANFD_MTU) | 792 | cf->flags = so->ll.tx_flags; |
| 794 | cf->flags = so->ll.tx_flags; | ||
| 795 | 793 | ||
| 796 | skb->dev = dev; | 794 | skb->dev = dev; |
| 797 | can_skb_set_owner(skb, sk); | 795 | can_skb_set_owner(skb, sk); |
| @@ -897,7 +895,7 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) · 99 unmodified lines | |||
| 897 | so->tx.idx = 0; | 895 | so->tx.idx = 0; |
| 898 | 896 | ||
| 899 | cf = (struct canfd_frame *)skb->data; | 897 | cf = (struct canfd_frame *)skb->data; |
| 900 | skb_put(skb, so->ll.mtu); | 898 | skb_put_zero(skb, so->ll.mtu); |
| 901 | 899 | ||
| 902 | /* check for single frame transmission depending on TX_DL */ | 900 | /* check for single frame transmission depending on TX_DL */ |
| 903 | if (size <= so->tx.ll_dl - SF_PCI_SZ4 - ae - off) { | 901 | if (size <= so->tx.ll_dl - SF_PCI_SZ4 - ae - off) { |
| @@ -939,8 +937,7 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) · 35 unmodified lines | |||
| 939 | } | 937 | } |
| 940 | 938 | ||
| 941 | /* send the first or only CAN frame */ | 939 | /* send the first or only CAN frame */ |
| 942 | if (so->ll.mtu == CANFD_MTU) | 940 | cf->flags = so->ll.tx_flags; |
| 943 | cf->flags = so->ll.tx_flags; | ||
| 944 | 941 | ||
| 945 | skb->dev = dev; | 942 | skb->dev = dev; |
| 946 | skb->sk = sk; | 943 | skb->sk = sk; |
| @@ -1228,7 +1225,8 @@ static int isotp_setsockopt(struct socket *sock, int level, int optname, · 281 unmodified lines | |||
| 1228 | if (ll.mtu != CAN_MTU && ll.mtu != CANFD_MTU) | 1225 | if (ll.mtu != CAN_MTU && ll.mtu != CANFD_MTU) |
| 1229 | return -EINVAL; | 1226 | return -EINVAL; |
| 1230 | 1227 | ||
| 1231 | if (ll.mtu == CAN_MTU && ll.tx_dl > CAN_MAX_DLEN) | 1228 | if (ll.mtu == CAN_MTU && |
| 1229 | (ll.tx_dl > CAN_MAX_DLEN || ll.tx_flags != 0)) | ||
| 1232 | return -EINVAL; | 1230 | return -EINVAL; |
| 1233 | 1231 | ||
| 1234 | memcpy(&so->ll, &ll, sizeof(ll)); | 1232 | memcpy(&so->ll, &ll, sizeof(ll)); |
| @@ -1184,6 +1184,18 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf) · 1183 unmodified lines | |||
| 1184 | return -ENOMEM; | 1184 | return -ENOMEM; |
| 1185 | 1185 | ||
| 1186 | for_each_netdev(net, d) { | 1186 | for_each_netdev(net, d) { |
| 1187 | struct netdev_name_node *name_node; | ||
| 1188 | list_for_each_entry(name_node, &d->name_node->list, list) { | ||
| 1189 | if (!sscanf(name_node->name, name, &i)) | ||
| 1190 | continue; | ||
| 1191 | if (i < 0 || i >= max_netdevices) | ||
| 1192 | continue; | ||
| 1193 | |||
| 1194 | /* avoid cases where sscanf is not exact inverse of printf */ | ||
| 1195 | snprintf(buf, IFNAMSIZ, name, i); | ||
| 1196 | if (!strncmp(buf, name_node->name, IFNAMSIZ)) | ||
| 1197 | set_bit(i, inuse); | ||
| 1198 | } | ||
| 1187 | if (!sscanf(d->name, name, &i)) | 1199 | if (!sscanf(d->name, name, &i)) |
| 1188 | continue; | 1200 | continue; |
| 1189 | if (i < 0 || i >= max_netdevices) | 1201 | if (i < 0 || i >= max_netdevices) |
| @@ -4294,6 +4306,13 @@ static inline void ____napi_schedule(struct softnet_data *sd, · 3104 unmodified lines | |||
| 4294 | */ | 4306 | */ |
| 4295 | thread = READ_ONCE(napi->thread); | 4307 | thread = READ_ONCE(napi->thread); |
| 4296 | if (thread) { | 4308 | if (thread) { |
| 4309 | /* Avoid doing set_bit() if the thread is in | ||
| 4310 | * INTERRUPTIBLE state, cause napi_thread_wait() | ||
| 4311 | * makes sure to proceed with napi polling | ||
| 4312 | * if the thread is explicitly woken from here. | ||
| 4313 | */ | ||
| 4314 | if (READ_ONCE(thread->state) != TASK_INTERRUPTIBLE) | ||
| 4315 | set_bit(NAPI_STATE_SCHED_THREADED, &napi->state); | ||
| 4297 | wake_up_process(thread); | 4316 | wake_up_process(thread); |
| 4298 | return; | 4317 | return; |
| 4299 | } | 4318 | } |
| @@ -6486,6 +6505,7 @@ bool napi_complete_done(struct napi_struct *n, int work_done) · 2186 unmodified lines | |||
| 6486 | WARN_ON_ONCE(!(val & NAPIF_STATE_SCHED)); | 6505 | WARN_ON_ONCE(!(val & NAPIF_STATE_SCHED)); |
| 6487 | 6506 | ||
| 6488 | new = val & ~(NAPIF_STATE_MISSED | NAPIF_STATE_SCHED | | 6507 | new = val & ~(NAPIF_STATE_MISSED | NAPIF_STATE_SCHED | |
| 6508 | NAPIF_STATE_SCHED_THREADED | | ||
| 6489 | NAPIF_STATE_PREFER_BUSY_POLL); | 6509 | NAPIF_STATE_PREFER_BUSY_POLL); |
| 6490 | 6510 | ||
| 6491 | /* If STATE_MISSED was set, leave STATE_SCHED set, | 6511 | /* If STATE_MISSED was set, leave STATE_SCHED set, |
| @@ -6968,16 +6988,25 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll) · 476 unmodified lines | |||
| 6968 | 6988 | ||
| 6969 | static int napi_thread_wait(struct napi_struct *napi) | 6989 | static int napi_thread_wait(struct napi_struct *napi) |
| 6970 | { | 6990 | { |
| 6991 | bool woken = false; | ||
| 6992 | |||
| 6971 | set_current_state(TASK_INTERRUPTIBLE); | 6993 | set_current_state(TASK_INTERRUPTIBLE); |
| 6972 | 6994 | ||
| 6973 | while (!kthread_should_stop() && !napi_disable_pending(napi)) { | 6995 | while (!kthread_should_stop() && !napi_disable_pending(napi)) { |
| 6974 | if (test_bit(NAPI_STATE_SCHED, &napi->state)) { | 6996 | /* Testing SCHED_THREADED bit here to make sure the current |
| 6997 | * kthread owns this napi and could poll on this napi. | ||
| 6998 | * Testing SCHED bit is not enough because SCHED bit might be | ||
| 6999 | * set by some other busy poll thread or by napi_disable(). | ||
| 7000 | */ | ||
| 7001 | if (test_bit(NAPI_STATE_SCHED_THREADED, &napi->state) || woken) { | ||
| 6975 | WARN_ON(!list_empty(&napi->poll_list)); | 7002 | WARN_ON(!list_empty(&napi->poll_list)); |
| 6976 | __set_current_state(TASK_RUNNING); | 7003 | __set_current_state(TASK_RUNNING); |
| 6977 | return 0; | 7004 | return 0; |
| 6978 | } | 7005 | } |
| 6979 | 7006 | ||
| 6980 | schedule(); | 7007 | schedule(); |
| 7008 | /* woken being true indicates this thread owns this napi. */ | ||
| 7009 | woken = true; | ||
| 6981 | set_current_state(TASK_INTERRUPTIBLE); | 7010 | set_current_state(TASK_INTERRUPTIBLE); |
| 6982 | } | 7011 | } |
| 6983 | __set_current_state(TASK_RUNNING); | 7012 | __set_current_state(TASK_RUNNING); |
| @@ -11346,7 +11375,7 @@ static void __net_exit default_device_exit(struct net *net) · 4362 unmodified lines | |||
| 11346 | continue; | 11375 | continue; |
| 11347 | 11376 | ||
| 11348 | /* Leave virtual devices for the generic cleanup */ | 11377 | /* Leave virtual devices for the generic cleanup */ |
| 11349 | if (dev->rtnl_link_ops) | 11378 | if (dev->rtnl_link_ops && !dev->rtnl_link_ops->netns_refund) |
| 11350 | continue; | 11379 | continue; |
| 11351 | 11380 | ||
| 11352 | /* Push remaining network devices to init_net */ | 11381 | /* Push remaining network devices to init_net */ |
| @@ -1053,6 +1053,20 @@ static int net_dm_hw_monitor_start(struct netlink_ext_ack *extack) · 1052 unmodified lines | |||
| 1053 | return 0; | 1053 | return 0; |
| 1054 | 1054 | ||
| 1055 | err_module_put: | 1055 | err_module_put: |
| 1056 | for_each_possible_cpu(cpu) { | ||
| 1057 | struct per_cpu_dm_data *hw_data = &per_cpu(dm_hw_cpu_data, cpu); | ||
| 1058 | struct sk_buff *skb; | ||
| 1059 | |||
| 1060 | del_timer_sync(&hw_data->send_timer); | ||
| 1061 | cancel_work_sync(&hw_data->dm_alert_work); | ||
| 1062 | while ((skb = __skb_dequeue(&hw_data->drop_queue))) { | ||
| 1063 | struct devlink_trap_metadata *hw_metadata; | ||
| 1064 | |||
| 1065 | hw_metadata = NET_DM_SKB_CB(skb)->hw_metadata; | ||
| 1066 | net_dm_hw_metadata_free(hw_metadata); | ||
| 1067 | consume_skb(skb); | ||
| 1068 | } | ||
| 1069 | } | ||
| 1056 | module_put(THIS_MODULE); | 1070 | module_put(THIS_MODULE); |
| 1057 | return rc; | 1071 | return rc; |
| 1058 | } | 1072 | } |
| @@ -1134,6 +1148,15 @@ static int net_dm_trace_on_set(struct netlink_ext_ack *extack) · 75 unmodified lines | |||
| 1134 | err_unregister_trace: | 1148 | err_unregister_trace: |
| 1135 | unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL); | 1149 | unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL); |
| 1136 | err_module_put: | 1150 | err_module_put: |
| 1151 | for_each_possible_cpu(cpu) { | ||
| 1152 | struct per_cpu_dm_data *data = &per_cpu(dm_cpu_data, cpu); | ||
| 1153 | struct sk_buff *skb; | ||
| 1154 | |||
| 1155 | del_timer_sync(&data->send_timer); | ||
| 1156 | cancel_work_sync(&data->dm_alert_work); | ||
| 1157 | while ((skb = __skb_dequeue(&data->drop_queue))) | ||
| 1158 | consume_skb(skb); | ||
| 1159 | } | ||
| 1137 | module_put(THIS_MODULE); | 1160 | module_put(THIS_MODULE); |
| 1138 | return rc; | 1161 | return rc; |
| 1139 | } | 1162 | } |
| @@ -237,37 +237,62 @@ void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old) · 236 unmodified lines | |||
| 237 | } | 237 | } |
| 238 | EXPORT_SYMBOL(__dst_destroy_metrics_generic); | 238 | EXPORT_SYMBOL(__dst_destroy_metrics_generic); |
| 239 | 239 | ||
| 240 | static struct dst_ops md_dst_ops = { | 240 | struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie) |
| 241 | .family = AF_UNSPEC, | 241 | { |
| 242 | }; | 242 | return NULL; |
| 243 | } | ||
| 243 | 244 | ||
| 244 | static int dst_md_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb) | 245 | u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old) |
| 245 | { | 246 | { |
| 246 | WARN_ONCE(1, "Attempting to call output on metadata dst\n"); | 247 | return NULL; |
| 247 | kfree_skb(skb); | ||
| 248 | return 0; | ||
| 249 | } | 248 | } |
| 250 | 249 | ||
| 251 | static int dst_md_discard(struct sk_buff *skb) | 250 | struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst, |
| 251 | struct sk_buff *skb, | ||
| 252 | const void *daddr) | ||
| 252 | { | 253 | { |
| 253 | WARN_ONCE(1, "Attempting to call input on metadata dst\n"); | 254 | return NULL; |
| 254 | kfree_skb(skb); | 255 | } |
| 255 | return 0; | 256 | |
| 257 | void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, | ||
| 258 | struct sk_buff *skb, u32 mtu, | ||
| 259 | bool confirm_neigh) | ||
| 260 | { | ||
| 261 | } | ||
| 262 | EXPORT_SYMBOL_GPL(dst_blackhole_update_pmtu); | ||
| 263 | |||
| 264 | void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk, | ||
| 265 | struct sk_buff *skb) | ||
| 266 | { | ||
| 267 | } | ||
| 268 | EXPORT_SYMBOL_GPL(dst_blackhole_redirect); | ||
| 269 | |||
| 270 | unsigned int dst_blackhole_mtu(const struct dst_entry *dst) | ||
| 271 | { | ||
| 272 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
| 273 | |||
| 274 | return mtu ? : dst->dev->mtu; | ||
| 256 | } | 275 | } |
| 276 | EXPORT_SYMBOL_GPL(dst_blackhole_mtu); | ||
| 277 | |||
| 278 | static struct dst_ops dst_blackhole_ops = { | ||
| 279 | .family = AF_UNSPEC, | ||
| 280 | .neigh_lookup = dst_blackhole_neigh_lookup, | ||
| 281 | .check = dst_blackhole_check, | ||
| 282 | .cow_metrics = dst_blackhole_cow_metrics, | ||
| 283 | .update_pmtu = dst_blackhole_update_pmtu, | ||
| 284 | .redirect = dst_blackhole_redirect, | ||
| 285 | .mtu = dst_blackhole_mtu, | ||
| 286 | }; | ||
| 257 | 287 | ||
| 258 | static void __metadata_dst_init(struct metadata_dst *md_dst, | 288 | static void __metadata_dst_init(struct metadata_dst *md_dst, |
| 259 | enum metadata_type type, u8 optslen) | 289 | enum metadata_type type, u8 optslen) |
| 260 | |||
| 261 | { | 290 | { |
| 262 | struct dst_entry *dst; | 291 | struct dst_entry *dst; |
| 263 | 292 | ||
| 264 | dst = &md_dst->dst; | 293 | dst = &md_dst->dst; |
| 265 | dst_init(dst, &md_dst_ops, NULL, 1, DST_OBSOLETE_NONE, | 294 | dst_init(dst, &dst_blackhole_ops, NULL, 1, DST_OBSOLETE_NONE, |
| 266 | DST_METADATA | DST_NOCOUNT); | 295 | DST_METADATA | DST_NOCOUNT); |
| 267 | |||
| 268 | dst->input = dst_md_discard; | ||
| 269 | dst->output = dst_md_discard_out; | ||
| 270 | |||
| 271 | memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst)); | 296 | memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst)); |
| 272 | md_dst->type = type; | 297 | md_dst->type = type; |
| 273 | } | 298 | } |
| @@ -5658,7 +5658,7 @@ BPF_CALL_5(bpf_skb_check_mtu, struct sk_buff *, skb, · 5657 unmodified lines | |||
| 5658 | if (unlikely(flags & ~(BPF_MTU_CHK_SEGS))) | 5658 | if (unlikely(flags & ~(BPF_MTU_CHK_SEGS))) |
| 5659 | return -EINVAL; | 5659 | return -EINVAL; |
| 5660 | 5660 | ||
| 5661 | if (unlikely(flags & BPF_MTU_CHK_SEGS && len_diff)) | 5661 | if (unlikely(flags & BPF_MTU_CHK_SEGS && (len_diff || *mtu_len))) |
| 5662 | return -EINVAL; | 5662 | return -EINVAL; |
| 5663 | 5663 | ||
| 5664 | dev = __dev_via_ifindex(dev, ifindex); | 5664 | dev = __dev_via_ifindex(dev, ifindex); |
| @@ -5668,7 +5668,11 @@ BPF_CALL_5(bpf_skb_check_mtu, struct sk_buff *, skb, · 3 unmodified lines | |||
| 5668 | mtu = READ_ONCE(dev->mtu); | 5668 | mtu = READ_ONCE(dev->mtu); |
| 5669 | 5669 | ||
| 5670 | dev_len = mtu + dev->hard_header_len; | 5670 | dev_len = mtu + dev->hard_header_len; |
| 5671 | skb_len = skb->len + len_diff; /* minus result pass check */ | 5671 | |
| 5672 | /* If set use *mtu_len as input, L3 as iph->tot_len (like fib_lookup) */ | ||
| 5673 | skb_len = *mtu_len ? *mtu_len + dev->hard_header_len : skb->len; | ||
| 5674 | |||
| 5675 | skb_len += len_diff; /* minus result pass check */ | ||
| 5672 | if (skb_len <= dev_len) { | 5676 | if (skb_len <= dev_len) { |
| 5673 | ret = BPF_MTU_CHK_RET_SUCCESS; | 5677 | ret = BPF_MTU_CHK_RET_SUCCESS; |
| 5674 | goto out; | 5678 | goto out; |
| @@ -5713,6 +5717,10 @@ BPF_CALL_5(bpf_xdp_check_mtu, struct xdp_buff *, xdp, · 38 unmodified lines | |||
| 5713 | /* Add L2-header as dev MTU is L3 size */ | 5717 | /* Add L2-header as dev MTU is L3 size */ |
| 5714 | dev_len = mtu + dev->hard_header_len; | 5718 | dev_len = mtu + dev->hard_header_len; |
| 5715 | 5719 | ||
| 5720 | /* Use *mtu_len as input, L3 as iph->tot_len (like fib_lookup) */ | ||
| 5721 | if (*mtu_len) | ||
| 5722 | xdp_len = *mtu_len + dev->hard_header_len; | ||
| 5723 | |||
| 5716 | xdp_len += len_diff; /* minus result pass check */ | 5724 | xdp_len += len_diff; /* minus result pass check */ |
| 5717 | if (xdp_len > dev_len) | 5725 | if (xdp_len > dev_len) |
| 5718 | ret = BPF_MTU_CHK_RET_FRAG_NEEDED; | 5726 | ret = BPF_MTU_CHK_RET_FRAG_NEEDED; |
| @@ -176,7 +176,7 @@ void skb_flow_get_icmp_tci(const struct sk_buff *skb, · 175 unmodified lines | |||
| 176 | * avoid confusion with packets without such field | 176 | * avoid confusion with packets without such field |
| 177 | */ | 177 | */ |
| 178 | if (icmp_has_id(ih->type)) | 178 | if (icmp_has_id(ih->type)) |
| 179 | key_icmp->id = ih->un.echo.id ? : 1; | 179 | key_icmp->id = ih->un.echo.id ? ntohs(ih->un.echo.id) : 1; |
| 180 | else | 180 | else |
| 181 | key_icmp->id = 0; | 181 | key_icmp->id = 0; |
| 182 | } | 182 | } |
| @@ -3440,6 +3440,32 @@ static void tw_prot_cleanup(struct timewait_sock_ops *twsk_prot) · 3439 unmodified lines | |||
| 3440 | twsk_prot->twsk_slab = NULL; | 3440 | twsk_prot->twsk_slab = NULL; |
| 3441 | } | 3441 | } |
| 3442 | 3442 | ||
| 3443 | static int tw_prot_init(const struct proto *prot) | ||
| 3444 | { | ||
| 3445 | struct timewait_sock_ops *twsk_prot = prot->twsk_prot; | ||
| 3446 | |||
| 3447 | if (!twsk_prot) | ||
| 3448 | return 0; | ||
| 3449 | |||
| 3450 | twsk_prot->twsk_slab_name = kasprintf(GFP_KERNEL, "tw_sock_%s", | ||
| 3451 | prot->name); | ||
| 3452 | if (!twsk_prot->twsk_slab_name) | ||
| 3453 | return -ENOMEM; | ||
| 3454 | |||
| 3455 | twsk_prot->twsk_slab = | ||
| 3456 | kmem_cache_create(twsk_prot->twsk_slab_name, | ||
| 3457 | twsk_prot->twsk_obj_size, 0, | ||
| 3458 | SLAB_ACCOUNT | prot->slab_flags, | ||
| 3459 | NULL); | ||
| 3460 | if (!twsk_prot->twsk_slab) { | ||
| 3461 | pr_crit("%s: Can't create timewait sock SLAB cache!\n", | ||
| 3462 | prot->name); | ||
| 3463 | return -ENOMEM; | ||
| 3464 | } | ||
| 3465 | |||
| 3466 | return 0; | ||
| 3467 | } | ||
| 3468 | |||
| 3443 | static void req_prot_cleanup(struct request_sock_ops *rsk_prot) | 3469 | static void req_prot_cleanup(struct request_sock_ops *rsk_prot) |
| 3444 | { | 3470 | { |
| 3445 | if (!rsk_prot) | 3471 | if (!rsk_prot) |
| @@ -3496,22 +3522,8 @@ int proto_register(struct proto *prot, int alloc_slab) · 50 unmodified lines | |||
| 3496 | if (req_prot_init(prot)) | 3522 | if (req_prot_init(prot)) |
| 3497 | goto out_free_request_sock_slab; | 3523 | goto out_free_request_sock_slab; |
| 3498 | 3524 | ||
| 3499 | if (prot->twsk_prot != NULL) { | 3525 | if (tw_prot_init(prot)) |
| 3500 | prot->twsk_prot->twsk_slab_name = kasprintf(GFP_KERNEL, "tw_sock_%s", prot->name); | 3526 | goto out_free_timewait_sock_slab; |
| 3501 | |||
| 3502 | if (prot->twsk_prot->twsk_slab_name == NULL) | ||
| 3503 | goto out_free_request_sock_slab; | ||
| 3504 | |||
| 3505 | prot->twsk_prot->twsk_slab = | ||
| 3506 | kmem_cache_create(prot->twsk_prot->twsk_slab_name, | ||
| 3507 | prot->twsk_prot->twsk_obj_size, | ||
| 3508 | 0, | ||
| 3509 | SLAB_ACCOUNT | | ||
| 3510 | prot->slab_flags, | ||
| 3511 | NULL); | ||
| 3512 | if (prot->twsk_prot->twsk_slab == NULL) | ||
| 3513 | goto out_free_timewait_sock_slab; | ||
| 3514 | } | ||
| 3515 | } | 3527 | } |
| 3516 | 3528 | ||
| 3517 | mutex_lock(&proto_list_mutex); | 3529 | mutex_lock(&proto_list_mutex); |
| @@ -319,6 +319,11 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) · 318 unmodified lines | |||
| 319 | if (!ipv6_unicast_destination(skb)) | 319 | if (!ipv6_unicast_destination(skb)) |
| 320 | return 0; /* discard, don't send a reset here */ | 320 | return 0; /* discard, don't send a reset here */ |
| 321 | 321 | ||
| 322 | if (ipv6_addr_v4mapped(&ipv6_hdr(skb)->saddr)) { | ||
| 323 | __IP6_INC_STATS(sock_net(sk), NULL, IPSTATS_MIB_INHDRERRORS); | ||
| 324 | return 0; | ||
| 325 | } | ||
| 326 | |||
| 322 | if (dccp_bad_service_code(sk, service)) { | 327 | if (dccp_bad_service_code(sk, service)) { |
| 323 | dcb->dccpd_reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; | 328 | dcb->dccpd_reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; |
| 324 | goto drop; | 329 | goto drop; |
| @@ -1066,6 +1066,7 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master) · 1065 unmodified lines | |||
| 1066 | { | 1066 | { |
| 1067 | struct dsa_switch *ds = dp->ds; | 1067 | struct dsa_switch *ds = dp->ds; |
| 1068 | struct dsa_switch_tree *dst = ds->dst; | 1068 | struct dsa_switch_tree *dst = ds->dst; |
| 1069 | const struct dsa_device_ops *tag_ops; | ||
| 1069 | enum dsa_tag_protocol tag_protocol; | 1070 | enum dsa_tag_protocol tag_protocol; |
| 1070 | 1071 | ||
| 1071 | tag_protocol = dsa_get_tag_protocol(dp, master); | 1072 | tag_protocol = dsa_get_tag_protocol(dp, master); |
| @@ -1080,14 +1081,16 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master) · 8 unmodified lines | |||
| 1080 | * nothing to do here. | 1081 | * nothing to do here. |
| 1081 | */ | 1082 | */ |
| 1082 | } else { | 1083 | } else { |
| 1083 | dst->tag_ops = dsa_tag_driver_get(tag_protocol); | 1084 | tag_ops = dsa_tag_driver_get(tag_protocol); |
| 1084 | if (IS_ERR(dst->tag_ops)) { | 1085 | if (IS_ERR(tag_ops)) { |
| 1085 | if (PTR_ERR(dst->tag_ops) == -ENOPROTOOPT) | 1086 | if (PTR_ERR(tag_ops) == -ENOPROTOOPT) |
| 1086 | return -EPROBE_DEFER; | 1087 | return -EPROBE_DEFER; |
| 1087 | dev_warn(ds->dev, "No tagger for this switch\n"); | 1088 | dev_warn(ds->dev, "No tagger for this switch\n"); |
| 1088 | dp->master = NULL; | 1089 | dp->master = NULL; |
| 1089 | return PTR_ERR(dst->tag_ops); | 1090 | return PTR_ERR(tag_ops); |
| 1090 | } | 1091 | } |
| 1092 | |||
| 1093 | dst->tag_ops = tag_ops; | ||
| 1091 | } | 1094 | } |
| 1092 | 1095 | ||
| 1093 | dp->master = master; | 1096 | dp->master = master; |
| @@ -705,12 +705,15 @@ static bool reqsk_queue_unlink(struct request_sock *req) · 704 unmodified lines | |||
| 705 | return found; | 705 | return found; |
| 706 | } | 706 | } |
| 707 | 707 | ||
| 708 | void inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req) | 708 | bool inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req) |
| 709 | { | 709 | { |
| 710 | if (reqsk_queue_unlink(req)) { | 710 | bool unlinked = reqsk_queue_unlink(req); |
| 711 | |||
| 712 | if (unlinked) { | ||
| 711 | reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req); | 713 | reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req); |
| 712 | reqsk_put(req); | 714 | reqsk_put(req); |
| 713 | } | 715 | } |
| 716 | return unlinked; | ||
| 714 | } | 717 | } |
| 715 | EXPORT_SYMBOL(inet_csk_reqsk_queue_drop); | 718 | EXPORT_SYMBOL(inet_csk_reqsk_queue_drop); |
| 716 | 719 | ||
| @@ -309,7 +309,7 @@ have_carrier: · 308 unmodified lines | |||
| 309 | */ | 309 | */ |
| 310 | static void __init ic_close_devs(void) | 310 | static void __init ic_close_devs(void) |
| 311 | { | 311 | { |
| 312 | struct net_device *selected_dev = ic_dev->dev; | 312 | struct net_device *selected_dev = ic_dev ? ic_dev->dev : NULL; |
| 313 | struct ic_device *d, *next; | 313 | struct ic_device *d, *next; |
| 314 | struct net_device *dev; | 314 | struct net_device *dev; |
| 315 | 315 | ||
| @@ -317,16 +317,18 @@ static void __init ic_close_devs(void) · 1 unmodified line | |||
| 317 | next = ic_first_dev; | 317 | next = ic_first_dev; |
| 318 | while ((d = next)) { | 318 | while ((d = next)) { |
| 319 | bool bring_down = (d != ic_dev); | 319 | bool bring_down = (d != ic_dev); |
| 320 | struct net_device *lower_dev; | 320 | struct net_device *lower; |
| 321 | struct list_head *iter; | 321 | struct list_head *iter; |
| 322 | 322 | ||
| 323 | next = d->next; | 323 | next = d->next; |
| 324 | dev = d->dev; | 324 | dev = d->dev; |
| 325 | 325 | ||
| 326 | netdev_for_each_lower_dev(selected_dev, lower_dev, iter) { | 326 | if (selected_dev) { |
| 327 | if (dev == lower_dev) { | 327 | netdev_for_each_lower_dev(selected_dev, lower, iter) { |
| 328 | bring_down = false; | 328 | if (dev == lower) { |
| 329 | break; | 329 | bring_down = false; |
| 330 | break; | ||
| 331 | } | ||
| 330 | } | 332 | } |
| 331 | } | 333 | } |
| 332 | if (bring_down) { | 334 | if (bring_down) { |
| @@ -203,7 +203,7 @@ unsigned int arpt_do_table(struct sk_buff *skb, · 202 unmodified lines | |||
| 203 | 203 | ||
| 204 | local_bh_disable(); | 204 | local_bh_disable(); |
| 205 | addend = xt_write_recseq_begin(); | 205 | addend = xt_write_recseq_begin(); |
| 206 | private = rcu_access_pointer(table->private); | 206 | private = READ_ONCE(table->private); /* Address dependency. */ |
| 207 | cpu = smp_processor_id(); | 207 | cpu = smp_processor_id(); |
| 208 | table_base = private->entries; | 208 | table_base = private->entries; |
| 209 | jumpstack = (struct arpt_entry **)private->jumpstack[cpu]; | 209 | jumpstack = (struct arpt_entry **)private->jumpstack[cpu]; |
| @@ -649,7 +649,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) · 439 unmodified lines | |||
| 649 | { | 649 | { |
| 650 | unsigned int countersize; | 650 | unsigned int countersize; |
| 651 | struct xt_counters *counters; | 651 | struct xt_counters *counters; |
| 652 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 652 | const struct xt_table_info *private = table->private; |
| 653 | 653 | ||
| 654 | /* We need atomic snapshot of counters: rest doesn't change | 654 | /* We need atomic snapshot of counters: rest doesn't change |
| 655 | * (other than comefrom, which userspace doesn't care | 655 | * (other than comefrom, which userspace doesn't care |
| @@ -673,7 +673,7 @@ static int copy_entries_to_user(unsigned int total_size, · 17 unmodified lines | |||
| 673 | unsigned int off, num; | 673 | unsigned int off, num; |
| 674 | const struct arpt_entry *e; | 674 | const struct arpt_entry *e; |
| 675 | struct xt_counters *counters; | 675 | struct xt_counters *counters; |
| 676 | struct xt_table_info *private = xt_table_get_private_protected(table); | 676 | struct xt_table_info *private = table->private; |
| 677 | int ret = 0; | 677 | int ret = 0; |
| 678 | void *loc_cpu_entry; | 678 | void *loc_cpu_entry; |
| 679 | 679 | ||
| @@ -807,7 +807,7 @@ static int get_info(struct net *net, void __user *user, const int *len) · 127 unmodified lines | |||
| 807 | t = xt_request_find_table_lock(net, NFPROTO_ARP, name); | 807 | t = xt_request_find_table_lock(net, NFPROTO_ARP, name); |
| 808 | if (!IS_ERR(t)) { | 808 | if (!IS_ERR(t)) { |
| 809 | struct arpt_getinfo info; | 809 | struct arpt_getinfo info; |
| 810 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 810 | const struct xt_table_info *private = t->private; |
| 811 | #ifdef CONFIG_COMPAT | 811 | #ifdef CONFIG_COMPAT |
| 812 | struct xt_table_info tmp; | 812 | struct xt_table_info tmp; |
| 813 | 813 | ||
| @@ -860,7 +860,7 @@ static int get_entries(struct net *net, struct arpt_get_entries __user *uptr, · 46 unmodified lines | |||
| 860 | 860 | ||
| 861 | t = xt_find_table_lock(net, NFPROTO_ARP, get.name); | 861 | t = xt_find_table_lock(net, NFPROTO_ARP, get.name); |
| 862 | if (!IS_ERR(t)) { | 862 | if (!IS_ERR(t)) { |
| 863 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 863 | const struct xt_table_info *private = t->private; |
| 864 | 864 | ||
| 865 | if (get.size == private->size) | 865 | if (get.size == private->size) |
| 866 | ret = copy_entries_to_user(private->size, | 866 | ret = copy_entries_to_user(private->size, |
| @@ -1017,7 +1017,7 @@ static int do_add_counters(struct net *net, sockptr_t arg, unsigned int len) · 150 unmodified lines | |||
| 1017 | } | 1017 | } |
| 1018 | 1018 | ||
| 1019 | local_bh_disable(); | 1019 | local_bh_disable(); |
| 1020 | private = xt_table_get_private_protected(t); | 1020 | private = t->private; |
| 1021 | if (private->number != tmp.num_counters) { | 1021 | if (private->number != tmp.num_counters) { |
| 1022 | ret = -EINVAL; | 1022 | ret = -EINVAL; |
| 1023 | goto unlock_up_free; | 1023 | goto unlock_up_free; |
| @@ -1330,7 +1330,7 @@ static int compat_copy_entries_to_user(unsigned int total_size, · 306 unmodified lines | |||
| 1330 | void __user *userptr) | 1330 | void __user *userptr) |
| 1331 | { | 1331 | { |
| 1332 | struct xt_counters *counters; | 1332 | struct xt_counters *counters; |
| 1333 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 1333 | const struct xt_table_info *private = table->private; |
| 1334 | void __user *pos; | 1334 | void __user *pos; |
| 1335 | unsigned int size; | 1335 | unsigned int size; |
| 1336 | int ret = 0; | 1336 | int ret = 0; |
| @@ -1379,7 +1379,7 @@ static int compat_get_entries(struct net *net, · 42 unmodified lines | |||
| 1379 | xt_compat_lock(NFPROTO_ARP); | 1379 | xt_compat_lock(NFPROTO_ARP); |
| 1380 | t = xt_find_table_lock(net, NFPROTO_ARP, get.name); | 1380 | t = xt_find_table_lock(net, NFPROTO_ARP, get.name); |
| 1381 | if (!IS_ERR(t)) { | 1381 | if (!IS_ERR(t)) { |
| 1382 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 1382 | const struct xt_table_info *private = t->private; |
| 1383 | struct xt_table_info info; | 1383 | struct xt_table_info info; |
| 1384 | 1384 | ||
| 1385 | ret = compat_table_info(private, &info); | 1385 | ret = compat_table_info(private, &info); |
| @@ -258,7 +258,7 @@ ipt_do_table(struct sk_buff *skb, · 257 unmodified lines | |||
| 258 | WARN_ON(!(table->valid_hooks & (1 << hook))); | 258 | WARN_ON(!(table->valid_hooks & (1 << hook))); |
| 259 | local_bh_disable(); | 259 | local_bh_disable(); |
| 260 | addend = xt_write_recseq_begin(); | 260 | addend = xt_write_recseq_begin(); |
| 261 | private = rcu_access_pointer(table->private); | 261 | private = READ_ONCE(table->private); /* Address dependency. */ |
| 262 | cpu = smp_processor_id(); | 262 | cpu = smp_processor_id(); |
| 263 | table_base = private->entries; | 263 | table_base = private->entries; |
| 264 | jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; | 264 | jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; |
| @@ -791,7 +791,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) · 526 unmodified lines | |||
| 791 | { | 791 | { |
| 792 | unsigned int countersize; | 792 | unsigned int countersize; |
| 793 | struct xt_counters *counters; | 793 | struct xt_counters *counters; |
| 794 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 794 | const struct xt_table_info *private = table->private; |
| 795 | 795 | ||
| 796 | /* We need atomic snapshot of counters: rest doesn't change | 796 | /* We need atomic snapshot of counters: rest doesn't change |
| 797 | (other than comefrom, which userspace doesn't care | 797 | (other than comefrom, which userspace doesn't care |
| @@ -815,7 +815,7 @@ copy_entries_to_user(unsigned int total_size, · 17 unmodified lines | |||
| 815 | unsigned int off, num; | 815 | unsigned int off, num; |
| 816 | const struct ipt_entry *e; | 816 | const struct ipt_entry *e; |
| 817 | struct xt_counters *counters; | 817 | struct xt_counters *counters; |
| 818 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 818 | const struct xt_table_info *private = table->private; |
| 819 | int ret = 0; | 819 | int ret = 0; |
| 820 | const void *loc_cpu_entry; | 820 | const void *loc_cpu_entry; |
| 821 | 821 | ||
| @@ -964,7 +964,7 @@ static int get_info(struct net *net, void __user *user, const int *len) · 142 unmodified lines | |||
| 964 | t = xt_request_find_table_lock(net, AF_INET, name); | 964 | t = xt_request_find_table_lock(net, AF_INET, name); |
| 965 | if (!IS_ERR(t)) { | 965 | if (!IS_ERR(t)) { |
| 966 | struct ipt_getinfo info; | 966 | struct ipt_getinfo info; |
| 967 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 967 | const struct xt_table_info *private = t->private; |
| 968 | #ifdef CONFIG_COMPAT | 968 | #ifdef CONFIG_COMPAT |
| 969 | struct xt_table_info tmp; | 969 | struct xt_table_info tmp; |
| 970 | 970 | ||
| @@ -1018,7 +1018,7 @@ get_entries(struct net *net, struct ipt_get_entries __user *uptr, · 47 unmodified lines | |||
| 1018 | 1018 | ||
| 1019 | t = xt_find_table_lock(net, AF_INET, get.name); | 1019 | t = xt_find_table_lock(net, AF_INET, get.name); |
| 1020 | if (!IS_ERR(t)) { | 1020 | if (!IS_ERR(t)) { |
| 1021 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 1021 | const struct xt_table_info *private = t->private; |
| 1022 | if (get.size == private->size) | 1022 | if (get.size == private->size) |
| 1023 | ret = copy_entries_to_user(private->size, | 1023 | ret = copy_entries_to_user(private->size, |
| 1024 | t, uptr->entrytable); | 1024 | t, uptr->entrytable); |
| @@ -1173,7 +1173,7 @@ do_add_counters(struct net *net, sockptr_t arg, unsigned int len) · 148 unmodified lines | |||
| 1173 | } | 1173 | } |
| 1174 | 1174 | ||
| 1175 | local_bh_disable(); | 1175 | local_bh_disable(); |
| 1176 | private = xt_table_get_private_protected(t); | 1176 | private = t->private; |
| 1177 | if (private->number != tmp.num_counters) { | 1177 | if (private->number != tmp.num_counters) { |
| 1178 | ret = -EINVAL; | 1178 | ret = -EINVAL; |
| 1179 | goto unlock_up_free; | 1179 | goto unlock_up_free; |
| @@ -1543,7 +1543,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, · 363 unmodified lines | |||
| 1543 | void __user *userptr) | 1543 | void __user *userptr) |
| 1544 | { | 1544 | { |
| 1545 | struct xt_counters *counters; | 1545 | struct xt_counters *counters; |
| 1546 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 1546 | const struct xt_table_info *private = table->private; |
| 1547 | void __user *pos; | 1547 | void __user *pos; |
| 1548 | unsigned int size; | 1548 | unsigned int size; |
| 1549 | int ret = 0; | 1549 | int ret = 0; |
| @@ -1589,7 +1589,7 @@ compat_get_entries(struct net *net, struct compat_ipt_get_entries __user *uptr, · 39 unmodified lines | |||
| 1589 | xt_compat_lock(AF_INET); | 1589 | xt_compat_lock(AF_INET); |
| 1590 | t = xt_find_table_lock(net, AF_INET, get.name); | 1590 | t = xt_find_table_lock(net, AF_INET, get.name); |
| 1591 | if (!IS_ERR(t)) { | 1591 | if (!IS_ERR(t)) { |
| 1592 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 1592 | const struct xt_table_info *private = t->private; |
| 1593 | struct xt_table_info info; | 1593 | struct xt_table_info info; |
| 1594 | ret = compat_table_info(private, &info); | 1594 | ret = compat_table_info(private, &info); |
| 1595 | if (!ret && get.size == info.size) | 1595 | if (!ret && get.size == info.size) |
| @@ -2687,44 +2687,15 @@ out: · 2686 unmodified lines | |||
| 2687 | return rth; | 2687 | return rth; |
| 2688 | } | 2688 | } |
| 2689 | 2689 | ||
| 2690 | static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 cookie) | ||
| 2691 | { | ||
| 2692 | return NULL; | ||
| 2693 | } | ||
| 2694 | |||
| 2695 | static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) | ||
| 2696 | { | ||
| 2697 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
| 2698 | |||
| 2699 | return mtu ? : dst->dev->mtu; | ||
| 2700 | } | ||
| 2701 | |||
| 2702 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, | ||
| 2703 | struct sk_buff *skb, u32 mtu, | ||
| 2704 | bool confirm_neigh) | ||
| 2705 | { | ||
| 2706 | } | ||
| 2707 | |||
| 2708 | static void ipv4_rt_blackhole_redirect(struct dst_entry *dst, struct sock *sk, | ||
| 2709 | struct sk_buff *skb) | ||
| 2710 | { | ||
| 2711 | } | ||
| 2712 | |||
| 2713 | static u32 *ipv4_rt_blackhole_cow_metrics(struct dst_entry *dst, | ||
| 2714 | unsigned long old) | ||
| 2715 | { | ||
| 2716 | return NULL; | ||
| 2717 | } | ||
| 2718 | |||
| 2719 | static struct dst_ops ipv4_dst_blackhole_ops = { | 2690 | static struct dst_ops ipv4_dst_blackhole_ops = { |
| 2720 | .family = AF_INET, | 2691 | .family = AF_INET, |
| 2721 | .check = ipv4_blackhole_dst_check, | 2692 | .default_advmss = ipv4_default_advmss, |
| 2722 | .mtu = ipv4_blackhole_mtu, | 2693 | .neigh_lookup = ipv4_neigh_lookup, |
| 2723 | .default_advmss = ipv4_default_advmss, | 2694 | .check = dst_blackhole_check, |
| 2724 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, | 2695 | .cow_metrics = dst_blackhole_cow_metrics, |
| 2725 | .redirect = ipv4_rt_blackhole_redirect, | 2696 | .update_pmtu = dst_blackhole_update_pmtu, |
| 2726 | .cow_metrics = ipv4_rt_blackhole_cow_metrics, | 2697 | .redirect = dst_blackhole_redirect, |
| 2727 | .neigh_lookup = ipv4_neigh_lookup, | 2698 | .mtu = dst_blackhole_mtu, |
| 2728 | }; | 2699 | }; |
| 2729 | 2700 | ||
| 2730 | struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig) | 2701 | struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig) |
| @@ -804,8 +804,11 @@ embryonic_reset: · 803 unmodified lines | |||
| 804 | tcp_reset(sk, skb); | 804 | tcp_reset(sk, skb); |
| 805 | } | 805 | } |
| 806 | if (!fastopen) { | 806 | if (!fastopen) { |
| 807 | inet_csk_reqsk_queue_drop(sk, req); | 807 | bool unlinked = inet_csk_reqsk_queue_drop(sk, req); |
| 808 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS); | 808 | |
| 809 | if (unlinked) | ||
| 810 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS); | ||
| 811 | *req_stolen = !unlinked; | ||
| 809 | } | 812 | } |
| 810 | return NULL; | 813 | return NULL; |
| 811 | } | 814 | } |
| @@ -2486,7 +2486,7 @@ static int ipv6_route_native_seq_show(struct seq_file *seq, void *v) · 2485 unmodified lines | |||
| 2486 | const struct net_device *dev; | 2486 | const struct net_device *dev; |
| 2487 | 2487 | ||
| 2488 | if (rt->nh) | 2488 | if (rt->nh) |
| 2489 | fib6_nh = nexthop_fib6_nh(rt->nh); | 2489 | fib6_nh = nexthop_fib6_nh_bh(rt->nh); |
| 2490 | 2490 | ||
| 2491 | seq_printf(seq, "%pi6 %02x ", &rt->fib6_dst.addr, rt->fib6_dst.plen); | 2491 | seq_printf(seq, "%pi6 %02x ", &rt->fib6_dst.addr, rt->fib6_dst.plen); |
| 2492 | 2492 | ||
| @@ -245,16 +245,6 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev, · 244 unmodified lines | |||
| 245 | if (ipv6_addr_is_multicast(&hdr->saddr)) | 245 | if (ipv6_addr_is_multicast(&hdr->saddr)) |
| 246 | goto err; | 246 | goto err; |
| 247 | 247 | ||
| 248 | /* While RFC4291 is not explicit about v4mapped addresses | ||
| 249 | * in IPv6 headers, it seems clear linux dual-stack | ||
| 250 | * model can not deal properly with these. | ||
| 251 | * Security models could be fooled by ::ffff:127.0.0.1 for example. | ||
| 252 | * | ||
| 253 | * https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02 | ||
| 254 | */ | ||
| 255 | if (ipv6_addr_v4mapped(&hdr->saddr)) | ||
| 256 | goto err; | ||
| 257 | |||
| 258 | skb->transport_header = skb->network_header + sizeof(*hdr); | 248 | skb->transport_header = skb->network_header + sizeof(*hdr); |
| 259 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); | 249 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
| 260 | 250 | ||
| @@ -280,7 +280,7 @@ ip6t_do_table(struct sk_buff *skb, · 279 unmodified lines | |||
| 280 | 280 | ||
| 281 | local_bh_disable(); | 281 | local_bh_disable(); |
| 282 | addend = xt_write_recseq_begin(); | 282 | addend = xt_write_recseq_begin(); |
| 283 | private = rcu_access_pointer(table->private); | 283 | private = READ_ONCE(table->private); /* Address dependency. */ |
| 284 | cpu = smp_processor_id(); | 284 | cpu = smp_processor_id(); |
| 285 | table_base = private->entries; | 285 | table_base = private->entries; |
| 286 | jumpstack = (struct ip6t_entry **)private->jumpstack[cpu]; | 286 | jumpstack = (struct ip6t_entry **)private->jumpstack[cpu]; |
| @@ -807,7 +807,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) · 520 unmodified lines | |||
| 807 | { | 807 | { |
| 808 | unsigned int countersize; | 808 | unsigned int countersize; |
| 809 | struct xt_counters *counters; | 809 | struct xt_counters *counters; |
| 810 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 810 | const struct xt_table_info *private = table->private; |
| 811 | 811 | ||
| 812 | /* We need atomic snapshot of counters: rest doesn't change | 812 | /* We need atomic snapshot of counters: rest doesn't change |
| 813 | (other than comefrom, which userspace doesn't care | 813 | (other than comefrom, which userspace doesn't care |
| @@ -831,7 +831,7 @@ copy_entries_to_user(unsigned int total_size, · 17 unmodified lines | |||
| 831 | unsigned int off, num; | 831 | unsigned int off, num; |
| 832 | const struct ip6t_entry *e; | 832 | const struct ip6t_entry *e; |
| 833 | struct xt_counters *counters; | 833 | struct xt_counters *counters; |
| 834 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 834 | const struct xt_table_info *private = table->private; |
| 835 | int ret = 0; | 835 | int ret = 0; |
| 836 | const void *loc_cpu_entry; | 836 | const void *loc_cpu_entry; |
| 837 | 837 | ||
| @@ -980,7 +980,7 @@ static int get_info(struct net *net, void __user *user, const int *len) · 142 unmodified lines | |||
| 980 | t = xt_request_find_table_lock(net, AF_INET6, name); | 980 | t = xt_request_find_table_lock(net, AF_INET6, name); |
| 981 | if (!IS_ERR(t)) { | 981 | if (!IS_ERR(t)) { |
| 982 | struct ip6t_getinfo info; | 982 | struct ip6t_getinfo info; |
| 983 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 983 | const struct xt_table_info *private = t->private; |
| 984 | #ifdef CONFIG_COMPAT | 984 | #ifdef CONFIG_COMPAT |
| 985 | struct xt_table_info tmp; | 985 | struct xt_table_info tmp; |
| 986 | 986 | ||
| @@ -1035,7 +1035,7 @@ get_entries(struct net *net, struct ip6t_get_entries __user *uptr, · 48 unmodified lines | |||
| 1035 | 1035 | ||
| 1036 | t = xt_find_table_lock(net, AF_INET6, get.name); | 1036 | t = xt_find_table_lock(net, AF_INET6, get.name); |
| 1037 | if (!IS_ERR(t)) { | 1037 | if (!IS_ERR(t)) { |
| 1038 | struct xt_table_info *private = xt_table_get_private_protected(t); | 1038 | struct xt_table_info *private = t->private; |
| 1039 | if (get.size == private->size) | 1039 | if (get.size == private->size) |
| 1040 | ret = copy_entries_to_user(private->size, | 1040 | ret = copy_entries_to_user(private->size, |
| 1041 | t, uptr->entrytable); | 1041 | t, uptr->entrytable); |
| @@ -1189,7 +1189,7 @@ do_add_counters(struct net *net, sockptr_t arg, unsigned int len) · 147 unmodified lines | |||
| 1189 | } | 1189 | } |
| 1190 | 1190 | ||
| 1191 | local_bh_disable(); | 1191 | local_bh_disable(); |
| 1192 | private = xt_table_get_private_protected(t); | 1192 | private = t->private; |
| 1193 | if (private->number != tmp.num_counters) { | 1193 | if (private->number != tmp.num_counters) { |
| 1194 | ret = -EINVAL; | 1194 | ret = -EINVAL; |
| 1195 | goto unlock_up_free; | 1195 | goto unlock_up_free; |
| @@ -1552,7 +1552,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, · 356 unmodified lines | |||
| 1552 | void __user *userptr) | 1552 | void __user *userptr) |
| 1553 | { | 1553 | { |
| 1554 | struct xt_counters *counters; | 1554 | struct xt_counters *counters; |
| 1555 | const struct xt_table_info *private = xt_table_get_private_protected(table); | 1555 | const struct xt_table_info *private = table->private; |
| 1556 | void __user *pos; | 1556 | void __user *pos; |
| 1557 | unsigned int size; | 1557 | unsigned int size; |
| 1558 | int ret = 0; | 1558 | int ret = 0; |
| @@ -1598,7 +1598,7 @@ compat_get_entries(struct net *net, struct compat_ip6t_get_entries __user *uptr, · 39 unmodified lines | |||
| 1598 | xt_compat_lock(AF_INET6); | 1598 | xt_compat_lock(AF_INET6); |
| 1599 | t = xt_find_table_lock(net, AF_INET6, get.name); | 1599 | t = xt_find_table_lock(net, AF_INET6, get.name); |
| 1600 | if (!IS_ERR(t)) { | 1600 | if (!IS_ERR(t)) { |
| 1601 | const struct xt_table_info *private = xt_table_get_private_protected(t); | 1601 | const struct xt_table_info *private = t->private; |
| 1602 | struct xt_table_info info; | 1602 | struct xt_table_info info; |
| 1603 | ret = compat_table_info(private, &info); | 1603 | ret = compat_table_info(private, &info); |
| 1604 | if (!ret && get.size == info.size) | 1604 | if (!ret && get.size == info.size) |
| @@ -260,34 +260,16 @@ static struct dst_ops ip6_dst_ops_template = { · 259 unmodified lines | |||
| 260 | .confirm_neigh = ip6_confirm_neigh, | 260 | .confirm_neigh = ip6_confirm_neigh, |
| 261 | }; | 261 | }; |
| 262 | 262 | ||
| 263 | static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) | ||
| 264 | { | ||
| 265 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
| 266 | |||
| 267 | return mtu ? : dst->dev->mtu; | ||
| 268 | } | ||
| 269 | |||
| 270 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, | ||
| 271 | struct sk_buff *skb, u32 mtu, | ||
| 272 | bool confirm_neigh) | ||
| 273 | { | ||
| 274 | } | ||
| 275 | |||
| 276 | static void ip6_rt_blackhole_redirect(struct dst_entry *dst, struct sock *sk, | ||
| 277 | struct sk_buff *skb) | ||
| 278 | { | ||
| 279 | } | ||
| 280 | |||
| 281 | static struct dst_ops ip6_dst_blackhole_ops = { | 263 | static struct dst_ops ip6_dst_blackhole_ops = { |
| 282 | .family = AF_INET6, | 264 | .family = AF_INET6, |
| 283 | .destroy = ip6_dst_destroy, | 265 | .default_advmss = ip6_default_advmss, |
| 284 | .check = ip6_dst_check, | 266 | .neigh_lookup = ip6_dst_neigh_lookup, |
| 285 | .mtu = ip6_blackhole_mtu, | 267 | .check = ip6_dst_check, |
| 286 | .default_advmss = ip6_default_advmss, | 268 | .destroy = ip6_dst_destroy, |
| 287 | .update_pmtu = ip6_rt_blackhole_update_pmtu, | 269 | .cow_metrics = dst_cow_metrics_generic, |
| 288 | .redirect = ip6_rt_blackhole_redirect, | 270 | .update_pmtu = dst_blackhole_update_pmtu, |
| 289 | .cow_metrics = dst_cow_metrics_generic, | 271 | .redirect = dst_blackhole_redirect, |
| 290 | .neigh_lookup = ip6_dst_neigh_lookup, | 272 | .mtu = dst_blackhole_mtu, |
| 291 | }; | 273 | }; |
| 292 | 274 | ||
| 293 | static const u32 ip6_template_metrics[RTAX_MAX] = { | 275 | static const u32 ip6_template_metrics[RTAX_MAX] = { |
| @@ -1175,6 +1175,11 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) · 1174 unmodified lines | |||
| 1175 | if (!ipv6_unicast_destination(skb)) | 1175 | if (!ipv6_unicast_destination(skb)) |
| 1176 | goto drop; | 1176 | goto drop; |
| 1177 | 1177 | ||
| 1178 | if (ipv6_addr_v4mapped(&ipv6_hdr(skb)->saddr)) { | ||
| 1179 | __IP6_INC_STATS(sock_net(sk), NULL, IPSTATS_MIB_INHDRERRORS); | ||
| 1180 | return 0; | ||
| 1181 | } | ||
| 1182 | |||
| 1178 | return tcp_conn_request(&tcp6_request_sock_ops, | 1183 | return tcp_conn_request(&tcp6_request_sock_ops, |
| 1179 | &tcp_request_sock_ipv6_ops, sk, skb); | 1184 | &tcp_request_sock_ipv6_ops, sk, skb); |
| 1180 | 1185 | ||
| @@ -23,6 +23,7 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, · 22 unmodified lines | |||
| 23 | struct aead_request *aead_req; | 23 | struct aead_request *aead_req; |
| 24 | int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); | 24 | int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); |
| 25 | u8 *__aad; | 25 | u8 *__aad; |
| 26 | int ret; | ||
| 26 | 27 | ||
| 27 | aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC); | 28 | aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC); |
| 28 | if (!aead_req) | 29 | if (!aead_req) |
| @@ -40,10 +41,10 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, · 11 unmodified lines | |||
| 40 | aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); | 41 | aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); |
| 41 | aead_request_set_ad(aead_req, sg[0].length); | 42 | aead_request_set_ad(aead_req, sg[0].length); |
| 42 | 43 | ||
| 43 | crypto_aead_encrypt(aead_req); | 44 | ret = crypto_aead_encrypt(aead_req); |
| 44 | kfree_sensitive(aead_req); | 45 | kfree_sensitive(aead_req); |
| 45 | 46 | ||
| 46 | return 0; | 47 | return ret; |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, | 50 | int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, |
| @@ -22,6 +22,7 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, · 21 unmodified lines | |||
| 22 | struct aead_request *aead_req; | 22 | struct aead_request *aead_req; |
| 23 | int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); | 23 | int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); |
| 24 | const __le16 *fc; | 24 | const __le16 *fc; |
| 25 | int ret; | ||
| 25 | 26 | ||
| 26 | if (data_len < GMAC_MIC_LEN) | 27 | if (data_len < GMAC_MIC_LEN) |
| 27 | return -EINVAL; | 28 | return -EINVAL; |
| @@ -59,10 +60,10 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, · 31 unmodified lines | |||
| 59 | aead_request_set_crypt(aead_req, sg, sg, 0, iv); | 60 | aead_request_set_crypt(aead_req, sg, sg, 0, iv); |
| 60 | aead_request_set_ad(aead_req, GMAC_AAD_LEN + data_len); | 61 | aead_request_set_ad(aead_req, GMAC_AAD_LEN + data_len); |
| 61 | 62 | ||
| 62 | crypto_aead_encrypt(aead_req); | 63 | ret = crypto_aead_encrypt(aead_req); |
| 63 | kfree_sensitive(aead_req); | 64 | kfree_sensitive(aead_req); |
| 64 | 65 | ||
| 65 | return 0; | 66 | return ret; |
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[], | 69 | struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[], |
| @@ -2950,14 +2950,14 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, · 2949 unmodified lines | |||
| 2950 | continue; | 2950 | continue; |
| 2951 | 2951 | ||
| 2952 | for (j = 0; j < IEEE80211_HT_MCS_MASK_LEN; j++) { | 2952 | for (j = 0; j < IEEE80211_HT_MCS_MASK_LEN; j++) { |
| 2953 | if (~sdata->rc_rateidx_mcs_mask[i][j]) { | 2953 | if (sdata->rc_rateidx_mcs_mask[i][j] != 0xff) { |
| 2954 | sdata->rc_has_mcs_mask[i] = true; | 2954 | sdata->rc_has_mcs_mask[i] = true; |
| 2955 | break; | 2955 | break; |
| 2956 | } | 2956 | } |
| 2957 | } | 2957 | } |
| 2958 | 2958 | ||
| 2959 | for (j = 0; j < NL80211_VHT_NSS_MAX; j++) { | 2959 | for (j = 0; j < NL80211_VHT_NSS_MAX; j++) { |
| 2960 | if (~sdata->rc_rateidx_vht_mcs_mask[i][j]) { | 2960 | if (sdata->rc_rateidx_vht_mcs_mask[i][j] != 0xffff) { |
| 2961 | sdata->rc_has_vht_mcs_mask[i] = true; | 2961 | sdata->rc_has_vht_mcs_mask[i] = true; |
| 2962 | break; | 2962 | break; |
| 2963 | } | 2963 | } |
| @@ -1874,6 +1874,8 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) · 1873 unmodified lines | |||
| 1874 | 1874 | ||
| 1875 | /* remove beacon */ | 1875 | /* remove beacon */ |
| 1876 | kfree(sdata->u.ibss.ie); | 1876 | kfree(sdata->u.ibss.ie); |
| 1877 | sdata->u.ibss.ie = NULL; | ||
| 1878 | sdata->u.ibss.ie_len = 0; | ||
| 1877 | 1879 | ||
| 1878 | /* on the next join, re-program HT parameters */ | 1880 | /* on the next join, re-program HT parameters */ |
| 1879 | memset(&ifibss->ht_capa, 0, sizeof(ifibss->ht_capa)); | 1881 | memset(&ifibss->ht_capa, 0, sizeof(ifibss->ht_capa)); |
| @@ -973,8 +973,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 972 unmodified lines | |||
| 973 | continue; | 973 | continue; |
| 974 | 974 | ||
| 975 | if (!dflt_chandef.chan) { | 975 | if (!dflt_chandef.chan) { |
| 976 | /* | ||
| 977 | * Assign the first enabled channel to dflt_chandef | ||
| 978 | * from the list of channels | ||
| 979 | */ | ||
| 980 | for (i = 0; i < sband->n_channels; i++) | ||
| 981 | if (!(sband->channels[i].flags & | ||
| 982 | IEEE80211_CHAN_DISABLED)) | ||
| 983 | break; | ||
| 984 | /* if none found then use the first anyway */ | ||
| 985 | if (i == sband->n_channels) | ||
| 986 | i = 0; | ||
| 976 | cfg80211_chandef_create(&dflt_chandef, | 987 | cfg80211_chandef_create(&dflt_chandef, |
| 977 | &sband->channels[0], | 988 | &sband->channels[i], |
| 978 | NL80211_CHAN_NO_HT); | 989 | NL80211_CHAN_NO_HT); |
| 979 | /* init channel we're on */ | 990 | /* init channel we're on */ |
| 980 | if (!local->use_chanctx && !local->_oper_chandef.chan) { | 991 | if (!local->use_chanctx && !local->_oper_chandef.chan) { |
| @@ -5071,7 +5071,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 5070 unmodified lines | |||
| 5071 | he_oper_ie = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_OPERATION, | 5071 | he_oper_ie = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_OPERATION, |
| 5072 | ies->data, ies->len); | 5072 | ies->data, ies->len); |
| 5073 | if (he_oper_ie && | 5073 | if (he_oper_ie && |
| 5074 | he_oper_ie[1] == ieee80211_he_oper_size(&he_oper_ie[3])) | 5074 | he_oper_ie[1] >= ieee80211_he_oper_size(&he_oper_ie[3])) |
| 5075 | he_oper = (void *)(he_oper_ie + 3); | 5075 | he_oper = (void *)(he_oper_ie + 3); |
| 5076 | else | 5076 | else |
| 5077 | he_oper = NULL; | 5077 | he_oper = NULL; |
| @@ -805,7 +805,6 @@ minstrel_ht_group_min_rate_offset(struct minstrel_ht_sta *mi, int group, · 804 unmodified lines | |||
| 805 | static u16 | 805 | static u16 |
| 806 | minstrel_ht_next_inc_rate(struct minstrel_ht_sta *mi, u32 fast_rate_dur) | 806 | minstrel_ht_next_inc_rate(struct minstrel_ht_sta *mi, u32 fast_rate_dur) |
| 807 | { | 807 | { |
| 808 | struct minstrel_mcs_group_data *mg; | ||
| 809 | u8 type = MINSTREL_SAMPLE_TYPE_INC; | 808 | u8 type = MINSTREL_SAMPLE_TYPE_INC; |
| 810 | int i, index = 0; | 809 | int i, index = 0; |
| 811 | u8 group; | 810 | u8 group; |
| @@ -813,7 +812,6 @@ minstrel_ht_next_inc_rate(struct minstrel_ht_sta *mi, u32 fast_rate_dur) · 1 unmodified line | |||
| 813 | group = mi->sample[type].sample_group; | 812 | group = mi->sample[type].sample_group; |
| 814 | for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) { | 813 | for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) { |
| 815 | group = (group + 1) % ARRAY_SIZE(minstrel_mcs_groups); | 814 | group = (group + 1) % ARRAY_SIZE(minstrel_mcs_groups); |
| 816 | mg = &mi->groups[group]; | ||
| 817 | 815 | ||
| 818 | index = minstrel_ht_group_min_rate_offset(mi, group, | 816 | index = minstrel_ht_group_min_rate_offset(mi, group, |
| 819 | fast_rate_dur); | 817 | fast_rate_dur); |
| @@ -968,7 +968,7 @@ static void ieee80211_parse_extension_element(u32 *crc, · 967 unmodified lines | |||
| 968 | break; | 968 | break; |
| 969 | case WLAN_EID_EXT_HE_OPERATION: | 969 | case WLAN_EID_EXT_HE_OPERATION: |
| 970 | if (len >= sizeof(*elems->he_operation) && | 970 | if (len >= sizeof(*elems->he_operation) && |
| 971 | len == ieee80211_he_oper_size(data) - 1) { | 971 | len >= ieee80211_he_oper_size(data) - 1) { |
| 972 | if (crc) | 972 | if (crc) |
| 973 | *crc = crc32_be(*crc, (void *)elem, | 973 | *crc = crc32_be(*crc, (void *)elem, |
| 974 | elem->datalen + 2); | 974 | elem->datalen + 2); |
| @@ -567,15 +567,15 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · 566 unmodified lines | |||
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | static u64 add_addr_generate_hmac(u64 key1, u64 key2, u8 addr_id, | 569 | static u64 add_addr_generate_hmac(u64 key1, u64 key2, u8 addr_id, |
| 570 | struct in_addr *addr) | 570 | struct in_addr *addr, u16 port) |
| 571 | { | 571 | { |
| 572 | u8 hmac[SHA256_DIGEST_SIZE]; | 572 | u8 hmac[SHA256_DIGEST_SIZE]; |
| 573 | u8 msg[7]; | 573 | u8 msg[7]; |
| 574 | 574 | ||
| 575 | msg[0] = addr_id; | 575 | msg[0] = addr_id; |
| 576 | memcpy(&msg[1], &addr->s_addr, 4); | 576 | memcpy(&msg[1], &addr->s_addr, 4); |
| 577 | msg[5] = 0; | 577 | msg[5] = port >> 8; |
| 578 | msg[6] = 0; | 578 | msg[6] = port & 0xFF; |
| 579 | 579 | ||
| 580 | mptcp_crypto_hmac_sha(key1, key2, msg, 7, hmac); | 580 | mptcp_crypto_hmac_sha(key1, key2, msg, 7, hmac); |
| 581 | 581 | ||
| @@ -584,15 +584,15 @@ static u64 add_addr_generate_hmac(u64 key1, u64 key2, u8 addr_id, · 2 unmodified lines | |||
| 584 | 584 | ||
| 585 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) | 585 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) |
| 586 | static u64 add_addr6_generate_hmac(u64 key1, u64 key2, u8 addr_id, | 586 | static u64 add_addr6_generate_hmac(u64 key1, u64 key2, u8 addr_id, |
| 587 | struct in6_addr *addr) | 587 | struct in6_addr *addr, u16 port) |
| 588 | { | 588 | { |
| 589 | u8 hmac[SHA256_DIGEST_SIZE]; | 589 | u8 hmac[SHA256_DIGEST_SIZE]; |
| 590 | u8 msg[19]; | 590 | u8 msg[19]; |
| 591 | 591 | ||
| 592 | msg[0] = addr_id; | 592 | msg[0] = addr_id; |
| 593 | memcpy(&msg[1], &addr->s6_addr, 16); | 593 | memcpy(&msg[1], &addr->s6_addr, 16); |
| 594 | msg[17] = 0; | 594 | msg[17] = port >> 8; |
| 595 | msg[18] = 0; | 595 | msg[18] = port & 0xFF; |
| 596 | 596 | ||
| 597 | mptcp_crypto_hmac_sha(key1, key2, msg, 19, hmac); | 597 | mptcp_crypto_hmac_sha(key1, key2, msg, 19, hmac); |
| 598 | 598 | ||
| @@ -646,7 +646,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * · 47 unmodified lines | |||
| 646 | opts->ahmac = add_addr_generate_hmac(msk->local_key, | 646 | opts->ahmac = add_addr_generate_hmac(msk->local_key, |
| 647 | msk->remote_key, | 647 | msk->remote_key, |
| 648 | opts->addr_id, | 648 | opts->addr_id, |
| 649 | &opts->addr); | 649 | &opts->addr, |
| 650 | opts->port); | ||
| 650 | } | 651 | } |
| 651 | } | 652 | } |
| 652 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) | 653 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) |
| @@ -657,7 +658,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * · 4 unmodified lines | |||
| 657 | opts->ahmac = add_addr6_generate_hmac(msk->local_key, | 658 | opts->ahmac = add_addr6_generate_hmac(msk->local_key, |
| 658 | msk->remote_key, | 659 | msk->remote_key, |
| 659 | opts->addr_id, | 660 | opts->addr_id, |
| 660 | &opts->addr6); | 661 | &opts->addr6, |
| 662 | opts->port); | ||
| 661 | } | 663 | } |
| 662 | } | 664 | } |
| 663 | #endif | 665 | #endif |
| @@ -962,12 +964,14 @@ static bool add_addr_hmac_valid(struct mptcp_sock *msk, · 298 unmodified lines | |||
| 962 | if (mp_opt->family == MPTCP_ADDR_IPVERSION_4) | 964 | if (mp_opt->family == MPTCP_ADDR_IPVERSION_4) |
| 963 | hmac = add_addr_generate_hmac(msk->remote_key, | 965 | hmac = add_addr_generate_hmac(msk->remote_key, |
| 964 | msk->local_key, | 966 | msk->local_key, |
| 965 | mp_opt->addr_id, &mp_opt->addr); | 967 | mp_opt->addr_id, &mp_opt->addr, |
| 968 | mp_opt->port); | ||
| 966 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) | 969 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) |
| 967 | else | 970 | else |
| 968 | hmac = add_addr6_generate_hmac(msk->remote_key, | 971 | hmac = add_addr6_generate_hmac(msk->remote_key, |
| 969 | msk->local_key, | 972 | msk->local_key, |
| 970 | mp_opt->addr_id, &mp_opt->addr6); | 973 | mp_opt->addr_id, &mp_opt->addr6, |
| 974 | mp_opt->port); | ||
| 971 | #endif | 975 | #endif |
| 972 | 976 | ||
| 973 | pr_debug("msk=%p, ahmac=%llu, mp_opt->ahmac=%llu\n", | 977 | pr_debug("msk=%p, ahmac=%llu, mp_opt->ahmac=%llu\n", |
| @@ -2968,7 +2968,7 @@ static void mptcp_release_cb(struct sock *sk) · 2967 unmodified lines | |||
| 2968 | for (;;) { | 2968 | for (;;) { |
| 2969 | flags = 0; | 2969 | flags = 0; |
| 2970 | if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) | 2970 | if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) |
| 2971 | flags |= MPTCP_PUSH_PENDING; | 2971 | flags |= BIT(MPTCP_PUSH_PENDING); |
| 2972 | if (!flags) | 2972 | if (!flags) |
| 2973 | break; | 2973 | break; |
| 2974 | 2974 | ||
| @@ -2981,7 +2981,7 @@ static void mptcp_release_cb(struct sock *sk) · 6 unmodified lines | |||
| 2981 | */ | 2981 | */ |
| 2982 | 2982 | ||
| 2983 | spin_unlock_bh(&sk->sk_lock.slock); | 2983 | spin_unlock_bh(&sk->sk_lock.slock); |
| 2984 | if (flags & MPTCP_PUSH_PENDING) | 2984 | if (flags & BIT(MPTCP_PUSH_PENDING)) |
| 2985 | __mptcp_push_pending(sk, 0); | 2985 | __mptcp_push_pending(sk, 0); |
| 2986 | 2986 | ||
| 2987 | cond_resched(); | 2987 | cond_resched(); |
| @@ -477,6 +477,11 @@ static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) · 476 unmodified lines | |||
| 477 | if (!ipv6_unicast_destination(skb)) | 477 | if (!ipv6_unicast_destination(skb)) |
| 478 | goto drop; | 478 | goto drop; |
| 479 | 479 | ||
| 480 | if (ipv6_addr_v4mapped(&ipv6_hdr(skb)->saddr)) { | ||
| 481 | __IP6_INC_STATS(sock_net(sk), NULL, IPSTATS_MIB_INHDRERRORS); | ||
| 482 | return 0; | ||
| 483 | } | ||
| 484 | |||
| 480 | return tcp_conn_request(&mptcp_subflow_request_sock_ops, | 485 | return tcp_conn_request(&mptcp_subflow_request_sock_ops, |
| 481 | &subflow_request_sock_ipv6_ops, sk, skb); | 486 | &subflow_request_sock_ipv6_ops, sk, skb); |
| 482 | 487 | ||
| @@ -2962,6 +2962,7 @@ static int ctnetlink_exp_dump_mask(struct sk_buff *skb, · 2961 unmodified lines | |||
| 2962 | memset(&m, 0xFF, sizeof(m)); | 2962 | memset(&m, 0xFF, sizeof(m)); |
| 2963 | memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3)); | 2963 | memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3)); |
| 2964 | m.src.u.all = mask->src.u.all; | 2964 | m.src.u.all = mask->src.u.all; |
| 2965 | m.src.l3num = tuple->src.l3num; | ||
| 2965 | m.dst.protonum = tuple->dst.protonum; | 2966 | m.dst.protonum = tuple->dst.protonum; |
| 2966 | 2967 | ||
| 2967 | nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK); | 2968 | nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK); |
| @@ -218,9 +218,6 @@ int nf_conntrack_gre_packet(struct nf_conn *ct, · 217 unmodified lines | |||
| 218 | enum ip_conntrack_info ctinfo, | 218 | enum ip_conntrack_info ctinfo, |
| 219 | const struct nf_hook_state *state) | 219 | const struct nf_hook_state *state) |
| 220 | { | 220 | { |
| 221 | if (state->pf != NFPROTO_IPV4) | ||
| 222 | return -NF_ACCEPT; | ||
| 223 | |||
| 224 | if (!nf_ct_is_confirmed(ct)) { | 221 | if (!nf_ct_is_confirmed(ct)) { |
| 225 | unsigned int *timeouts = nf_ct_timeout_lookup(ct); | 222 | unsigned int *timeouts = nf_ct_timeout_lookup(ct); |
| 226 | 223 | ||
| @@ -506,7 +506,7 @@ int nf_flow_table_init(struct nf_flowtable *flowtable) · 505 unmodified lines | |||
| 506 | { | 506 | { |
| 507 | int err; | 507 | int err; |
| 508 | 508 | ||
| 509 | INIT_DEFERRABLE_WORK(&flowtable->gc_work, nf_flow_offload_work_gc); | 509 | INIT_DELAYED_WORK(&flowtable->gc_work, nf_flow_offload_work_gc); |
| 510 | flow_block_init(&flowtable->flow_block); | 510 | flow_block_init(&flowtable->flow_block); |
| 511 | init_rwsem(&flowtable->flow_block_lock); | 511 | init_rwsem(&flowtable->flow_block_lock); |
| 512 | 512 | ||
| @@ -6783,6 +6783,9 @@ static int nft_register_flowtable_net_hooks(struct net *net, · 6782 unmodified lines | |||
| 6783 | 6783 | ||
| 6784 | list_for_each_entry(hook, hook_list, list) { | 6784 | list_for_each_entry(hook, hook_list, list) { |
| 6785 | list_for_each_entry(ft, &table->flowtables, list) { | 6785 | list_for_each_entry(ft, &table->flowtables, list) { |
| 6786 | if (!nft_is_active_next(net, ft)) | ||
| 6787 | continue; | ||
| 6788 | |||
| 6786 | list_for_each_entry(hook2, &ft->hook_list, list) { | 6789 | list_for_each_entry(hook2, &ft->hook_list, list) { |
| 6787 | if (hook->ops.dev == hook2->ops.dev && | 6790 | if (hook->ops.dev == hook2->ops.dev && |
| 6788 | hook->ops.pf == hook2->ops.pf) { | 6791 | hook->ops.pf == hook2->ops.pf) { |
| @@ -6842,6 +6845,7 @@ static int nft_flowtable_update(struct nft_ctx *ctx, const struct nlmsghdr *nlh, · 53 unmodified lines | |||
| 6842 | struct nft_hook *hook, *next; | 6845 | struct nft_hook *hook, *next; |
| 6843 | struct nft_trans *trans; | 6846 | struct nft_trans *trans; |
| 6844 | bool unregister = false; | 6847 | bool unregister = false; |
| 6848 | u32 flags; | ||
| 6845 | int err; | 6849 | int err; |
| 6846 | 6850 | ||
| 6847 | err = nft_flowtable_parse_hook(ctx, nla[NFTA_FLOWTABLE_HOOK], | 6851 | err = nft_flowtable_parse_hook(ctx, nla[NFTA_FLOWTABLE_HOOK], |
| @@ -6856,6 +6860,17 @@ static int nft_flowtable_update(struct nft_ctx *ctx, const struct nlmsghdr *nlh, · 8 unmodified lines | |||
| 6856 | } | 6860 | } |
| 6857 | } | 6861 | } |
| 6858 | 6862 | ||
| 6863 | if (nla[NFTA_FLOWTABLE_FLAGS]) { | ||
| 6864 | flags = ntohl(nla_get_be32(nla[NFTA_FLOWTABLE_FLAGS])); | ||
| 6865 | if (flags & ~NFT_FLOWTABLE_MASK) | ||
| 6866 | return -EOPNOTSUPP; | ||
| 6867 | if ((flowtable->data.flags & NFT_FLOWTABLE_HW_OFFLOAD) ^ | ||
| 6868 | (flags & NFT_FLOWTABLE_HW_OFFLOAD)) | ||
| 6869 | return -EOPNOTSUPP; | ||
| 6870 | } else { | ||
| 6871 | flags = flowtable->data.flags; | ||
| 6872 | } | ||
| 6873 | |||
| 6859 | err = nft_register_flowtable_net_hooks(ctx->net, ctx->table, | 6874 | err = nft_register_flowtable_net_hooks(ctx->net, ctx->table, |
| 6860 | &flowtable_hook.list, flowtable); | 6875 | &flowtable_hook.list, flowtable); |
| 6861 | if (err < 0) | 6876 | if (err < 0) |
| @@ -6869,6 +6884,7 @@ static int nft_flowtable_update(struct nft_ctx *ctx, const struct nlmsghdr *nlh, · 7 unmodified lines | |||
| 6869 | goto err_flowtable_update_hook; | 6884 | goto err_flowtable_update_hook; |
| 6870 | } | 6885 | } |
| 6871 | 6886 | ||
| 6887 | nft_trans_flowtable_flags(trans) = flags; | ||
| 6872 | nft_trans_flowtable(trans) = flowtable; | 6888 | nft_trans_flowtable(trans) = flowtable; |
| 6873 | nft_trans_flowtable_update(trans) = true; | 6889 | nft_trans_flowtable_update(trans) = true; |
| 6874 | INIT_LIST_HEAD(&nft_trans_flowtable_hooks(trans)); | 6890 | INIT_LIST_HEAD(&nft_trans_flowtable_hooks(trans)); |
| @@ -6963,8 +6979,10 @@ static int nf_tables_newflowtable(struct net *net, struct sock *nlsk, · 88 unmodified lines | |||
| 6963 | if (nla[NFTA_FLOWTABLE_FLAGS]) { | 6979 | if (nla[NFTA_FLOWTABLE_FLAGS]) { |
| 6964 | flowtable->data.flags = | 6980 | flowtable->data.flags = |
| 6965 | ntohl(nla_get_be32(nla[NFTA_FLOWTABLE_FLAGS])); | 6981 | ntohl(nla_get_be32(nla[NFTA_FLOWTABLE_FLAGS])); |
| 6966 | if (flowtable->data.flags & ~NFT_FLOWTABLE_MASK) | 6982 | if (flowtable->data.flags & ~NFT_FLOWTABLE_MASK) { |
| 6983 | err = -EOPNOTSUPP; | ||
| 6967 | goto err3; | 6984 | goto err3; |
| 6985 | } | ||
| 6968 | } | 6986 | } |
| 6969 | 6987 | ||
| 6970 | write_pnet(&flowtable->data.net, net); | 6988 | write_pnet(&flowtable->data.net, net); |
| @@ -8176,6 +8194,8 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) · 1205 unmodified lines | |||
| 8176 | break; | 8194 | break; |
| 8177 | case NFT_MSG_NEWFLOWTABLE: | 8195 | case NFT_MSG_NEWFLOWTABLE: |
| 8178 | if (nft_trans_flowtable_update(trans)) { | 8196 | if (nft_trans_flowtable_update(trans)) { |
| 8197 | nft_trans_flowtable(trans)->data.flags = | ||
| 8198 | nft_trans_flowtable_flags(trans); | ||
| 8179 | nf_tables_flowtable_notify(&trans->ctx, | 8199 | nf_tables_flowtable_notify(&trans->ctx, |
| 8180 | nft_trans_flowtable(trans), | 8200 | nft_trans_flowtable(trans), |
| 8181 | &nft_trans_flowtable_hooks(trans), | 8201 | &nft_trans_flowtable_hooks(trans), |
| @@ -1351,14 +1351,6 @@ struct xt_counters *xt_counters_alloc(unsigned int counters) · 1350 unmodified lines | |||
| 1351 | } | 1351 | } |
| 1352 | EXPORT_SYMBOL(xt_counters_alloc); | 1352 | EXPORT_SYMBOL(xt_counters_alloc); |
| 1353 | 1353 | ||
| 1354 | struct xt_table_info | ||
| 1355 | *xt_table_get_private_protected(const struct xt_table *table) | ||
| 1356 | { | ||
| 1357 | return rcu_dereference_protected(table->private, | ||
| 1358 | mutex_is_locked(&xt[table->af].mutex)); | ||
| 1359 | } | ||
| 1360 | EXPORT_SYMBOL(xt_table_get_private_protected); | ||
| 1361 | |||
| 1362 | struct xt_table_info * | 1354 | struct xt_table_info * |
| 1363 | xt_replace_table(struct xt_table *table, | 1355 | xt_replace_table(struct xt_table *table, |
| 1364 | unsigned int num_counters, | 1356 | unsigned int num_counters, |
| @@ -1366,6 +1358,7 @@ xt_replace_table(struct xt_table *table, · 1 unmodified line | |||
| 1366 | int *error) | 1358 | int *error) |
| 1367 | { | 1359 | { |
| 1368 | struct xt_table_info *private; | 1360 | struct xt_table_info *private; |
| 1361 | unsigned int cpu; | ||
| 1369 | int ret; | 1362 | int ret; |
| 1370 | 1363 | ||
| 1371 | ret = xt_jumpstack_alloc(newinfo); | 1364 | ret = xt_jumpstack_alloc(newinfo); |
| @@ -1375,20 +1368,47 @@ xt_replace_table(struct xt_table *table, · 3 unmodified lines | |||
| 1375 | } | 1368 | } |
| 1376 | 1369 | ||
| 1377 | /* Do the substitution. */ | 1370 | /* Do the substitution. */ |
| 1378 | private = xt_table_get_private_protected(table); | 1371 | local_bh_disable(); |
| 1372 | private = table->private; | ||
| 1379 | 1373 | ||
| 1380 | /* Check inside lock: is the old number correct? */ | 1374 | /* Check inside lock: is the old number correct? */ |
| 1381 | if (num_counters != private->number) { | 1375 | if (num_counters != private->number) { |
| 1382 | pr_debug("num_counters != table->private->number (%u/%u)\n", | 1376 | pr_debug("num_counters != table->private->number (%u/%u)\n", |
| 1383 | num_counters, private->number); | 1377 | num_counters, private->number); |
| 1378 | local_bh_enable(); | ||
| 1384 | *error = -EAGAIN; | 1379 | *error = -EAGAIN; |
| 1385 | return NULL; | 1380 | return NULL; |
| 1386 | } | 1381 | } |
| 1387 | 1382 | ||
| 1388 | newinfo->initial_entries = private->initial_entries; | 1383 | newinfo->initial_entries = private->initial_entries; |
| 1384 | /* | ||
| 1385 | * Ensure contents of newinfo are visible before assigning to | ||
| 1386 | * private. | ||
| 1387 | */ | ||
| 1388 | smp_wmb(); | ||
| 1389 | table->private = newinfo; | ||
| 1390 | |||
| 1391 | /* make sure all cpus see new ->private value */ | ||
| 1392 | smp_mb(); | ||
| 1389 | 1393 | ||
| 1390 | rcu_assign_pointer(table->private, newinfo); | 1394 | /* |
| 1391 | synchronize_rcu(); | 1395 | * Even though table entries have now been swapped, other CPU's |
| 1396 | * may still be using the old entries... | ||
| 1397 | */ | ||
| 1398 | local_bh_enable(); | ||
| 1399 | |||
| 1400 | /* ... so wait for even xt_recseq on all cpus */ | ||
| 1401 | for_each_possible_cpu(cpu) { | ||
| 1402 | seqcount_t *s = &per_cpu(xt_recseq, cpu); | ||
| 1403 | u32 seq = raw_read_seqcount(s); | ||
| 1404 | |||
| 1405 | if (seq & 1) { | ||
| 1406 | do { | ||
| 1407 | cond_resched(); | ||
| 1408 | cpu_relax(); | ||
| 1409 | } while (seq == raw_read_seqcount(s)); | ||
| 1410 | } | ||
| 1411 | } | ||
| 1392 | 1412 | ||
| 1393 | audit_log_nfcfg(table->name, table->af, private->number, | 1413 | audit_log_nfcfg(table->name, table->af, private->number, |
| 1394 | !private->number ? AUDIT_XT_OP_REGISTER : | 1414 | !private->number ? AUDIT_XT_OP_REGISTER : |
| @@ -1424,12 +1444,12 @@ struct xt_table *xt_register_table(struct net *net, · 29 unmodified lines | |||
| 1424 | } | 1444 | } |
| 1425 | 1445 | ||
| 1426 | /* Simplifies replace_table code. */ | 1446 | /* Simplifies replace_table code. */ |
| 1427 | rcu_assign_pointer(table->private, bootstrap); | 1447 | table->private = bootstrap; |
| 1428 | 1448 | ||
| 1429 | if (!xt_replace_table(table, 0, newinfo, &ret)) | 1449 | if (!xt_replace_table(table, 0, newinfo, &ret)) |
| 1430 | goto unlock; | 1450 | goto unlock; |
| 1431 | 1451 | ||
| 1432 | private = xt_table_get_private_protected(table); | 1452 | private = table->private; |
| 1433 | pr_debug("table->private->number = %u\n", private->number); | 1453 | pr_debug("table->private->number = %u\n", private->number); |
| 1434 | 1454 | ||
| 1435 | /* save number of initial entries */ | 1455 | /* save number of initial entries */ |
| @@ -1452,8 +1472,7 @@ void *xt_unregister_table(struct xt_table *table) · 16 unmodified lines | |||
| 1452 | struct xt_table_info *private; | 1472 | struct xt_table_info *private; |
| 1453 | 1473 | ||
| 1454 | mutex_lock(&xt[table->af].mutex); | 1474 | mutex_lock(&xt[table->af].mutex); |
| 1455 | private = xt_table_get_private_protected(table); | 1475 | private = table->private; |
| 1456 | RCU_INIT_POINTER(table->private, NULL); | ||
| 1457 | list_del(&table->list); | 1476 | list_del(&table->list); |
| 1458 | mutex_unlock(&xt[table->af].mutex); | 1477 | mutex_unlock(&xt[table->af].mutex); |
| 1459 | audit_log_nfcfg(table->name, table->af, private->number, | 1478 | audit_log_nfcfg(table->name, table->af, private->number, |
| @@ -271,9 +271,11 @@ static void ovs_ct_update_key(const struct sk_buff *skb, · 270 unmodified lines | |||
| 271 | /* This is called to initialize CT key fields possibly coming in from the local | 271 | /* This is called to initialize CT key fields possibly coming in from the local |
| 272 | * stack. | 272 | * stack. |
| 273 | */ | 273 | */ |
| 274 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) | 274 | void ovs_ct_fill_key(const struct sk_buff *skb, |
| 275 | struct sw_flow_key *key, | ||
| 276 | bool post_ct) | ||
| 275 | { | 277 | { |
| 276 | ovs_ct_update_key(skb, NULL, key, false, false); | 278 | ovs_ct_update_key(skb, NULL, key, post_ct, false); |
| 277 | } | 279 | } |
| 278 | 280 | ||
| 279 | int ovs_ct_put_key(const struct sw_flow_key *swkey, | 281 | int ovs_ct_put_key(const struct sw_flow_key *swkey, |
| @@ -1332,7 +1334,7 @@ int ovs_ct_clear(struct sk_buff *skb, struct sw_flow_key *key) · 1052 unmodified lines | |||
| 1332 | if (skb_nfct(skb)) { | 1334 | if (skb_nfct(skb)) { |
| 1333 | nf_conntrack_put(skb_nfct(skb)); | 1335 | nf_conntrack_put(skb_nfct(skb)); |
| 1334 | nf_ct_set(skb, NULL, IP_CT_UNTRACKED); | 1336 | nf_ct_set(skb, NULL, IP_CT_UNTRACKED); |
| 1335 | ovs_ct_fill_key(skb, key); | 1337 | ovs_ct_fill_key(skb, key, false); |
| 1336 | } | 1338 | } |
| 1337 | 1339 | ||
| 1338 | return 0; | 1340 | return 0; |
| @@ -25,7 +25,8 @@ int ovs_ct_execute(struct net *, struct sk_buff *, struct sw_flow_key *, · 24 unmodified lines | |||
| 25 | const struct ovs_conntrack_info *); | 25 | const struct ovs_conntrack_info *); |
| 26 | int ovs_ct_clear(struct sk_buff *skb, struct sw_flow_key *key); | 26 | int ovs_ct_clear(struct sk_buff *skb, struct sw_flow_key *key); |
| 27 | 27 | ||
| 28 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key); | 28 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key, |
| 29 | bool post_ct); | ||
| 29 | int ovs_ct_put_key(const struct sw_flow_key *swkey, | 30 | int ovs_ct_put_key(const struct sw_flow_key *swkey, |
| 30 | const struct sw_flow_key *output, struct sk_buff *skb); | 31 | const struct sw_flow_key *output, struct sk_buff *skb); |
| 31 | void ovs_ct_free_action(const struct nlattr *a); | 32 | void ovs_ct_free_action(const struct nlattr *a); |
| @@ -74,7 +75,8 @@ static inline int ovs_ct_clear(struct sk_buff *skb, · 42 unmodified lines | |||
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | static inline void ovs_ct_fill_key(const struct sk_buff *skb, | 77 | static inline void ovs_ct_fill_key(const struct sk_buff *skb, |
| 77 | struct sw_flow_key *key) | 78 | struct sw_flow_key *key, |
| 79 | bool post_ct) | ||
| 78 | { | 80 | { |
| 79 | key->ct_state = 0; | 81 | key->ct_state = 0; |
| 80 | key->ct_zone = 0; | 82 | key->ct_zone = 0; |
| @@ -857,6 +857,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, · 856 unmodified lines | |||
| 857 | #if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) | 857 | #if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) |
| 858 | struct tc_skb_ext *tc_ext; | 858 | struct tc_skb_ext *tc_ext; |
| 859 | #endif | 859 | #endif |
| 860 | bool post_ct = false; | ||
| 860 | int res, err; | 861 | int res, err; |
| 861 | 862 | ||
| 862 | /* Extract metadata from packet. */ | 863 | /* Extract metadata from packet. */ |
| @@ -895,6 +896,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, · 32 unmodified lines | |||
| 895 | tc_ext = skb_ext_find(skb, TC_SKB_EXT); | 896 | tc_ext = skb_ext_find(skb, TC_SKB_EXT); |
| 896 | key->recirc_id = tc_ext ? tc_ext->chain : 0; | 897 | key->recirc_id = tc_ext ? tc_ext->chain : 0; |
| 897 | OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; | 898 | OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; |
| 899 | post_ct = tc_ext ? tc_ext->post_ct : false; | ||
| 898 | } else { | 900 | } else { |
| 899 | key->recirc_id = 0; | 901 | key->recirc_id = 0; |
| 900 | } | 902 | } |
| @@ -904,7 +906,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, · 3 unmodified lines | |||
| 904 | 906 | ||
| 905 | err = key_extract(skb, key); | 907 | err = key_extract(skb, key); |
| 906 | if (!err) | 908 | if (!err) |
| 907 | ovs_ct_fill_key(skb, key); /* Must be after key_extract(). */ | 909 | ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ |
| 908 | return err; | 910 | return err; |
| 909 | } | 911 | } |
| 910 | 912 | ||
| @@ -1058,6 +1058,11 @@ static int qrtr_recvmsg(struct socket *sock, struct msghdr *msg, · 1057 unmodified lines | |||
| 1058 | rc = copied; | 1058 | rc = copied; |
| 1059 | 1059 | ||
| 1060 | if (addr) { | 1060 | if (addr) { |
| 1061 | /* There is an anonymous 2-byte hole after sq_family, | ||
| 1062 | * make sure to clear it. | ||
| 1063 | */ | ||
| 1064 | memset(addr, 0, sizeof(*addr)); | ||
| 1065 | |||
| 1061 | addr->sq_family = AF_QIPCRTR; | 1066 | addr->sq_family = AF_QIPCRTR; |
| 1062 | addr->sq_node = cb->src_node; | 1067 | addr->sq_node = cb->src_node; |
| 1063 | addr->sq_port = cb->src_port; | 1068 | addr->sq_port = cb->src_port; |
| @@ -945,13 +945,14 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, · 944 unmodified lines | |||
| 945 | tcf_lastuse_update(&c->tcf_tm); | 945 | tcf_lastuse_update(&c->tcf_tm); |
| 946 | 946 | ||
| 947 | if (clear) { | 947 | if (clear) { |
| 948 | qdisc_skb_cb(skb)->post_ct = false; | ||
| 948 | ct = nf_ct_get(skb, &ctinfo); | 949 | ct = nf_ct_get(skb, &ctinfo); |
| 949 | if (ct) { | 950 | if (ct) { |
| 950 | nf_conntrack_put(&ct->ct_general); | 951 | nf_conntrack_put(&ct->ct_general); |
| 951 | nf_ct_set(skb, NULL, IP_CT_UNTRACKED); | 952 | nf_ct_set(skb, NULL, IP_CT_UNTRACKED); |
| 952 | } | 953 | } |
| 953 | 954 | ||
| 954 | goto out; | 955 | goto out_clear; |
| 955 | } | 956 | } |
| 956 | 957 | ||
| 957 | family = tcf_ct_skb_nf_family(skb); | 958 | family = tcf_ct_skb_nf_family(skb); |
| @@ -1030,8 +1031,9 @@ out_push: · 72 unmodified lines | |||
| 1030 | skb_push_rcsum(skb, nh_ofs); | 1031 | skb_push_rcsum(skb, nh_ofs); |
| 1031 | 1032 | ||
| 1032 | out: | 1033 | out: |
| 1033 | tcf_action_update_bstats(&c->common, skb); | ||
| 1034 | qdisc_skb_cb(skb)->post_ct = true; | 1034 | qdisc_skb_cb(skb)->post_ct = true; |
| 1035 | out_clear: | ||
| 1036 | tcf_action_update_bstats(&c->common, skb); | ||
| 1035 | if (defrag) | 1037 | if (defrag) |
| 1036 | qdisc_skb_cb(skb)->pkt_len = skb->len; | 1038 | qdisc_skb_cb(skb)->pkt_len = skb->len; |
| 1037 | return retval; | 1039 | return retval; |
| @@ -1629,6 +1629,7 @@ int tcf_classify_ingress(struct sk_buff *skb, · 1628 unmodified lines | |||
| 1629 | return TC_ACT_SHOT; | 1629 | return TC_ACT_SHOT; |
| 1630 | ext->chain = last_executed_chain; | 1630 | ext->chain = last_executed_chain; |
| 1631 | ext->mru = qdisc_skb_cb(skb)->mru; | 1631 | ext->mru = qdisc_skb_cb(skb)->mru; |
| 1632 | ext->post_ct = qdisc_skb_cb(skb)->post_ct; | ||
| 1632 | } | 1633 | } |
| 1633 | 1634 | ||
| 1634 | return ret; | 1635 | return ret; |
| @@ -1451,7 +1451,7 @@ static int fl_set_key_ct(struct nlattr **tb, · 1450 unmodified lines | |||
| 1451 | &mask->ct_state, TCA_FLOWER_KEY_CT_STATE_MASK, | 1451 | &mask->ct_state, TCA_FLOWER_KEY_CT_STATE_MASK, |
| 1452 | sizeof(key->ct_state)); | 1452 | sizeof(key->ct_state)); |
| 1453 | 1453 | ||
| 1454 | err = fl_validate_ct_state(mask->ct_state, | 1454 | err = fl_validate_ct_state(key->ct_state & mask->ct_state, |
| 1455 | tb[TCA_FLOWER_KEY_CT_STATE_MASK], | 1455 | tb[TCA_FLOWER_KEY_CT_STATE_MASK], |
| 1456 | extack); | 1456 | extack); |
| 1457 | if (err) | 1457 | if (err) |
| @@ -345,6 +345,7 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt, · 344 unmodified lines | |||
| 345 | struct sk_buff **old = NULL; | 345 | struct sk_buff **old = NULL; |
| 346 | unsigned int mask; | 346 | unsigned int mask; |
| 347 | u32 max_P; | 347 | u32 max_P; |
| 348 | u8 *stab; | ||
| 348 | 349 | ||
| 349 | if (opt == NULL) | 350 | if (opt == NULL) |
| 350 | return -EINVAL; | 351 | return -EINVAL; |
| @@ -361,8 +362,8 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt, · 10 unmodified lines | |||
| 361 | max_P = tb[TCA_CHOKE_MAX_P] ? nla_get_u32(tb[TCA_CHOKE_MAX_P]) : 0; | 362 | max_P = tb[TCA_CHOKE_MAX_P] ? nla_get_u32(tb[TCA_CHOKE_MAX_P]) : 0; |
| 362 | 363 | ||
| 363 | ctl = nla_data(tb[TCA_CHOKE_PARMS]); | 364 | ctl = nla_data(tb[TCA_CHOKE_PARMS]); |
| 364 | 365 | stab = nla_data(tb[TCA_CHOKE_STAB]); | |
| 365 | if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log)) | 366 | if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log, stab)) |
| 366 | return -EINVAL; | 367 | return -EINVAL; |
| 367 | 368 | ||
| 368 | if (ctl->limit > CHOKE_MAX_QUEUE) | 369 | if (ctl->limit > CHOKE_MAX_QUEUE) |
| @@ -412,7 +413,7 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt, · 43 unmodified lines | |||
| 412 | 413 | ||
| 413 | red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, | 414 | red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, |
| 414 | ctl->Plog, ctl->Scell_log, | 415 | ctl->Plog, ctl->Scell_log, |
| 415 | nla_data(tb[TCA_CHOKE_STAB]), | 416 | stab, |
| 416 | max_P); | 417 | max_P); |
| 417 | red_set_vars(&q->vars); | 418 | red_set_vars(&q->vars); |
| 418 | 419 | ||
| @@ -480,7 +480,7 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp, · 479 unmodified lines | |||
| 480 | struct gred_sched *table = qdisc_priv(sch); | 480 | struct gred_sched *table = qdisc_priv(sch); |
| 481 | struct gred_sched_data *q = table->tab[dp]; | 481 | struct gred_sched_data *q = table->tab[dp]; |
| 482 | 482 | ||
| 483 | if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log)) { | 483 | if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log, stab)) { |
| 484 | NL_SET_ERR_MSG_MOD(extack, "invalid RED parameters"); | 484 | NL_SET_ERR_MSG_MOD(extack, "invalid RED parameters"); |
| 485 | return -EINVAL; | 485 | return -EINVAL; |
| 486 | } | 486 | } |
| @@ -1020,6 +1020,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt, · 1019 unmodified lines | |||
| 1020 | struct nlattr *tb[TCA_HTB_MAX + 1]; | 1020 | struct nlattr *tb[TCA_HTB_MAX + 1]; |
| 1021 | struct tc_htb_glob *gopt; | 1021 | struct tc_htb_glob *gopt; |
| 1022 | unsigned int ntx; | 1022 | unsigned int ntx; |
| 1023 | bool offload; | ||
| 1023 | int err; | 1024 | int err; |
| 1024 | 1025 | ||
| 1025 | qdisc_watchdog_init(&q->watchdog, sch); | 1026 | qdisc_watchdog_init(&q->watchdog, sch); |
| @@ -1044,9 +1045,9 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt, · 18 unmodified lines | |||
| 1044 | if (gopt->version != HTB_VER >> 16) | 1045 | if (gopt->version != HTB_VER >> 16) |
| 1045 | return -EINVAL; | 1046 | return -EINVAL; |
| 1046 | 1047 | ||
| 1047 | q->offload = nla_get_flag(tb[TCA_HTB_OFFLOAD]); | 1048 | offload = nla_get_flag(tb[TCA_HTB_OFFLOAD]); |
| 1048 | 1049 | ||
| 1049 | if (q->offload) { | 1050 | if (offload) { |
| 1050 | if (sch->parent != TC_H_ROOT) | 1051 | if (sch->parent != TC_H_ROOT) |
| 1051 | return -EOPNOTSUPP; | 1052 | return -EOPNOTSUPP; |
| 1052 | 1053 | ||
| @@ -1076,7 +1077,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt, · 23 unmodified lines | |||
| 1076 | q->rate2quantum = 1; | 1077 | q->rate2quantum = 1; |
| 1077 | q->defcls = gopt->defcls; | 1078 | q->defcls = gopt->defcls; |
| 1078 | 1079 | ||
| 1079 | if (!q->offload) | 1080 | if (!offload) |
| 1080 | return 0; | 1081 | return 0; |
| 1081 | 1082 | ||
| 1082 | for (ntx = 0; ntx < q->num_direct_qdiscs; ntx++) { | 1083 | for (ntx = 0; ntx < q->num_direct_qdiscs; ntx++) { |
| @@ -1107,12 +1108,14 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt, · 24 unmodified lines | |||
| 1107 | if (err) | 1108 | if (err) |
| 1108 | goto err_free_qdiscs; | 1109 | goto err_free_qdiscs; |
| 1109 | 1110 | ||
| 1111 | /* Defer this assignment, so that htb_destroy skips offload-related | ||
| 1112 | * parts (especially calling ndo_setup_tc) on errors. | ||
| 1113 | */ | ||
| 1114 | q->offload = true; | ||
| 1115 | |||
| 1110 | return 0; | 1116 | return 0; |
| 1111 | 1117 | ||
| 1112 | err_free_qdiscs: | 1118 | err_free_qdiscs: |
| 1113 | /* TC_HTB_CREATE call failed, avoid any further calls to the driver. */ | ||
| 1114 | q->offload = false; | ||
| 1115 | |||
| 1116 | for (ntx = 0; ntx < q->num_direct_qdiscs && q->direct_qdiscs[ntx]; | 1119 | for (ntx = 0; ntx < q->num_direct_qdiscs && q->direct_qdiscs[ntx]; |
| 1117 | ntx++) | 1120 | ntx++) |
| 1118 | qdisc_put(q->direct_qdiscs[ntx]); | 1121 | qdisc_put(q->direct_qdiscs[ntx]); |
| @@ -1340,8 +1343,12 @@ htb_select_queue(struct Qdisc *sch, struct tcmsg *tcm) · 221 unmodified lines | |||
| 1340 | { | 1343 | { |
| 1341 | struct net_device *dev = qdisc_dev(sch); | 1344 | struct net_device *dev = qdisc_dev(sch); |
| 1342 | struct tc_htb_qopt_offload offload_opt; | 1345 | struct tc_htb_qopt_offload offload_opt; |
| 1346 | struct htb_sched *q = qdisc_priv(sch); | ||
| 1343 | int err; | 1347 | int err; |
| 1344 | 1348 | ||
| 1349 | if (!q->offload) | ||
| 1350 | return sch->dev_queue; | ||
| 1351 | |||
| 1345 | offload_opt = (struct tc_htb_qopt_offload) { | 1352 | offload_opt = (struct tc_htb_qopt_offload) { |
| 1346 | .command = TC_HTB_LEAF_QUERY_QUEUE, | 1353 | .command = TC_HTB_LEAF_QUERY_QUEUE, |
| 1347 | .classid = TC_H_MIN(tcm->tcm_parent), | 1354 | .classid = TC_H_MIN(tcm->tcm_parent), |
| @@ -242,6 +242,7 @@ static int __red_change(struct Qdisc *sch, struct nlattr **tb, · 241 unmodified lines | |||
| 242 | unsigned char flags; | 242 | unsigned char flags; |
| 243 | int err; | 243 | int err; |
| 244 | u32 max_P; | 244 | u32 max_P; |
| 245 | u8 *stab; | ||
| 245 | 246 | ||
| 246 | if (tb[TCA_RED_PARMS] == NULL || | 247 | if (tb[TCA_RED_PARMS] == NULL || |
| 247 | tb[TCA_RED_STAB] == NULL) | 248 | tb[TCA_RED_STAB] == NULL) |
| @@ -250,7 +251,9 @@ static int __red_change(struct Qdisc *sch, struct nlattr **tb, · 2 unmodified lines | |||
| 250 | max_P = tb[TCA_RED_MAX_P] ? nla_get_u32(tb[TCA_RED_MAX_P]) : 0; | 251 | max_P = tb[TCA_RED_MAX_P] ? nla_get_u32(tb[TCA_RED_MAX_P]) : 0; |
| 251 | 252 | ||
| 252 | ctl = nla_data(tb[TCA_RED_PARMS]); | 253 | ctl = nla_data(tb[TCA_RED_PARMS]); |
| 253 | if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log)) | 254 | stab = nla_data(tb[TCA_RED_STAB]); |
| 255 | if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, | ||
| 256 | ctl->Scell_log, stab)) | ||
| 254 | return -EINVAL; | 257 | return -EINVAL; |
| 255 | 258 | ||
| 256 | err = red_get_flags(ctl->flags, TC_RED_HISTORIC_FLAGS, | 259 | err = red_get_flags(ctl->flags, TC_RED_HISTORIC_FLAGS, |
| @@ -288,7 +291,7 @@ static int __red_change(struct Qdisc *sch, struct nlattr **tb, · 31 unmodified lines | |||
| 288 | red_set_parms(&q->parms, | 291 | red_set_parms(&q->parms, |
| 289 | ctl->qth_min, ctl->qth_max, ctl->Wlog, | 292 | ctl->qth_min, ctl->qth_max, ctl->Wlog, |
| 290 | ctl->Plog, ctl->Scell_log, | 293 | ctl->Plog, ctl->Scell_log, |
| 291 | nla_data(tb[TCA_RED_STAB]), | 294 | stab, |
| 292 | max_P); | 295 | max_P); |
| 293 | red_set_vars(&q->vars); | 296 | red_set_vars(&q->vars); |
| 294 | 297 | ||
| @@ -647,7 +647,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) · 646 unmodified lines | |||
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | if (ctl_v1 && !red_check_params(ctl_v1->qth_min, ctl_v1->qth_max, | 649 | if (ctl_v1 && !red_check_params(ctl_v1->qth_min, ctl_v1->qth_max, |
| 650 | ctl_v1->Wlog, ctl_v1->Scell_log)) | 650 | ctl_v1->Wlog, ctl_v1->Scell_log, NULL)) |
| 651 | return -EINVAL; | 651 | return -EINVAL; |
| 652 | if (ctl_v1 && ctl_v1->qth_min) { | 652 | if (ctl_v1 && ctl_v1->qth_min) { |
| 653 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 653 | p = kmalloc(sizeof(*p), GFP_KERNEL); |
| @@ -584,13 +584,6 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 583 unmodified lines | |||
| 584 | goto out; | 584 | goto out; |
| 585 | } | 585 | } |
| 586 | 586 | ||
| 587 | rcu_read_lock(); | ||
| 588 | if (__sk_dst_get(sk) != tp->dst) { | ||
| 589 | dst_hold(tp->dst); | ||
| 590 | sk_setup_caps(sk, tp->dst); | ||
| 591 | } | ||
| 592 | rcu_read_unlock(); | ||
| 593 | |||
| 594 | /* pack up chunks */ | 587 | /* pack up chunks */ |
| 595 | pkt_count = sctp_packet_pack(packet, head, gso, gfp); | 588 | pkt_count = sctp_packet_pack(packet, head, gso, gfp); |
| 596 | if (!pkt_count) { | 589 | if (!pkt_count) { |
| @@ -1135,6 +1135,7 @@ static void sctp_outq_flush_data(struct sctp_flush_ctx *ctx, · 1134 unmodified lines | |||
| 1135 | 1135 | ||
| 1136 | static void sctp_outq_flush_transports(struct sctp_flush_ctx *ctx) | 1136 | static void sctp_outq_flush_transports(struct sctp_flush_ctx *ctx) |
| 1137 | { | 1137 | { |
| 1138 | struct sock *sk = ctx->asoc->base.sk; | ||
| 1138 | struct list_head *ltransport; | 1139 | struct list_head *ltransport; |
| 1139 | struct sctp_packet *packet; | 1140 | struct sctp_packet *packet; |
| 1140 | struct sctp_transport *t; | 1141 | struct sctp_transport *t; |
| @@ -1144,6 +1145,12 @@ static void sctp_outq_flush_transports(struct sctp_flush_ctx *ctx) · 3 unmodified lines | |||
| 1144 | t = list_entry(ltransport, struct sctp_transport, send_ready); | 1145 | t = list_entry(ltransport, struct sctp_transport, send_ready); |
| 1145 | packet = &t->packet; | 1146 | packet = &t->packet; |
| 1146 | if (!sctp_packet_empty(packet)) { | 1147 | if (!sctp_packet_empty(packet)) { |
| 1148 | rcu_read_lock(); | ||
| 1149 | if (t->dst && __sk_dst_get(sk) != t->dst) { | ||
| 1150 | dst_hold(t->dst); | ||
| 1151 | sk_setup_caps(sk, t->dst); | ||
| 1152 | } | ||
| 1153 | rcu_read_unlock(); | ||
| 1147 | error = sctp_packet_transmit(packet, ctx->gfp); | 1154 | error = sctp_packet_transmit(packet, ctx->gfp); |
| 1148 | if (error < 0) | 1155 | if (error < 0) |
| 1149 | ctx->q->asoc->base.sk->sk_err = -error; | 1156 | ctx->q->asoc->base.sk->sk_err = -error; |
| @@ -2895,17 +2895,22 @@ int tipc_nl_node_dump_monitor_peer(struct sk_buff *skb, · 2894 unmodified lines | |||
| 2895 | 2895 | ||
| 2896 | #ifdef CONFIG_TIPC_CRYPTO | 2896 | #ifdef CONFIG_TIPC_CRYPTO |
| 2897 | static int tipc_nl_retrieve_key(struct nlattr **attrs, | 2897 | static int tipc_nl_retrieve_key(struct nlattr **attrs, |
| 2898 | struct tipc_aead_key **key) | 2898 | struct tipc_aead_key **pkey) |
| 2899 | { | 2899 | { |
| 2900 | struct nlattr *attr = attrs[TIPC_NLA_NODE_KEY]; | 2900 | struct nlattr *attr = attrs[TIPC_NLA_NODE_KEY]; |
| 2901 | struct tipc_aead_key *key; | ||
| 2901 | 2902 | ||
| 2902 | if (!attr) | 2903 | if (!attr) |
| 2903 | return -ENODATA; | 2904 | return -ENODATA; |
| 2904 | 2905 | ||
| 2905 | *key = (struct tipc_aead_key *)nla_data(attr); | 2906 | if (nla_len(attr) < sizeof(*key)) |
| 2906 | if (nla_len(attr) < tipc_aead_key_size(*key)) | 2907 | return -EINVAL; |
| 2908 | key = (struct tipc_aead_key *)nla_data(attr); | ||
| 2909 | if (key->keylen > TIPC_AEAD_KEYLEN_MAX || | ||
| 2910 | nla_len(attr) < tipc_aead_key_size(key)) | ||
| 2907 | return -EINVAL; | 2911 | return -EINVAL; |
| 2908 | 2912 | ||
| 2913 | *pkey = key; | ||
| 2909 | return 0; | 2914 | return 0; |
| 2910 | } | 2915 | } |
| 2911 | 2916 | ||
| @@ -755,6 +755,7 @@ static struct sock *__vsock_create(struct net *net, · 754 unmodified lines | |||
| 755 | vsk->buffer_size = psk->buffer_size; | 755 | vsk->buffer_size = psk->buffer_size; |
| 756 | vsk->buffer_min_size = psk->buffer_min_size; | 756 | vsk->buffer_min_size = psk->buffer_min_size; |
| 757 | vsk->buffer_max_size = psk->buffer_max_size; | 757 | vsk->buffer_max_size = psk->buffer_max_size; |
| 758 | security_sk_clone(parent, sk); | ||
| 758 | } else { | 759 | } else { |
| 759 | vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN); | 760 | vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN); |
| 760 | vsk->owner = get_current_cred(); | 761 | vsk->owner = get_current_cred(); |
| @@ -70,7 +70,7 @@ __cfg80211_wdev_from_attrs(struct cfg80211_registered_device *rdev, · 69 unmodified lines | |||
| 70 | struct wireless_dev *result = NULL; | 70 | struct wireless_dev *result = NULL; |
| 71 | bool have_ifidx = attrs[NL80211_ATTR_IFINDEX]; | 71 | bool have_ifidx = attrs[NL80211_ATTR_IFINDEX]; |
| 72 | bool have_wdev_id = attrs[NL80211_ATTR_WDEV]; | 72 | bool have_wdev_id = attrs[NL80211_ATTR_WDEV]; |
| 73 | u64 wdev_id; | 73 | u64 wdev_id = 0; |
| 74 | int wiphy_idx = -1; | 74 | int wiphy_idx = -1; |
| 75 | int ifidx = -1; | 75 | int ifidx = -1; |
| 76 | 76 | ||
| @@ -14789,6 +14789,7 @@ bad_tid_conf: · 14712 unmodified lines | |||
| 14789 | #define NL80211_FLAG_NEED_WDEV_UP (NL80211_FLAG_NEED_WDEV |\ | 14789 | #define NL80211_FLAG_NEED_WDEV_UP (NL80211_FLAG_NEED_WDEV |\ |
| 14790 | NL80211_FLAG_CHECK_NETDEV_UP) | 14790 | NL80211_FLAG_CHECK_NETDEV_UP) |
| 14791 | #define NL80211_FLAG_CLEAR_SKB 0x20 | 14791 | #define NL80211_FLAG_CLEAR_SKB 0x20 |
| 14792 | #define NL80211_FLAG_NO_WIPHY_MTX 0x40 | ||
| 14792 | 14793 | ||
| 14793 | static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, | 14794 | static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, |
| 14794 | struct genl_info *info) | 14795 | struct genl_info *info) |
| @@ -14840,7 +14841,7 @@ static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, · 45 unmodified lines | |||
| 14840 | info->user_ptr[0] = rdev; | 14841 | info->user_ptr[0] = rdev; |
| 14841 | } | 14842 | } |
| 14842 | 14843 | ||
| 14843 | if (rdev) { | 14844 | if (rdev && !(ops->internal_flags & NL80211_FLAG_NO_WIPHY_MTX)) { |
| 14844 | wiphy_lock(&rdev->wiphy); | 14845 | wiphy_lock(&rdev->wiphy); |
| 14845 | /* we keep the mutex locked until post_doit */ | 14846 | /* we keep the mutex locked until post_doit */ |
| 14846 | __release(&rdev->wiphy.mtx); | 14847 | __release(&rdev->wiphy.mtx); |
| @@ -14865,7 +14866,8 @@ static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb, · 18 unmodified lines | |||
| 14865 | } | 14866 | } |
| 14866 | } | 14867 | } |
| 14867 | 14868 | ||
| 14868 | if (info->user_ptr[0]) { | 14869 | if (info->user_ptr[0] && |
| 14870 | !(ops->internal_flags & NL80211_FLAG_NO_WIPHY_MTX)) { | ||
| 14869 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 14871 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
| 14870 | 14872 | ||
| 14871 | /* we kept the mutex locked since pre_doit */ | 14873 | /* we kept the mutex locked since pre_doit */ |
| @@ -15329,7 +15331,9 @@ static const struct genl_small_ops nl80211_small_ops[] = { · 457 unmodified lines | |||
| 15329 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 15331 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 15330 | .doit = nl80211_wiphy_netns, | 15332 | .doit = nl80211_wiphy_netns, |
| 15331 | .flags = GENL_UNS_ADMIN_PERM, | 15333 | .flags = GENL_UNS_ADMIN_PERM, |
| 15332 | .internal_flags = NL80211_FLAG_NEED_WIPHY, | 15334 | .internal_flags = NL80211_FLAG_NEED_WIPHY | |
| 15335 | NL80211_FLAG_NEED_RTNL | | ||
| 15336 | NL80211_FLAG_NO_WIPHY_MTX, | ||
| 15333 | }, | 15337 | }, |
| 15334 | { | 15338 | { |
| 15335 | .cmd = NL80211_CMD_GET_SURVEY, | 15339 | .cmd = NL80211_CMD_GET_SURVEY, |
| @@ -98,6 +98,14 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode) · 97 unmodified lines | |||
| 98 | struct rb_node *node, *parent = NULL; | 98 | struct rb_node *node, *parent = NULL; |
| 99 | struct integrity_iint_cache *iint, *test_iint; | 99 | struct integrity_iint_cache *iint, *test_iint; |
| 100 | 100 | ||
| 101 | /* | ||
| 102 | * The integrity's "iint_cache" is initialized at security_init(), | ||
| 103 | * unless it is not included in the ordered list of LSMs enabled | ||
| 104 | * on the boot command line. | ||
| 105 | */ | ||
| 106 | if (!iint_cache) | ||
| 107 | panic("%s: lsm=integrity required.\n", __func__); | ||
| 108 | |||
| 101 | iint = integrity_iint_find(inode); | 109 | iint = integrity_iint_find(inode); |
| 102 | if (iint) | 110 | if (iint) |
| 103 | return iint; | 111 | return iint; |
| @@ -219,14 +219,21 @@ static inline bool selinux_policycap_genfs_seclabel_symlinks(void) · 218 unmodified lines | |||
| 219 | return READ_ONCE(state->policycap[POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS]); | 219 | return READ_ONCE(state->policycap[POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS]); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | struct selinux_policy_convert_data; | ||
| 223 | |||
| 224 | struct selinux_load_state { | ||
| 225 | struct selinux_policy *policy; | ||
| 226 | struct selinux_policy_convert_data *convert_data; | ||
| 227 | }; | ||
| 228 | |||
| 222 | int security_mls_enabled(struct selinux_state *state); | 229 | int security_mls_enabled(struct selinux_state *state); |
| 223 | int security_load_policy(struct selinux_state *state, | 230 | int security_load_policy(struct selinux_state *state, |
| 224 | void *data, size_t len, | 231 | void *data, size_t len, |
| 225 | struct selinux_policy **newpolicyp); | 232 | struct selinux_load_state *load_state); |
| 226 | void selinux_policy_commit(struct selinux_state *state, | 233 | void selinux_policy_commit(struct selinux_state *state, |
| 227 | struct selinux_policy *newpolicy); | 234 | struct selinux_load_state *load_state); |
| 228 | void selinux_policy_cancel(struct selinux_state *state, | 235 | void selinux_policy_cancel(struct selinux_state *state, |
| 229 | struct selinux_policy *policy); | 236 | struct selinux_load_state *load_state); |
| 230 | int security_read_policy(struct selinux_state *state, | 237 | int security_read_policy(struct selinux_state *state, |
| 231 | void **data, size_t *len); | 238 | void **data, size_t *len); |
| 232 | int security_read_state_kernel(struct selinux_state *state, | 239 | int security_read_state_kernel(struct selinux_state *state, |
| @@ -563,17 +563,13 @@ static int sel_make_policy_nodes(struct selinux_fs_info *fsi, · 562 unmodified lines | |||
| 563 | 563 | ||
| 564 | ret = sel_make_bools(newpolicy, tmp_bool_dir, &tmp_bool_num, | 564 | ret = sel_make_bools(newpolicy, tmp_bool_dir, &tmp_bool_num, |
| 565 | &tmp_bool_names, &tmp_bool_values); | 565 | &tmp_bool_names, &tmp_bool_values); |
| 566 | if (ret) { | 566 | if (ret) |
| 567 | pr_err("SELinux: failed to load policy booleans\n"); | ||
| 568 | goto out; | 567 | goto out; |
| 569 | } | ||
| 570 | 568 | ||
| 571 | ret = sel_make_classes(newpolicy, tmp_class_dir, | 569 | ret = sel_make_classes(newpolicy, tmp_class_dir, |
| 572 | &fsi->last_class_ino); | 570 | &fsi->last_class_ino); |
| 573 | if (ret) { | 571 | if (ret) |
| 574 | pr_err("SELinux: failed to load policy classes\n"); | ||
| 575 | goto out; | 572 | goto out; |
| 576 | } | ||
| 577 | 573 | ||
| 578 | /* booleans */ | 574 | /* booleans */ |
| 579 | old_dentry = fsi->bool_dir; | 575 | old_dentry = fsi->bool_dir; |
| @@ -616,7 +612,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf, · 36 unmodified lines | |||
| 616 | 612 | ||
| 617 | { | 613 | { |
| 618 | struct selinux_fs_info *fsi = file_inode(file)->i_sb->s_fs_info; | 614 | struct selinux_fs_info *fsi = file_inode(file)->i_sb->s_fs_info; |
| 619 | struct selinux_policy *newpolicy; | 615 | struct selinux_load_state load_state; |
| 620 | ssize_t length; | 616 | ssize_t length; |
| 621 | void *data = NULL; | 617 | void *data = NULL; |
| 622 | 618 | ||
| @@ -642,23 +638,23 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf, · 19 unmodified lines | |||
| 642 | if (copy_from_user(data, buf, count) != 0) | 638 | if (copy_from_user(data, buf, count) != 0) |
| 643 | goto out; | 639 | goto out; |
| 644 | 640 | ||
| 645 | length = security_load_policy(fsi->state, data, count, &newpolicy); | 641 | length = security_load_policy(fsi->state, data, count, &load_state); |
| 646 | if (length) { | 642 | if (length) { |
| 647 | pr_warn_ratelimited("SELinux: failed to load policy\n"); | 643 | pr_warn_ratelimited("SELinux: failed to load policy\n"); |
| 648 | goto out; | 644 | goto out; |
| 649 | } | 645 | } |
| 650 | 646 | ||
| 651 | length = sel_make_policy_nodes(fsi, newpolicy); | 647 | length = sel_make_policy_nodes(fsi, load_state.policy); |
| 652 | if (length) { | 648 | if (length) { |
| 653 | selinux_policy_cancel(fsi->state, newpolicy); | 649 | pr_warn_ratelimited("SELinux: failed to initialize selinuxfs\n"); |
| 654 | goto out1; | 650 | selinux_policy_cancel(fsi->state, &load_state); |
| 651 | goto out; | ||
| 655 | } | 652 | } |
| 656 | 653 | ||
| 657 | selinux_policy_commit(fsi->state, newpolicy); | 654 | selinux_policy_commit(fsi->state, &load_state); |
| 658 | 655 | ||
| 659 | length = count; | 656 | length = count; |
| 660 | 657 | ||
| 661 | out1: | ||
| 662 | audit_log(audit_context(), GFP_KERNEL, AUDIT_MAC_POLICY_LOAD, | 658 | audit_log(audit_context(), GFP_KERNEL, AUDIT_MAC_POLICY_LOAD, |
| 663 | "auid=%u ses=%u lsm=selinux res=1", | 659 | "auid=%u ses=%u lsm=selinux res=1", |
| 664 | from_kuid(&init_user_ns, audit_get_loginuid(current)), | 660 | from_kuid(&init_user_ns, audit_get_loginuid(current)), |
| @@ -67,6 +67,17 @@ · 66 unmodified lines | |||
| 67 | #include "policycap_names.h" | 67 | #include "policycap_names.h" |
| 68 | #include "ima.h" | 68 | #include "ima.h" |
| 69 | 69 | ||
| 70 | struct convert_context_args { | ||
| 71 | struct selinux_state *state; | ||
| 72 | struct policydb *oldp; | ||
| 73 | struct policydb *newp; | ||
| 74 | }; | ||
| 75 | |||
| 76 | struct selinux_policy_convert_data { | ||
| 77 | struct convert_context_args args; | ||
| 78 | struct sidtab_convert_params sidtab_params; | ||
| 79 | }; | ||
| 80 | |||
| 70 | /* Forward declaration. */ | 81 | /* Forward declaration. */ |
| 71 | static int context_struct_to_string(struct policydb *policydb, | 82 | static int context_struct_to_string(struct policydb *policydb, |
| 72 | struct context *context, | 83 | struct context *context, |
| @@ -1974,12 +1985,6 @@ static inline int convert_context_handle_invalid_context( · 1901 unmodified lines | |||
| 1974 | return 0; | 1985 | return 0; |
| 1975 | } | 1986 | } |
| 1976 | 1987 | ||
| 1977 | struct convert_context_args { | ||
| 1978 | struct selinux_state *state; | ||
| 1979 | struct policydb *oldp; | ||
| 1980 | struct policydb *newp; | ||
| 1981 | }; | ||
| 1982 | |||
| 1983 | /* | 1988 | /* |
| 1984 | * Convert the values in the security context | 1989 | * Convert the values in the security context |
| 1985 | * structure `oldc' from the values specified | 1990 | * structure `oldc' from the values specified |
| @@ -2159,7 +2164,7 @@ static void selinux_policy_cond_free(struct selinux_policy *policy) · 173 unmodified lines | |||
| 2159 | } | 2164 | } |
| 2160 | 2165 | ||
| 2161 | void selinux_policy_cancel(struct selinux_state *state, | 2166 | void selinux_policy_cancel(struct selinux_state *state, |
| 2162 | struct selinux_policy *policy) | 2167 | struct selinux_load_state *load_state) |
| 2163 | { | 2168 | { |
| 2164 | struct selinux_policy *oldpolicy; | 2169 | struct selinux_policy *oldpolicy; |
| 2165 | 2170 | ||
| @@ -2167,7 +2172,8 @@ void selinux_policy_cancel(struct selinux_state *state, · 1 unmodified line | |||
| 2167 | lockdep_is_held(&state->policy_mutex)); | 2172 | lockdep_is_held(&state->policy_mutex)); |
| 2168 | 2173 | ||
| 2169 | sidtab_cancel_convert(oldpolicy->sidtab); | 2174 | sidtab_cancel_convert(oldpolicy->sidtab); |
| 2170 | selinux_policy_free(policy); | 2175 | selinux_policy_free(load_state->policy); |
| 2176 | kfree(load_state->convert_data); | ||
| 2171 | } | 2177 | } |
| 2172 | 2178 | ||
| 2173 | static void selinux_notify_policy_change(struct selinux_state *state, | 2179 | static void selinux_notify_policy_change(struct selinux_state *state, |
| @@ -2183,9 +2189,9 @@ static void selinux_notify_policy_change(struct selinux_state *state, · 9 unmodified lines | |||
| 2183 | } | 2189 | } |
| 2184 | 2190 | ||
| 2185 | void selinux_policy_commit(struct selinux_state *state, | 2191 | void selinux_policy_commit(struct selinux_state *state, |
| 2186 | struct selinux_policy *newpolicy) | 2192 | struct selinux_load_state *load_state) |
| 2187 | { | 2193 | { |
| 2188 | struct selinux_policy *oldpolicy; | 2194 | struct selinux_policy *oldpolicy, *newpolicy = load_state->policy; |
| 2189 | u32 seqno; | 2195 | u32 seqno; |
| 2190 | 2196 | ||
| 2191 | oldpolicy = rcu_dereference_protected(state->policy, | 2197 | oldpolicy = rcu_dereference_protected(state->policy, |
| @@ -2225,6 +2231,7 @@ void selinux_policy_commit(struct selinux_state *state, · 33 unmodified lines | |||
| 2225 | /* Free the old policy */ | 2231 | /* Free the old policy */ |
| 2226 | synchronize_rcu(); | 2232 | synchronize_rcu(); |
| 2227 | selinux_policy_free(oldpolicy); | 2233 | selinux_policy_free(oldpolicy); |
| 2234 | kfree(load_state->convert_data); | ||
| 2228 | 2235 | ||
| 2229 | /* Notify others of the policy change */ | 2236 | /* Notify others of the policy change */ |
| 2230 | selinux_notify_policy_change(state, seqno); | 2237 | selinux_notify_policy_change(state, seqno); |
| @@ -2241,11 +2248,10 @@ void selinux_policy_commit(struct selinux_state *state, · 10 unmodified lines | |||
| 2241 | * loading the new policy. | 2248 | * loading the new policy. |
| 2242 | */ | 2249 | */ |
| 2243 | int security_load_policy(struct selinux_state *state, void *data, size_t len, | 2250 | int security_load_policy(struct selinux_state *state, void *data, size_t len, |
| 2244 | struct selinux_policy **newpolicyp) | 2251 | struct selinux_load_state *load_state) |
| 2245 | { | 2252 | { |
| 2246 | struct selinux_policy *newpolicy, *oldpolicy; | 2253 | struct selinux_policy *newpolicy, *oldpolicy; |
| 2247 | struct sidtab_convert_params convert_params; | 2254 | struct selinux_policy_convert_data *convert_data; |
| 2248 | struct convert_context_args args; | ||
| 2249 | int rc = 0; | 2255 | int rc = 0; |
| 2250 | struct policy_file file = { data, len }, *fp = &file; | 2256 | struct policy_file file = { data, len }, *fp = &file; |
| 2251 | 2257 | ||
| @@ -2275,10 +2281,10 @@ int security_load_policy(struct selinux_state *state, void *data, size_t len, · 23 unmodified lines | |||
| 2275 | goto err_mapping; | 2281 | goto err_mapping; |
| 2276 | } | 2282 | } |
| 2277 | 2283 | ||
| 2278 | |||
| 2279 | if (!selinux_initialized(state)) { | 2284 | if (!selinux_initialized(state)) { |
| 2280 | /* First policy load, so no need to preserve state from old policy */ | 2285 | /* First policy load, so no need to preserve state from old policy */ |
| 2281 | *newpolicyp = newpolicy; | 2286 | load_state->policy = newpolicy; |
| 2287 | load_state->convert_data = NULL; | ||
| 2282 | return 0; | 2288 | return 0; |
| 2283 | } | 2289 | } |
| 2284 | 2290 | ||
| @@ -2292,29 +2298,38 @@ int security_load_policy(struct selinux_state *state, void *data, size_t len, · 7 unmodified lines | |||
| 2292 | goto err_free_isids; | 2298 | goto err_free_isids; |
| 2293 | } | 2299 | } |
| 2294 | 2300 | ||
| 2301 | convert_data = kmalloc(sizeof(*convert_data), GFP_KERNEL); | ||
| 2302 | if (!convert_data) { | ||
| 2303 | rc = -ENOMEM; | ||
| 2304 | goto err_free_isids; | ||
| 2305 | } | ||
| 2306 | |||
| 2295 | /* | 2307 | /* |
| 2296 | * Convert the internal representations of contexts | 2308 | * Convert the internal representations of contexts |
| 2297 | * in the new SID table. | 2309 | * in the new SID table. |
| 2298 | */ | 2310 | */ |
| 2299 | args.state = state; | 2311 | convert_data->args.state = state; |
| 2300 | args.oldp = &oldpolicy->policydb; | 2312 | convert_data->args.oldp = &oldpolicy->policydb; |
| 2301 | args.newp = &newpolicy->policydb; | 2313 | convert_data->args.newp = &newpolicy->policydb; |
| 2302 | 2314 | ||
| 2303 | convert_params.func = convert_context; | 2315 | convert_data->sidtab_params.func = convert_context; |
| 2304 | convert_params.args = &args; | 2316 | convert_data->sidtab_params.args = &convert_data->args; |
| 2305 | convert_params.target = newpolicy->sidtab; | 2317 | convert_data->sidtab_params.target = newpolicy->sidtab; |
| 2306 | 2318 | ||
| 2307 | rc = sidtab_convert(oldpolicy->sidtab, &convert_params); | 2319 | rc = sidtab_convert(oldpolicy->sidtab, &convert_data->sidtab_params); |
| 2308 | if (rc) { | 2320 | if (rc) { |
| 2309 | pr_err("SELinux: unable to convert the internal" | 2321 | pr_err("SELinux: unable to convert the internal" |
| 2310 | " representation of contexts in the new SID" | 2322 | " representation of contexts in the new SID" |
| 2311 | " table\n"); | 2323 | " table\n"); |
| 2312 | goto err_free_isids; | 2324 | goto err_free_convert_data; |
| 2313 | } | 2325 | } |
| 2314 | 2326 | ||
| 2315 | *newpolicyp = newpolicy; | 2327 | load_state->policy = newpolicy; |
| 2328 | load_state->convert_data = convert_data; | ||
| 2316 | return 0; | 2329 | return 0; |
| 2317 | 2330 | ||
| 2331 | err_free_convert_data: | ||
| 2332 | kfree(convert_data); | ||
| 2318 | err_free_isids: | 2333 | err_free_isids: |
| 2319 | sidtab_destroy(newpolicy->sidtab); | 2334 | sidtab_destroy(newpolicy->sidtab); |
| 2320 | err_mapping: | 2335 | err_mapping: |
| @@ -33,7 +33,6 @@ · 32 unmodified lines | |||
| 33 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 33 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 34 | MODULE_DESCRIPTION("A loopback soundcard"); | 34 | MODULE_DESCRIPTION("A loopback soundcard"); |
| 35 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
| 36 | MODULE_SUPPORTED_DEVICE("{{ALSA,Loopback soundcard}}"); | ||
| 37 | 36 | ||
| 38 | #define MAX_PCM_SUBSTREAMS 8 | 37 | #define MAX_PCM_SUBSTREAMS 8 |
| 39 | 38 | ||
| @@ -25,7 +25,6 @@ · 24 unmodified lines | |||
| 25 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 25 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 26 | MODULE_DESCRIPTION("Dummy soundcard (/dev/null)"); | 26 | MODULE_DESCRIPTION("Dummy soundcard (/dev/null)"); |
| 27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
| 28 | MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}"); | ||
| 29 | 28 | ||
| 30 | #define MAX_PCM_DEVICES 4 | 29 | #define MAX_PCM_DEVICES 4 |
| 31 | #define MAX_PCM_SUBSTREAMS 128 | 30 | #define MAX_PCM_SUBSTREAMS 128 |
| @@ -53,7 +53,6 @@ · 52 unmodified lines | |||
| 53 | MODULE_AUTHOR("Michael T. Mayers"); | 53 | MODULE_AUTHOR("Michael T. Mayers"); |
| 54 | MODULE_DESCRIPTION("MOTU MidiTimePiece AV multiport MIDI"); | 54 | MODULE_DESCRIPTION("MOTU MidiTimePiece AV multiport MIDI"); |
| 55 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
| 56 | MODULE_SUPPORTED_DEVICE("{{MOTU,MidiTimePiece AV multiport MIDI}}"); | ||
| 57 | 56 | ||
| 58 | // io resources | 57 | // io resources |
| 59 | #define MTPAV_IOBASE 0x378 | 58 | #define MTPAV_IOBASE 0x378 |
| @@ -37,7 +37,6 @@ MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); · 36 unmodified lines | |||
| 37 | MODULE_AUTHOR("Matthias Koenig <mk@phasorlab.de>"); | 37 | MODULE_AUTHOR("Matthias Koenig <mk@phasorlab.de>"); |
| 38 | MODULE_DESCRIPTION("ESI Miditerminal 4140"); | 38 | MODULE_DESCRIPTION("ESI Miditerminal 4140"); |
| 39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
| 40 | MODULE_SUPPORTED_DEVICE("{{ESI,Miditerminal 4140}}"); | ||
| 41 | 40 | ||
| 42 | /********************************************************************* | 41 | /********************************************************************* |
| 43 | * Chip specific | 42 | * Chip specific |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | |||
| 22 | MODULE_AUTHOR("Stas Sergeev <stsp@users.sourceforge.net>"); | 22 | MODULE_AUTHOR("Stas Sergeev <stsp@users.sourceforge.net>"); |
| 23 | MODULE_DESCRIPTION("PC-Speaker driver"); | 23 | MODULE_DESCRIPTION("PC-Speaker driver"); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | MODULE_SUPPORTED_DEVICE("{{PC-Speaker, pcsp}}"); | ||
| 26 | MODULE_ALIAS("platform:pcspkr"); | 25 | MODULE_ALIAS("platform:pcspkr"); |
| 27 | 26 | ||
| 28 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 27 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| @@ -57,7 +57,6 @@ MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); · 56 unmodified lines | |||
| 57 | MODULE_AUTHOR("Levent Guendogdu, Tobias Gehrig, Matthias Koenig"); | 57 | MODULE_AUTHOR("Levent Guendogdu, Tobias Gehrig, Matthias Koenig"); |
| 58 | MODULE_DESCRIPTION("Midiman Portman2x4"); | 58 | MODULE_DESCRIPTION("Midiman Portman2x4"); |
| 59 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
| 60 | MODULE_SUPPORTED_DEVICE("{{Midiman,Portman2x4}}"); | ||
| 61 | 60 | ||
| 62 | /********************************************************************* | 61 | /********************************************************************* |
| 63 | * Chip specific | 62 | * Chip specific |
| @@ -34,7 +34,6 @@ · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | MODULE_DESCRIPTION("MIDI serial u16550"); | 35 | MODULE_DESCRIPTION("MIDI serial u16550"); |
| 36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
| 37 | MODULE_SUPPORTED_DEVICE("{{ALSA, MIDI serial u16550}}"); | ||
| 38 | 37 | ||
| 39 | #define SNDRV_SERIAL_SOUNDCANVAS 0 /* Roland Soundcanvas; F5 NN selects part */ | 38 | #define SNDRV_SERIAL_SOUNDCANVAS 0 /* Roland Soundcanvas; F5 NN selects part */ |
| 40 | #define SNDRV_SERIAL_MS124T 1 /* Midiator MS-124T */ | 39 | #define SNDRV_SERIAL_MS124T 1 /* Midiator MS-124T */ |
| @@ -43,7 +43,6 @@ · 42 unmodified lines | |||
| 43 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 43 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 44 | MODULE_DESCRIPTION("Dummy soundcard for virtual rawmidi devices"); | 44 | MODULE_DESCRIPTION("Dummy soundcard for virtual rawmidi devices"); |
| 45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
| 46 | MODULE_SUPPORTED_DEVICE("{{ALSA,Virtual rawmidi device}}"); | ||
| 47 | 46 | ||
| 48 | #define MAX_MIDI_DEVICES 4 | 47 | #define MAX_MIDI_DEVICES 4 |
| 49 | 48 | ||
| @@ -493,11 +493,10 @@ void snd_dice_stream_stop_duplex(struct snd_dice *dice) · 492 unmodified lines | |||
| 493 | struct reg_params tx_params, rx_params; | 493 | struct reg_params tx_params, rx_params; |
| 494 | 494 | ||
| 495 | if (dice->substreams_counter == 0) { | 495 | if (dice->substreams_counter == 0) { |
| 496 | if (get_register_params(dice, &tx_params, &rx_params) >= 0) { | 496 | if (get_register_params(dice, &tx_params, &rx_params) >= 0) |
| 497 | amdtp_domain_stop(&dice->domain); | ||
| 498 | finish_session(dice, &tx_params, &rx_params); | 497 | finish_session(dice, &tx_params, &rx_params); |
| 499 | } | ||
| 500 | 498 | ||
| 499 | amdtp_domain_stop(&dice->domain); | ||
| 501 | release_resources(dice); | 500 | release_resources(dice); |
| 502 | } | 501 | } |
| 503 | } | 502 | } |
| @@ -22,13 +22,6 @@ · 21 unmodified lines | |||
| 22 | MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); | 22 | MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); |
| 23 | MODULE_DESCRIPTION("AD1816A, AD1815"); | 23 | MODULE_DESCRIPTION("AD1816A, AD1815"); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | MODULE_SUPPORTED_DEVICE("{{Highscreen,Sound-Boostar 16 3D}," | ||
| 26 | "{Analog Devices,AD1815}," | ||
| 27 | "{Analog Devices,AD1816A}," | ||
| 28 | "{TerraTec,Base 64}," | ||
| 29 | "{TerraTec,AudioSystem EWS64S}," | ||
| 30 | "{Aztech/Newcom SC-16 3D}," | ||
| 31 | "{Shark Predator ISA}}"); | ||
| 32 | 25 | ||
| 33 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ | 26 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ |
| 34 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 27 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -22,9 +22,6 @@ · 21 unmodified lines | |||
| 22 | MODULE_DESCRIPTION(CRD_NAME); | 22 | MODULE_DESCRIPTION(CRD_NAME); |
| 23 | MODULE_AUTHOR("Tugrul Galatali <galatalt@stuy.edu>, Jaroslav Kysela <perex@perex.cz>"); | 23 | MODULE_AUTHOR("Tugrul Galatali <galatalt@stuy.edu>, Jaroslav Kysela <perex@perex.cz>"); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1848}," | ||
| 26 | "{Analog Devices,AD1847}," | ||
| 27 | "{Crystal Semiconductors,CS4248}}"); | ||
| 28 | 25 | ||
| 29 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 26 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 30 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 27 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -26,17 +26,6 @@ · 25 unmodified lines | |||
| 26 | #define PFX "als100: " | 26 | #define PFX "als100: " |
| 27 | 27 | ||
| 28 | MODULE_DESCRIPTION("Avance Logic ALS007/ALS1X0"); | 28 | MODULE_DESCRIPTION("Avance Logic ALS007/ALS1X0"); |
| 29 | MODULE_SUPPORTED_DEVICE("{{Diamond Technologies DT-019X}," | ||
| 30 | "{Avance Logic ALS-007}}" | ||
| 31 | "{{Avance Logic,ALS100 - PRO16PNP}," | ||
| 32 | "{Avance Logic,ALS110}," | ||
| 33 | "{Avance Logic,ALS120}," | ||
| 34 | "{Avance Logic,ALS200}," | ||
| 35 | "{3D Melody,MF1000}," | ||
| 36 | "{Digimate,3D Sound}," | ||
| 37 | "{Avance Logic,ALS120}," | ||
| 38 | "{RTL,RTL3000}}"); | ||
| 39 | |||
| 40 | MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); | 29 | MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); |
| 41 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
| 42 | 31 | ||
| @@ -35,11 +35,6 @@ · 34 unmodified lines | |||
| 35 | MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); | 35 | MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); |
| 36 | MODULE_DESCRIPTION("Aztech Systems AZT2320"); | 36 | MODULE_DESCRIPTION("Aztech Systems AZT2320"); |
| 37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
| 38 | MODULE_SUPPORTED_DEVICE("{{Aztech Systems,PRO16V}," | ||
| 39 | "{Aztech Systems,AZT2320}," | ||
| 40 | "{Aztech Systems,AZT3300}," | ||
| 41 | "{Aztech Systems,AZT2320}," | ||
| 42 | "{Aztech Systems,AZT3000}}"); | ||
| 43 | 38 | ||
| 44 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 39 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 45 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 40 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -51,7 +51,6 @@ · 50 unmodified lines | |||
| 51 | MODULE_AUTHOR("George Talusan <gstalusan@uwaterloo.ca>"); | 51 | MODULE_AUTHOR("George Talusan <gstalusan@uwaterloo.ca>"); |
| 52 | MODULE_DESCRIPTION("C-Media CMI8330/CMI8329"); | 52 | MODULE_DESCRIPTION("C-Media CMI8330/CMI8329"); |
| 53 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
| 54 | MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8330,isapnp:{CMI0001,@@@0001,@X@0001}}}"); | ||
| 55 | 54 | ||
| 56 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 55 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 57 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 56 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | |||
| 23 | MODULE_DESCRIPTION(CRD_NAME); | 23 | MODULE_DESCRIPTION(CRD_NAME); |
| 24 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 24 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
| 26 | MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4231}}"); | ||
| 27 | 26 | ||
| 28 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 27 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 29 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 28 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -18,40 +18,6 @@ · 17 unmodified lines | |||
| 18 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 18 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 19 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
| 20 | MODULE_DESCRIPTION("Cirrus Logic CS4232-9"); | 20 | MODULE_DESCRIPTION("Cirrus Logic CS4232-9"); |
| 21 | MODULE_SUPPORTED_DEVICE("{{Turtle Beach,TBS-2000}," | ||
| 22 | "{Turtle Beach,Tropez Plus}," | ||
| 23 | "{SIC CrystalWave 32}," | ||
| 24 | "{Hewlett Packard,Omnibook 5500}," | ||
| 25 | "{TerraTec,Maestro 32/96}," | ||
| 26 | "{Philips,PCA70PS}}," | ||
| 27 | "{{Crystal Semiconductors,CS4235}," | ||
| 28 | "{Crystal Semiconductors,CS4236}," | ||
| 29 | "{Crystal Semiconductors,CS4237}," | ||
| 30 | "{Crystal Semiconductors,CS4238}," | ||
| 31 | "{Crystal Semiconductors,CS4239}," | ||
| 32 | "{Acer,AW37}," | ||
| 33 | "{Acer,AW35/Pro}," | ||
| 34 | "{Crystal,3D}," | ||
| 35 | "{Crystal Computer,TidalWave128}," | ||
| 36 | "{Dell,Optiplex GX1}," | ||
| 37 | "{Dell,Workstation 400 sound}," | ||
| 38 | "{EliteGroup,P5TX-LA sound}," | ||
| 39 | "{Gallant,SC-70P}," | ||
| 40 | "{Gateway,E1000 Onboard CS4236B}," | ||
| 41 | "{Genius,Sound Maker 3DJ}," | ||
| 42 | "{Hewlett Packard,HP6330 sound}," | ||
| 43 | "{IBM,PC 300PL sound}," | ||
| 44 | "{IBM,Aptiva 2137 E24}," | ||
| 45 | "{IBM,IntelliStation M Pro}," | ||
| 46 | "{Intel,Marlin Spike Mobo CS4235}," | ||
| 47 | "{Intel PR440FX Onboard}," | ||
| 48 | "{Guillemot,MaxiSound 16 PnP}," | ||
| 49 | "{NewClear,3D}," | ||
| 50 | "{TerraTec,AudioSystem EWS64L/XL}," | ||
| 51 | "{Typhoon Soundsystem,CS4236B}," | ||
| 52 | "{Turtle Beach,Malibu}," | ||
| 53 | "{Unknown,Digital PC 5000 Onboard}}"); | ||
| 54 | |||
| 55 | MODULE_ALIAS("snd_cs4232"); | 21 | MODULE_ALIAS("snd_cs4232"); |
| 56 | 22 | ||
| 57 | #define IDENT "CS4232+" | 23 | #define IDENT "CS4232+" |
| @@ -26,11 +26,6 @@ · 25 unmodified lines | |||
| 26 | MODULE_DESCRIPTION(CRD_NAME); | 26 | MODULE_DESCRIPTION(CRD_NAME); |
| 27 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 27 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 28 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 29 | MODULE_SUPPORTED_DEVICE("{{ESS,ES688 PnP AudioDrive,pnp:ESS0100}," | ||
| 30 | "{ESS,ES1688 PnP AudioDrive,pnp:ESS0102}," | ||
| 31 | "{ESS,ES688 AudioDrive,pnp:ESS6881}," | ||
| 32 | "{ESS,ES1688 AudioDrive,pnp:ESS1681}}"); | ||
| 33 | |||
| 34 | MODULE_ALIAS("snd_es968"); | 29 | MODULE_ALIAS("snd_es968"); |
| 35 | 30 | ||
| 36 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 31 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| @@ -1929,17 +1929,9 @@ static int snd_es18xx_mixer(struct snd_card *card) · 1928 unmodified lines | |||
| 1929 | 1929 | ||
| 1930 | /* Card level */ | 1930 | /* Card level */ |
| 1931 | 1931 | ||
| 1932 | MODULE_AUTHOR("Christian Fischbach <fishbach@pool.informatik.rwth-aachen.de>, Abramo Bagnara <abramo@alsa-project.org>"); | 1932 | MODULE_AUTHOR("Christian Fischbach <fishbach@pool.informatik.rwth-aachen.de>, Abramo Bagnara <abramo@alsa-project.org>"); |
| 1933 | MODULE_DESCRIPTION("ESS ES18xx AudioDrive"); | 1933 | MODULE_DESCRIPTION("ESS ES18xx AudioDrive"); |
| 1934 | MODULE_LICENSE("GPL"); | 1934 | MODULE_LICENSE("GPL"); |
| 1935 | MODULE_SUPPORTED_DEVICE("{{ESS,ES1868 PnP AudioDrive}," | ||
| 1936 | "{ESS,ES1869 PnP AudioDrive}," | ||
| 1937 | "{ESS,ES1878 PnP AudioDrive}," | ||
| 1938 | "{ESS,ES1879 PnP AudioDrive}," | ||
| 1939 | "{ESS,ES1887 PnP AudioDrive}," | ||
| 1940 | "{ESS,ES1888 PnP AudioDrive}," | ||
| 1941 | "{ESS,ES1887 AudioDrive}," | ||
| 1942 | "{ESS,ES1888 AudioDrive}}"); | ||
| 1943 | 1935 | ||
| 1944 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 1936 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 1945 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 1937 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | |||
| 23 | MODULE_DESCRIPTION(CRD_NAME); | 23 | MODULE_DESCRIPTION(CRD_NAME); |
| 24 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 24 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
| 26 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Classic}}"); | ||
| 27 | 26 | ||
| 28 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 27 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 29 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 28 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -27,7 +27,6 @@ · 26 unmodified lines | |||
| 27 | MODULE_DESCRIPTION(CRD_NAME); | 27 | MODULE_DESCRIPTION(CRD_NAME); |
| 28 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 28 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
| 30 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Extreme}}"); | ||
| 31 | 30 | ||
| 32 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 31 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 33 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 32 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | |||
| 21 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 21 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 22 | MODULE_DESCRIPTION("Gravis UltraSound MAX"); | 22 | MODULE_DESCRIPTION("Gravis UltraSound MAX"); |
| 23 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
| 24 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound MAX}}"); | ||
| 25 | 24 | ||
| 26 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 25 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 27 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 26 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -28,14 +28,8 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); · 27 unmodified lines | |||
| 28 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 29 | #ifndef SNDRV_STB | 29 | #ifndef SNDRV_STB |
| 30 | MODULE_DESCRIPTION("AMD InterWave"); | 30 | MODULE_DESCRIPTION("AMD InterWave"); |
| 31 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Plug & Play}," | ||
| 32 | "{STB,SoundRage32}," | ||
| 33 | "{MED,MED3210}," | ||
| 34 | "{Dynasonix,Dynasonix Pro}," | ||
| 35 | "{Panasonic,PCA761AW}}"); | ||
| 36 | #else | 31 | #else |
| 37 | MODULE_DESCRIPTION("AMD InterWave STB with TEA6330T"); | 32 | MODULE_DESCRIPTION("AMD InterWave STB with TEA6330T"); |
| 38 | MODULE_SUPPORTED_DEVICE("{{AMD,InterWave STB with TEA6330T}}"); | ||
| 39 | #endif | 33 | #endif |
| 40 | 34 | ||
| 41 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 35 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| @@ -22,11 +22,6 @@ · 21 unmodified lines | |||
| 22 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 22 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 23 | MODULE_DESCRIPTION("Yamaha OPL3SA2+"); | 23 | MODULE_DESCRIPTION("Yamaha OPL3SA2+"); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF719E-S}," | ||
| 26 | "{Genius,Sound Maker 3DX}," | ||
| 27 | "{Yamaha,OPL3SA3}," | ||
| 28 | "{Intel,AL440LX sound}," | ||
| 29 | "{NeoMagic,MagicWave 3DX}}"); | ||
| 30 | 25 | ||
| 31 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 26 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 32 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 27 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -33,9 +33,6 @@ · 32 unmodified lines | |||
| 33 | MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>"); | 33 | MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>"); |
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_DESCRIPTION("Miro miroSOUND PCM1 pro, PCM12, PCM20 Radio"); | 35 | MODULE_DESCRIPTION("Miro miroSOUND PCM1 pro, PCM12, PCM20 Radio"); |
| 36 | MODULE_SUPPORTED_DEVICE("{{Miro,miroSOUND PCM1 pro}, " | ||
| 37 | "{Miro,miroSOUND PCM12}, " | ||
| 38 | "{Miro,miroSOUND PCM20 Radio}}"); | ||
| 39 | 36 | ||
| 40 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 37 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| 41 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 38 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -36,17 +36,11 @@ MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); · 35 unmodified lines | |||
| 36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
| 37 | #ifdef OPTi93X | 37 | #ifdef OPTi93X |
| 38 | MODULE_DESCRIPTION("OPTi93X"); | 38 | MODULE_DESCRIPTION("OPTi93X"); |
| 39 | MODULE_SUPPORTED_DEVICE("{{OPTi,82C931/3}}"); | ||
| 40 | #else /* OPTi93X */ | 39 | #else /* OPTi93X */ |
| 41 | #ifdef CS4231 | 40 | #ifdef CS4231 |
| 42 | MODULE_DESCRIPTION("OPTi92X - CS4231"); | 41 | MODULE_DESCRIPTION("OPTi92X - CS4231"); |
| 43 | MODULE_SUPPORTED_DEVICE("{{OPTi,82C924 (CS4231)}," | ||
| 44 | "{OPTi,82C925 (CS4231)}}"); | ||
| 45 | #else /* CS4231 */ | 42 | #else /* CS4231 */ |
| 46 | MODULE_DESCRIPTION("OPTi92X - AD1848"); | 43 | MODULE_DESCRIPTION("OPTi92X - AD1848"); |
| 47 | MODULE_SUPPORTED_DEVICE("{{OPTi,82C924 (AD1848)}," | ||
| 48 | "{OPTi,82C925 (AD1848)}," | ||
| 49 | "{OAK,Mozart}}"); | ||
| 50 | #endif /* CS4231 */ | 44 | #endif /* CS4231 */ |
| 51 | #endif /* OPTi93X */ | 45 | #endif /* OPTi93X */ |
| 52 | 46 | ||
| @@ -28,9 +28,6 @@ · 27 unmodified lines | |||
| 28 | #define PFX "jazz16: " | 28 | #define PFX "jazz16: " |
| 29 | 29 | ||
| 30 | MODULE_DESCRIPTION("Media Vision Jazz16"); | 30 | MODULE_DESCRIPTION("Media Vision Jazz16"); |
| 31 | MODULE_SUPPORTED_DEVICE("{{Media Vision ??? }," | ||
| 32 | "{RTL,RTL3000}}"); | ||
| 33 | |||
| 34 | MODULE_AUTHOR("Krzysztof Helt <krzysztof.h1@wp.pl>"); | 31 | MODULE_AUTHOR("Krzysztof Helt <krzysztof.h1@wp.pl>"); |
| 35 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
| 36 | 33 | ||
| @@ -31,16 +31,8 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); · 30 unmodified lines | |||
| 31 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
| 32 | #ifndef SNDRV_SBAWE | 32 | #ifndef SNDRV_SBAWE |
| 33 | MODULE_DESCRIPTION("Sound Blaster 16"); | 33 | MODULE_DESCRIPTION("Sound Blaster 16"); |
| 34 | MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB 16}," | ||
| 35 | "{Creative Labs,SB Vibra16S}," | ||
| 36 | "{Creative Labs,SB Vibra16C}," | ||
| 37 | "{Creative Labs,SB Vibra16CL}," | ||
| 38 | "{Creative Labs,SB Vibra16X}}"); | ||
| 39 | #else | 34 | #else |
| 40 | MODULE_DESCRIPTION("Sound Blaster AWE"); | 35 | MODULE_DESCRIPTION("Sound Blaster AWE"); |
| 41 | MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB AWE 32}," | ||
| 42 | "{Creative Labs,SB AWE 64}," | ||
| 43 | "{Creative Labs,SB AWE 64 Gold}}"); | ||
| 44 | #endif | 36 | #endif |
| 45 | 37 | ||
| 46 | #if 0 | 38 | #if 0 |
| @@ -17,7 +17,6 @@ · 16 unmodified lines | |||
| 17 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 17 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 18 | MODULE_DESCRIPTION("Sound Blaster 1.0/2.0/Pro"); | 18 | MODULE_DESCRIPTION("Sound Blaster 1.0/2.0/Pro"); |
| 19 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
| 20 | MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB 1.0/SB 2.0/SB Pro}}"); | ||
| 21 | 20 | ||
| 22 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 21 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 23 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 22 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -29,9 +29,6 @@ · 28 unmodified lines | |||
| 29 | MODULE_AUTHOR("Krzysztof Helt"); | 29 | MODULE_AUTHOR("Krzysztof Helt"); |
| 30 | MODULE_DESCRIPTION("Gallant SC-6000"); | 30 | MODULE_DESCRIPTION("Gallant SC-6000"); |
| 31 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
| 32 | MODULE_SUPPORTED_DEVICE("{{Gallant, SC-6000}," | ||
| 33 | "{AudioExcel, Audio Excel DSP 16}," | ||
| 34 | "{Zoltrix, AV302}}"); | ||
| 35 | 32 | ||
| 36 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 33 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 37 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 34 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | |||
| 21 | MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>"); | 21 | MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>"); |
| 22 | MODULE_DESCRIPTION("Turtle Beach Wavefront"); | 22 | MODULE_DESCRIPTION("Turtle Beach Wavefront"); |
| 23 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
| 24 | MODULE_SUPPORTED_DEVICE("{{Turtle Beach,Maui/Tropez/Tropez+}}"); | ||
| 25 | 24 | ||
| 26 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 25 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 27 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 26 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | |||
| 32 | MODULE_AUTHOR("Vivien Chappelier <vivien.chappelier@linux-mips.org>"); | 32 | MODULE_AUTHOR("Vivien Chappelier <vivien.chappelier@linux-mips.org>"); |
| 33 | MODULE_DESCRIPTION("SGI O2 Audio"); | 33 | MODULE_DESCRIPTION("SGI O2 Audio"); |
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_SUPPORTED_DEVICE("{{Silicon Graphics, O2 Audio}}"); | ||
| 36 | 35 | ||
| 37 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 36 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| 38 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 37 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -43,7 +43,6 @@ · 42 unmodified lines | |||
| 43 | MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>"); | 43 | MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>"); |
| 44 | MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver"); | 44 | MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver"); |
| 45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
| 46 | MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1889}}"); | ||
| 47 | 46 | ||
| 48 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 47 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 49 | module_param_array(index, int, NULL, 0444); | 48 | module_param_array(index, int, NULL, 0444); |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | |||
| 29 | MODULE_AUTHOR("Matt Wu <Matt_Wu@acersoftech.com.cn>"); | 29 | MODULE_AUTHOR("Matt Wu <Matt_Wu@acersoftech.com.cn>"); |
| 30 | MODULE_DESCRIPTION("ALI M5451"); | 30 | MODULE_DESCRIPTION("ALI M5451"); |
| 31 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
| 32 | MODULE_SUPPORTED_DEVICE("{{ALI,M5451,pci},{ALI,M5451}}"); | ||
| 33 | 32 | ||
| 34 | static int index = SNDRV_DEFAULT_IDX1; /* Index */ | 33 | static int index = SNDRV_DEFAULT_IDX1; /* Index */ |
| 35 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 34 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -86,7 +86,6 @@ enum {DEVICE_ALS300, DEVICE_ALS300_PLUS}; · 85 unmodified lines | |||
| 86 | MODULE_AUTHOR("Ash Willis <ashwillis@programmer.net>"); | 86 | MODULE_AUTHOR("Ash Willis <ashwillis@programmer.net>"); |
| 87 | MODULE_DESCRIPTION("Avance Logic ALS300"); | 87 | MODULE_DESCRIPTION("Avance Logic ALS300"); |
| 88 | MODULE_LICENSE("GPL"); | 88 | MODULE_LICENSE("GPL"); |
| 89 | MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS300},{Avance Logic,ALS300+}}"); | ||
| 90 | 89 | ||
| 91 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 90 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 92 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 91 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
| @@ -68,7 +68,6 @@ · 67 unmodified lines | |||
| 68 | MODULE_AUTHOR("Bart Hartgers <bart@etpmod.phys.tue.nl>, Andreas Mohr"); | 68 | MODULE_AUTHOR("Bart Hartgers <bart@etpmod.phys.tue.nl>, Andreas Mohr"); |
| 69 | MODULE_DESCRIPTION("Avance Logic ALS4000"); | 69 | MODULE_DESCRIPTION("Avance Logic ALS4000"); |
| 70 | MODULE_LICENSE("GPL"); | 70 | MODULE_LICENSE("GPL"); |
| 71 | MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}"); | ||
| 72 | 71 | ||
| 73 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 72 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| 74 | #define SUPPORT_JOYSTICK 1 | 73 | #define SUPPORT_JOYSTICK 1 |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | |||
| 23 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 23 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 24 | MODULE_DESCRIPTION("ATI IXP AC97 controller"); | 24 | MODULE_DESCRIPTION("ATI IXP AC97 controller"); |
| 25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
| 26 | MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250/300/400/600}}"); | ||
| 27 | 26 | ||
| 28 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 27 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| 29 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 28 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | |||
| 23 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 23 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 24 | MODULE_DESCRIPTION("ATI IXP MC97 controller"); | 24 | MODULE_DESCRIPTION("ATI IXP MC97 controller"); |
| 25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
| 26 | MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250}}"); | ||
| 27 | 26 | ||
| 28 | static int index = -2; /* Exclude the first card */ | 27 | static int index = -2; /* Exclude the first card */ |
| 29 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 28 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -41,8 +41,6 @@ MODULE_PARM_DESC(pcifix, "Enable VIA-workaround for " CARD_NAME " soundcard."); · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | MODULE_DESCRIPTION("Aureal vortex"); | 42 | MODULE_DESCRIPTION("Aureal vortex"); |
| 43 | MODULE_LICENSE("GPL"); | 43 | MODULE_LICENSE("GPL"); |
| 44 | MODULE_SUPPORTED_DEVICE("{{Aureal Semiconductor Inc., Aureal Vortex Sound Processor}}"); | ||
| 45 | |||
| 46 | MODULE_DEVICE_TABLE(pci, snd_vortex_ids); | 44 | MODULE_DEVICE_TABLE(pci, snd_vortex_ids); |
| 47 | 45 | ||
| 48 | static void vortex_fix_latency(struct pci_dev *vortex) | 46 | static void vortex_fix_latency(struct pci_dev *vortex) |
| @@ -196,7 +196,6 @@ · 195 unmodified lines | |||
| 196 | MODULE_AUTHOR("Andreas Mohr <andi AT lisas.de>"); | 196 | MODULE_AUTHOR("Andreas Mohr <andi AT lisas.de>"); |
| 197 | MODULE_DESCRIPTION("Aztech AZF3328 (PCI168)"); | 197 | MODULE_DESCRIPTION("Aztech AZF3328 (PCI168)"); |
| 198 | MODULE_LICENSE("GPL"); | 198 | MODULE_LICENSE("GPL"); |
| 199 | MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | ||
| 200 | 199 | ||
| 201 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 200 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| 202 | #define SUPPORT_GAMEPORT 1 | 201 | #define SUPPORT_GAMEPORT 1 |
| @@ -23,8 +23,6 @@ · 22 unmodified lines | |||
| 23 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 23 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
| 24 | MODULE_DESCRIPTION("Brooktree Bt87x audio driver"); | 24 | MODULE_DESCRIPTION("Brooktree Bt87x audio driver"); |
| 25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
| 26 | MODULE_SUPPORTED_DEVICE("{{Brooktree,Bt878}," | ||
| 27 | "{Brooktree,Bt879}}"); | ||
| 28 | 26 | ||
| 29 | static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ | 27 | static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ |
| 30 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 28 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -137,7 +137,6 @@ · 136 unmodified lines | |||
| 137 | MODULE_AUTHOR("James Courtier-Dutton <James@superbug.demon.co.uk>"); | 137 | MODULE_AUTHOR("James Courtier-Dutton <James@superbug.demon.co.uk>"); |
| 138 | MODULE_DESCRIPTION("CA0106"); | 138 | MODULE_DESCRIPTION("CA0106"); |
| 139 | MODULE_LICENSE("GPL"); | 139 | MODULE_LICENSE("GPL"); |
| 140 | MODULE_SUPPORTED_DEVICE("{{Creative,SB CA0106 chip}}"); | ||
| 141 | 140 | ||
| 142 | // module parameters (see "Module Parameters") | 141 | // module parameters (see "Module Parameters") |
| 143 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 142 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| @@ -30,10 +30,6 @@ · 29 unmodified lines | |||
| 30 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 30 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 31 | MODULE_DESCRIPTION("C-Media CMI8x38 PCI"); | 31 | MODULE_DESCRIPTION("C-Media CMI8x38 PCI"); |
| 32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
| 33 | MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738}," | ||
| 34 | "{C-Media,CMI8738B}," | ||
| 35 | "{C-Media,CMI8338A}," | ||
| 36 | "{C-Media,CMI8338B}}"); | ||
| 37 | 33 | ||
| 38 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 34 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| 39 | #define SUPPORT_JOYSTICK 1 | 35 | #define SUPPORT_JOYSTICK 1 |
| @@ -25,7 +25,6 @@ · 24 unmodified lines | |||
| 25 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 25 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 26 | MODULE_DESCRIPTION("Cirrus Logic CS4281"); | 26 | MODULE_DESCRIPTION("Cirrus Logic CS4281"); |
| 27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
| 28 | MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,CS4281}}"); | ||
| 29 | 28 | ||
| 30 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 29 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 31 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 30 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -21,13 +21,6 @@ · 20 unmodified lines | |||
| 21 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 21 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 22 | MODULE_DESCRIPTION("Cirrus Logic Sound Fusion CS46XX"); | 22 | MODULE_DESCRIPTION("Cirrus Logic Sound Fusion CS46XX"); |
| 23 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
| 24 | MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,Sound Fusion (CS4280)}," | ||
| 25 | "{Cirrus Logic,Sound Fusion (CS4610)}," | ||
| 26 | "{Cirrus Logic,Sound Fusion (CS4612)}," | ||
| 27 | "{Cirrus Logic,Sound Fusion (CS4615)}," | ||
| 28 | "{Cirrus Logic,Sound Fusion (CS4622)}," | ||
| 29 | "{Cirrus Logic,Sound Fusion (CS4624)}," | ||
| 30 | "{Cirrus Logic,Sound Fusion (CS4630)}}"); | ||
| 31 | 24 | ||
| 32 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 25 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 33 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 26 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -393,4 +393,3 @@ module_pci_driver(cs5535audio_driver); · 392 unmodified lines | |||
| 393 | MODULE_AUTHOR("Jaya Kumar"); | 393 | MODULE_AUTHOR("Jaya Kumar"); |
| 394 | MODULE_LICENSE("GPL"); | 394 | MODULE_LICENSE("GPL"); |
| 395 | MODULE_DESCRIPTION("CS5535 Audio"); | 395 | MODULE_DESCRIPTION("CS5535 Audio"); |
| 396 | MODULE_SUPPORTED_DEVICE("CS5535 Audio"); | ||
| @@ -18,7 +18,6 @@ · 17 unmodified lines | |||
| 18 | MODULE_AUTHOR("Creative Technology Ltd"); | 18 | MODULE_AUTHOR("Creative Technology Ltd"); |
| 19 | MODULE_DESCRIPTION("X-Fi driver version 1.03"); | 19 | MODULE_DESCRIPTION("X-Fi driver version 1.03"); |
| 20 | MODULE_LICENSE("GPL v2"); | 20 | MODULE_LICENSE("GPL v2"); |
| 21 | MODULE_SUPPORTED_DEVICE("{{Creative Labs, Sound Blaster X-Fi}"); | ||
| 22 | 21 | ||
| 23 | static unsigned int reference_rate = 48000; | 22 | static unsigned int reference_rate = 48000; |
| 24 | static unsigned int multiple = 2; | 23 | static unsigned int multiple = 2; |
| @@ -10,7 +10,6 @@ · 9 unmodified lines | |||
| 10 | MODULE_AUTHOR("Giuliano Pochini <pochini@shiny.it>"); | 10 | MODULE_AUTHOR("Giuliano Pochini <pochini@shiny.it>"); |
| 11 | MODULE_LICENSE("GPL v2"); | 11 | MODULE_LICENSE("GPL v2"); |
| 12 | MODULE_DESCRIPTION("Echoaudio " ECHOCARD_NAME " soundcards driver"); | 12 | MODULE_DESCRIPTION("Echoaudio " ECHOCARD_NAME " soundcards driver"); |
| 13 | MODULE_SUPPORTED_DEVICE("{{Echoaudio," ECHOCARD_NAME "}}"); | ||
| 14 | MODULE_DEVICE_TABLE(pci, snd_echo_ids); | 13 | MODULE_DEVICE_TABLE(pci, snd_echo_ids); |
| 15 | 14 | ||
| 16 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 15 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| @@ -18,8 +18,6 @@ · 17 unmodified lines | |||
| 18 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 18 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 19 | MODULE_DESCRIPTION("EMU10K1"); | 19 | MODULE_DESCRIPTION("EMU10K1"); |
| 20 | MODULE_LICENSE("GPL"); | 20 | MODULE_LICENSE("GPL"); |
| 21 | MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS}," | ||
| 22 | "{Creative Labs,SB Audigy}}"); | ||
| 23 | 21 | ||
| 24 | #if IS_ENABLED(CONFIG_SND_SEQUENCER) | 22 | #if IS_ENABLED(CONFIG_SND_SEQUENCER) |
| 25 | #define ENABLE_SYNTH | 23 | #define ENABLE_SYNTH |
| @@ -31,7 +31,6 @@ · 30 unmodified lines | |||
| 31 | MODULE_AUTHOR("Francisco Moraes <fmoraes@nc.rr.com>"); | 31 | MODULE_AUTHOR("Francisco Moraes <fmoraes@nc.rr.com>"); |
| 32 | MODULE_DESCRIPTION("EMU10K1X"); | 32 | MODULE_DESCRIPTION("EMU10K1X"); |
| 33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
| 34 | MODULE_SUPPORTED_DEVICE("{{Dell Creative Labs,SB Live!}"); | ||
| 35 | 34 | ||
| 36 | // module parameters (see "Module Parameters") | 35 | // module parameters (see "Module Parameters") |
| 37 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 36 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| @@ -52,17 +52,9 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Thomas Sailer <sailer@ife.ee.et · 51 unmodified lines | |||
| 52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
| 53 | #ifdef CHIP1370 | 53 | #ifdef CHIP1370 |
| 54 | MODULE_DESCRIPTION("Ensoniq AudioPCI ES1370"); | 54 | MODULE_DESCRIPTION("Ensoniq AudioPCI ES1370"); |
| 55 | MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI-97 ES1370}," | ||
| 56 | "{Creative Labs,SB PCI64/128 (ES1370)}}"); | ||
| 57 | #endif | 55 | #endif |
| 58 | #ifdef CHIP1371 | 56 | #ifdef CHIP1371 |
| 59 | MODULE_DESCRIPTION("Ensoniq/Creative AudioPCI ES1371+"); | 57 | MODULE_DESCRIPTION("Ensoniq/Creative AudioPCI ES1371+"); |
| 60 | MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI ES1371/73}," | ||
| 61 | "{Ensoniq,AudioPCI ES1373}," | ||
| 62 | "{Creative Labs,Ectiva EV1938}," | ||
| 63 | "{Creative Labs,SB PCI64/128 (ES1371/73)}," | ||
| 64 | "{Creative Labs,Vibra PCI128}," | ||
| 65 | "{Ectiva,EV1938}}"); | ||
| 66 | #endif | 58 | #endif |
| 67 | 59 | ||
| 68 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 60 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| @@ -52,10 +52,6 @@ · 51 unmodified lines | |||
| 52 | MODULE_AUTHOR("Jaromir Koutek <miri@punknet.cz>"); | 52 | MODULE_AUTHOR("Jaromir Koutek <miri@punknet.cz>"); |
| 53 | MODULE_DESCRIPTION("ESS Solo-1"); | 53 | MODULE_DESCRIPTION("ESS Solo-1"); |
| 54 | MODULE_LICENSE("GPL"); | 54 | MODULE_LICENSE("GPL"); |
| 55 | MODULE_SUPPORTED_DEVICE("{{ESS,ES1938}," | ||
| 56 | "{ESS,ES1946}," | ||
| 57 | "{ESS,ES1969}," | ||
| 58 | "{TerraTec,128i PCI}}"); | ||
| 59 | 55 | ||
| 60 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 56 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| 61 | #define SUPPORT_JOYSTICK 1 | 57 | #define SUPPORT_JOYSTICK 1 |
| @@ -107,10 +107,6 @@ · 106 unmodified lines | |||
| 107 | 107 | ||
| 108 | MODULE_DESCRIPTION("ESS Maestro"); | 108 | MODULE_DESCRIPTION("ESS Maestro"); |
| 109 | MODULE_LICENSE("GPL"); | 109 | MODULE_LICENSE("GPL"); |
| 110 | MODULE_SUPPORTED_DEVICE("{{ESS,Maestro 2e}," | ||
| 111 | "{ESS,Maestro 2}," | ||
| 112 | "{ESS,Maestro 1}," | ||
| 113 | "{TerraTec,DMX}}"); | ||
| 114 | 110 | ||
| 115 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 111 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| 116 | #define SUPPORT_JOYSTICK 1 | 112 | #define SUPPORT_JOYSTICK 1 |
| @@ -26,8 +26,6 @@ · 25 unmodified lines | |||
| 26 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 26 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 27 | MODULE_DESCRIPTION("ForteMedia FM801"); | 27 | MODULE_DESCRIPTION("ForteMedia FM801"); |
| 28 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 29 | MODULE_SUPPORTED_DEVICE("{{ForteMedia,FM801}," | ||
| 30 | "{Genius,SoundMaker Live 5.1}}"); | ||
| 31 | 29 | ||
| 32 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 30 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 33 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 31 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -4065,7 +4065,7 @@ static int add_micmute_led_hook(struct hda_codec *codec) · 4064 unmodified lines | |||
| 4065 | 4065 | ||
| 4066 | spec->micmute_led.led_mode = MICMUTE_LED_FOLLOW_MUTE; | 4066 | spec->micmute_led.led_mode = MICMUTE_LED_FOLLOW_MUTE; |
| 4067 | spec->micmute_led.capture = 0; | 4067 | spec->micmute_led.capture = 0; |
| 4068 | spec->micmute_led.led_value = 0; | 4068 | spec->micmute_led.led_value = -1; |
| 4069 | spec->micmute_led.old_hook = spec->cap_sync_hook; | 4069 | spec->micmute_led.old_hook = spec->cap_sync_hook; |
| 4070 | spec->cap_sync_hook = update_micmute_led; | 4070 | spec->cap_sync_hook = update_micmute_led; |
| 4071 | if (!snd_hda_gen_add_kctl(spec, NULL, &micmute_led_mode_ctl)) | 4071 | if (!snd_hda_gen_add_kctl(spec, NULL, &micmute_led_mode_ctl)) |
| @@ -208,40 +208,6 @@ MODULE_PARM_DESC(snoop, "Enable/disable snooping"); · 207 unmodified lines | |||
| 208 | 208 | ||
| 209 | 209 | ||
| 210 | MODULE_LICENSE("GPL"); | 210 | MODULE_LICENSE("GPL"); |
| 211 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | ||
| 212 | "{Intel, ICH6M}," | ||
| 213 | "{Intel, ICH7}," | ||
| 214 | "{Intel, ESB2}," | ||
| 215 | "{Intel, ICH8}," | ||
| 216 | "{Intel, ICH9}," | ||
| 217 | "{Intel, ICH10}," | ||
| 218 | "{Intel, PCH}," | ||
| 219 | "{Intel, CPT}," | ||
| 220 | "{Intel, PPT}," | ||
| 221 | "{Intel, LPT}," | ||
| 222 | "{Intel, LPT_LP}," | ||
| 223 | "{Intel, WPT_LP}," | ||
| 224 | "{Intel, SPT}," | ||
| 225 | "{Intel, SPT_LP}," | ||
| 226 | "{Intel, HPT}," | ||
| 227 | "{Intel, PBG}," | ||
| 228 | "{Intel, SCH}," | ||
| 229 | "{ATI, SB450}," | ||
| 230 | "{ATI, SB600}," | ||
| 231 | "{ATI, RS600}," | ||
| 232 | "{ATI, RS690}," | ||
| 233 | "{ATI, RS780}," | ||
| 234 | "{ATI, R600}," | ||
| 235 | "{ATI, RV630}," | ||
| 236 | "{ATI, RV610}," | ||
| 237 | "{ATI, RV670}," | ||
| 238 | "{ATI, RV635}," | ||
| 239 | "{ATI, RV620}," | ||
| 240 | "{ATI, RV770}," | ||
| 241 | "{VIA, VT8251}," | ||
| 242 | "{VIA, VT8237A}," | ||
| 243 | "{SiS, SIS966}," | ||
| 244 | "{ULI, M5461}}"); | ||
| 245 | MODULE_DESCRIPTION("Intel HDA driver"); | 211 | MODULE_DESCRIPTION("Intel HDA driver"); |
| 246 | 212 | ||
| 247 | #if defined(CONFIG_PM) && defined(CONFIG_VGA_SWITCHEROO) | 213 | #if defined(CONFIG_PM) && defined(CONFIG_VGA_SWITCHEROO) |
| @@ -4225,6 +4225,12 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, · 4224 unmodified lines | |||
| 4225 | } | 4225 | } |
| 4226 | } | 4226 | } |
| 4227 | 4227 | ||
| 4228 | static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, | ||
| 4229 | const struct hda_fixup *fix, int action) | ||
| 4230 | { | ||
| 4231 | alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); | ||
| 4232 | } | ||
| 4233 | |||
| 4228 | static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, | 4234 | static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, |
| 4229 | const struct hda_fixup *fix, int action) | 4235 | const struct hda_fixup *fix, int action) |
| 4230 | { | 4236 | { |
| @@ -6381,6 +6387,7 @@ enum { · 2150 unmodified lines | |||
| 6381 | ALC294_FIXUP_ASUS_GX502_VERBS, | 6387 | ALC294_FIXUP_ASUS_GX502_VERBS, |
| 6382 | ALC285_FIXUP_HP_GPIO_LED, | 6388 | ALC285_FIXUP_HP_GPIO_LED, |
| 6383 | ALC285_FIXUP_HP_MUTE_LED, | 6389 | ALC285_FIXUP_HP_MUTE_LED, |
| 6390 | ALC236_FIXUP_HP_GPIO_LED, | ||
| 6384 | ALC236_FIXUP_HP_MUTE_LED, | 6391 | ALC236_FIXUP_HP_MUTE_LED, |
| 6385 | ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, | 6392 | ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, |
| 6386 | ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, | 6393 | ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, |
| @@ -7616,6 +7623,10 @@ static const struct hda_fixup alc269_fixups[] = { · 1229 unmodified lines | |||
| 7616 | .type = HDA_FIXUP_FUNC, | 7623 | .type = HDA_FIXUP_FUNC, |
| 7617 | .v.func = alc285_fixup_hp_mute_led, | 7624 | .v.func = alc285_fixup_hp_mute_led, |
| 7618 | }, | 7625 | }, |
| 7626 | [ALC236_FIXUP_HP_GPIO_LED] = { | ||
| 7627 | .type = HDA_FIXUP_FUNC, | ||
| 7628 | .v.func = alc236_fixup_hp_gpio_led, | ||
| 7629 | }, | ||
| 7619 | [ALC236_FIXUP_HP_MUTE_LED] = { | 7630 | [ALC236_FIXUP_HP_MUTE_LED] = { |
| 7620 | .type = HDA_FIXUP_FUNC, | 7631 | .type = HDA_FIXUP_FUNC, |
| 7621 | .v.func = alc236_fixup_hp_mute_led, | 7632 | .v.func = alc236_fixup_hp_mute_led, |
| @@ -8045,9 +8056,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 423 unmodified lines | |||
| 8045 | SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation", | 8056 | SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation", |
| 8046 | ALC285_FIXUP_HP_GPIO_AMP_INIT), | 8057 | ALC285_FIXUP_HP_GPIO_AMP_INIT), |
| 8047 | SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED), | 8058 | SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED), |
| 8059 | SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), | ||
| 8048 | SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED), | 8060 | SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED), |
| 8049 | SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED), | 8061 | SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED), |
| 8050 | SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP), | 8062 | SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP), |
| 8063 | SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED), | ||
| 8064 | SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED), | ||
| 8051 | SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), | 8065 | SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), |
| 8052 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), | 8066 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
| 8053 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 8067 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| @@ -8242,7 +8256,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 188 unmodified lines | |||
| 8242 | SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101), | 8256 | SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101), |
| 8243 | SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ | 8257 | SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ |
| 8244 | SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), | 8258 | SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), |
| 8259 | SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
| 8245 | SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), | 8260 | SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), |
| 8261 | SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC), | ||
| 8246 | SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), | 8262 | SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), |
| 8247 | SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), | 8263 | SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), |
| 8248 | SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), | 8264 | SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), |
| @@ -60,12 +60,6 @@ · 59 unmodified lines | |||
| 60 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 60 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 61 | MODULE_DESCRIPTION("ICEnsemble ICE1712 (Envy24)"); | 61 | MODULE_DESCRIPTION("ICEnsemble ICE1712 (Envy24)"); |
| 62 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
| 63 | MODULE_SUPPORTED_DEVICE("{" | ||
| 64 | HOONTECH_DEVICE_DESC | ||
| 65 | DELTA_DEVICE_DESC | ||
| 66 | EWS_DEVICE_DESC | ||
| 67 | "{ICEnsemble,Generic ICE1712}," | ||
| 68 | "{ICEnsemble,Generic Envy24}}"); | ||
| 69 | 63 | ||
| 70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 64 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 71 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 65 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -44,25 +44,6 @@ · 43 unmodified lines | |||
| 44 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 44 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 45 | MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)"); | 45 | MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)"); |
| 46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
| 47 | MODULE_SUPPORTED_DEVICE("{" | ||
| 48 | REVO_DEVICE_DESC | ||
| 49 | AMP_AUDIO2000_DEVICE_DESC | ||
| 50 | AUREON_DEVICE_DESC | ||
| 51 | VT1720_MOBO_DEVICE_DESC | ||
| 52 | PONTIS_DEVICE_DESC | ||
| 53 | PRODIGY192_DEVICE_DESC | ||
| 54 | PRODIGY_HIFI_DEVICE_DESC | ||
| 55 | JULI_DEVICE_DESC | ||
| 56 | MAYA44_DEVICE_DESC | ||
| 57 | PHASE_DEVICE_DESC | ||
| 58 | WTM_DEVICE_DESC | ||
| 59 | SE_DEVICE_DESC | ||
| 60 | QTET_DEVICE_DESC | ||
| 61 | "{VIA,VT1720}," | ||
| 62 | "{VIA,VT1724}," | ||
| 63 | "{ICEnsemble,Generic ICE1724}," | ||
| 64 | "{ICEnsemble,Generic Envy24HT}" | ||
| 65 | "{ICEnsemble,Generic Envy24PT}}"); | ||
| 66 | 47 | ||
| 67 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 48 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 68 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 49 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -27,29 +27,6 @@ · 26 unmodified lines | |||
| 27 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 27 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 28 | MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7012; Ali 5455"); | 28 | MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7012; Ali 5455"); |
| 29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
| 30 | MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH}," | ||
| 31 | "{Intel,82901AB-ICH0}," | ||
| 32 | "{Intel,82801BA-ICH2}," | ||
| 33 | "{Intel,82801CA-ICH3}," | ||
| 34 | "{Intel,82801DB-ICH4}," | ||
| 35 | "{Intel,ICH5}," | ||
| 36 | "{Intel,ICH6}," | ||
| 37 | "{Intel,ICH7}," | ||
| 38 | "{Intel,6300ESB}," | ||
| 39 | "{Intel,ESB2}," | ||
| 40 | "{Intel,MX440}," | ||
| 41 | "{SiS,SI7012}," | ||
| 42 | "{NVidia,nForce Audio}," | ||
| 43 | "{NVidia,nForce2 Audio}," | ||
| 44 | "{NVidia,nForce3 Audio}," | ||
| 45 | "{NVidia,MCP04}," | ||
| 46 | "{NVidia,MCP501}," | ||
| 47 | "{NVidia,CK804}," | ||
| 48 | "{NVidia,CK8}," | ||
| 49 | "{NVidia,CK8S}," | ||
| 50 | "{AMD,AMD768}," | ||
| 51 | "{AMD,AMD8111}," | ||
| 52 | "{ALI,M5455}}"); | ||
| 53 | 30 | ||
| 54 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 31 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| 55 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 32 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -25,21 +25,6 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); · 24 unmodified lines | |||
| 25 | MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; " | 25 | MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; " |
| 26 | "SiS 7013; NVidia MCP/2/2S/3 modems"); | 26 | "SiS 7013; NVidia MCP/2/2S/3 modems"); |
| 27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
| 28 | MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH}," | ||
| 29 | "{Intel,82901AB-ICH0}," | ||
| 30 | "{Intel,82801BA-ICH2}," | ||
| 31 | "{Intel,82801CA-ICH3}," | ||
| 32 | "{Intel,82801DB-ICH4}," | ||
| 33 | "{Intel,ICH5}," | ||
| 34 | "{Intel,ICH6}," | ||
| 35 | "{Intel,ICH7}," | ||
| 36 | "{Intel,MX440}," | ||
| 37 | "{SiS,7013}," | ||
| 38 | "{NVidia,NForce Modem}," | ||
| 39 | "{NVidia,NForce2 Modem}," | ||
| 40 | "{NVidia,NForce2s Modem}," | ||
| 41 | "{NVidia,NForce3 Modem}," | ||
| 42 | "{AMD,AMD768}}"); | ||
| 43 | 28 | ||
| 44 | static int index = -2; /* Exclude the first card */ | 29 | static int index = -2; /* Exclude the first card */ |
| 45 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 30 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -388,7 +388,6 @@ struct snd_korg1212 { · 387 unmodified lines | |||
| 388 | 388 | ||
| 389 | MODULE_DESCRIPTION("korg1212"); | 389 | MODULE_DESCRIPTION("korg1212"); |
| 390 | MODULE_LICENSE("GPL"); | 390 | MODULE_LICENSE("GPL"); |
| 391 | MODULE_SUPPORTED_DEVICE("{{KORG,korg1212}}"); | ||
| 392 | MODULE_FIRMWARE("korg/k1212.dsp"); | 391 | MODULE_FIRMWARE("korg/k1212.dsp"); |
| 393 | 392 | ||
| 394 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 393 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| @@ -54,7 +54,6 @@ MODULE_PARM_DESC(sample_rate_min, "Minimal sample rate"); · 53 unmodified lines | |||
| 54 | */ | 54 | */ |
| 55 | 55 | ||
| 56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
| 57 | MODULE_SUPPORTED_DEVICE("{{Digigram, Lola}}"); | ||
| 58 | MODULE_DESCRIPTION("Digigram Lola driver"); | 57 | MODULE_DESCRIPTION("Digigram Lola driver"); |
| 59 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 58 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 60 | 59 | ||
| @@ -21,8 +21,6 @@ · 20 unmodified lines | |||
| 21 | MODULE_AUTHOR("Tim Blechmann"); | 21 | MODULE_AUTHOR("Tim Blechmann"); |
| 22 | MODULE_LICENSE("GPL"); | 22 | MODULE_LICENSE("GPL"); |
| 23 | MODULE_DESCRIPTION("digigram lx6464es"); | 23 | MODULE_DESCRIPTION("digigram lx6464es"); |
| 24 | MODULE_SUPPORTED_DEVICE("{digigram lx6464es{}}"); | ||
| 25 | |||
| 26 | 24 | ||
| 27 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 25 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 28 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 26 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
| @@ -39,11 +39,6 @@ · 38 unmodified lines | |||
| 39 | MODULE_AUTHOR("Zach Brown <zab@zabbo.net>, Takashi Iwai <tiwai@suse.de>"); | 39 | MODULE_AUTHOR("Zach Brown <zab@zabbo.net>, Takashi Iwai <tiwai@suse.de>"); |
| 40 | MODULE_DESCRIPTION("ESS Maestro3 PCI"); | 40 | MODULE_DESCRIPTION("ESS Maestro3 PCI"); |
| 41 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
| 42 | MODULE_SUPPORTED_DEVICE("{{ESS,Maestro3 PCI}," | ||
| 43 | "{ESS,ES1988}," | ||
| 44 | "{ESS,Allegro PCI}," | ||
| 45 | "{ESS,Allegro-1 PCI}," | ||
| 46 | "{ESS,Canyon3D-2/LE PCI}}"); | ||
| 47 | MODULE_FIRMWARE("ess/maestro3_assp_kernel.fw"); | 42 | MODULE_FIRMWARE("ess/maestro3_assp_kernel.fw"); |
| 48 | MODULE_FIRMWARE("ess/maestro3_assp_minisrc.fw"); | 43 | MODULE_FIRMWARE("ess/maestro3_assp_minisrc.fw"); |
| 49 | 44 | ||
| @@ -32,7 +32,6 @@ · 31 unmodified lines | |||
| 32 | MODULE_AUTHOR("Digigram <alsa@digigram.com>"); | 32 | MODULE_AUTHOR("Digigram <alsa@digigram.com>"); |
| 33 | MODULE_DESCRIPTION("Digigram " CARD_NAME); | 33 | MODULE_DESCRIPTION("Digigram " CARD_NAME); |
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); | ||
| 36 | 35 | ||
| 37 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 36 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 38 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 37 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -32,8 +32,6 @@ · 31 unmodified lines | |||
| 32 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 32 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 33 | MODULE_DESCRIPTION("NeoMagic NM256AV/ZX"); | 33 | MODULE_DESCRIPTION("NeoMagic NM256AV/ZX"); |
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_SUPPORTED_DEVICE("{{NeoMagic,NM256AV}," | ||
| 36 | "{NeoMagic,NM256ZX}}"); | ||
| 37 | 35 | ||
| 38 | /* | 36 | /* |
| 39 | * some compile conditions. | 37 | * some compile conditions. |
| @@ -56,9 +56,6 @@ · 55 unmodified lines | |||
| 56 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 56 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
| 57 | MODULE_DESCRIPTION("C-Media CMI8788 driver"); | 57 | MODULE_DESCRIPTION("C-Media CMI8788 driver"); |
| 58 | MODULE_LICENSE("GPL v2"); | 58 | MODULE_LICENSE("GPL v2"); |
| 59 | MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8786}" | ||
| 60 | ",{C-Media,CMI8787}" | ||
| 61 | ",{C-Media,CMI8788}}"); | ||
| 62 | 59 | ||
| 63 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 60 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 64 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 61 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | |||
| 29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
| 30 | MODULE_DESCRIPTION("Studio Evolution SE6X driver"); | 30 | MODULE_DESCRIPTION("Studio Evolution SE6X driver"); |
| 31 | MODULE_LICENSE("GPL v2"); | 31 | MODULE_LICENSE("GPL v2"); |
| 32 | MODULE_SUPPORTED_DEVICE("{{Studio Evolution,SE6X}}"); | ||
| 33 | 32 | ||
| 34 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 33 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 35 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 34 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
| @@ -16,7 +16,6 @@ · 15 unmodified lines | |||
| 16 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 16 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
| 17 | MODULE_DESCRIPTION("Asus Virtuoso driver"); | 17 | MODULE_DESCRIPTION("Asus Virtuoso driver"); |
| 18 | MODULE_LICENSE("GPL v2"); | 18 | MODULE_LICENSE("GPL v2"); |
| 19 | MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}"); | ||
| 20 | 19 | ||
| 21 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 20 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 22 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 21 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
| @@ -35,7 +35,6 @@ MODULE_AUTHOR("Markus Bollinger <bollinger@digigram.com>, " · 34 unmodified lines | |||
| 35 | "Marc Titinger <titinger@digigram.com>"); | 35 | "Marc Titinger <titinger@digigram.com>"); |
| 36 | MODULE_DESCRIPTION("Digigram " DRIVER_NAME " " PCXHR_DRIVER_VERSION_STRING); | 36 | MODULE_DESCRIPTION("Digigram " DRIVER_NAME " " PCXHR_DRIVER_VERSION_STRING); |
| 37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
| 38 | MODULE_SUPPORTED_DEVICE("{{Digigram," DRIVER_NAME "}}"); | ||
| 39 | 38 | ||
| 40 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 39 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 41 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 40 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -103,7 +103,6 @@ · 102 unmodified lines | |||
| 103 | MODULE_AUTHOR("Peter Gruber <nokos@gmx.net>"); | 103 | MODULE_AUTHOR("Peter Gruber <nokos@gmx.net>"); |
| 104 | MODULE_DESCRIPTION("riptide"); | 104 | MODULE_DESCRIPTION("riptide"); |
| 105 | MODULE_LICENSE("GPL"); | 105 | MODULE_LICENSE("GPL"); |
| 106 | MODULE_SUPPORTED_DEVICE("{{Conexant,Riptide}}"); | ||
| 107 | MODULE_FIRMWARE("riptide.hex"); | 106 | MODULE_FIRMWARE("riptide.hex"); |
| 108 | 107 | ||
| 109 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 108 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| @@ -88,7 +88,6 @@ MODULE_PARM_DESC(fullduplex, "Support full-duplex mode."); · 87 unmodified lines | |||
| 88 | MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>, Pilo Chambert <pilo.c@wanadoo.fr>"); | 88 | MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>, Pilo Chambert <pilo.c@wanadoo.fr>"); |
| 89 | MODULE_DESCRIPTION("RME Digi32, Digi32/8, Digi32 PRO"); | 89 | MODULE_DESCRIPTION("RME Digi32, Digi32/8, Digi32 PRO"); |
| 90 | MODULE_LICENSE("GPL"); | 90 | MODULE_LICENSE("GPL"); |
| 91 | MODULE_SUPPORTED_DEVICE("{{RME,Digi32}," "{RME,Digi32/8}," "{RME,Digi32 PRO}}"); | ||
| 92 | 91 | ||
| 93 | /* Defines for RME Digi32 series */ | 92 | /* Defines for RME Digi32 series */ |
| 94 | #define RME32_SPDIF_NCHANNELS 2 | 93 | #define RME32_SPDIF_NCHANNELS 2 |
| @@ -31,11 +31,6 @@ MODULE_AUTHOR("Anders Torger <torger@ludd.luth.se>"); · 30 unmodified lines | |||
| 31 | MODULE_DESCRIPTION("RME Digi96, Digi96/8, Digi96/8 PRO, Digi96/8 PST, " | 31 | MODULE_DESCRIPTION("RME Digi96, Digi96/8, Digi96/8 PRO, Digi96/8 PST, " |
| 32 | "Digi96/8 PAD"); | 32 | "Digi96/8 PAD"); |
| 33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
| 34 | MODULE_SUPPORTED_DEVICE("{{RME,Digi96}," | ||
| 35 | "{RME,Digi96/8}," | ||
| 36 | "{RME,Digi96/8 PRO}," | ||
| 37 | "{RME,Digi96/8 PST}," | ||
| 38 | "{RME,Digi96/8 PAD}}"); | ||
| 39 | 34 | ||
| 40 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 35 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 41 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 36 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -44,9 +44,6 @@ MODULE_PARM_DESC(enable, "Enable/disable specific Hammerfall DSP soundcards."); · 43 unmodified lines | |||
| 44 | MODULE_AUTHOR("Paul Davis <paul@linuxaudiosystems.com>, Marcus Andersson, Thomas Charbonnel <thomas@undata.org>"); | 44 | MODULE_AUTHOR("Paul Davis <paul@linuxaudiosystems.com>, Marcus Andersson, Thomas Charbonnel <thomas@undata.org>"); |
| 45 | MODULE_DESCRIPTION("RME Hammerfall DSP"); | 45 | MODULE_DESCRIPTION("RME Hammerfall DSP"); |
| 46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
| 47 | MODULE_SUPPORTED_DEVICE("{{RME Hammerfall-DSP}," | ||
| 48 | "{RME HDSP-9652}," | ||
| 49 | "{RME HDSP-9632}}"); | ||
| 50 | MODULE_FIRMWARE("rpm_firmware.bin"); | 47 | MODULE_FIRMWARE("rpm_firmware.bin"); |
| 51 | MODULE_FIRMWARE("multiface_firmware.bin"); | 48 | MODULE_FIRMWARE("multiface_firmware.bin"); |
| 52 | MODULE_FIRMWARE("multiface_firmware_rev11.bin"); | 49 | MODULE_FIRMWARE("multiface_firmware_rev11.bin"); |
| @@ -165,7 +165,6 @@ MODULE_AUTHOR · 164 unmodified lines | |||
| 165 | ); | 165 | ); |
| 166 | MODULE_DESCRIPTION("RME HDSPM"); | 166 | MODULE_DESCRIPTION("RME HDSPM"); |
| 167 | MODULE_LICENSE("GPL"); | 167 | MODULE_LICENSE("GPL"); |
| 168 | MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}"); | ||
| 169 | 168 | ||
| 170 | /* --- Write registers. --- | 169 | /* --- Write registers. --- |
| 171 | These are defined as byte-offsets from the iobase value. */ | 170 | These are defined as byte-offsets from the iobase value. */ |
| @@ -39,8 +39,6 @@ MODULE_PARM_DESC(precise_ptr, "Enable precise pointer (doesn't work reliably).") · 38 unmodified lines | |||
| 39 | MODULE_AUTHOR("Paul Davis <pbd@op.net>, Winfried Ritsch"); | 39 | MODULE_AUTHOR("Paul Davis <pbd@op.net>, Winfried Ritsch"); |
| 40 | MODULE_DESCRIPTION("RME Digi9652/Digi9636"); | 40 | MODULE_DESCRIPTION("RME Digi9652/Digi9636"); |
| 41 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
| 42 | MODULE_SUPPORTED_DEVICE("{{RME,Hammerfall}," | ||
| 43 | "{RME,Hammerfall-Light}}"); | ||
| 44 | 42 | ||
| 45 | /* The Hammerfall has two sets of 24 ADAT + 2 S/PDIF channels, one for | 43 | /* The Hammerfall has two sets of 24 ADAT + 2 S/PDIF channels, one for |
| 46 | capture, one for playback. Both the ADAT and S/PDIF channels appear | 44 | capture, one for playback. Both the ADAT and S/PDIF channels appear |
| @@ -24,7 +24,6 @@ · 23 unmodified lines | |||
| 24 | MODULE_AUTHOR("David Dillow <dave@thedillows.org>"); | 24 | MODULE_AUTHOR("David Dillow <dave@thedillows.org>"); |
| 25 | MODULE_DESCRIPTION("SiS7019"); | 25 | MODULE_DESCRIPTION("SiS7019"); |
| 26 | MODULE_LICENSE("GPL"); | 26 | MODULE_LICENSE("GPL"); |
| 27 | MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}"); | ||
| 28 | 27 | ||
| 29 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 28 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| 30 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 29 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | |||
| 29 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 29 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 30 | MODULE_DESCRIPTION("S3 SonicVibes PCI"); | 30 | MODULE_DESCRIPTION("S3 SonicVibes PCI"); |
| 31 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
| 32 | MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}"); | ||
| 33 | 32 | ||
| 34 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 33 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| 35 | #define SUPPORT_JOYSTICK 1 | 34 | #define SUPPORT_JOYSTICK 1 |
| @@ -17,18 +17,6 @@ · 16 unmodified lines | |||
| 17 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, <audio@tridentmicro.com>"); | 17 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, <audio@tridentmicro.com>"); |
| 18 | MODULE_DESCRIPTION("Trident 4D-WaveDX/NX & SiS SI7018"); | 18 | MODULE_DESCRIPTION("Trident 4D-WaveDX/NX & SiS SI7018"); |
| 19 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
| 20 | MODULE_SUPPORTED_DEVICE("{{Trident,4DWave DX}," | ||
| 21 | "{Trident,4DWave NX}," | ||
| 22 | "{SiS,SI7018 PCI Audio}," | ||
| 23 | "{Best Union,Miss Melody 4DWave PCI}," | ||
| 24 | "{HIS,4DWave PCI}," | ||
| 25 | "{Warpspeed,ONSpeed 4DWave PCI}," | ||
| 26 | "{Aztech Systems,PCI 64-Q3D}," | ||
| 27 | "{Addonics,SV 750}," | ||
| 28 | "{CHIC,True Sound 4Dwave}," | ||
| 29 | "{Shark,Predator4D-PCI}," | ||
| 30 | "{Jaton,SonicWave 4D}," | ||
| 31 | "{Hoontech,SoundTrack Digital 4DWave NX}}"); | ||
| 32 | 20 | ||
| 33 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 21 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 34 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 22 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -56,7 +56,6 @@ · 55 unmodified lines | |||
| 56 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 56 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 57 | MODULE_DESCRIPTION("VIA VT82xx audio"); | 57 | MODULE_DESCRIPTION("VIA VT82xx audio"); |
| 58 | MODULE_LICENSE("GPL"); | 58 | MODULE_LICENSE("GPL"); |
| 59 | MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}"); | ||
| 60 | 59 | ||
| 61 | #if IS_REACHABLE(CONFIG_GAMEPORT) | 60 | #if IS_REACHABLE(CONFIG_GAMEPORT) |
| 62 | #define SUPPORT_JOYSTICK 1 | 61 | #define SUPPORT_JOYSTICK 1 |
| @@ -38,7 +38,6 @@ · 37 unmodified lines | |||
| 38 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 38 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 39 | MODULE_DESCRIPTION("VIA VT82xx modem"); | 39 | MODULE_DESCRIPTION("VIA VT82xx modem"); |
| 40 | MODULE_LICENSE("GPL"); | 40 | MODULE_LICENSE("GPL"); |
| 41 | MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C modem,pci}}"); | ||
| 42 | 41 | ||
| 43 | static int index = -2; /* Exclude the first card */ | 42 | static int index = -2; /* Exclude the first card */ |
| 44 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 43 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | |||
| 20 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 20 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 21 | MODULE_DESCRIPTION("Digigram VX222 V2/Mic"); | 21 | MODULE_DESCRIPTION("Digigram VX222 V2/Mic"); |
| 22 | MODULE_LICENSE("GPL"); | 22 | MODULE_LICENSE("GPL"); |
| 23 | MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); | ||
| 24 | 23 | ||
| 25 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 24 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 26 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 25 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -17,12 +17,6 @@ · 16 unmodified lines | |||
| 17 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 17 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 18 | MODULE_DESCRIPTION("Yamaha DS-1 PCI"); | 18 | MODULE_DESCRIPTION("Yamaha DS-1 PCI"); |
| 19 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
| 20 | MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF724}," | ||
| 21 | "{Yamaha,YMF724F}," | ||
| 22 | "{Yamaha,YMF740}," | ||
| 23 | "{Yamaha,YMF740C}," | ||
| 24 | "{Yamaha,YMF744}," | ||
| 25 | "{Yamaha,YMF754}}"); | ||
| 26 | 20 | ||
| 27 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 21 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 28 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 22 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | |||
| 22 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 22 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
| 23 | MODULE_DESCRIPTION("Sound Core " CARD_NAME); | 23 | MODULE_DESCRIPTION("Sound Core " CARD_NAME); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | MODULE_SUPPORTED_DEVICE("{{Sound Core," CARD_NAME "}}"); | ||
| 26 | 25 | ||
| 27 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 26 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 28 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 27 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -17,13 +17,9 @@ · 16 unmodified lines | |||
| 17 | #include <sound/initval.h> | 17 | #include <sound/initval.h> |
| 18 | #include <sound/tlv.h> | 18 | #include <sound/tlv.h> |
| 19 | 19 | ||
| 20 | /* | ||
| 21 | */ | ||
| 22 | |||
| 23 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 20 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 24 | MODULE_DESCRIPTION("Digigram VXPocket"); | 21 | MODULE_DESCRIPTION("Digigram VXPocket"); |
| 25 | MODULE_LICENSE("GPL"); | 22 | MODULE_LICENSE("GPL"); |
| 26 | MODULE_SUPPORTED_DEVICE("{{Digigram,VXPocket},{Digigram,VXPocket440}}"); | ||
| 27 | 23 | ||
| 28 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 24 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 29 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 25 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | |||
| 18 | #define CHIP_NAME "PMac" | 18 | #define CHIP_NAME "PMac" |
| 19 | 19 | ||
| 20 | MODULE_DESCRIPTION("PowerMac"); | 20 | MODULE_DESCRIPTION("PowerMac"); |
| 21 | MODULE_SUPPORTED_DEVICE("{{Apple,PowerMac}}"); | ||
| 22 | MODULE_LICENSE("GPL"); | 21 | MODULE_LICENSE("GPL"); |
| 23 | 22 | ||
| 24 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 23 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | |||
| 32 | MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>"); | 32 | MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>"); |
| 33 | MODULE_DESCRIPTION("Dreamcast AICA sound (pcm) driver"); | 33 | MODULE_DESCRIPTION("Dreamcast AICA sound (pcm) driver"); |
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_SUPPORTED_DEVICE("{{Yamaha/SEGA, AICA}}"); | ||
| 36 | MODULE_FIRMWARE("aica_firmware.bin"); | 35 | MODULE_FIRMWARE("aica_firmware.bin"); |
| 37 | 36 | ||
| 38 | /* module parameters */ | 37 | /* module parameters */ |
| @@ -25,7 +25,6 @@ · 24 unmodified lines | |||
| 25 | MODULE_AUTHOR("Rafael Ignacio Zurita <rizurita@yahoo.com>"); | 25 | MODULE_AUTHOR("Rafael Ignacio Zurita <rizurita@yahoo.com>"); |
| 26 | MODULE_DESCRIPTION("SuperH DAC audio driver"); | 26 | MODULE_DESCRIPTION("SuperH DAC audio driver"); |
| 27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
| 28 | MODULE_SUPPORTED_DEVICE("{{SuperH DAC audio support}}"); | ||
| 29 | 28 | ||
| 30 | /* Module Parameters */ | 29 | /* Module Parameters */ |
| 31 | static int index = SNDRV_DEFAULT_IDX1; | 30 | static int index = SNDRV_DEFAULT_IDX1; |
| @@ -186,7 +186,6 @@ config SND_SOC_ALL_CODECS · 185 unmodified lines | |||
| 186 | imply SND_SOC_SI476X | 186 | imply SND_SOC_SI476X |
| 187 | imply SND_SOC_SIMPLE_AMPLIFIER | 187 | imply SND_SOC_SIMPLE_AMPLIFIER |
| 188 | imply SND_SOC_SIMPLE_MUX | 188 | imply SND_SOC_SIMPLE_MUX |
| 189 | imply SND_SOC_SIRF_AUDIO_CODEC | ||
| 190 | imply SND_SOC_SPDIF | 189 | imply SND_SOC_SPDIF |
| 191 | imply SND_SOC_SSM2305 | 190 | imply SND_SOC_SSM2305 |
| 192 | imply SND_SOC_SSM2518 | 191 | imply SND_SOC_SSM2518 |
| @@ -1279,10 +1278,6 @@ config SND_SOC_SIMPLE_MUX · 1086 unmodified lines | |||
| 1279 | tristate "Simple Audio Mux" | 1278 | tristate "Simple Audio Mux" |
| 1280 | select GPIOLIB | 1279 | select GPIOLIB |
| 1281 | 1280 | ||
| 1282 | config SND_SOC_SIRF_AUDIO_CODEC | ||
| 1283 | tristate "SiRF SoC internal audio codec" | ||
| 1284 | select REGMAP_MMIO | ||
| 1285 | |||
| 1286 | config SND_SOC_SPDIF | 1281 | config SND_SOC_SPDIF |
| 1287 | tristate "S/PDIF CODEC" | 1282 | tristate "S/PDIF CODEC" |
| 1288 | 1283 | ||
| @@ -812,6 +812,7 @@ static const struct of_device_id ak4458_of_match[] = { · 811 unmodified lines | |||
| 812 | { .compatible = "asahi-kasei,ak4497", .data = &ak4497_drvdata}, | 812 | { .compatible = "asahi-kasei,ak4497", .data = &ak4497_drvdata}, |
| 813 | { }, | 813 | { }, |
| 814 | }; | 814 | }; |
| 815 | MODULE_DEVICE_TABLE(of, ak4458_of_match); | ||
| 815 | 816 | ||
| 816 | static struct i2c_driver ak4458_i2c_driver = { | 817 | static struct i2c_driver ak4458_i2c_driver = { |
| 817 | .driver = { | 818 | .driver = { |
| @@ -419,6 +419,7 @@ static const struct of_device_id ak5558_i2c_dt_ids[] __maybe_unused = { · 418 unmodified lines | |||
| 419 | { .compatible = "asahi-kasei,ak5558"}, | 419 | { .compatible = "asahi-kasei,ak5558"}, |
| 420 | { } | 420 | { } |
| 421 | }; | 421 | }; |
| 422 | MODULE_DEVICE_TABLE(of, ak5558_i2c_dt_ids); | ||
| 422 | 423 | ||
| 423 | static struct i2c_driver ak5558_i2c_driver = { | 424 | static struct i2c_driver ak5558_i2c_driver = { |
| 424 | .driver = { | 425 | .driver = { |
| @@ -401,7 +401,7 @@ static const struct regmap_config cs42l42_regmap = { · 400 unmodified lines | |||
| 401 | }; | 401 | }; |
| 402 | 402 | ||
| 403 | static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, false); | 403 | static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, false); |
| 404 | static DECLARE_TLV_DB_SCALE(mixer_tlv, -6200, 100, false); | 404 | static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true); |
| 405 | 405 | ||
| 406 | static const char * const cs42l42_hpf_freq_text[] = { | 406 | static const char * const cs42l42_hpf_freq_text[] = { |
| 407 | "1.86Hz", "120Hz", "235Hz", "466Hz" | 407 | "1.86Hz", "120Hz", "235Hz", "466Hz" |
| @@ -458,7 +458,7 @@ static const struct snd_kcontrol_new cs42l42_snd_controls[] = { · 50 unmodified lines | |||
| 458 | CS42L42_DAC_HPF_EN_SHIFT, true, false), | 458 | CS42L42_DAC_HPF_EN_SHIFT, true, false), |
| 459 | SOC_DOUBLE_R_TLV("Mixer Volume", CS42L42_MIXER_CHA_VOL, | 459 | SOC_DOUBLE_R_TLV("Mixer Volume", CS42L42_MIXER_CHA_VOL, |
| 460 | CS42L42_MIXER_CHB_VOL, CS42L42_MIXER_CH_VOL_SHIFT, | 460 | CS42L42_MIXER_CHB_VOL, CS42L42_MIXER_CH_VOL_SHIFT, |
| 461 | 0x3e, 1, mixer_tlv) | 461 | 0x3f, 1, mixer_tlv) |
| 462 | }; | 462 | }; |
| 463 | 463 | ||
| 464 | static int cs42l42_hpdrv_evt(struct snd_soc_dapm_widget *w, | 464 | static int cs42l42_hpdrv_evt(struct snd_soc_dapm_widget *w, |
| @@ -511,43 +511,6 @@ static const struct snd_soc_dapm_route cs42l42_audio_map[] = { · 46 unmodified lines | |||
| 511 | {"HP", NULL, "HPDRV"} | 511 | {"HP", NULL, "HPDRV"} |
| 512 | }; | 512 | }; |
| 513 | 513 | ||
| 514 | static int cs42l42_set_bias_level(struct snd_soc_component *component, | ||
| 515 | enum snd_soc_bias_level level) | ||
| 516 | { | ||
| 517 | struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component); | ||
| 518 | int ret; | ||
| 519 | |||
| 520 | switch (level) { | ||
| 521 | case SND_SOC_BIAS_ON: | ||
| 522 | break; | ||
| 523 | case SND_SOC_BIAS_PREPARE: | ||
| 524 | break; | ||
| 525 | case SND_SOC_BIAS_STANDBY: | ||
| 526 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | ||
| 527 | regcache_cache_only(cs42l42->regmap, false); | ||
| 528 | regcache_sync(cs42l42->regmap); | ||
| 529 | ret = regulator_bulk_enable( | ||
| 530 | ARRAY_SIZE(cs42l42->supplies), | ||
| 531 | cs42l42->supplies); | ||
| 532 | if (ret != 0) { | ||
| 533 | dev_err(component->dev, | ||
| 534 | "Failed to enable regulators: %d\n", | ||
| 535 | ret); | ||
| 536 | return ret; | ||
| 537 | } | ||
| 538 | } | ||
| 539 | break; | ||
| 540 | case SND_SOC_BIAS_OFF: | ||
| 541 | |||
| 542 | regcache_cache_only(cs42l42->regmap, true); | ||
| 543 | regulator_bulk_disable(ARRAY_SIZE(cs42l42->supplies), | ||
| 544 | cs42l42->supplies); | ||
| 545 | break; | ||
| 546 | } | ||
| 547 | |||
| 548 | return 0; | ||
| 549 | } | ||
| 550 | |||
| 551 | static int cs42l42_component_probe(struct snd_soc_component *component) | 514 | static int cs42l42_component_probe(struct snd_soc_component *component) |
| 552 | { | 515 | { |
| 553 | struct cs42l42_private *cs42l42 = | 516 | struct cs42l42_private *cs42l42 = |
| @@ -560,7 +523,6 @@ static int cs42l42_component_probe(struct snd_soc_component *component) · 6 unmodified lines | |||
| 560 | 523 | ||
| 561 | static const struct snd_soc_component_driver soc_component_dev_cs42l42 = { | 524 | static const struct snd_soc_component_driver soc_component_dev_cs42l42 = { |
| 562 | .probe = cs42l42_component_probe, | 525 | .probe = cs42l42_component_probe, |
| 563 | .set_bias_level = cs42l42_set_bias_level, | ||
| 564 | .dapm_widgets = cs42l42_dapm_widgets, | 526 | .dapm_widgets = cs42l42_dapm_widgets, |
| 565 | .num_dapm_widgets = ARRAY_SIZE(cs42l42_dapm_widgets), | 527 | .num_dapm_widgets = ARRAY_SIZE(cs42l42_dapm_widgets), |
| 566 | .dapm_routes = cs42l42_audio_map, | 528 | .dapm_routes = cs42l42_audio_map, |
| @@ -691,24 +653,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component) · 124 unmodified lines | |||
| 691 | CS42L42_CLK_OASRC_SEL_MASK, | 653 | CS42L42_CLK_OASRC_SEL_MASK, |
| 692 | CS42L42_CLK_OASRC_SEL_12 << | 654 | CS42L42_CLK_OASRC_SEL_12 << |
| 693 | CS42L42_CLK_OASRC_SEL_SHIFT); | 655 | CS42L42_CLK_OASRC_SEL_SHIFT); |
| 694 | /* channel 1 on low LRCLK, 32 bit */ | ||
| 695 | snd_soc_component_update_bits(component, | ||
| 696 | CS42L42_ASP_RX_DAI0_CH1_AP_RES, | ||
| 697 | CS42L42_ASP_RX_CH_AP_MASK | | ||
| 698 | CS42L42_ASP_RX_CH_RES_MASK, | ||
| 699 | (CS42L42_ASP_RX_CH_AP_LOW << | ||
| 700 | CS42L42_ASP_RX_CH_AP_SHIFT) | | ||
| 701 | (CS42L42_ASP_RX_CH_RES_32 << | ||
| 702 | CS42L42_ASP_RX_CH_RES_SHIFT)); | ||
| 703 | /* Channel 2 on high LRCLK, 32 bit */ | ||
| 704 | snd_soc_component_update_bits(component, | ||
| 705 | CS42L42_ASP_RX_DAI0_CH2_AP_RES, | ||
| 706 | CS42L42_ASP_RX_CH_AP_MASK | | ||
| 707 | CS42L42_ASP_RX_CH_RES_MASK, | ||
| 708 | (CS42L42_ASP_RX_CH_AP_HI << | ||
| 709 | CS42L42_ASP_RX_CH_AP_SHIFT) | | ||
| 710 | (CS42L42_ASP_RX_CH_RES_32 << | ||
| 711 | CS42L42_ASP_RX_CH_RES_SHIFT)); | ||
| 712 | if (pll_ratio_table[i].mclk_src_sel == 0) { | 656 | if (pll_ratio_table[i].mclk_src_sel == 0) { |
| 713 | /* Pass the clock straight through */ | 657 | /* Pass the clock straight through */ |
| 714 | snd_soc_component_update_bits(component, | 658 | snd_soc_component_update_bits(component, |
| @@ -797,27 +741,23 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 82 unmodified lines | |||
| 797 | /* Bitclock/frame inversion */ | 741 | /* Bitclock/frame inversion */ |
| 798 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 742 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
| 799 | case SND_SOC_DAIFMT_NB_NF: | 743 | case SND_SOC_DAIFMT_NB_NF: |
| 744 | asp_cfg_val |= CS42L42_ASP_SCPOL_NOR << CS42L42_ASP_SCPOL_SHIFT; | ||
| 800 | break; | 745 | break; |
| 801 | case SND_SOC_DAIFMT_NB_IF: | 746 | case SND_SOC_DAIFMT_NB_IF: |
| 802 | asp_cfg_val |= CS42L42_ASP_POL_INV << | 747 | asp_cfg_val |= CS42L42_ASP_SCPOL_NOR << CS42L42_ASP_SCPOL_SHIFT; |
| 803 | CS42L42_ASP_LCPOL_IN_SHIFT; | 748 | asp_cfg_val |= CS42L42_ASP_LCPOL_INV << CS42L42_ASP_LCPOL_SHIFT; |
| 804 | break; | 749 | break; |
| 805 | case SND_SOC_DAIFMT_IB_NF: | 750 | case SND_SOC_DAIFMT_IB_NF: |
| 806 | asp_cfg_val |= CS42L42_ASP_POL_INV << | ||
| 807 | CS42L42_ASP_SCPOL_IN_DAC_SHIFT; | ||
| 808 | break; | 751 | break; |
| 809 | case SND_SOC_DAIFMT_IB_IF: | 752 | case SND_SOC_DAIFMT_IB_IF: |
| 810 | asp_cfg_val |= CS42L42_ASP_POL_INV << | 753 | asp_cfg_val |= CS42L42_ASP_LCPOL_INV << CS42L42_ASP_LCPOL_SHIFT; |
| 811 | CS42L42_ASP_LCPOL_IN_SHIFT; | ||
| 812 | asp_cfg_val |= CS42L42_ASP_POL_INV << | ||
| 813 | CS42L42_ASP_SCPOL_IN_DAC_SHIFT; | ||
| 814 | break; | 754 | break; |
| 815 | } | 755 | } |
| 816 | 756 | ||
| 817 | snd_soc_component_update_bits(component, CS42L42_ASP_CLK_CFG, | 757 | snd_soc_component_update_bits(component, CS42L42_ASP_CLK_CFG, CS42L42_ASP_MODE_MASK | |
| 818 | CS42L42_ASP_MODE_MASK | | 758 | CS42L42_ASP_SCPOL_MASK | |
| 819 | CS42L42_ASP_SCPOL_IN_DAC_MASK | | 759 | CS42L42_ASP_LCPOL_MASK, |
| 820 | CS42L42_ASP_LCPOL_IN_MASK, asp_cfg_val); | 760 | asp_cfg_val); |
| 821 | 761 | ||
| 822 | return 0; | 762 | return 0; |
| 823 | } | 763 | } |
| @@ -828,14 +768,29 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream, · 4 unmodified lines | |||
| 828 | { | 768 | { |
| 829 | struct snd_soc_component *component = dai->component; | 769 | struct snd_soc_component *component = dai->component; |
| 830 | struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component); | 770 | struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component); |
| 831 | int retval; | 771 | unsigned int width = (params_width(params) / 8) - 1; |
| 772 | unsigned int val = 0; | ||
| 832 | 773 | ||
| 833 | cs42l42->srate = params_rate(params); | 774 | cs42l42->srate = params_rate(params); |
| 834 | cs42l42->swidth = params_width(params); | ||
| 835 | 775 | ||
| 836 | retval = cs42l42_pll_config(component); | 776 | switch(substream->stream) { |
| 777 | case SNDRV_PCM_STREAM_PLAYBACK: | ||
| 778 | val |= width << CS42L42_ASP_RX_CH_RES_SHIFT; | ||
| 779 | /* channel 1 on low LRCLK */ | ||
| 780 | snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH1_AP_RES, | ||
| 781 | CS42L42_ASP_RX_CH_AP_MASK | | ||
| 782 | CS42L42_ASP_RX_CH_RES_MASK, val); | ||
| 783 | /* Channel 2 on high LRCLK */ | ||
| 784 | val |= CS42L42_ASP_RX_CH_AP_HI << CS42L42_ASP_RX_CH_AP_SHIFT; | ||
| 785 | snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH2_AP_RES, | ||
| 786 | CS42L42_ASP_RX_CH_AP_MASK | | ||
| 787 | CS42L42_ASP_RX_CH_RES_MASK, val); | ||
| 788 | break; | ||
| 789 | default: | ||
| 790 | break; | ||
| 791 | } | ||
| 837 | 792 | ||
| 838 | return retval; | 793 | return cs42l42_pll_config(component); |
| 839 | } | 794 | } |
| 840 | 795 | ||
| 841 | static int cs42l42_set_sysclk(struct snd_soc_dai *dai, | 796 | static int cs42l42_set_sysclk(struct snd_soc_dai *dai, |
| @@ -900,9 +855,9 @@ static int cs42l42_mute(struct snd_soc_dai *dai, int mute, int direction) · 58 unmodified lines | |||
| 900 | return 0; | 855 | return 0; |
| 901 | } | 856 | } |
| 902 | 857 | ||
| 903 | #define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S18_3LE | \ | 858 | #define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ |
| 904 | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE | \ | 859 | SNDRV_PCM_FMTBIT_S24_LE |\ |
| 905 | SNDRV_PCM_FMTBIT_S32_LE) | 860 | SNDRV_PCM_FMTBIT_S32_LE ) |
| 906 | 861 | ||
| 907 | 862 | ||
| 908 | static const struct snd_soc_dai_ops cs42l42_ops = { | 863 | static const struct snd_soc_dai_ops cs42l42_ops = { |
| @@ -1801,7 +1756,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client, · 892 unmodified lines | |||
| 1801 | dev_dbg(&i2c_client->dev, "Found reset GPIO\n"); | 1756 | dev_dbg(&i2c_client->dev, "Found reset GPIO\n"); |
| 1802 | gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); | 1757 | gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); |
| 1803 | } | 1758 | } |
| 1804 | mdelay(3); | 1759 | usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2); |
| 1805 | 1760 | ||
| 1806 | /* Request IRQ */ | 1761 | /* Request IRQ */ |
| 1807 | ret = devm_request_threaded_irq(&i2c_client->dev, | 1762 | ret = devm_request_threaded_irq(&i2c_client->dev, |
| @@ -1926,6 +1881,7 @@ static int cs42l42_runtime_resume(struct device *dev) · 118 unmodified lines | |||
| 1926 | } | 1881 | } |
| 1927 | 1882 | ||
| 1928 | gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); | 1883 | gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); |
| 1884 | usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2); | ||
| 1929 | 1885 | ||
| 1930 | regcache_cache_only(cs42l42->regmap, false); | 1886 | regcache_cache_only(cs42l42->regmap, false); |
| 1931 | regcache_sync(cs42l42->regmap); | 1887 | regcache_sync(cs42l42->regmap); |
| @@ -258,11 +258,12 @@ · 257 unmodified lines | |||
| 258 | #define CS42L42_ASP_SLAVE_MODE 0x00 | 258 | #define CS42L42_ASP_SLAVE_MODE 0x00 |
| 259 | #define CS42L42_ASP_MODE_SHIFT 4 | 259 | #define CS42L42_ASP_MODE_SHIFT 4 |
| 260 | #define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) | 260 | #define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) |
| 261 | #define CS42L42_ASP_SCPOL_IN_DAC_SHIFT 2 | 261 | #define CS42L42_ASP_SCPOL_SHIFT 2 |
| 262 | #define CS42L42_ASP_SCPOL_IN_DAC_MASK (1 << CS42L42_ASP_SCPOL_IN_DAC_SHIFT) | 262 | #define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) |
| 263 | #define CS42L42_ASP_LCPOL_IN_SHIFT 0 | 263 | #define CS42L42_ASP_SCPOL_NOR 3 |
| 264 | #define CS42L42_ASP_LCPOL_IN_MASK (1 << CS42L42_ASP_LCPOL_IN_SHIFT) | 264 | #define CS42L42_ASP_LCPOL_SHIFT 0 |
| 265 | #define CS42L42_ASP_POL_INV 1 | 265 | #define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) |
| 266 | #define CS42L42_ASP_LCPOL_INV 3 | ||
| 266 | 267 | ||
| 267 | #define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) | 268 | #define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) |
| 268 | #define CS42L42_ASP_STP_SHIFT 4 | 269 | #define CS42L42_ASP_STP_SHIFT 4 |
| @@ -739,6 +740,7 @@ · 470 unmodified lines | |||
| 739 | #define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) | 740 | #define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) |
| 740 | 741 | ||
| 741 | #define CS42L42_NUM_SUPPLIES 5 | 742 | #define CS42L42_NUM_SUPPLIES 5 |
| 743 | #define CS42L42_BOOT_TIME_US 3000 | ||
| 742 | 744 | ||
| 743 | static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { | 745 | static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { |
| 744 | "VA", | 746 | "VA", |
| @@ -756,7 +758,6 @@ struct cs42l42_private { · 11 unmodified lines | |||
| 756 | struct completion pdn_done; | 758 | struct completion pdn_done; |
| 757 | u32 sclk; | 759 | u32 sclk; |
| 758 | u32 srate; | 760 | u32 srate; |
| 759 | u32 swidth; | ||
| 760 | u8 plug_state; | 761 | u8 plug_state; |
| 761 | u8 hs_type; | 762 | u8 hs_type; |
| 762 | u8 ts_inv; | 763 | u8 ts_inv; |
| @@ -63,13 +63,8 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv, · 62 unmodified lines | |||
| 63 | 1, 1, TLV_DB_SCALE_ITEM(0, 0, 0), | 63 | 1, 1, TLV_DB_SCALE_ITEM(0, 0, 0), |
| 64 | 2, 2, TLV_DB_SCALE_ITEM(250, 0, 0), | 64 | 2, 2, TLV_DB_SCALE_ITEM(250, 0, 0), |
| 65 | 3, 3, TLV_DB_SCALE_ITEM(450, 0, 0), | 65 | 3, 3, TLV_DB_SCALE_ITEM(450, 0, 0), |
| 66 | 4, 4, TLV_DB_SCALE_ITEM(700, 0, 0), | 66 | 4, 7, TLV_DB_SCALE_ITEM(700, 300, 0), |
| 67 | 5, 5, TLV_DB_SCALE_ITEM(1000, 0, 0), | 67 | 8, 10, TLV_DB_SCALE_ITEM(1800, 300, 0), |
| 68 | 6, 6, TLV_DB_SCALE_ITEM(1300, 0, 0), | ||
| 69 | 7, 7, TLV_DB_SCALE_ITEM(1600, 0, 0), | ||
| 70 | 8, 8, TLV_DB_SCALE_ITEM(1800, 0, 0), | ||
| 71 | 9, 9, TLV_DB_SCALE_ITEM(2100, 0, 0), | ||
| 72 | 10, 10, TLV_DB_SCALE_ITEM(2400, 0, 0), | ||
| 73 | ); | 68 | ); |
| 74 | 69 | ||
| 75 | static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpout_vol_tlv, | 70 | static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpout_vol_tlv, |
| @@ -2895,7 +2895,7 @@ static int rx_macro_enable_echo(struct snd_soc_dapm_widget *w, · 2894 unmodified lines | |||
| 2895 | { | 2895 | { |
| 2896 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | 2896 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
| 2897 | u16 val, ec_hq_reg; | 2897 | u16 val, ec_hq_reg; |
| 2898 | int ec_tx; | 2898 | int ec_tx = -1; |
| 2899 | 2899 | ||
| 2900 | val = snd_soc_component_read(component, | 2900 | val = snd_soc_component_read(component, |
| 2901 | CDC_RX_INP_MUX_RX_MIX_CFG4); | 2901 | CDC_RX_INP_MUX_RX_MIX_CFG4); |
| @@ -189,7 +189,6 @@ struct va_macro { · 188 unmodified lines | |||
| 189 | struct device *dev; | 189 | struct device *dev; |
| 190 | unsigned long active_ch_mask[VA_MACRO_MAX_DAIS]; | 190 | unsigned long active_ch_mask[VA_MACRO_MAX_DAIS]; |
| 191 | unsigned long active_ch_cnt[VA_MACRO_MAX_DAIS]; | 191 | unsigned long active_ch_cnt[VA_MACRO_MAX_DAIS]; |
| 192 | unsigned long active_decimator[VA_MACRO_MAX_DAIS]; | ||
| 193 | u16 dmic_clk_div; | 192 | u16 dmic_clk_div; |
| 194 | 193 | ||
| 195 | int dec_mode[VA_MACRO_NUM_DECIMATORS]; | 194 | int dec_mode[VA_MACRO_NUM_DECIMATORS]; |
| @@ -549,11 +548,9 @@ static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, · 353 unmodified lines | |||
| 549 | if (enable) { | 548 | if (enable) { |
| 550 | set_bit(dec_id, &va->active_ch_mask[dai_id]); | 549 | set_bit(dec_id, &va->active_ch_mask[dai_id]); |
| 551 | va->active_ch_cnt[dai_id]++; | 550 | va->active_ch_cnt[dai_id]++; |
| 552 | va->active_decimator[dai_id] = dec_id; | ||
| 553 | } else { | 551 | } else { |
| 554 | clear_bit(dec_id, &va->active_ch_mask[dai_id]); | 552 | clear_bit(dec_id, &va->active_ch_mask[dai_id]); |
| 555 | va->active_ch_cnt[dai_id]--; | 553 | va->active_ch_cnt[dai_id]--; |
| 556 | va->active_decimator[dai_id] = -1; | ||
| 557 | } | 554 | } |
| 558 | 555 | ||
| 559 | snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update); | 556 | snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update); |
| @@ -880,18 +877,19 @@ static int va_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream) · 320 unmodified lines | |||
| 880 | struct va_macro *va = snd_soc_component_get_drvdata(component); | 877 | struct va_macro *va = snd_soc_component_get_drvdata(component); |
| 881 | u16 tx_vol_ctl_reg, decimator; | 878 | u16 tx_vol_ctl_reg, decimator; |
| 882 | 879 | ||
| 883 | decimator = va->active_decimator[dai->id]; | 880 | for_each_set_bit(decimator, &va->active_ch_mask[dai->id], |
| 884 | 881 | VA_MACRO_DEC_MAX) { | |
| 885 | tx_vol_ctl_reg = CDC_VA_TX0_TX_PATH_CTL + | 882 | tx_vol_ctl_reg = CDC_VA_TX0_TX_PATH_CTL + |
| 886 | VA_MACRO_TX_PATH_OFFSET * decimator; | 883 | VA_MACRO_TX_PATH_OFFSET * decimator; |
| 887 | if (mute) | 884 | if (mute) |
| 888 | snd_soc_component_update_bits(component, tx_vol_ctl_reg, | 885 | snd_soc_component_update_bits(component, tx_vol_ctl_reg, |
| 889 | CDC_VA_TX_PATH_PGA_MUTE_EN_MASK, | 886 | CDC_VA_TX_PATH_PGA_MUTE_EN_MASK, |
| 890 | CDC_VA_TX_PATH_PGA_MUTE_EN); | 887 | CDC_VA_TX_PATH_PGA_MUTE_EN); |
| 891 | else | 888 | else |
| 892 | snd_soc_component_update_bits(component, tx_vol_ctl_reg, | 889 | snd_soc_component_update_bits(component, tx_vol_ctl_reg, |
| 893 | CDC_VA_TX_PATH_PGA_MUTE_EN_MASK, | 890 | CDC_VA_TX_PATH_PGA_MUTE_EN_MASK, |
| 894 | CDC_VA_TX_PATH_PGA_MUTE_DISABLE); | 891 | CDC_VA_TX_PATH_PGA_MUTE_DISABLE); |
| 892 | } | ||
| 895 | 893 | ||
| 896 | return 0; | 894 | return 0; |
| 897 | } | 895 | } |
| @@ -1211,14 +1211,16 @@ static int wsa_macro_enable_mix_path(struct snd_soc_dapm_widget *w, · 1210 unmodified lines | |||
| 1211 | struct snd_kcontrol *kcontrol, int event) | 1211 | struct snd_kcontrol *kcontrol, int event) |
| 1212 | { | 1212 | { |
| 1213 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | 1213 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
| 1214 | u16 gain_reg; | 1214 | u16 path_reg, gain_reg; |
| 1215 | int val; | 1215 | int val; |
| 1216 | 1216 | ||
| 1217 | switch (w->reg) { | 1217 | switch (w->shift) { |
| 1218 | case CDC_WSA_RX0_RX_PATH_MIX_CTL: | 1218 | case WSA_MACRO_RX_MIX0: |
| 1219 | path_reg = CDC_WSA_RX0_RX_PATH_MIX_CTL; | ||
| 1219 | gain_reg = CDC_WSA_RX0_RX_VOL_MIX_CTL; | 1220 | gain_reg = CDC_WSA_RX0_RX_VOL_MIX_CTL; |
| 1220 | break; | 1221 | break; |
| 1221 | case CDC_WSA_RX1_RX_PATH_MIX_CTL: | 1222 | case WSA_MACRO_RX_MIX1: |
| 1223 | path_reg = CDC_WSA_RX1_RX_PATH_MIX_CTL; | ||
| 1222 | gain_reg = CDC_WSA_RX1_RX_VOL_MIX_CTL; | 1224 | gain_reg = CDC_WSA_RX1_RX_VOL_MIX_CTL; |
| 1223 | break; | 1225 | break; |
| 1224 | default: | 1226 | default: |
| @@ -1231,7 +1233,7 @@ static int wsa_macro_enable_mix_path(struct snd_soc_dapm_widget *w, · 6 unmodified lines | |||
| 1231 | snd_soc_component_write(component, gain_reg, val); | 1233 | snd_soc_component_write(component, gain_reg, val); |
| 1232 | break; | 1234 | break; |
| 1233 | case SND_SOC_DAPM_POST_PMD: | 1235 | case SND_SOC_DAPM_POST_PMD: |
| 1234 | snd_soc_component_update_bits(component, w->reg, | 1236 | snd_soc_component_update_bits(component, path_reg, |
| 1235 | CDC_WSA_RX_PATH_MIX_CLK_EN_MASK, | 1237 | CDC_WSA_RX_PATH_MIX_CLK_EN_MASK, |
| 1236 | CDC_WSA_RX_PATH_MIX_CLK_DISABLE); | 1238 | CDC_WSA_RX_PATH_MIX_CLK_DISABLE); |
| 1237 | break; | 1239 | break; |
| @@ -2068,14 +2070,14 @@ static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets[] = { · 830 unmodified lines | |||
| 2068 | SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux), | 2070 | SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux), |
| 2069 | SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux), | 2071 | SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux), |
| 2070 | SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux), | 2072 | SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux), |
| 2071 | SND_SOC_DAPM_MUX_E("WSA_RX0 MIX INP", CDC_WSA_RX0_RX_PATH_MIX_CTL, | 2073 | SND_SOC_DAPM_MUX_E("WSA_RX0 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX0, |
| 2072 | 0, 0, &rx0_mix_mux, wsa_macro_enable_mix_path, | 2074 | 0, &rx0_mix_mux, wsa_macro_enable_mix_path, |
| 2073 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | 2075 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), |
| 2074 | SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux), | 2076 | SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux), |
| 2075 | SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux), | 2077 | SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux), |
| 2076 | SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux), | 2078 | SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux), |
| 2077 | SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", CDC_WSA_RX1_RX_PATH_MIX_CTL, | 2079 | SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX1, |
| 2078 | 0, 0, &rx1_mix_mux, wsa_macro_enable_mix_path, | 2080 | 0, &rx1_mix_mux, wsa_macro_enable_mix_path, |
| 2079 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | 2081 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), |
| 2080 | 2082 | ||
| 2081 | SND_SOC_DAPM_MIXER_E("WSA_RX INT0 MIX", SND_SOC_NOPM, 0, 0, NULL, 0, | 2083 | SND_SOC_DAPM_MIXER_E("WSA_RX INT0 MIX", SND_SOC_NOPM, 0, 0, NULL, 0, |
| @@ -209,6 +209,7 @@ static bool rt1015_volatile_register(struct device *dev, unsigned int reg) · 208 unmodified lines | |||
| 209 | case RT1015_VENDOR_ID: | 209 | case RT1015_VENDOR_ID: |
| 210 | case RT1015_DEVICE_ID: | 210 | case RT1015_DEVICE_ID: |
| 211 | case RT1015_PRO_ALT: | 211 | case RT1015_PRO_ALT: |
| 212 | case RT1015_MAN_I2C: | ||
| 212 | case RT1015_DAC3: | 213 | case RT1015_DAC3: |
| 213 | case RT1015_VBAT_TEST_OUT1: | 214 | case RT1015_VBAT_TEST_OUT1: |
| 214 | case RT1015_VBAT_TEST_OUT2: | 215 | case RT1015_VBAT_TEST_OUT2: |
| @@ -513,6 +514,7 @@ static void rt1015_calibrate(struct rt1015_priv *rt1015) · 298 unmodified lines | |||
| 513 | msleep(300); | 514 | msleep(300); |
| 514 | regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x0008); | 515 | regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x0008); |
| 515 | regmap_write(regmap, RT1015_SYS_RST1, 0x05F5); | 516 | regmap_write(regmap, RT1015_SYS_RST1, 0x05F5); |
| 517 | regmap_write(regmap, RT1015_CLK_DET, 0x8000); | ||
| 516 | 518 | ||
| 517 | regcache_cache_bypass(regmap, false); | 519 | regcache_cache_bypass(regmap, false); |
| 518 | regcache_mark_dirty(regmap); | 520 | regcache_mark_dirty(regmap); |
| @@ -339,9 +339,9 @@ static bool rt5640_readable_register(struct device *dev, unsigned int reg) · 338 unmodified lines | |||
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); | 341 | static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); |
| 342 | static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); | 342 | static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); |
| 343 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); | 343 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); |
| 344 | static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); | 344 | static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); |
| 345 | static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); | 345 | static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); |
| 346 | 346 | ||
| 347 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ | 347 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ |
| @@ -285,9 +285,9 @@ static bool rt5651_readable_register(struct device *dev, unsigned int reg) · 284 unmodified lines | |||
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); | 287 | static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); |
| 288 | static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); | 288 | static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); |
| 289 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); | 289 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); |
| 290 | static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); | 290 | static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); |
| 291 | static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); | 291 | static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); |
| 292 | 292 | ||
| 293 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ | 293 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ |
| @@ -3426,12 +3426,17 @@ static int rt5659_set_component_sysclk(struct snd_soc_component *component, int · 3425 unmodified lines | |||
| 3426 | { | 3426 | { |
| 3427 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); | 3427 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); |
| 3428 | unsigned int reg_val = 0; | 3428 | unsigned int reg_val = 0; |
| 3429 | int ret; | ||
| 3429 | 3430 | ||
| 3430 | if (freq == rt5659->sysclk && clk_id == rt5659->sysclk_src) | 3431 | if (freq == rt5659->sysclk && clk_id == rt5659->sysclk_src) |
| 3431 | return 0; | 3432 | return 0; |
| 3432 | 3433 | ||
| 3433 | switch (clk_id) { | 3434 | switch (clk_id) { |
| 3434 | case RT5659_SCLK_S_MCLK: | 3435 | case RT5659_SCLK_S_MCLK: |
| 3436 | ret = clk_set_rate(rt5659->mclk, freq); | ||
| 3437 | if (ret) | ||
| 3438 | return ret; | ||
| 3439 | |||
| 3435 | reg_val |= RT5659_SCLK_SRC_MCLK; | 3440 | reg_val |= RT5659_SCLK_SRC_MCLK; |
| 3436 | break; | 3441 | break; |
| 3437 | case RT5659_SCLK_S_PLL1: | 3442 | case RT5659_SCLK_S_PLL1: |
| @@ -629,21 +629,69 @@ static SOC_ENUM_SINGLE_DECL(rt5670_if2_dac_enum, RT5670_DIG_INF1_DATA, · 628 unmodified lines | |||
| 629 | static SOC_ENUM_SINGLE_DECL(rt5670_if2_adc_enum, RT5670_DIG_INF1_DATA, | 629 | static SOC_ENUM_SINGLE_DECL(rt5670_if2_adc_enum, RT5670_DIG_INF1_DATA, |
| 630 | RT5670_IF2_ADC_SEL_SFT, rt5670_data_select); | 630 | RT5670_IF2_ADC_SEL_SFT, rt5670_data_select); |
| 631 | 631 | ||
| 632 | /* | ||
| 633 | * For reliable output-mute LED control we need a "DAC1 Playback Switch" control. | ||
| 634 | * We emulate this by only clearing the RT5670_M_DAC1_L/_R AD_DA_MIXER register | ||
| 635 | * bits when both our emulated DAC1 Playback Switch control and the DAC1 MIXL/R | ||
| 636 | * DAPM-mixer DAC1 input are enabled. | ||
| 637 | */ | ||
| 638 | static void rt5670_update_ad_da_mixer_dac1_m_bits(struct rt5670_priv *rt5670) | ||
| 639 | { | ||
| 640 | int val = RT5670_M_DAC1_L | RT5670_M_DAC1_R; | ||
| 641 | |||
| 642 | if (rt5670->dac1_mixl_dac1_switch && rt5670->dac1_playback_switch_l) | ||
| 643 | val &= ~RT5670_M_DAC1_L; | ||
| 644 | |||
| 645 | if (rt5670->dac1_mixr_dac1_switch && rt5670->dac1_playback_switch_r) | ||
| 646 | val &= ~RT5670_M_DAC1_R; | ||
| 647 | |||
| 648 | regmap_update_bits(rt5670->regmap, RT5670_AD_DA_MIXER, | ||
| 649 | RT5670_M_DAC1_L | RT5670_M_DAC1_R, val); | ||
| 650 | } | ||
| 651 | |||
| 652 | static int rt5670_dac1_playback_switch_get(struct snd_kcontrol *kcontrol, | ||
| 653 | struct snd_ctl_elem_value *ucontrol) | ||
| 654 | { | ||
| 655 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | ||
| 656 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | ||
| 657 | |||
| 658 | ucontrol->value.integer.value[0] = rt5670->dac1_playback_switch_l; | ||
| 659 | ucontrol->value.integer.value[1] = rt5670->dac1_playback_switch_r; | ||
| 660 | |||
| 661 | return 0; | ||
| 662 | } | ||
| 663 | |||
| 664 | static int rt5670_dac1_playback_switch_put(struct snd_kcontrol *kcontrol, | ||
| 665 | struct snd_ctl_elem_value *ucontrol) | ||
| 666 | { | ||
| 667 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | ||
| 668 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | ||
| 669 | |||
| 670 | if (rt5670->dac1_playback_switch_l == ucontrol->value.integer.value[0] && | ||
| 671 | rt5670->dac1_playback_switch_r == ucontrol->value.integer.value[1]) | ||
| 672 | return 0; | ||
| 673 | |||
| 674 | rt5670->dac1_playback_switch_l = ucontrol->value.integer.value[0]; | ||
| 675 | rt5670->dac1_playback_switch_r = ucontrol->value.integer.value[1]; | ||
| 676 | |||
| 677 | rt5670_update_ad_da_mixer_dac1_m_bits(rt5670); | ||
| 678 | |||
| 679 | return 1; | ||
| 680 | } | ||
| 681 | |||
| 632 | static const struct snd_kcontrol_new rt5670_snd_controls[] = { | 682 | static const struct snd_kcontrol_new rt5670_snd_controls[] = { |
| 633 | /* Headphone Output Volume */ | 683 | /* Headphone Output Volume */ |
| 634 | SOC_DOUBLE("HP Playback Switch", RT5670_HP_VOL, | ||
| 635 | RT5670_L_MUTE_SFT, RT5670_R_MUTE_SFT, 1, 1), | ||
| 636 | SOC_DOUBLE_TLV("HP Playback Volume", RT5670_HP_VOL, | 684 | SOC_DOUBLE_TLV("HP Playback Volume", RT5670_HP_VOL, |
| 637 | RT5670_L_VOL_SFT, RT5670_R_VOL_SFT, | 685 | RT5670_L_VOL_SFT, RT5670_R_VOL_SFT, |
| 638 | 39, 1, out_vol_tlv), | 686 | 39, 1, out_vol_tlv), |
| 639 | /* OUTPUT Control */ | 687 | /* OUTPUT Control */ |
| 640 | SOC_DOUBLE("OUT Channel Switch", RT5670_LOUT1, | ||
| 641 | RT5670_VOL_L_SFT, RT5670_VOL_R_SFT, 1, 1), | ||
| 642 | SOC_DOUBLE_TLV("OUT Playback Volume", RT5670_LOUT1, | 688 | SOC_DOUBLE_TLV("OUT Playback Volume", RT5670_LOUT1, |
| 643 | RT5670_L_VOL_SFT, RT5670_R_VOL_SFT, 39, 1, out_vol_tlv), | 689 | RT5670_L_VOL_SFT, RT5670_R_VOL_SFT, 39, 1, out_vol_tlv), |
| 644 | /* DAC Digital Volume */ | 690 | /* DAC Digital Volume */ |
| 645 | SOC_DOUBLE("DAC2 Playback Switch", RT5670_DAC_CTRL, | 691 | SOC_DOUBLE("DAC2 Playback Switch", RT5670_DAC_CTRL, |
| 646 | RT5670_M_DAC_L2_VOL_SFT, RT5670_M_DAC_R2_VOL_SFT, 1, 1), | 692 | RT5670_M_DAC_L2_VOL_SFT, RT5670_M_DAC_R2_VOL_SFT, 1, 1), |
| 693 | SOC_DOUBLE_EXT("DAC1 Playback Switch", SND_SOC_NOPM, 0, 1, 1, 0, | ||
| 694 | rt5670_dac1_playback_switch_get, rt5670_dac1_playback_switch_put), | ||
| 647 | SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5670_DAC1_DIG_VOL, | 695 | SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5670_DAC1_DIG_VOL, |
| 648 | RT5670_L_VOL_SFT, RT5670_R_VOL_SFT, | 696 | RT5670_L_VOL_SFT, RT5670_R_VOL_SFT, |
| 649 | 175, 0, dac_vol_tlv), | 697 | 175, 0, dac_vol_tlv), |
| @@ -913,18 +961,44 @@ static const struct snd_kcontrol_new rt5670_mono_adc_r_mix[] = { · 263 unmodified lines | |||
| 913 | RT5670_M_MONO_ADC_R2_SFT, 1, 1), | 961 | RT5670_M_MONO_ADC_R2_SFT, 1, 1), |
| 914 | }; | 962 | }; |
| 915 | 963 | ||
| 964 | /* See comment above rt5670_update_ad_da_mixer_dac1_m_bits() */ | ||
| 965 | static int rt5670_put_dac1_mix_dac1_switch(struct snd_kcontrol *kcontrol, | ||
| 966 | struct snd_ctl_elem_value *ucontrol) | ||
| 967 | { | ||
| 968 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | ||
| 969 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 970 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | ||
| 971 | int ret; | ||
| 972 | |||
| 973 | if (mc->shift == 0) | ||
| 974 | rt5670->dac1_mixl_dac1_switch = ucontrol->value.integer.value[0]; | ||
| 975 | else | ||
| 976 | rt5670->dac1_mixr_dac1_switch = ucontrol->value.integer.value[0]; | ||
| 977 | |||
| 978 | /* Apply the update (if any) */ | ||
| 979 | ret = snd_soc_dapm_put_volsw(kcontrol, ucontrol); | ||
| 980 | if (ret == 0) | ||
| 981 | return 0; | ||
| 982 | |||
| 983 | rt5670_update_ad_da_mixer_dac1_m_bits(rt5670); | ||
| 984 | |||
| 985 | return 1; | ||
| 986 | } | ||
| 987 | |||
| 988 | #define SOC_DAPM_SINGLE_RT5670_DAC1_SW(name, shift) \ | ||
| 989 | SOC_SINGLE_EXT(name, SND_SOC_NOPM, shift, 1, 0, \ | ||
| 990 | snd_soc_dapm_get_volsw, rt5670_put_dac1_mix_dac1_switch) | ||
| 991 | |||
| 916 | static const struct snd_kcontrol_new rt5670_dac_l_mix[] = { | 992 | static const struct snd_kcontrol_new rt5670_dac_l_mix[] = { |
| 917 | SOC_DAPM_SINGLE("Stereo ADC Switch", RT5670_AD_DA_MIXER, | 993 | SOC_DAPM_SINGLE("Stereo ADC Switch", RT5670_AD_DA_MIXER, |
| 918 | RT5670_M_ADCMIX_L_SFT, 1, 1), | 994 | RT5670_M_ADCMIX_L_SFT, 1, 1), |
| 919 | SOC_DAPM_SINGLE("DAC1 Switch", RT5670_AD_DA_MIXER, | 995 | SOC_DAPM_SINGLE_RT5670_DAC1_SW("DAC1 Switch", 0), |
| 920 | RT5670_M_DAC1_L_SFT, 1, 1), | ||
| 921 | }; | 996 | }; |
| 922 | 997 | ||
| 923 | static const struct snd_kcontrol_new rt5670_dac_r_mix[] = { | 998 | static const struct snd_kcontrol_new rt5670_dac_r_mix[] = { |
| 924 | SOC_DAPM_SINGLE("Stereo ADC Switch", RT5670_AD_DA_MIXER, | 999 | SOC_DAPM_SINGLE("Stereo ADC Switch", RT5670_AD_DA_MIXER, |
| 925 | RT5670_M_ADCMIX_R_SFT, 1, 1), | 1000 | RT5670_M_ADCMIX_R_SFT, 1, 1), |
| 926 | SOC_DAPM_SINGLE("DAC1 Switch", RT5670_AD_DA_MIXER, | 1001 | SOC_DAPM_SINGLE_RT5670_DAC1_SW("DAC1 Switch", 1), |
| 927 | RT5670_M_DAC1_R_SFT, 1, 1), | ||
| 928 | }; | 1002 | }; |
| 929 | 1003 | ||
| 930 | static const struct snd_kcontrol_new rt5670_sto_dac_l_mix[] = { | 1004 | static const struct snd_kcontrol_new rt5670_sto_dac_l_mix[] = { |
| @@ -1656,12 +1730,10 @@ static const struct snd_soc_dapm_widget rt5670_dapm_widgets[] = { · 725 unmodified lines | |||
| 1656 | RT5670_PWR_ADC_S1F_BIT, 0, NULL, 0), | 1730 | RT5670_PWR_ADC_S1F_BIT, 0, NULL, 0), |
| 1657 | SND_SOC_DAPM_SUPPLY("ADC Stereo2 Filter", RT5670_PWR_DIG2, | 1731 | SND_SOC_DAPM_SUPPLY("ADC Stereo2 Filter", RT5670_PWR_DIG2, |
| 1658 | RT5670_PWR_ADC_S2F_BIT, 0, NULL, 0), | 1732 | RT5670_PWR_ADC_S2F_BIT, 0, NULL, 0), |
| 1659 | SND_SOC_DAPM_MIXER("Sto1 ADC MIXL", RT5670_STO1_ADC_DIG_VOL, | 1733 | SND_SOC_DAPM_MIXER("Sto1 ADC MIXL", SND_SOC_NOPM, 0, 0, |
| 1660 | RT5670_L_MUTE_SFT, 1, rt5670_sto1_adc_l_mix, | 1734 | rt5670_sto1_adc_l_mix, ARRAY_SIZE(rt5670_sto1_adc_l_mix)), |
| 1661 | ARRAY_SIZE(rt5670_sto1_adc_l_mix)), | 1735 | SND_SOC_DAPM_MIXER("Sto1 ADC MIXR", SND_SOC_NOPM, 0, 0, |
| 1662 | SND_SOC_DAPM_MIXER("Sto1 ADC MIXR", RT5670_STO1_ADC_DIG_VOL, | 1736 | rt5670_sto1_adc_r_mix, ARRAY_SIZE(rt5670_sto1_adc_r_mix)), |
| 1663 | RT5670_R_MUTE_SFT, 1, rt5670_sto1_adc_r_mix, | ||
| 1664 | ARRAY_SIZE(rt5670_sto1_adc_r_mix)), | ||
| 1665 | SND_SOC_DAPM_MIXER("Sto2 ADC MIXL", SND_SOC_NOPM, 0, 0, | 1737 | SND_SOC_DAPM_MIXER("Sto2 ADC MIXL", SND_SOC_NOPM, 0, 0, |
| 1666 | rt5670_sto2_adc_l_mix, | 1738 | rt5670_sto2_adc_l_mix, |
| 1667 | ARRAY_SIZE(rt5670_sto2_adc_l_mix)), | 1739 | ARRAY_SIZE(rt5670_sto2_adc_l_mix)), |
| @@ -2999,6 +3071,16 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, · 1331 unmodified lines | |||
| 2999 | dev_info(&i2c->dev, "quirk JD mode 3\n"); | 3071 | dev_info(&i2c->dev, "quirk JD mode 3\n"); |
| 3000 | } | 3072 | } |
| 3001 | 3073 | ||
| 3074 | /* | ||
| 3075 | * Enable the emulated "DAC1 Playback Switch" by default to avoid | ||
| 3076 | * muting the output with older UCM profiles. | ||
| 3077 | */ | ||
| 3078 | rt5670->dac1_playback_switch_l = true; | ||
| 3079 | rt5670->dac1_playback_switch_r = true; | ||
| 3080 | /* The Power-On-Reset values for the DAC1 mixer have the DAC1 input enabled. */ | ||
| 3081 | rt5670->dac1_mixl_dac1_switch = true; | ||
| 3082 | rt5670->dac1_mixr_dac1_switch = true; | ||
| 3083 | |||
| 3002 | rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap); | 3084 | rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap); |
| 3003 | if (IS_ERR(rt5670->regmap)) { | 3085 | if (IS_ERR(rt5670->regmap)) { |
| 3004 | ret = PTR_ERR(rt5670->regmap); | 3086 | ret = PTR_ERR(rt5670->regmap); |
| @@ -212,12 +212,8 @@ · 211 unmodified lines | |||
| 212 | /* global definition */ | 212 | /* global definition */ |
| 213 | #define RT5670_L_MUTE (0x1 << 15) | 213 | #define RT5670_L_MUTE (0x1 << 15) |
| 214 | #define RT5670_L_MUTE_SFT 15 | 214 | #define RT5670_L_MUTE_SFT 15 |
| 215 | #define RT5670_VOL_L_MUTE (0x1 << 14) | ||
| 216 | #define RT5670_VOL_L_SFT 14 | ||
| 217 | #define RT5670_R_MUTE (0x1 << 7) | 215 | #define RT5670_R_MUTE (0x1 << 7) |
| 218 | #define RT5670_R_MUTE_SFT 7 | 216 | #define RT5670_R_MUTE_SFT 7 |
| 219 | #define RT5670_VOL_R_MUTE (0x1 << 6) | ||
| 220 | #define RT5670_VOL_R_SFT 6 | ||
| 221 | #define RT5670_L_VOL_MASK (0x3f << 8) | 217 | #define RT5670_L_VOL_MASK (0x3f << 8) |
| 222 | #define RT5670_L_VOL_SFT 8 | 218 | #define RT5670_L_VOL_SFT 8 |
| 223 | #define RT5670_R_VOL_MASK (0x3f) | 219 | #define RT5670_R_VOL_MASK (0x3f) |
| @@ -2017,6 +2013,11 @@ struct rt5670_priv { · 1793 unmodified lines | |||
| 2017 | int dsp_rate; | 2013 | int dsp_rate; |
| 2018 | int jack_type; | 2014 | int jack_type; |
| 2019 | int jack_type_saved; | 2015 | int jack_type_saved; |
| 2016 | |||
| 2017 | bool dac1_mixl_dac1_switch; | ||
| 2018 | bool dac1_mixr_dac1_switch; | ||
| 2019 | bool dac1_playback_switch_l; | ||
| 2020 | bool dac1_playback_switch_r; | ||
| 2020 | }; | 2021 | }; |
| 2021 | 2022 | ||
| 2022 | void rt5670_jack_suspend(struct snd_soc_component *component); | 2023 | void rt5670_jack_suspend(struct snd_soc_component *component); |
| @@ -895,6 +895,13 @@ static int rt711_probe(struct snd_soc_component *component) · 894 unmodified lines | |||
| 895 | return 0; | 895 | return 0; |
| 896 | } | 896 | } |
| 897 | 897 | ||
| 898 | static void rt711_remove(struct snd_soc_component *component) | ||
| 899 | { | ||
| 900 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); | ||
| 901 | |||
| 902 | regcache_cache_only(rt711->regmap, true); | ||
| 903 | } | ||
| 904 | |||
| 898 | static const struct snd_soc_component_driver soc_codec_dev_rt711 = { | 905 | static const struct snd_soc_component_driver soc_codec_dev_rt711 = { |
| 899 | .probe = rt711_probe, | 906 | .probe = rt711_probe, |
| 900 | .set_bias_level = rt711_set_bias_level, | 907 | .set_bias_level = rt711_set_bias_level, |
| @@ -905,6 +912,7 @@ static const struct snd_soc_component_driver soc_codec_dev_rt711 = { · 4 unmodified lines | |||
| 905 | .dapm_routes = rt711_audio_map, | 912 | .dapm_routes = rt711_audio_map, |
| 906 | .num_dapm_routes = ARRAY_SIZE(rt711_audio_map), | 913 | .num_dapm_routes = ARRAY_SIZE(rt711_audio_map), |
| 907 | .set_jack = rt711_set_jack_detect, | 914 | .set_jack = rt711_set_jack_detect, |
| 915 | .remove = rt711_remove, | ||
| 908 | }; | 916 | }; |
| 909 | 917 | ||
| 910 | static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, | 918 | static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
| @@ -71,7 +71,7 @@ static const struct reg_default sgtl5000_reg_defaults[] = { · 70 unmodified lines | |||
| 71 | { SGTL5000_DAP_EQ_BASS_BAND4, 0x002f }, | 71 | { SGTL5000_DAP_EQ_BASS_BAND4, 0x002f }, |
| 72 | { SGTL5000_DAP_MAIN_CHAN, 0x8000 }, | 72 | { SGTL5000_DAP_MAIN_CHAN, 0x8000 }, |
| 73 | { SGTL5000_DAP_MIX_CHAN, 0x0000 }, | 73 | { SGTL5000_DAP_MIX_CHAN, 0x0000 }, |
| 74 | { SGTL5000_DAP_AVC_CTRL, 0x0510 }, | 74 | { SGTL5000_DAP_AVC_CTRL, 0x5100 }, |
| 75 | { SGTL5000_DAP_AVC_THRESHOLD, 0x1473 }, | 75 | { SGTL5000_DAP_AVC_THRESHOLD, 0x1473 }, |
| 76 | { SGTL5000_DAP_AVC_ATTACK, 0x0028 }, | 76 | { SGTL5000_DAP_AVC_ATTACK, 0x0028 }, |
| 77 | { SGTL5000_DAP_AVC_DECAY, 0x0050 }, | 77 | { SGTL5000_DAP_AVC_DECAY, 0x0050 }, |
| @@ -1,124 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | /* | ||
| 3 | * SiRF inner codec controllers define | ||
| 4 | * | ||
| 5 | * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef _SIRF_AUDIO_CODEC_H | ||
| 9 | #define _SIRF_AUDIO_CODEC_H | ||
| 10 | |||
| 11 | |||
| 12 | #define AUDIO_IC_CODEC_PWR (0x00E0) | ||
| 13 | #define AUDIO_IC_CODEC_CTRL0 (0x00E4) | ||
| 14 | #define AUDIO_IC_CODEC_CTRL1 (0x00E8) | ||
| 15 | #define AUDIO_IC_CODEC_CTRL2 (0x00EC) | ||
| 16 | #define AUDIO_IC_CODEC_CTRL3 (0x00F0) | ||
| 17 | |||
| 18 | #define MICBIASEN (1 << 3) | ||
| 19 | |||
| 20 | #define IC_RDACEN (1 << 0) | ||
| 21 | #define IC_LDACEN (1 << 1) | ||
| 22 | #define IC_HSREN (1 << 2) | ||
| 23 | #define IC_HSLEN (1 << 3) | ||
| 24 | #define IC_SPEN (1 << 4) | ||
| 25 | #define IC_CPEN (1 << 5) | ||
| 26 | |||
| 27 | #define IC_HPRSELR (1 << 6) | ||
| 28 | #define IC_HPLSELR (1 << 7) | ||
| 29 | #define IC_HPRSELL (1 << 8) | ||
| 30 | #define IC_HPLSELL (1 << 9) | ||
| 31 | #define IC_SPSELR (1 << 10) | ||
| 32 | #define IC_SPSELL (1 << 11) | ||
| 33 | |||
| 34 | #define IC_MONOR (1 << 12) | ||
| 35 | #define IC_MONOL (1 << 13) | ||
| 36 | |||
| 37 | #define IC_RXOSRSEL (1 << 28) | ||
| 38 | #define IC_CPFREQ (1 << 29) | ||
| 39 | #define IC_HSINVEN (1 << 30) | ||
| 40 | |||
| 41 | #define IC_MICINREN (1 << 0) | ||
| 42 | #define IC_MICINLEN (1 << 1) | ||
| 43 | #define IC_MICIN1SEL (1 << 2) | ||
| 44 | #define IC_MICIN2SEL (1 << 3) | ||
| 45 | #define IC_MICDIFSEL (1 << 4) | ||
| 46 | #define IC_LINEIN1SEL (1 << 5) | ||
| 47 | #define IC_LINEIN2SEL (1 << 6) | ||
| 48 | #define IC_RADCEN (1 << 7) | ||
| 49 | #define IC_LADCEN (1 << 8) | ||
| 50 | #define IC_ALM (1 << 9) | ||
| 51 | |||
| 52 | #define IC_DIGMICEN (1 << 22) | ||
| 53 | #define IC_DIGMICFREQ (1 << 23) | ||
| 54 | #define IC_ADC14B_12 (1 << 24) | ||
| 55 | #define IC_FIRDAC_HSL_EN (1 << 25) | ||
| 56 | #define IC_FIRDAC_HSR_EN (1 << 26) | ||
| 57 | #define IC_FIRDAC_LOUT_EN (1 << 27) | ||
| 58 | #define IC_POR (1 << 28) | ||
| 59 | #define IC_CODEC_CLK_EN (1 << 29) | ||
| 60 | #define IC_HP_3DB_BOOST (1 << 30) | ||
| 61 | |||
| 62 | #define IC_ADC_LEFT_GAIN_SHIFT 16 | ||
| 63 | #define IC_ADC_RIGHT_GAIN_SHIFT 10 | ||
| 64 | #define IC_ADC_GAIN_MASK 0x3F | ||
| 65 | #define IC_MIC_MAX_GAIN 0x39 | ||
| 66 | |||
| 67 | #define IC_RXPGAR_MASK 0x3F | ||
| 68 | #define IC_RXPGAR_SHIFT 14 | ||
| 69 | #define IC_RXPGAL_MASK 0x3F | ||
| 70 | #define IC_RXPGAL_SHIFT 21 | ||
| 71 | #define IC_RXPGAR 0x7B | ||
| 72 | #define IC_RXPGAL 0x7B | ||
| 73 | |||
| 74 | #define AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK 0x3F | ||
| 75 | #define AUDIO_PORT_TX_FIFO_SC_OFFSET 0 | ||
| 76 | #define AUDIO_PORT_TX_FIFO_LC_OFFSET 10 | ||
| 77 | #define AUDIO_PORT_TX_FIFO_HC_OFFSET 20 | ||
| 78 | |||
| 79 | #define TX_FIFO_SC(x) (((x) & AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK) \ | ||
| 80 | << AUDIO_PORT_TX_FIFO_SC_OFFSET) | ||
| 81 | #define TX_FIFO_LC(x) (((x) & AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK) \ | ||
| 82 | << AUDIO_PORT_TX_FIFO_LC_OFFSET) | ||
| 83 | #define TX_FIFO_HC(x) (((x) & AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK) \ | ||
| 84 | << AUDIO_PORT_TX_FIFO_HC_OFFSET) | ||
| 85 | |||
| 86 | #define AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK 0x0F | ||
| 87 | #define AUDIO_PORT_RX_FIFO_SC_OFFSET 0 | ||
| 88 | #define AUDIO_PORT_RX_FIFO_LC_OFFSET 10 | ||
| 89 | #define AUDIO_PORT_RX_FIFO_HC_OFFSET 20 | ||
| 90 | |||
| 91 | #define RX_FIFO_SC(x) (((x) & AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK) \ | ||
| 92 | << AUDIO_PORT_RX_FIFO_SC_OFFSET) | ||
| 93 | #define RX_FIFO_LC(x) (((x) & AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK) \ | ||
| 94 | << AUDIO_PORT_RX_FIFO_LC_OFFSET) | ||
| 95 | #define RX_FIFO_HC(x) (((x) & AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK) \ | ||
| 96 | << AUDIO_PORT_RX_FIFO_HC_OFFSET) | ||
| 97 | #define AUDIO_PORT_IC_CODEC_TX_CTRL (0x00F4) | ||
| 98 | #define AUDIO_PORT_IC_CODEC_RX_CTRL (0x00F8) | ||
| 99 | |||
| 100 | #define AUDIO_PORT_IC_TXFIFO_OP (0x00FC) | ||
| 101 | #define AUDIO_PORT_IC_TXFIFO_LEV_CHK (0x0100) | ||
| 102 | #define AUDIO_PORT_IC_TXFIFO_STS (0x0104) | ||
| 103 | #define AUDIO_PORT_IC_TXFIFO_INT (0x0108) | ||
| 104 | #define AUDIO_PORT_IC_TXFIFO_INT_MSK (0x010C) | ||
| 105 | |||
| 106 | #define AUDIO_PORT_IC_RXFIFO_OP (0x0110) | ||
| 107 | #define AUDIO_PORT_IC_RXFIFO_LEV_CHK (0x0114) | ||
| 108 | #define AUDIO_PORT_IC_RXFIFO_STS (0x0118) | ||
| 109 | #define AUDIO_PORT_IC_RXFIFO_INT (0x011C) | ||
| 110 | #define AUDIO_PORT_IC_RXFIFO_INT_MSK (0x0120) | ||
| 111 | |||
| 112 | #define AUDIO_FIFO_START (1 << 0) | ||
| 113 | #define AUDIO_FIFO_RESET (1 << 1) | ||
| 114 | |||
| 115 | #define AUDIO_FIFO_FULL (1 << 0) | ||
| 116 | #define AUDIO_FIFO_EMPTY (1 << 1) | ||
| 117 | #define AUDIO_FIFO_OFLOW (1 << 2) | ||
| 118 | #define AUDIO_FIFO_UFLOW (1 << 3) | ||
| 119 | |||
| 120 | #define IC_TX_ENABLE (0x03) | ||
| 121 | #define IC_RX_ENABLE_MONO (0x01) | ||
| 122 | #define IC_RX_ENABLE_STEREO (0x03) | ||
| 123 | |||
| 124 | #endif /*__SIRF_AUDIO_CODEC_H*/ | ||
| @@ -1873,6 +1873,12 @@ static int wcd934x_set_channel_map(struct snd_soc_dai *dai, · 1872 unmodified lines | |||
| 1873 | 1873 | ||
| 1874 | wcd = snd_soc_component_get_drvdata(dai->component); | 1874 | wcd = snd_soc_component_get_drvdata(dai->component); |
| 1875 | 1875 | ||
| 1876 | if (tx_num > WCD934X_TX_MAX || rx_num > WCD934X_RX_MAX) { | ||
| 1877 | dev_err(wcd->dev, "Invalid tx %d or rx %d channel count\n", | ||
| 1878 | tx_num, rx_num); | ||
| 1879 | return -EINVAL; | ||
| 1880 | } | ||
| 1881 | |||
| 1876 | if (!tx_slot || !rx_slot) { | 1882 | if (!tx_slot || !rx_slot) { |
| 1877 | dev_err(wcd->dev, "Invalid tx_slot=%p, rx_slot=%p\n", | 1883 | dev_err(wcd->dev, "Invalid tx_slot=%p, rx_slot=%p\n", |
| 1878 | tx_slot, rx_slot); | 1884 | tx_slot, rx_slot); |
| @@ -878,6 +878,7 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream, · 877 unmodified lines | |||
| 878 | static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt) | 878 | static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt) |
| 879 | { | 879 | { |
| 880 | u32 strcr = 0, scr = 0, stcr, srcr, mask; | 880 | u32 strcr = 0, scr = 0, stcr, srcr, mask; |
| 881 | unsigned int slots; | ||
| 881 | 882 | ||
| 882 | ssi->dai_fmt = fmt; | 883 | ssi->dai_fmt = fmt; |
| 883 | 884 | ||
| @@ -909,10 +910,11 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt) · 25 unmodified lines | |||
| 909 | return -EINVAL; | 910 | return -EINVAL; |
| 910 | } | 911 | } |
| 911 | 912 | ||
| 913 | slots = ssi->slots ? : 2; | ||
| 912 | regmap_update_bits(ssi->regs, REG_SSI_STCCR, | 914 | regmap_update_bits(ssi->regs, REG_SSI_STCCR, |
| 913 | SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(2)); | 915 | SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(slots)); |
| 914 | regmap_update_bits(ssi->regs, REG_SSI_SRCCR, | 916 | regmap_update_bits(ssi->regs, REG_SSI_SRCCR, |
| 915 | SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(2)); | 917 | SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(slots)); |
| 916 | 918 | ||
| 917 | /* Data on rising edge of bclk, frame low, 1clk before data */ | 919 | /* Data on rising edge of bclk, frame low, 1clk before data */ |
| 918 | strcr |= SSI_STCR_TFSI | SSI_STCR_TSCKP | SSI_STCR_TEFS; | 920 | strcr |= SSI_STCR_TFSI | SSI_STCR_TSCKP | SSI_STCR_TEFS; |
| @@ -172,15 +172,16 @@ int asoc_simple_parse_clk(struct device *dev, · 171 unmodified lines | |||
| 172 | * or device's module clock. | 172 | * or device's module clock. |
| 173 | */ | 173 | */ |
| 174 | clk = devm_get_clk_from_child(dev, node, NULL); | 174 | clk = devm_get_clk_from_child(dev, node, NULL); |
| 175 | if (IS_ERR(clk)) | ||
| 176 | clk = devm_get_clk_from_child(dev, dlc->of_node, NULL); | ||
| 177 | |||
| 178 | if (!IS_ERR(clk)) { | 175 | if (!IS_ERR(clk)) { |
| 179 | simple_dai->clk = clk; | ||
| 180 | simple_dai->sysclk = clk_get_rate(clk); | 176 | simple_dai->sysclk = clk_get_rate(clk); |
| 181 | } else if (!of_property_read_u32(node, "system-clock-frequency", | 177 | |
| 182 | &val)) { | 178 | simple_dai->clk = clk; |
| 179 | } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) { | ||
| 183 | simple_dai->sysclk = val; | 180 | simple_dai->sysclk = val; |
| 181 | } else { | ||
| 182 | clk = devm_get_clk_from_child(dev, dlc->of_node, NULL); | ||
| 183 | if (!IS_ERR(clk)) | ||
| 184 | simple_dai->sysclk = clk_get_rate(clk); | ||
| 184 | } | 185 | } |
| 185 | 186 | ||
| 186 | if (of_property_read_bool(node, "system-clock-direction-out")) | 187 | if (of_property_read_bool(node, "system-clock-direction-out")) |
| @@ -581,7 +581,7 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { · 580 unmodified lines | |||
| 581 | }, | 581 | }, |
| 582 | .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | | 582 | .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
| 583 | BYT_RT5640_JD_SRC_JD1_IN4P | | 583 | BYT_RT5640_JD_SRC_JD1_IN4P | |
| 584 | BYT_RT5640_OVCD_TH_1500UA | | 584 | BYT_RT5640_OVCD_TH_2000UA | |
| 585 | BYT_RT5640_OVCD_SF_0P75 | | 585 | BYT_RT5640_OVCD_SF_0P75 | |
| 586 | BYT_RT5640_MCLK_EN), | 586 | BYT_RT5640_MCLK_EN), |
| 587 | }, | 587 | }, |
| @@ -555,7 +555,9 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream, · 554 unmodified lines | |||
| 555 | 555 | ||
| 556 | /* set tdm */ | 556 | /* set tdm */ |
| 557 | if (tdm_priv->bck_invert) | 557 | if (tdm_priv->bck_invert) |
| 558 | tdm_con |= 1 << BCK_INVERSE_SFT; | 558 | regmap_update_bits(afe->regmap, AUDIO_TOP_CON3, |
| 559 | BCK_INVERSE_MASK_SFT, | ||
| 560 | 0x1 << BCK_INVERSE_SFT); | ||
| 559 | 561 | ||
| 560 | if (tdm_priv->lck_invert) | 562 | if (tdm_priv->lck_invert) |
| 561 | tdm_con |= 1 << LRCK_INVERSE_SFT; | 563 | tdm_con |= 1 << LRCK_INVERSE_SFT; |
| @@ -21,6 +21,11 @@ enum { · 20 unmodified lines | |||
| 21 | /***************************************************************************** | 21 | /***************************************************************************** |
| 22 | * R E G I S T E R D E F I N I T I O N | 22 | * R E G I S T E R D E F I N I T I O N |
| 23 | *****************************************************************************/ | 23 | *****************************************************************************/ |
| 24 | /* AUDIO_TOP_CON3 */ | ||
| 25 | #define BCK_INVERSE_SFT 3 | ||
| 26 | #define BCK_INVERSE_MASK 0x1 | ||
| 27 | #define BCK_INVERSE_MASK_SFT (0x1 << 3) | ||
| 28 | |||
| 24 | /* AFE_DAC_CON0 */ | 29 | /* AFE_DAC_CON0 */ |
| 25 | #define VUL12_ON_SFT 31 | 30 | #define VUL12_ON_SFT 31 |
| 26 | #define VUL12_ON_MASK 0x1 | 31 | #define VUL12_ON_MASK 0x1 |
| @@ -2079,9 +2084,6 @@ enum { · 2052 unmodified lines | |||
| 2079 | #define TDM_EN_SFT 0 | 2084 | #define TDM_EN_SFT 0 |
| 2080 | #define TDM_EN_MASK 0x1 | 2085 | #define TDM_EN_MASK 0x1 |
| 2081 | #define TDM_EN_MASK_SFT (0x1 << 0) | 2086 | #define TDM_EN_MASK_SFT (0x1 << 0) |
| 2082 | #define BCK_INVERSE_SFT 1 | ||
| 2083 | #define BCK_INVERSE_MASK 0x1 | ||
| 2084 | #define BCK_INVERSE_MASK_SFT (0x1 << 1) | ||
| 2085 | #define LRCK_INVERSE_SFT 2 | 2087 | #define LRCK_INVERSE_SFT 2 |
| 2086 | #define LRCK_INVERSE_MASK 0x1 | 2088 | #define LRCK_INVERSE_MASK 0x1 |
| 2087 | #define LRCK_INVERSE_MASK_SFT (0x1 << 2) | 2089 | #define LRCK_INVERSE_MASK_SFT (0x1 << 2) |
| @@ -739,7 +739,7 @@ static void of_lpass_cpu_parse_dai_data(struct device *dev, · 738 unmodified lines | |||
| 739 | 739 | ||
| 740 | for_each_child_of_node(dev->of_node, node) { | 740 | for_each_child_of_node(dev->of_node, node) { |
| 741 | ret = of_property_read_u32(node, "reg", &id); | 741 | ret = of_property_read_u32(node, "reg", &id); |
| 742 | if (ret || id < 0 || id >= data->variant->num_dai) { | 742 | if (ret || id < 0) { |
| 743 | dev_err(dev, "valid dai id not found: %d\n", ret); | 743 | dev_err(dev, "valid dai id not found: %d\n", ret); |
| 744 | continue; | 744 | continue; |
| 745 | } | 745 | } |
| @@ -27,18 +27,18 @@ · 26 unmodified lines | |||
| 27 | #define SPK_TDM_RX_MASK 0x03 | 27 | #define SPK_TDM_RX_MASK 0x03 |
| 28 | #define NUM_TDM_SLOTS 8 | 28 | #define NUM_TDM_SLOTS 8 |
| 29 | #define SLIM_MAX_TX_PORTS 16 | 29 | #define SLIM_MAX_TX_PORTS 16 |
| 30 | #define SLIM_MAX_RX_PORTS 16 | 30 | #define SLIM_MAX_RX_PORTS 13 |
| 31 | #define WCD934X_DEFAULT_MCLK_RATE 9600000 | 31 | #define WCD934X_DEFAULT_MCLK_RATE 9600000 |
| 32 | 32 | ||
| 33 | struct sdm845_snd_data { | 33 | struct sdm845_snd_data { |
| 34 | struct snd_soc_jack jack; | 34 | struct snd_soc_jack jack; |
| 35 | bool jack_setup; | 35 | bool jack_setup; |
| 36 | bool stream_prepared[SLIM_MAX_RX_PORTS]; | 36 | bool stream_prepared[AFE_PORT_MAX]; |
| 37 | struct snd_soc_card *card; | 37 | struct snd_soc_card *card; |
| 38 | uint32_t pri_mi2s_clk_count; | 38 | uint32_t pri_mi2s_clk_count; |
| 39 | uint32_t sec_mi2s_clk_count; | 39 | uint32_t sec_mi2s_clk_count; |
| 40 | uint32_t quat_tdm_clk_count; | 40 | uint32_t quat_tdm_clk_count; |
| 41 | struct sdw_stream_runtime *sruntime[SLIM_MAX_RX_PORTS]; | 41 | struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | static unsigned int tdm_slot_offset[8] = {0, 4, 8, 12, 16, 20, 24, 28}; | 44 | static unsigned int tdm_slot_offset[8] = {0, 4, 8, 12, 16, 20, 24, 28}; |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | |||
| 31 | #include <linux/of.h> | 31 | #include <linux/of.h> |
| 32 | #include <linux/of_graph.h> | 32 | #include <linux/of_graph.h> |
| 33 | #include <linux/dmi.h> | 33 | #include <linux/dmi.h> |
| 34 | #include <linux/acpi.h> | ||
| 34 | #include <sound/core.h> | 35 | #include <sound/core.h> |
| 35 | #include <sound/pcm.h> | 36 | #include <sound/pcm.h> |
| 36 | #include <sound/pcm_params.h> | 37 | #include <sound/pcm_params.h> |
| @@ -1573,6 +1574,9 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) · 1536 unmodified lines | |||
| 1573 | if (card->long_name) | 1574 | if (card->long_name) |
| 1574 | return 0; /* long name already set by driver or from DMI */ | 1575 | return 0; /* long name already set by driver or from DMI */ |
| 1575 | 1576 | ||
| 1577 | if (!is_acpi_device_node(card->dev->fwnode)) | ||
| 1578 | return 0; | ||
| 1579 | |||
| 1576 | /* make up dmi long name as: vendor-product-version-board */ | 1580 | /* make up dmi long name as: vendor-product-version-board */ |
| 1577 | vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1581 | vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
| 1578 | if (!vendor || !is_dmi_valid(vendor)) { | 1582 | if (!vendor || !is_dmi_valid(vendor)) { |
| @@ -207,7 +207,7 @@ int hda_dsp_core_power_down(struct snd_sof_dev *sdev, unsigned int core_mask) · 206 unmodified lines | |||
| 207 | 207 | ||
| 208 | ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, | 208 | ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, |
| 209 | HDA_DSP_REG_ADSPCS, adspcs, | 209 | HDA_DSP_REG_ADSPCS, adspcs, |
| 210 | !(adspcs & HDA_DSP_ADSPCS_SPA_MASK(core_mask)), | 210 | !(adspcs & HDA_DSP_ADSPCS_CPA_MASK(core_mask)), |
| 211 | HDA_DSP_REG_POLL_INTERVAL_US, | 211 | HDA_DSP_REG_POLL_INTERVAL_US, |
| 212 | HDA_DSP_PD_TIMEOUT * USEC_PER_MSEC); | 212 | HDA_DSP_PD_TIMEOUT * USEC_PER_MSEC); |
| 213 | if (ret < 0) | 213 | if (ret < 0) |
| @@ -897,6 +897,7 @@ free_streams: · 896 unmodified lines | |||
| 897 | /* dsp_unmap: not currently used */ | 897 | /* dsp_unmap: not currently used */ |
| 898 | iounmap(sdev->bar[HDA_DSP_BAR]); | 898 | iounmap(sdev->bar[HDA_DSP_BAR]); |
| 899 | hdac_bus_unmap: | 899 | hdac_bus_unmap: |
| 900 | platform_device_unregister(hdev->dmic_dev); | ||
| 900 | iounmap(bus->remap_addr); | 901 | iounmap(bus->remap_addr); |
| 901 | hda_codec_i915_exit(sdev); | 902 | hda_codec_i915_exit(sdev); |
| 902 | err: | 903 | err: |
| @@ -62,7 +62,6 @@ MODULE_PARM_DESC(enable, "Enable Sun AMD7930 soundcard."); · 61 unmodified lines | |||
| 62 | MODULE_AUTHOR("Thomas K. Dyas and David S. Miller"); | 62 | MODULE_AUTHOR("Thomas K. Dyas and David S. Miller"); |
| 63 | MODULE_DESCRIPTION("Sun AMD7930"); | 63 | MODULE_DESCRIPTION("Sun AMD7930"); |
| 64 | MODULE_LICENSE("GPL"); | 64 | MODULE_LICENSE("GPL"); |
| 65 | MODULE_SUPPORTED_DEVICE("{{Sun,AMD7930}}"); | ||
| 66 | 65 | ||
| 67 | /* Device register layout. */ | 66 | /* Device register layout. */ |
| 68 | 67 | ||
| @@ -52,7 +52,6 @@ MODULE_PARM_DESC(enable, "Enable Sun CS4231 soundcard."); · 51 unmodified lines | |||
| 52 | MODULE_AUTHOR("Jaroslav Kysela, Derrick J. Brashear and David S. Miller"); | 52 | MODULE_AUTHOR("Jaroslav Kysela, Derrick J. Brashear and David S. Miller"); |
| 53 | MODULE_DESCRIPTION("Sun CS4231"); | 53 | MODULE_DESCRIPTION("Sun CS4231"); |
| 54 | MODULE_LICENSE("GPL"); | 54 | MODULE_LICENSE("GPL"); |
| 55 | MODULE_SUPPORTED_DEVICE("{{Sun,CS4231}}"); | ||
| 56 | 55 | ||
| 57 | #ifdef SBUS_SUPPORT | 56 | #ifdef SBUS_SUPPORT |
| 58 | struct sbus_dma_info { | 57 | struct sbus_dma_info { |
| @@ -76,7 +76,6 @@ · 75 unmodified lines | |||
| 76 | MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); | 76 | MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); |
| 77 | MODULE_DESCRIPTION("Sun DBRI"); | 77 | MODULE_DESCRIPTION("Sun DBRI"); |
| 78 | MODULE_LICENSE("GPL"); | 78 | MODULE_LICENSE("GPL"); |
| 79 | MODULE_SUPPORTED_DEVICE("{{Sun,DBRI}}"); | ||
| 80 | 79 | ||
| 81 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 80 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 82 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 81 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -26,7 +26,6 @@ · 25 unmodified lines | |||
| 26 | MODULE_AUTHOR("Torsten Schenk <torsten.schenk@zoho.com>"); | 26 | MODULE_AUTHOR("Torsten Schenk <torsten.schenk@zoho.com>"); |
| 27 | MODULE_DESCRIPTION("TerraTec DMX 6Fire USB audio driver"); | 27 | MODULE_DESCRIPTION("TerraTec DMX 6Fire USB audio driver"); |
| 28 | MODULE_LICENSE("GPL v2"); | 28 | MODULE_LICENSE("GPL v2"); |
| 29 | MODULE_SUPPORTED_DEVICE("{{TerraTec,DMX 6Fire USB}}"); | ||
| 30 | 29 | ||
| 31 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ | 30 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ |
| 32 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ | 31 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ |
| @@ -26,20 +26,6 @@ · 25 unmodified lines | |||
| 26 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); | 26 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); |
| 27 | MODULE_DESCRIPTION("caiaq USB audio"); | 27 | MODULE_DESCRIPTION("caiaq USB audio"); |
| 28 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 29 | MODULE_SUPPORTED_DEVICE("{{Native Instruments,RigKontrol2}," | ||
| 30 | "{Native Instruments,RigKontrol3}," | ||
| 31 | "{Native Instruments,Kore Controller}," | ||
| 32 | "{Native Instruments,Kore Controller 2}," | ||
| 33 | "{Native Instruments,Audio Kontrol 1}," | ||
| 34 | "{Native Instruments,Audio 2 DJ}," | ||
| 35 | "{Native Instruments,Audio 4 DJ}," | ||
| 36 | "{Native Instruments,Audio 8 DJ}," | ||
| 37 | "{Native Instruments,Traktor Audio 2}," | ||
| 38 | "{Native Instruments,Session I/O}," | ||
| 39 | "{Native Instruments,GuitarRig mobile}," | ||
| 40 | "{Native Instruments,Traktor Kontrol X1}," | ||
| 41 | "{Native Instruments,Traktor Kontrol S4}," | ||
| 42 | "{Native Instruments,Maschine Controller}}"); | ||
| 43 | 29 | ||
| 44 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ | 30 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ |
| 45 | static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ | 31 | static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ |
| @@ -58,8 +58,6 @@ · 57 unmodified lines | |||
| 58 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 58 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
| 59 | MODULE_DESCRIPTION("USB Audio"); | 59 | MODULE_DESCRIPTION("USB Audio"); |
| 60 | MODULE_LICENSE("GPL"); | 60 | MODULE_LICENSE("GPL"); |
| 61 | MODULE_SUPPORTED_DEVICE("{{Generic,USB Audio}}"); | ||
| 62 | |||
| 63 | 61 | ||
| 64 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 62 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 65 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 63 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| @@ -21,23 +21,6 @@ MODULE_AUTHOR("Michael Trimarchi <michael@amarulasolutions.com>"); · 20 unmodified lines | |||
| 21 | MODULE_AUTHOR("Antonio Ospite <ao2@amarulasolutions.com>"); | 21 | MODULE_AUTHOR("Antonio Ospite <ao2@amarulasolutions.com>"); |
| 22 | MODULE_DESCRIPTION("M2Tech hiFace USB-SPDIF audio driver"); | 22 | MODULE_DESCRIPTION("M2Tech hiFace USB-SPDIF audio driver"); |
| 23 | MODULE_LICENSE("GPL v2"); | 23 | MODULE_LICENSE("GPL v2"); |
| 24 | MODULE_SUPPORTED_DEVICE("{{M2Tech,Young}," | ||
| 25 | "{M2Tech,hiFace}," | ||
| 26 | "{M2Tech,North Star}," | ||
| 27 | "{M2Tech,W4S Young}," | ||
| 28 | "{M2Tech,Corrson}," | ||
| 29 | "{M2Tech,AUDIA}," | ||
| 30 | "{M2Tech,SL Audio}," | ||
| 31 | "{M2Tech,Empirical}," | ||
| 32 | "{M2Tech,Rockna}," | ||
| 33 | "{M2Tech,Pathos}," | ||
| 34 | "{M2Tech,Metronome}," | ||
| 35 | "{M2Tech,CAD}," | ||
| 36 | "{M2Tech,Audio Esclusive}," | ||
| 37 | "{M2Tech,Rotel}," | ||
| 38 | "{M2Tech,Eeaudio}," | ||
| 39 | "{The Chord Company,CHORD}," | ||
| 40 | "{AVA Group A/S,Vitus}}"); | ||
| 41 | 24 | ||
| 42 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ | 25 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ |
| 43 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ | 26 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | |||
| 19 | MODULE_DESCRIPTION("Edirol UA-101/1000 driver"); | 19 | MODULE_DESCRIPTION("Edirol UA-101/1000 driver"); |
| 20 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 20 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
| 21 | MODULE_LICENSE("GPL v2"); | 21 | MODULE_LICENSE("GPL v2"); |
| 22 | MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); | ||
| 23 | 22 | ||
| 24 | /* | 23 | /* |
| 25 | * Should not be lower than the minimum scheduling delay of the host | 24 | * Should not be lower than the minimum scheduling delay of the host |
| @@ -2883,7 +2883,7 @@ static int snd_djm_controls_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_v · 2882 unmodified lines | |||
| 2883 | u8 group = (private_value & SND_DJM_GROUP_MASK) >> SND_DJM_GROUP_SHIFT; | 2883 | u8 group = (private_value & SND_DJM_GROUP_MASK) >> SND_DJM_GROUP_SHIFT; |
| 2884 | u16 value = elem->value.enumerated.item[0]; | 2884 | u16 value = elem->value.enumerated.item[0]; |
| 2885 | 2885 | ||
| 2886 | kctl->private_value = ((device << SND_DJM_DEVICE_SHIFT) | | 2886 | kctl->private_value = (((unsigned long)device << SND_DJM_DEVICE_SHIFT) | |
| 2887 | (group << SND_DJM_GROUP_SHIFT) | | 2887 | (group << SND_DJM_GROUP_SHIFT) | |
| 2888 | value); | 2888 | value); |
| 2889 | 2889 | ||
| @@ -2921,7 +2921,7 @@ static int snd_djm_controls_create(struct usb_mixer_interface *mixer, · 31 unmodified lines | |||
| 2921 | value = device->controls[i].default_value; | 2921 | value = device->controls[i].default_value; |
| 2922 | knew.name = device->controls[i].name; | 2922 | knew.name = device->controls[i].name; |
| 2923 | knew.private_value = ( | 2923 | knew.private_value = ( |
| 2924 | (device_idx << SND_DJM_DEVICE_SHIFT) | | 2924 | ((unsigned long)device_idx << SND_DJM_DEVICE_SHIFT) | |
| 2925 | (i << SND_DJM_GROUP_SHIFT) | | 2925 | (i << SND_DJM_GROUP_SHIFT) | |
| 2926 | value); | 2926 | value); |
| 2927 | err = snd_djm_controls_update(mixer, device_idx, i, value); | 2927 | err = snd_djm_controls_update(mixer, device_idx, i, value); |
| @@ -137,7 +137,6 @@ · 136 unmodified lines | |||
| 137 | MODULE_AUTHOR("Karsten Wiese <annabellesgarden@yahoo.de>"); | 137 | MODULE_AUTHOR("Karsten Wiese <annabellesgarden@yahoo.de>"); |
| 138 | MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.7.2"); | 138 | MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.7.2"); |
| 139 | MODULE_LICENSE("GPL"); | 139 | MODULE_LICENSE("GPL"); |
| 140 | MODULE_SUPPORTED_DEVICE("{{TASCAM(0x1604),"NAME_ALLCAPS"(0x8001)(0x8005)(0x8007)}}"); | ||
| 141 | 140 | ||
| 142 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ | 141 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ |
| 143 | static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ | 142 | static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ |
| @@ -1887,4 +1887,3 @@ MODULE_AUTHOR("Vaibhav Agarwal <vaibhav.agarwal@intel.com>"); · 1886 unmodified lines | |||
| 1887 | MODULE_AUTHOR("Jerome Anand <jerome.anand@intel.com>"); | 1887 | MODULE_AUTHOR("Jerome Anand <jerome.anand@intel.com>"); |
| 1888 | MODULE_DESCRIPTION("Intel HDMI Audio driver"); | 1888 | MODULE_DESCRIPTION("Intel HDMI Audio driver"); |
| 1889 | MODULE_LICENSE("GPL v2"); | 1889 | MODULE_LICENSE("GPL v2"); |
| 1890 | MODULE_SUPPORTED_DEVICE("{Intel,Intel_HAD}"); | ||
| @@ -391,4 +391,3 @@ module_exit(xen_drv_fini); · 390 unmodified lines | |||
| 391 | MODULE_DESCRIPTION("Xen virtual sound device frontend"); | 391 | MODULE_DESCRIPTION("Xen virtual sound device frontend"); |
| 392 | MODULE_LICENSE("GPL"); | 392 | MODULE_LICENSE("GPL"); |
| 393 | MODULE_ALIAS("xen:" XENSND_DRIVER_NAME); | 393 | MODULE_ALIAS("xen:" XENSND_DRIVER_NAME); |
| 394 | MODULE_SUPPORTED_DEVICE("{{ALSA,Virtual soundcard}}"); | ||
| @@ -1154,6 +1154,7 @@ struct kvm_x86_mce { · 1153 unmodified lines | |||
| 1154 | #define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR (1 << 0) | 1154 | #define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR (1 << 0) |
| 1155 | #define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1) | 1155 | #define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1) |
| 1156 | #define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2) | 1156 | #define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2) |
| 1157 | #define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3) | ||
| 1157 | 1158 | ||
| 1158 | struct kvm_xen_hvm_config { | 1159 | struct kvm_xen_hvm_config { |
| 1159 | __u32 flags; | 1160 | __u32 flags; |
| @@ -1621,12 +1622,24 @@ struct kvm_xen_vcpu_attr { · 461 unmodified lines | |||
| 1621 | union { | 1622 | union { |
| 1622 | __u64 gpa; | 1623 | __u64 gpa; |
| 1623 | __u64 pad[8]; | 1624 | __u64 pad[8]; |
| 1625 | struct { | ||
| 1626 | __u64 state; | ||
| 1627 | __u64 state_entry_time; | ||
| 1628 | __u64 time_running; | ||
| 1629 | __u64 time_runnable; | ||
| 1630 | __u64 time_blocked; | ||
| 1631 | __u64 time_offline; | ||
| 1632 | } runstate; | ||
| 1624 | } u; | 1633 | } u; |
| 1625 | }; | 1634 | }; |
| 1626 | 1635 | ||
| 1627 | /* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO */ | 1636 | /* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO */ |
| 1628 | #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO 0x0 | 1637 | #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO 0x0 |
| 1629 | #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO 0x1 | 1638 | #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO 0x1 |
| 1639 | #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR 0x2 | ||
| 1640 | #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 0x3 | ||
| 1641 | #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 0x4 | ||
| 1642 | #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 0x5 | ||
| 1630 | 1643 | ||
| 1631 | /* Secure Encrypted Virtualization command */ | 1644 | /* Secure Encrypted Virtualization command */ |
| 1632 | enum sev_cmd_id { | 1645 | enum sev_cmd_id { |
| @@ -215,7 +215,7 @@ define do_install · 214 unmodified lines | |||
| 215 | if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ | 215 | if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ |
| 216 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ | 216 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ |
| 217 | fi; \ | 217 | fi; \ |
| 218 | $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' | 218 | $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2' |
| 219 | endef | 219 | endef |
| 220 | 220 | ||
| 221 | install_lib: all_cmd | 221 | install_lib: all_cmd |
| @@ -462,7 +462,7 @@ static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr) · 461 unmodified lines | |||
| 462 | return err; | 462 | return err; |
| 463 | 463 | ||
| 464 | case BTF_KIND_ARRAY: | 464 | case BTF_KIND_ARRAY: |
| 465 | return btf_dump_order_type(d, btf_array(t)->type, through_ptr); | 465 | return btf_dump_order_type(d, btf_array(t)->type, false); |
| 466 | 466 | ||
| 467 | case BTF_KIND_STRUCT: | 467 | case BTF_KIND_STRUCT: |
| 468 | case BTF_KIND_UNION: { | 468 | case BTF_KIND_UNION: { |
| @@ -1181,7 +1181,8 @@ static int bpf_object__elf_init(struct bpf_object *obj) · 1180 unmodified lines | |||
| 1181 | if (!elf_rawdata(elf_getscn(obj->efile.elf, obj->efile.shstrndx), NULL)) { | 1181 | if (!elf_rawdata(elf_getscn(obj->efile.elf, obj->efile.shstrndx), NULL)) { |
| 1182 | pr_warn("elf: failed to get section names strings from %s: %s\n", | 1182 | pr_warn("elf: failed to get section names strings from %s: %s\n", |
| 1183 | obj->path, elf_errmsg(-1)); | 1183 | obj->path, elf_errmsg(-1)); |
| 1184 | return -LIBBPF_ERRNO__FORMAT; | 1184 | err = -LIBBPF_ERRNO__FORMAT; |
| 1185 | goto errout; | ||
| 1185 | } | 1186 | } |
| 1186 | 1187 | ||
| 1187 | /* Old LLVM set e_machine to EM_NONE */ | 1188 | /* Old LLVM set e_machine to EM_NONE */ |
| @@ -40,7 +40,7 @@ static int libbpf_netlink_open(__u32 *nl_pid) · 39 unmodified lines | |||
| 40 | memset(&sa, 0, sizeof(sa)); | 40 | memset(&sa, 0, sizeof(sa)); |
| 41 | sa.nl_family = AF_NETLINK; | 41 | sa.nl_family = AF_NETLINK; |
| 42 | 42 | ||
| 43 | sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); | 43 | sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE); |
| 44 | if (sock < 0) | 44 | if (sock < 0) |
| 45 | return -errno; | 45 | return -errno; |
| 46 | 46 | ||
| @@ -402,35 +402,42 @@ static pid_t handle_signalfd(struct daemon *daemon) · 401 unmodified lines | |||
| 402 | int status; | 402 | int status; |
| 403 | pid_t pid; | 403 | pid_t pid; |
| 404 | 404 | ||
| 405 | /* | ||
| 406 | * Take signal fd data as pure signal notification and check all | ||
| 407 | * the sessions state. The reason is that multiple signals can get | ||
| 408 | * coalesced in kernel and we can receive only single signal even | ||
| 409 | * if multiple SIGCHLD were generated. | ||
| 410 | */ | ||
| 405 | err = read(daemon->signal_fd, &si, sizeof(struct signalfd_siginfo)); | 411 | err = read(daemon->signal_fd, &si, sizeof(struct signalfd_siginfo)); |
| 406 | if (err != sizeof(struct signalfd_siginfo)) | 412 | if (err != sizeof(struct signalfd_siginfo)) { |
| 413 | pr_err("failed to read signal fd\n"); | ||
| 407 | return -1; | 414 | return -1; |
| 415 | } | ||
| 408 | 416 | ||
| 409 | list_for_each_entry(session, &daemon->sessions, list) { | 417 | list_for_each_entry(session, &daemon->sessions, list) { |
| 418 | if (session->pid == -1) | ||
| 419 | continue; | ||
| 410 | 420 | ||
| 411 | if (session->pid != (int) si.ssi_pid) | 421 | pid = waitpid(session->pid, &status, WNOHANG); |
| 422 | if (pid <= 0) | ||
| 412 | continue; | 423 | continue; |
| 413 | 424 | ||
| 414 | pid = waitpid(session->pid, &status, 0); | 425 | if (WIFEXITED(status)) { |
| 415 | if (pid == session->pid) { | 426 | pr_info("session '%s' exited, status=%d\n", |
| 416 | if (WIFEXITED(status)) { | 427 | session->name, WEXITSTATUS(status)); |
| 417 | pr_info("session '%s' exited, status=%d\n", | 428 | } else if (WIFSIGNALED(status)) { |
| 418 | session->name, WEXITSTATUS(status)); | 429 | pr_info("session '%s' killed (signal %d)\n", |
| 419 | } else if (WIFSIGNALED(status)) { | 430 | session->name, WTERMSIG(status)); |
| 420 | pr_info("session '%s' killed (signal %d)\n", | 431 | } else if (WIFSTOPPED(status)) { |
| 421 | session->name, WTERMSIG(status)); | 432 | pr_info("session '%s' stopped (signal %d)\n", |
| 422 | } else if (WIFSTOPPED(status)) { | 433 | session->name, WSTOPSIG(status)); |
| 423 | pr_info("session '%s' stopped (signal %d)\n", | 434 | } else { |
| 424 | session->name, WSTOPSIG(status)); | 435 | pr_info("session '%s' Unexpected status (0x%x)\n", |
| 425 | } else { | 436 | session->name, status); |
| 426 | pr_info("session '%s' Unexpected status (0x%x)\n", | ||
| 427 | session->name, status); | ||
| 428 | } | ||
| 429 | } | 437 | } |
| 430 | 438 | ||
| 431 | session->state = KILL; | 439 | session->state = KILL; |
| 432 | session->pid = -1; | 440 | session->pid = -1; |
| 433 | return pid; | ||
| 434 | } | 441 | } |
| 435 | 442 | ||
| 436 | return 0; | 443 | return 0; |
| @@ -443,7 +450,6 @@ static int daemon_session__wait(struct daemon_session *session, struct daemon *d · 6 unmodified lines | |||
| 443 | .fd = daemon->signal_fd, | 450 | .fd = daemon->signal_fd, |
| 444 | .events = POLLIN, | 451 | .events = POLLIN, |
| 445 | }; | 452 | }; |
| 446 | pid_t wpid = 0, pid = session->pid; | ||
| 447 | time_t start; | 453 | time_t start; |
| 448 | 454 | ||
| 449 | start = time(NULL); | 455 | start = time(NULL); |
| @@ -452,7 +458,7 @@ static int daemon_session__wait(struct daemon_session *session, struct daemon *d · 2 unmodified lines | |||
| 452 | int err = poll(&pollfd, 1, 1000); | 458 | int err = poll(&pollfd, 1, 1000); |
| 453 | 459 | ||
| 454 | if (err > 0) { | 460 | if (err > 0) { |
| 455 | wpid = handle_signalfd(daemon); | 461 | handle_signalfd(daemon); |
| 456 | } else if (err < 0) { | 462 | } else if (err < 0) { |
| 457 | perror("failed: poll\n"); | 463 | perror("failed: poll\n"); |
| 458 | return -1; | 464 | return -1; |
| @@ -460,7 +466,7 @@ static int daemon_session__wait(struct daemon_session *session, struct daemon *d · 1 unmodified line | |||
| 460 | 466 | ||
| 461 | if (start + secs < time(NULL)) | 467 | if (start + secs < time(NULL)) |
| 462 | return -1; | 468 | return -1; |
| 463 | } while (wpid != pid); | 469 | } while (session->pid != -1); |
| 464 | 470 | ||
| 465 | return 0; | 471 | return 0; |
| 466 | } | 472 | } |
| @@ -902,7 +908,9 @@ static void daemon_session__kill(struct daemon_session *session, · 435 unmodified lines | |||
| 902 | daemon_session__signal(session, SIGKILL); | 908 | daemon_session__signal(session, SIGKILL); |
| 903 | break; | 909 | break; |
| 904 | default: | 910 | default: |
| 905 | break; | 911 | pr_err("failed to wait for session %s\n", |
| 912 | session->name); | ||
| 913 | return; | ||
| 906 | } | 914 | } |
| 907 | how++; | 915 | how++; |
| 908 | 916 | ||
| @@ -955,7 +963,8 @@ static void daemon__kill(struct daemon *daemon) · 46 unmodified lines | |||
| 955 | daemon__signal(daemon, SIGKILL); | 963 | daemon__signal(daemon, SIGKILL); |
| 956 | break; | 964 | break; |
| 957 | default: | 965 | default: |
| 958 | break; | 966 | pr_err("failed to wait for sessions\n"); |
| 967 | return; | ||
| 959 | } | 968 | } |
| 960 | how++; | 969 | how++; |
| 961 | 970 | ||
| @@ -1344,7 +1353,7 @@ out: · 382 unmodified lines | |||
| 1344 | close(sock_fd); | 1353 | close(sock_fd); |
| 1345 | if (conf_fd != -1) | 1354 | if (conf_fd != -1) |
| 1346 | close(conf_fd); | 1355 | close(conf_fd); |
| 1347 | if (conf_fd != -1) | 1356 | if (signal_fd != -1) |
| 1348 | close(signal_fd); | 1357 | close(signal_fd); |
| 1349 | 1358 | ||
| 1350 | pr_info("daemon exited\n"); | 1359 | pr_info("daemon exited\n"); |
| @@ -86,7 +86,7 @@ static struct { · 85 unmodified lines | |||
| 86 | .msg_load_fail = "check your vmlinux setting?", | 86 | .msg_load_fail = "check your vmlinux setting?", |
| 87 | .target_func = &epoll_pwait_loop, | 87 | .target_func = &epoll_pwait_loop, |
| 88 | .expect_result = (NR_ITERS + 1) / 2, | 88 | .expect_result = (NR_ITERS + 1) / 2, |
| 89 | .pin = true, | 89 | .pin = true, |
| 90 | }, | 90 | }, |
| 91 | #ifdef HAVE_BPF_PROLOGUE | 91 | #ifdef HAVE_BPF_PROLOGUE |
| 92 | { | 92 | { |
| @@ -99,13 +99,6 @@ static struct { · 6 unmodified lines | |||
| 99 | .expect_result = (NR_ITERS + 1) / 4, | 99 | .expect_result = (NR_ITERS + 1) / 4, |
| 100 | }, | 100 | }, |
| 101 | #endif | 101 | #endif |
| 102 | { | ||
| 103 | .prog_id = LLVM_TESTCASE_BPF_RELOCATION, | ||
| 104 | .desc = "BPF relocation checker", | ||
| 105 | .name = "[bpf_relocation_test]", | ||
| 106 | .msg_compile_fail = "fix 'perf test LLVM' first", | ||
| 107 | .msg_load_fail = "libbpf error when dealing with relocation", | ||
| 108 | }, | ||
| 109 | }; | 102 | }; |
| 110 | 103 | ||
| 111 | static int do_test(struct bpf_object *obj, int (*func)(void), | 104 | static int do_test(struct bpf_object *obj, int (*func)(void), |
| @@ -1,4 +1,4 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/bash |
| 2 | # daemon operations | 2 | # daemon operations |
| 3 | # SPDX-License-Identifier: GPL-2.0 | 3 | # SPDX-License-Identifier: GPL-2.0 |
| 4 | 4 | ||
| @@ -298,10 +298,6 @@ static int auxtrace_queues__queue_buffer(struct auxtrace_queues *queues, · 297 unmodified lines | |||
| 298 | queue->set = true; | 298 | queue->set = true; |
| 299 | queue->tid = buffer->tid; | 299 | queue->tid = buffer->tid; |
| 300 | queue->cpu = buffer->cpu; | 300 | queue->cpu = buffer->cpu; |
| 301 | } else if (buffer->cpu != queue->cpu || buffer->tid != queue->tid) { | ||
| 302 | pr_err("auxtrace queue conflict: cpu %d, tid %d vs cpu %d, tid %d\n", | ||
| 303 | queue->cpu, queue->tid, buffer->cpu, buffer->tid); | ||
| 304 | return -EINVAL; | ||
| 305 | } | 301 | } |
| 306 | 302 | ||
| 307 | buffer->buffer_nr = queues->next_buffer_nr++; | 303 | buffer->buffer_nr = queues->next_buffer_nr++; |
| @@ -196,25 +196,32 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, · 195 unmodified lines | |||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | if (info_linear->info_len < offsetof(struct bpf_prog_info, prog_tags)) { | 198 | if (info_linear->info_len < offsetof(struct bpf_prog_info, prog_tags)) { |
| 199 | free(info_linear); | ||
| 199 | pr_debug("%s: the kernel is too old, aborting\n", __func__); | 200 | pr_debug("%s: the kernel is too old, aborting\n", __func__); |
| 200 | return -2; | 201 | return -2; |
| 201 | } | 202 | } |
| 202 | 203 | ||
| 203 | info = &info_linear->info; | 204 | info = &info_linear->info; |
| 205 | if (!info->jited_ksyms) { | ||
| 206 | free(info_linear); | ||
| 207 | return -1; | ||
| 208 | } | ||
| 204 | 209 | ||
| 205 | /* number of ksyms, func_lengths, and tags should match */ | 210 | /* number of ksyms, func_lengths, and tags should match */ |
| 206 | sub_prog_cnt = info->nr_jited_ksyms; | 211 | sub_prog_cnt = info->nr_jited_ksyms; |
| 207 | if (sub_prog_cnt != info->nr_prog_tags || | 212 | if (sub_prog_cnt != info->nr_prog_tags || |
| 208 | sub_prog_cnt != info->nr_jited_func_lens) | 213 | sub_prog_cnt != info->nr_jited_func_lens) { |
| 214 | free(info_linear); | ||
| 209 | return -1; | 215 | return -1; |
| 216 | } | ||
| 210 | 217 | ||
| 211 | /* check BTF func info support */ | 218 | /* check BTF func info support */ |
| 212 | if (info->btf_id && info->nr_func_info && info->func_info_rec_size) { | 219 | if (info->btf_id && info->nr_func_info && info->func_info_rec_size) { |
| 213 | /* btf func info number should be same as sub_prog_cnt */ | 220 | /* btf func info number should be same as sub_prog_cnt */ |
| 214 | if (sub_prog_cnt != info->nr_func_info) { | 221 | if (sub_prog_cnt != info->nr_func_info) { |
| 215 | pr_debug("%s: mismatch in BPF sub program count and BTF function info count, aborting\n", __func__); | 222 | pr_debug("%s: mismatch in BPF sub program count and BTF function info count, aborting\n", __func__); |
| 216 | err = -1; | 223 | free(info_linear); |
| 217 | goto out; | 224 | return -1; |
| 218 | } | 225 | } |
| 219 | if (btf__get_from_id(info->btf_id, &btf)) { | 226 | if (btf__get_from_id(info->btf_id, &btf)) { |
| 220 | pr_debug("%s: failed to get BTF of id %u, aborting\n", __func__, info->btf_id); | 227 | pr_debug("%s: failed to get BTF of id %u, aborting\n", __func__, info->btf_id); |
| @@ -356,6 +356,9 @@ __add_event(struct list_head *list, int *idx, · 355 unmodified lines | |||
| 356 | struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) : | 356 | struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) : |
| 357 | cpu_list ? perf_cpu_map__new(cpu_list) : NULL; | 357 | cpu_list ? perf_cpu_map__new(cpu_list) : NULL; |
| 358 | 358 | ||
| 359 | if (pmu && attr->type == PERF_TYPE_RAW) | ||
| 360 | perf_pmu__warn_invalid_config(pmu, attr->config, name); | ||
| 361 | |||
| 359 | if (init_attr) | 362 | if (init_attr) |
| 360 | event_attr_init(attr); | 363 | event_attr_init(attr); |
| 361 | 364 | ||
| @@ -1812,3 +1812,36 @@ int perf_pmu__caps_parse(struct perf_pmu *pmu) · 1811 unmodified lines | |||
| 1812 | 1812 | ||
| 1813 | return nr_caps; | 1813 | return nr_caps; |
| 1814 | } | 1814 | } |
| 1815 | |||
| 1816 | void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, | ||
| 1817 | char *name) | ||
| 1818 | { | ||
| 1819 | struct perf_pmu_format *format; | ||
| 1820 | __u64 masks = 0, bits; | ||
| 1821 | char buf[100]; | ||
| 1822 | unsigned int i; | ||
| 1823 | |||
| 1824 | list_for_each_entry(format, &pmu->format, list) { | ||
| 1825 | if (format->value != PERF_PMU_FORMAT_VALUE_CONFIG) | ||
| 1826 | continue; | ||
| 1827 | |||
| 1828 | for_each_set_bit(i, format->bits, PERF_PMU_FORMAT_BITS) | ||
| 1829 | masks |= 1ULL << i; | ||
| 1830 | } | ||
| 1831 | |||
| 1832 | /* | ||
| 1833 | * Kernel doesn't export any valid format bits. | ||
| 1834 | */ | ||
| 1835 | if (masks == 0) | ||
| 1836 | return; | ||
| 1837 | |||
| 1838 | bits = config & ~masks; | ||
| 1839 | if (bits == 0) | ||
| 1840 | return; | ||
| 1841 | |||
| 1842 | bitmap_scnprintf((unsigned long *)&bits, sizeof(bits) * 8, buf, sizeof(buf)); | ||
| 1843 | |||
| 1844 | pr_warning("WARNING: event '%s' not valid (bits %s of config " | ||
| 1845 | "'%llx' not supported by kernel)!\n", | ||
| 1846 | name ?: "N/A", buf, config); | ||
| 1847 | } | ||
| @@ -123,4 +123,7 @@ int perf_pmu__convert_scale(const char *scale, char **end, double *sval); · 122 unmodified lines | |||
| 123 | 123 | ||
| 124 | int perf_pmu__caps_parse(struct perf_pmu *pmu); | 124 | int perf_pmu__caps_parse(struct perf_pmu *pmu); |
| 125 | 125 | ||
| 126 | void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, | ||
| 127 | char *name); | ||
| 128 | |||
| 126 | #endif /* __PMU_H */ | 129 | #endif /* __PMU_H */ |
| @@ -424,7 +424,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, · 423 unmodified lines | |||
| 424 | 424 | ||
| 425 | while (!io.eof) { | 425 | while (!io.eof) { |
| 426 | static const char anonstr[] = "//anon"; | 426 | static const char anonstr[] = "//anon"; |
| 427 | size_t size; | 427 | size_t size, aligned_size; |
| 428 | 428 | ||
| 429 | /* ensure null termination since stack will be reused. */ | 429 | /* ensure null termination since stack will be reused. */ |
| 430 | event->mmap2.filename[0] = '\0'; | 430 | event->mmap2.filename[0] = '\0'; |
| @@ -484,11 +484,12 @@ out: · 53 unmodified lines | |||
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | size = strlen(event->mmap2.filename) + 1; | 486 | size = strlen(event->mmap2.filename) + 1; |
| 487 | size = PERF_ALIGN(size, sizeof(u64)); | 487 | aligned_size = PERF_ALIGN(size, sizeof(u64)); |
| 488 | event->mmap2.len -= event->mmap.start; | 488 | event->mmap2.len -= event->mmap.start; |
| 489 | event->mmap2.header.size = (sizeof(event->mmap2) - | 489 | event->mmap2.header.size = (sizeof(event->mmap2) - |
| 490 | (sizeof(event->mmap2.filename) - size)); | 490 | (sizeof(event->mmap2.filename) - aligned_size)); |
| 491 | memset(event->mmap2.filename + size, 0, machine->id_hdr_size); | 491 | memset(event->mmap2.filename + size, 0, machine->id_hdr_size + |
| 492 | (aligned_size - size)); | ||
| 492 | event->mmap2.header.size += machine->id_hdr_size; | 493 | event->mmap2.header.size += machine->id_hdr_size; |
| 493 | event->mmap2.pid = tgid; | 494 | event->mmap2.pid = tgid; |
| 494 | event->mmap2.tid = pid; | 495 | event->mmap2.tid = pid; |
| @@ -758,7 +759,7 @@ static int __event__synthesize_thread(union perf_event *comm_event, · 263 unmodified lines | |||
| 758 | for (i = 0; i < n; i++) { | 759 | for (i = 0; i < n; i++) { |
| 759 | char *end; | 760 | char *end; |
| 760 | pid_t _pid; | 761 | pid_t _pid; |
| 761 | bool kernel_thread; | 762 | bool kernel_thread = false; |
| 762 | 763 | ||
| 763 | _pid = strtol(dirent[i]->d_name, &end, 10); | 764 | _pid = strtol(dirent[i]->d_name, &end, 10); |
| 764 | if (*end) | 765 | if (*end) |
| @@ -133,6 +133,8 @@ static struct dso *__machine__addnew_vdso(struct machine *machine, const char *s · 132 unmodified lines | |||
| 133 | if (dso != NULL) { | 133 | if (dso != NULL) { |
| 134 | __dsos__add(&machine->dsos, dso); | 134 | __dsos__add(&machine->dsos, dso); |
| 135 | dso__set_long_name(dso, long_name, false); | 135 | dso__set_long_name(dso, long_name, false); |
| 136 | /* Put dso here because __dsos_add already got it */ | ||
| 137 | dso__put(dso); | ||
| 136 | } | 138 | } |
| 137 | 139 | ||
| 138 | return dso; | 140 | return dso; |
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 261 lines aren’t shown here.
This diff is large: its 167 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.