]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 13:53:34 +0000 (14:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 13:53:34 +0000 (14:53 +0100)
added patches:
drm-virtio-use-kvmalloc-for-large-allocations.patch
input-elan_i2c-add-new-trackpoint-report-type-0x5f.patch
input-elantech-fix-protocol-errors-for-some-trackpoints-in-smbus-mode.patch
net-usb-qmi_wwan-support-zte-p685m-modem.patch
x86-build-treat-r_386_plt32-relocation-as-r_386_pc32.patch

queue-5.10/drm-virtio-use-kvmalloc-for-large-allocations.patch [new file with mode: 0644]
queue-5.10/input-elan_i2c-add-new-trackpoint-report-type-0x5f.patch [new file with mode: 0644]
queue-5.10/input-elantech-fix-protocol-errors-for-some-trackpoints-in-smbus-mode.patch [new file with mode: 0644]
queue-5.10/net-usb-qmi_wwan-support-zte-p685m-modem.patch [new file with mode: 0644]
queue-5.10/x86-build-treat-r_386_plt32-relocation-as-r_386_pc32.patch [new file with mode: 0644]

diff --git a/queue-5.10/drm-virtio-use-kvmalloc-for-large-allocations.patch b/queue-5.10/drm-virtio-use-kvmalloc-for-large-allocations.patch
new file mode 100644 (file)
index 0000000..888516b
--- /dev/null
@@ -0,0 +1,38 @@
+From ea86f3defd55f141a44146e66cbf8ffb683d60da Mon Sep 17 00:00:00 2001
+From: Sergey Senozhatsky <senozhatsky@chromium.org>
+Date: Thu, 5 Nov 2020 10:47:44 +0900
+Subject: drm/virtio: use kvmalloc for large allocations
+
+From: Sergey Senozhatsky <senozhatsky@chromium.org>
+
+commit ea86f3defd55f141a44146e66cbf8ffb683d60da upstream.
+
+We observed that some of virtio_gpu_object_shmem_init() allocations
+can be rather costly - order 6 - which can be difficult to fulfill
+under memory pressure conditions. Switch to kvmalloc_array() in
+virtio_gpu_object_shmem_init() and let the kernel vmalloc the entries
+array.
+
+Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
+Link: http://patchwork.freedesktop.org/patch/msgid/20201105014744.1662226-1-senozhatsky@chromium.org
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Signed-off-by: Doug Horn <doughorn@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/virtio/virtgpu_object.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/virtio/virtgpu_object.c
++++ b/drivers/gpu/drm/virtio/virtgpu_object.c
+@@ -172,8 +172,9 @@ static int virtio_gpu_object_shmem_init(
+               *nents = shmem->pages->orig_nents;
+       }
+-      *ents = kmalloc_array(*nents, sizeof(struct virtio_gpu_mem_entry),
+-                            GFP_KERNEL);
++      *ents = kvmalloc_array(*nents,
++                             sizeof(struct virtio_gpu_mem_entry),
++                             GFP_KERNEL);
+       if (!(*ents)) {
+               DRM_ERROR("failed to allocate ent list\n");
+               return -ENOMEM;
diff --git a/queue-5.10/input-elan_i2c-add-new-trackpoint-report-type-0x5f.patch b/queue-5.10/input-elan_i2c-add-new-trackpoint-report-type-0x5f.patch
new file mode 100644 (file)
index 0000000..d2f17ae
--- /dev/null
@@ -0,0 +1,102 @@
+From 056115daede8d01f71732bc7d778fb85acee8eb6 Mon Sep 17 00:00:00 2001
+From: Jingle Wu <jingle.wu@emc.com.tw>
+Date: Thu, 10 Dec 2020 23:40:09 -0800
+Subject: Input: elan_i2c - add new trackpoint report type 0x5F
+
+From: Jingle Wu <jingle.wu@emc.com.tw>
+
+commit 056115daede8d01f71732bc7d778fb85acee8eb6 upstream.
+
+The 0x5F is a new trackpoint report type used by some modules.
+
+Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw>
+Link: https://lore.kernel.org/r/20201211071511.32349-1-jingle.wu@emc.com.tw
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Cc: Nikolai Kostrigin <nickel@basealt.ru>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/mouse/elan_i2c.h       |   16 ++++++++++++++++
+ drivers/input/mouse/elan_i2c_core.c  |   13 +------------
+ drivers/input/mouse/elan_i2c_smbus.c |    8 ++++++--
+ 3 files changed, 23 insertions(+), 14 deletions(-)
+
+--- a/drivers/input/mouse/elan_i2c.h
++++ b/drivers/input/mouse/elan_i2c.h
+@@ -28,6 +28,22 @@
+ #define ETP_FEATURE_REPORT_MK BIT(0)
++#define ETP_REPORT_ID         0x5D
++#define ETP_TP_REPORT_ID      0x5E
++#define ETP_TP_REPORT_ID2     0x5F
++#define ETP_REPORT_ID2                0x60    /* High precision report */
++
++#define ETP_REPORT_ID_OFFSET  2
++#define ETP_TOUCH_INFO_OFFSET 3
++#define ETP_FINGER_DATA_OFFSET        4
++#define ETP_HOVER_INFO_OFFSET 30
++#define ETP_MK_DATA_OFFSET    33      /* For high precision reports */
++
++#define ETP_MAX_REPORT_LEN    39
++
++#define ETP_MAX_FINGERS               5
++#define ETP_FINGER_DATA_LEN   5
++
+ /* IAP Firmware handling */
+ #define ETP_PRODUCT_ID_FORMAT_STRING  "%d.0"
+ #define ETP_FW_NAME           "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin"
+--- a/drivers/input/mouse/elan_i2c_core.c
++++ b/drivers/input/mouse/elan_i2c_core.c
+@@ -47,18 +47,6 @@
+ #define ETP_FINGER_WIDTH      15
+ #define ETP_RETRY_COUNT               3
+-#define ETP_MAX_FINGERS               5
+-#define ETP_FINGER_DATA_LEN   5
+-#define ETP_REPORT_ID         0x5D
+-#define ETP_REPORT_ID2                0x60    /* High precision report */
+-#define ETP_TP_REPORT_ID      0x5E
+-#define ETP_REPORT_ID_OFFSET  2
+-#define ETP_TOUCH_INFO_OFFSET 3
+-#define ETP_FINGER_DATA_OFFSET        4
+-#define ETP_HOVER_INFO_OFFSET 30
+-#define ETP_MK_DATA_OFFSET    33      /* For high precision reports */
+-#define ETP_MAX_REPORT_LEN    39
+-
+ /* The main device structure */
+ struct elan_tp_data {
+       struct i2c_client       *client;
+@@ -1076,6 +1064,7 @@ static irqreturn_t elan_isr(int irq, voi
+               elan_report_absolute(data, report, true);
+               break;
+       case ETP_TP_REPORT_ID:
++      case ETP_TP_REPORT_ID2:
+               elan_report_trackpoint(data, report);
+               break;
+       default:
+--- a/drivers/input/mouse/elan_i2c_smbus.c
++++ b/drivers/input/mouse/elan_i2c_smbus.c
+@@ -45,6 +45,7 @@
+ #define ETP_SMBUS_CALIBRATE_QUERY     0xC5
+ #define ETP_SMBUS_REPORT_LEN          32
++#define ETP_SMBUS_REPORT_LEN2         7
+ #define ETP_SMBUS_REPORT_OFFSET               2
+ #define ETP_SMBUS_HELLOPACKET_LEN     5
+ #define ETP_SMBUS_IAP_PASSWORD                0x1234
+@@ -497,10 +498,13 @@ static int elan_smbus_get_report(struct
+               return len;
+       }
+-      if (len != ETP_SMBUS_REPORT_LEN) {
++      if (report[ETP_REPORT_ID_OFFSET] == ETP_TP_REPORT_ID2)
++              report_len = ETP_SMBUS_REPORT_LEN2;
++
++      if (len != report_len) {
+               dev_err(&client->dev,
+                       "wrong report length (%d vs %d expected)\n",
+-                      len, ETP_SMBUS_REPORT_LEN);
++                      len, report_len);
+               return -EIO;
+       }
diff --git a/queue-5.10/input-elantech-fix-protocol-errors-for-some-trackpoints-in-smbus-mode.patch b/queue-5.10/input-elantech-fix-protocol-errors-for-some-trackpoints-in-smbus-mode.patch
new file mode 100644 (file)
index 0000000..72aced0
--- /dev/null
@@ -0,0 +1,199 @@
+From e4c9062717feda88900b566463228d1c4910af6d Mon Sep 17 00:00:00 2001
+From: "jingle.wu" <jingle.wu@emc.com.tw>
+Date: Thu, 10 Dec 2020 23:49:16 -0800
+Subject: Input: elantech - fix protocol errors for some trackpoints in SMBus mode
+
+From: jingle.wu <jingle.wu@emc.com.tw>
+
+commit e4c9062717feda88900b566463228d1c4910af6d upstream.
+
+There are some version of Elan trackpads that send incorrect data when
+in SMbus mode, unless they are switched to use 0x5f reports instead of
+standard 0x5e. This patch implements querying device to retrieve chips
+identifying data, and switching it, when needed to the alternative
+report.
+
+Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw>
+Link: https://lore.kernel.org/r/20201211071531.32413-1-jingle.wu@emc.com.tw
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/mouse/elantech.c |   99 ++++++++++++++++++++++++++++++++++++++++-
+ drivers/input/mouse/elantech.h |    4 +
+ 2 files changed, 101 insertions(+), 2 deletions(-)
+
+--- a/drivers/input/mouse/elantech.c
++++ b/drivers/input/mouse/elantech.c
+@@ -90,6 +90,47 @@ static int elantech_ps2_command(struct p
+ }
+ /*
++ * Send an Elantech style special command to read 3 bytes from a register
++ */
++static int elantech_read_reg_params(struct psmouse *psmouse, u8 reg, u8 *param)
++{
++      if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
++          elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) ||
++          elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
++          elantech_ps2_command(psmouse, NULL, reg) ||
++          elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) {
++              psmouse_err(psmouse,
++                          "failed to read register %#02x\n", reg);
++              return -EIO;
++      }
++
++      return 0;
++}
++
++/*
++ * Send an Elantech style special command to write a register with a parameter
++ */
++static int elantech_write_reg_params(struct psmouse *psmouse, u8 reg, u8 *param)
++{
++      if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
++          elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) ||
++          elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
++          elantech_ps2_command(psmouse, NULL, reg) ||
++          elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
++          elantech_ps2_command(psmouse, NULL, param[0]) ||
++          elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
++          elantech_ps2_command(psmouse, NULL, param[1]) ||
++          elantech_ps2_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) {
++              psmouse_err(psmouse,
++                          "failed to write register %#02x with value %#02x%#02x\n",
++                          reg, param[0], param[1]);
++              return -EIO;
++      }
++
++      return 0;
++}
++
++/*
+  * Send an Elantech style special command to read a value from a register
+  */
+ static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg,
+@@ -1530,18 +1571,34 @@ static const struct dmi_system_id no_hw_
+ };
+ /*
++ * Change Report id 0x5E to 0x5F.
++ */
++static int elantech_change_report_id(struct psmouse *psmouse)
++{
++      unsigned char param[2] = { 0x10, 0x03 };
++
++      if (elantech_write_reg_params(psmouse, 0x7, param) ||
++          elantech_read_reg_params(psmouse, 0x7, param) ||
++          param[0] != 0x10 || param[1] != 0x03) {
++              psmouse_err(psmouse, "Unable to change report ID to 0x5f.\n");
++              return -EIO;
++      }
++
++      return 0;
++}
++/*
+  * determine hardware version and set some properties according to it.
+  */
+ static int elantech_set_properties(struct elantech_device_info *info)
+ {
+       /* This represents the version of IC body. */
+-      int ver = (info->fw_version & 0x0f0000) >> 16;
++      info->ic_version = (info->fw_version & 0x0f0000) >> 16;
+       /* Early version of Elan touchpads doesn't obey the rule. */
+       if (info->fw_version < 0x020030 || info->fw_version == 0x020600)
+               info->hw_version = 1;
+       else {
+-              switch (ver) {
++              switch (info->ic_version) {
+               case 2:
+               case 4:
+                       info->hw_version = 2;
+@@ -1557,6 +1614,11 @@ static int elantech_set_properties(struc
+               }
+       }
++      /* Get information pattern for hw_version 4 */
++      info->pattern = 0x00;
++      if (info->ic_version == 0x0f && (info->fw_version & 0xff) <= 0x02)
++              info->pattern = info->fw_version & 0xff;
++
+       /* decide which send_cmd we're gonna use early */
+       info->send_cmd = info->hw_version >= 3 ? elantech_send_cmd :
+                                                synaptics_send_cmd;
+@@ -1598,6 +1660,7 @@ static int elantech_query_info(struct ps
+ {
+       unsigned char param[3];
+       unsigned char traces;
++      unsigned char ic_body[3];
+       memset(info, 0, sizeof(*info));
+@@ -1640,6 +1703,21 @@ static int elantech_query_info(struct ps
+                            info->samples[2]);
+       }
++      if (info->pattern > 0x00 && info->ic_version == 0xf) {
++              if (info->send_cmd(psmouse, ETP_ICBODY_QUERY, ic_body)) {
++                      psmouse_err(psmouse, "failed to query ic body\n");
++                      return -EINVAL;
++              }
++              info->ic_version = be16_to_cpup((__be16 *)ic_body);
++              psmouse_info(psmouse,
++                           "Elan ic body: %#04x, current fw version: %#02x\n",
++                           info->ic_version, ic_body[2]);
++      }
++
++      info->product_id = be16_to_cpup((__be16 *)info->samples);
++      if (info->pattern == 0x00)
++              info->product_id &= 0xff;
++
+       if (info->samples[1] == 0x74 && info->hw_version == 0x03) {
+               /*
+                * This module has a bug which makes absolute mode
+@@ -1654,6 +1732,23 @@ static int elantech_query_info(struct ps
+       /* The MSB indicates the presence of the trackpoint */
+       info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80;
++      if (info->has_trackpoint && info->ic_version == 0x0011 &&
++          (info->product_id == 0x08 || info->product_id == 0x09 ||
++           info->product_id == 0x0d || info->product_id == 0x0e)) {
++              /*
++               * This module has a bug which makes trackpoint in SMBus
++               * mode return invalid data unless trackpoint is switched
++               * from using 0x5e reports to 0x5f. If we are not able to
++               * make the switch, let's abort initialization so we'll be
++               * using standard PS/2 protocol.
++               */
++              if (elantech_change_report_id(psmouse)) {
++                      psmouse_info(psmouse,
++                                   "Trackpoint report is broken, forcing standard PS/2 protocol\n");
++                      return -ENODEV;
++              }
++      }
++
+       info->x_res = 31;
+       info->y_res = 31;
+       if (info->hw_version == 4) {
+--- a/drivers/input/mouse/elantech.h
++++ b/drivers/input/mouse/elantech.h
+@@ -18,6 +18,7 @@
+ #define ETP_CAPABILITIES_QUERY                0x02
+ #define ETP_SAMPLE_QUERY              0x03
+ #define ETP_RESOLUTION_QUERY          0x04
++#define ETP_ICBODY_QUERY              0x05
+ /*
+  * Command values for register reading or writing
+@@ -140,7 +141,10 @@ struct elantech_device_info {
+       unsigned char samples[3];
+       unsigned char debug;
+       unsigned char hw_version;
++      unsigned char pattern;
+       unsigned int fw_version;
++      unsigned int ic_version;
++      unsigned int product_id;
+       unsigned int x_min;
+       unsigned int y_min;
+       unsigned int x_max;
diff --git a/queue-5.10/net-usb-qmi_wwan-support-zte-p685m-modem.patch b/queue-5.10/net-usb-qmi_wwan-support-zte-p685m-modem.patch
new file mode 100644 (file)
index 0000000..adbde36
--- /dev/null
@@ -0,0 +1,65 @@
+From 88eee9b7b42e69fb622ddb3ff6f37e8e4347f5b2 Mon Sep 17 00:00:00 2001
+From: Lech Perczak <lech.perczak@gmail.com>
+Date: Tue, 23 Feb 2021 19:34:56 +0100
+Subject: net: usb: qmi_wwan: support ZTE P685M modem
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Lech Perczak <lech.perczak@gmail.com>
+
+commit 88eee9b7b42e69fb622ddb3ff6f37e8e4347f5b2 upstream.
+
+Now that interface 3 in "option" driver is no longer mapped, add device
+ID matching it to qmi_wwan.
+
+The modem is used inside ZTE MF283+ router and carriers identify it as
+such.
+Interface mapping is:
+0: QCDM, 1: AT (PCUI), 2: AT (Modem), 3: QMI, 4: ADB
+
+T:  Bus=02 Lev=02 Prnt=02 Port=05 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
+D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=19d2 ProdID=1275 Rev=f0.00
+S:  Manufacturer=ZTE,Incorporated
+S:  Product=ZTE Technologies MSM
+S:  SerialNumber=P685M510ZTED0000CP&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&0
+C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
+I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
+E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
+E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
+E:  Ad=87(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
+E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
+E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+
+Acked-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
+Link: https://lore.kernel.org/r/20210223183456.6377-1-lech.perczak@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/qmi_wwan.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -1258,6 +1258,7 @@ static const struct usb_device_id produc
+       {QMI_FIXED_INTF(0x19d2, 0x1255, 4)},
+       {QMI_FIXED_INTF(0x19d2, 0x1256, 4)},
+       {QMI_FIXED_INTF(0x19d2, 0x1270, 5)},    /* ZTE MF667 */
++      {QMI_FIXED_INTF(0x19d2, 0x1275, 3)},    /* ZTE P685M */
+       {QMI_FIXED_INTF(0x19d2, 0x1401, 2)},
+       {QMI_FIXED_INTF(0x19d2, 0x1402, 2)},    /* ZTE MF60 */
+       {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},
diff --git a/queue-5.10/x86-build-treat-r_386_plt32-relocation-as-r_386_pc32.patch b/queue-5.10/x86-build-treat-r_386_plt32-relocation-as-r_386_pc32.patch
new file mode 100644 (file)
index 0000000..762099b
--- /dev/null
@@ -0,0 +1,104 @@
+From bb73d07148c405c293e576b40af37737faf23a6a Mon Sep 17 00:00:00 2001
+From: Fangrui Song <maskray@google.com>
+Date: Wed, 27 Jan 2021 12:56:00 -0800
+Subject: x86/build: Treat R_386_PLT32 relocation as R_386_PC32
+
+From: Fangrui Song <maskray@google.com>
+
+commit bb73d07148c405c293e576b40af37737faf23a6a upstream.
+
+This is similar to commit
+
+  b21ebf2fb4cd ("x86: Treat R_X86_64_PLT32 as R_X86_64_PC32")
+
+but for i386. As far as the kernel is concerned, R_386_PLT32 can be
+treated the same as R_386_PC32.
+
+R_386_PLT32/R_X86_64_PLT32 are PC-relative relocation types which
+can only be used by branches. If the referenced symbol is defined
+externally, a PLT will be used.
+
+R_386_PC32/R_X86_64_PC32 are PC-relative relocation types which can be
+used by address taking operations and branches. If the referenced symbol
+is defined externally, a copy relocation/canonical PLT entry will be
+created in the executable.
+
+On x86-64, there is no PIC vs non-PIC PLT distinction and an
+R_X86_64_PLT32 relocation is produced for both `call/jmp foo` and
+`call/jmp foo@PLT` with newer (2018) GNU as/LLVM integrated assembler.
+This avoids canonical PLT entries (st_shndx=0, st_value!=0).
+
+On i386, there are 2 types of PLTs, PIC and non-PIC. Currently,
+the GCC/GNU as convention is to use R_386_PC32 for non-PIC PLT and
+R_386_PLT32 for PIC PLT. Copy relocations/canonical PLT entries
+are possible ABI issues but GCC/GNU as will likely keep the status
+quo because (1) the ABI is legacy (2) the change will drop a GNU
+ld diagnostic for non-default visibility ifunc in shared objects.
+
+clang-12 -fno-pic (since [1]) can emit R_386_PLT32 for compiler
+generated function declarations, because preventing canonical PLT
+entries is weighed over the rare ifunc diagnostic.
+
+Further info for the more interested:
+
+  https://github.com/ClangBuiltLinux/linux/issues/1210
+  https://sourceware.org/bugzilla/show_bug.cgi?id=27169
+  https://github.com/llvm/llvm-project/commit/a084c0388e2a59b9556f2de0083333232da3f1d6 [1]
+
+ [ bp: Massage commit message. ]
+
+Reported-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Fangrui Song <maskray@google.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Tested-by: Nick Desaulniers <ndesaulniers@google.com>
+Tested-by: Nathan Chancellor <natechancellor@gmail.com>
+Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
+Link: https://lkml.kernel.org/r/20210127205600.1227437-1-maskray@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/module.c |    1 +
+ arch/x86/tools/relocs.c  |   12 ++++++++----
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+--- a/arch/x86/kernel/module.c
++++ b/arch/x86/kernel/module.c
+@@ -114,6 +114,7 @@ int apply_relocate(Elf32_Shdr *sechdrs,
+                       *location += sym->st_value;
+                       break;
+               case R_386_PC32:
++              case R_386_PLT32:
+                       /* Add the value, subtract its position */
+                       *location += sym->st_value - (uint32_t)location;
+                       break;
+--- a/arch/x86/tools/relocs.c
++++ b/arch/x86/tools/relocs.c
+@@ -867,9 +867,11 @@ static int do_reloc32(struct section *se
+       case R_386_PC32:
+       case R_386_PC16:
+       case R_386_PC8:
++      case R_386_PLT32:
+               /*
+-               * NONE can be ignored and PC relative relocations don't
+-               * need to be adjusted.
++               * NONE can be ignored and PC relative relocations don't need
++               * to be adjusted. Because sym must be defined, R_386_PLT32 can
++               * be treated the same way as R_386_PC32.
+                */
+               break;
+@@ -910,9 +912,11 @@ static int do_reloc_real(struct section
+       case R_386_PC32:
+       case R_386_PC16:
+       case R_386_PC8:
++      case R_386_PLT32:
+               /*
+-               * NONE can be ignored and PC relative relocations don't
+-               * need to be adjusted.
++               * NONE can be ignored and PC relative relocations don't need
++               * to be adjusted. Because sym must be defined, R_386_PLT32 can
++               * be treated the same way as R_386_PC32.
+                */
+               break;