summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch35
-rw-r--r--0002-staging-r8188eu-Fix-breakage-introduced-when-5G-code.patch47
-rw-r--r--0003-PCI-MSI-Deal-with-devices-lying-about-their-MSI-mask.patch56
-rw-r--r--0004-PCI-Add-MSI-masking-quirk-for-Nvidia-ION-AHCI.patch40
-rw-r--r--0005-PCI-Add-more-NVIDIA-controllers-to-the-MSI-masking-q.patch24
-rw-r--r--0006-drm-amd-pm-avoid-duplicate-powergate-ungate-setting.patch108
-rw-r--r--0007-iommu-intel-do-deep-dma-unmapping-to-avoid-kernel-fl.patch88
-rw-r--r--PKGBUILD24
8 files changed, 402 insertions, 20 deletions
diff --git a/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch b/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
index 48371cd..9c90773 100644
--- a/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
+++ b/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
@@ -1,7 +1,8 @@
-From 048c6dda33c592ef025b372311eede5e05ef9cb7 Mon Sep 17 00:00:00 2001
+From 47d2645e7e3964621caea15feae6b806bd63ad92 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Mon, 16 Sep 2019 04:53:20 +0200
-Subject: ZEN: Add sysctl and CONFIG to disallow unprivileged CLONE_NEWUSER
+Subject: [PATCH 1/8] ZEN: Add sysctl and CONFIG to disallow unprivileged
+ CLONE_NEWUSER
Our default behavior continues to match the vanilla kernel.
---
@@ -13,10 +14,10 @@ Our default behavior continues to match the vanilla kernel.
5 files changed, 53 insertions(+)
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
-index 6ef1c7109fc4..2140091b0b8d 100644
+index 33a4240e6a6f..82213f9c4c17 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
-@@ -106,6 +106,8 @@ void dec_ucount(struct ucounts *ucounts, enum ucount_type type);
+@@ -139,6 +139,8 @@ static inline void set_rlimit_ucount_max(struct user_namespace *ns,
#ifdef CONFIG_USER_NS
@@ -25,7 +26,7 @@ index 6ef1c7109fc4..2140091b0b8d 100644
static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
{
if (ns)
-@@ -139,6 +141,8 @@ extern bool current_in_userns(const struct user_namespace *target_ns);
+@@ -172,6 +174,8 @@ extern bool current_in_userns(const struct user_namespace *target_ns);
struct ns_common *ns_get_owner(struct ns_common *ns);
#else
@@ -35,10 +36,10 @@ index 6ef1c7109fc4..2140091b0b8d 100644
{
return &init_user_ns;
diff --git a/init/Kconfig b/init/Kconfig
-index 0872a5a2e759..a40d8afeb1bb 100644
+index 11f8a845f259..02b7a0e455a5 100644
--- a/init/Kconfig
+++ b/init/Kconfig
-@@ -1173,6 +1173,22 @@ config USER_NS
+@@ -1226,6 +1226,22 @@ config USER_NS
If unsure, say N.
@@ -62,12 +63,12 @@ index 0872a5a2e759..a40d8afeb1bb 100644
bool "PID Namespaces"
default y
diff --git a/kernel/fork.c b/kernel/fork.c
-index 6d266388d380..635146a691c1 100644
+index 10885c649ca4..e0fe98e1afbd 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
-@@ -97,6 +97,10 @@
- #include <linux/scs.h>
+@@ -98,6 +98,10 @@
#include <linux/io_uring.h>
+ #include <linux/bpf.h>
+#ifdef CONFIG_USER_NS
+#include <linux/user_namespace.h>
@@ -76,7 +77,7 @@ index 6d266388d380..635146a691c1 100644
#include <asm/pgalloc.h>
#include <linux/uaccess.h>
#include <asm/mmu_context.h>
-@@ -1862,6 +1866,10 @@ static __latent_entropy struct task_struct *copy_process(
+@@ -1950,6 +1954,10 @@ static __latent_entropy struct task_struct *copy_process(
if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS))
return ERR_PTR(-EINVAL);
@@ -87,7 +88,7 @@ index 6d266388d380..635146a691c1 100644
/*
* Thread groups must share signals as well, and detached threads
* can only be started up within the thread group.
-@@ -2927,6 +2935,12 @@ int ksys_unshare(unsigned long unshare_flags)
+@@ -3056,6 +3064,12 @@ int ksys_unshare(unsigned long unshare_flags)
if (unshare_flags & CLONE_NEWNS)
unshare_flags |= CLONE_FS;
@@ -101,10 +102,10 @@ index 6d266388d380..635146a691c1 100644
if (err)
goto bad_unshare_out;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
-index afad085960b8..a94828fb31c2 100644
+index 083be6af29d7..42aa3c7835b9 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
-@@ -103,6 +103,9 @@
+@@ -105,6 +105,9 @@
#ifdef CONFIG_LOCKUP_DETECTOR
#include <linux/nmi.h>
#endif
@@ -114,7 +115,7 @@ index afad085960b8..a94828fb31c2 100644
#if defined(CONFIG_SYSCTL)
-@@ -1902,6 +1905,15 @@ static struct ctl_table kern_table[] = {
+@@ -1949,6 +1952,15 @@ static struct ctl_table kern_table[] = {
.proc_handler = proc_dointvec,
},
#endif
@@ -131,7 +132,7 @@ index afad085960b8..a94828fb31c2 100644
{
.procname = "tainted",
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
-index e703d5d9cbe8..5758274feaee 100644
+index 6b2e3ca7ee99..0253002184f1 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -21,6 +21,13 @@
@@ -149,5 +150,5 @@ index e703d5d9cbe8..5758274feaee 100644
static DEFINE_MUTEX(userns_state_mutex);
--
-cgit v1.2.3-1-gf6bb5
+2.33.1
diff --git a/0002-staging-r8188eu-Fix-breakage-introduced-when-5G-code.patch b/0002-staging-r8188eu-Fix-breakage-introduced-when-5G-code.patch
new file mode 100644
index 0000000..8cd4c11
--- /dev/null
+++ b/0002-staging-r8188eu-Fix-breakage-introduced-when-5G-code.patch
@@ -0,0 +1,47 @@
+From 150424b14ca70f807b083aaae52db9eb072ba2e4 Mon Sep 17 00:00:00 2001
+From: Larry Finger <Larry.Finger@lwfinger.net>
+Date: Sun, 7 Nov 2021 11:35:43 -0600
+Subject: [PATCH 2/8] staging: r8188eu: Fix breakage introduced when 5G code
+ was removed
+
+In commit 221abd4d478a ("staging: r8188eu: Remove no more necessary definitions
+and code"), two entries were removed from RTW_ChannelPlanMap[], but not replaced
+with zeros. The position within this table is important, thus the patch broke
+systems operating in regulatory domains osted later than entry 0x13 in the table.
+Unfortunately, the FCC entry comes before that point and most testers did not see
+this problem.
+
+Reported-and-tested-by: Zameer Manji <zmanji@gmail.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Fixes: 221abd4d478a ("staging: r8188eu: Remove no more necessary definitions and code")
+Cc: Stable <stable@vger.kernel.org> # v5.5+
+Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
+For: https://bugs.archlinux.org/task/72659
+For: https://bugs.archlinux.org/task/72760
+---
+ drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+index 5a472a4954b0..e5c907ac10fc 100644
+--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
++++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+@@ -104,6 +104,7 @@ static struct rt_channel_plan_map RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = {
+ {0x01}, /* 0x10, RT_CHANNEL_DOMAIN_JAPAN */
+ {0x02}, /* 0x11, RT_CHANNEL_DOMAIN_FCC_NO_DFS */
+ {0x01}, /* 0x12, RT_CHANNEL_DOMAIN_JAPAN_NO_DFS */
++ {0x00}, /* 0x13 */
+ {0x02}, /* 0x14, RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS */
+ {0x00}, /* 0x15, RT_CHANNEL_DOMAIN_ETSI_NO_DFS */
+ {0x00}, /* 0x16, RT_CHANNEL_DOMAIN_KOREA_NO_DFS */
+@@ -115,6 +116,7 @@ static struct rt_channel_plan_map RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = {
+ {0x00}, /* 0x1C, */
+ {0x00}, /* 0x1D, */
+ {0x00}, /* 0x1E, */
++ {0x00}, /* 0x1F, */
+ /* 0x20 ~ 0x7F , New Define ===== */
+ {0x00}, /* 0x20, RT_CHANNEL_DOMAIN_WORLD_NULL */
+ {0x01}, /* 0x21, RT_CHANNEL_DOMAIN_ETSI1_NULL */
+--
+2.33.1
+
diff --git a/0003-PCI-MSI-Deal-with-devices-lying-about-their-MSI-mask.patch b/0003-PCI-MSI-Deal-with-devices-lying-about-their-MSI-mask.patch
new file mode 100644
index 0000000..2e55d5d
--- /dev/null
+++ b/0003-PCI-MSI-Deal-with-devices-lying-about-their-MSI-mask.patch
@@ -0,0 +1,56 @@
+From 946e7362fca464b136ec89171e565e33153ccdcf Mon Sep 17 00:00:00 2001
+From: Marc Zyngier <maz@kernel.org>
+Date: Thu, 4 Nov 2021 18:01:29 +0000
+Subject: [PATCH 3/8] PCI/MSI: Deal with devices lying about their MSI mask
+ capability
+
+It appears that some devices are lying about their mask capability,
+pretending that they don't have it, while they actually do.
+The net result is that now that we don't enable MSIs on such
+endpoint.
+
+Add a new per-device flag to deal with this. Further patches will
+make use of it, sadly.
+
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lore.kernel.org/r/20211104180130.3825416-2-maz@kernel.org
+Cc: Bjorn Helgaas <helgaas@kernel.org>
+For: https://bugs.archlinux.org/task/72734
+For: https://bugs.archlinux.org/task/72777
+---
+ drivers/pci/msi.c | 3 +++
+ include/linux/pci.h | 2 ++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
+index ea6371eb9b25..e2dedfa9072d 100644
+--- a/drivers/pci/msi.c
++++ b/drivers/pci/msi.c
+@@ -477,6 +477,9 @@ msi_setup_entry(struct pci_dev *dev, int nvec, struct irq_affinity *affd)
+ goto out;
+
+ pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
++ /* Lies, damned lies, and MSIs */
++ if (dev->dev_flags & PCI_DEV_FLAGS_HAS_MSI_MASKING)
++ control |= PCI_MSI_FLAGS_MASKBIT;
+
+ entry->msi_attrib.is_msix = 0;
+ entry->msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT);
+diff --git a/include/linux/pci.h b/include/linux/pci.h
+index cd8aa6fce204..152a4d74f87f 100644
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -233,6 +233,8 @@ enum pci_dev_flags {
+ PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10),
+ /* Don't use Relaxed Ordering for TLPs directed at this device */
+ PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11),
++ /* Device does honor MSI masking despite saying otherwise */
++ PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12),
+ };
+
+ enum pci_irq_reroute_variant {
+--
+2.33.1
+
diff --git a/0004-PCI-Add-MSI-masking-quirk-for-Nvidia-ION-AHCI.patch b/0004-PCI-Add-MSI-masking-quirk-for-Nvidia-ION-AHCI.patch
new file mode 100644
index 0000000..4fdb40c
--- /dev/null
+++ b/0004-PCI-Add-MSI-masking-quirk-for-Nvidia-ION-AHCI.patch
@@ -0,0 +1,40 @@
+From d791f46784859b98205808be0e08fc70eeb91d45 Mon Sep 17 00:00:00 2001
+From: Marc Zyngier <maz@kernel.org>
+Date: Thu, 4 Nov 2021 18:01:30 +0000
+Subject: [PATCH 4/8] PCI: Add MSI masking quirk for Nvidia ION AHCI
+
+The ION AHCI device pretends that MSI masking isn't a thing, while it
+actually implements it and needs MSIs to be unmasked to work. Add a quirk
+to that effect.
+
+Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Bjorn Helgaas <helgaas@kernel.org>
+Link: https://lore.kernel.org/r/CALjTZvbzYfBuLB+H=fj2J+9=DxjQ2Uqcy0if_PvmJ-nU-qEgkg@mail.gmail.com
+Link: https://lore.kernel.org/r/20211104180130.3825416-3-maz@kernel.org
+For: https://bugs.archlinux.org/task/72734
+For: https://bugs.archlinux.org/task/72777
+---
+ drivers/pci/quirks.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
+index 6c957124f84d..208fa03acdda 100644
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -5796,3 +5796,9 @@ static void apex_pci_fixup_class(struct pci_dev *pdev)
+ }
+ DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
+ PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
++
++static void nvidia_ion_ahci_fixup(struct pci_dev *pdev)
++{
++ pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING;
++}
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup);
+--
+2.33.1
+
diff --git a/0005-PCI-Add-more-NVIDIA-controllers-to-the-MSI-masking-q.patch b/0005-PCI-Add-more-NVIDIA-controllers-to-the-MSI-masking-q.patch
new file mode 100644
index 0000000..315dd1e
--- /dev/null
+++ b/0005-PCI-Add-more-NVIDIA-controllers-to-the-MSI-masking-q.patch
@@ -0,0 +1,24 @@
+From 6edac03ec96354bac75a0240ee1f848836a2fb19 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
+Date: Thu, 18 Nov 2021 22:53:31 +0100
+Subject: [PATCH 5/8] PCI: Add more NVIDIA controllers to the MSI masking quirk
+
+For: https://bugs.archlinux.org/task/72734
+For: https://bugs.archlinux.org/task/72777
+---
+ drivers/pci/quirks.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
+index 208fa03acdda..7fdb7e9c2e12 100644
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -5802,3 +5802,5 @@ static void nvidia_ion_ahci_fixup(struct pci_dev *pdev)
+ pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING;
+ }
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup);
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab9, nvidia_ion_ahci_fixup);
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0d88, nvidia_ion_ahci_fixup);
+--
+2.33.1
+
diff --git a/0006-drm-amd-pm-avoid-duplicate-powergate-ungate-setting.patch b/0006-drm-amd-pm-avoid-duplicate-powergate-ungate-setting.patch
new file mode 100644
index 0000000..e5b94c4
--- /dev/null
+++ b/0006-drm-amd-pm-avoid-duplicate-powergate-ungate-setting.patch
@@ -0,0 +1,108 @@
+From 8414110f6b3801058a55b505539da7f7d7acd1fb Mon Sep 17 00:00:00 2001
+From: Evan Quan <evan.quan@amd.com>
+Date: Mon, 15 Nov 2021 10:51:37 +0800
+Subject: [PATCH 6/8] drm/amd/pm: avoid duplicate powergate/ungate setting
+
+Just bail out if the target IP block is already in the desired
+powergate/ungate state. This can avoid some duplicate settings
+which sometimes may cause unexpected issues.
+
+Link: https://lore.kernel.org/all/YV81vidWQLWvATMM@zn.tnic/
+
+Change-Id: I66346c69f121df0f5ee20182451313ae4fda2d04
+Signed-off-by: Evan Quan <evan.quan@amd.com>
+Tested-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
+For: https://bugs.archlinux.org/task/72753
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
+ drivers/gpu/drm/amd/include/amd_shared.h | 3 ++-
+ drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 10 ++++++++++
+ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 8 ++++++++
+ 4 files changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index c1e34aa5925b..96ca42bcfdbf 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -3532,6 +3532,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
+ adev->rmmio_size = pci_resource_len(adev->pdev, 2);
+ }
+
++ for (i = 0; i < AMD_IP_BLOCK_TYPE_NUM; i++)
++ atomic_set(&adev->pm.pwr_state[i], POWER_STATE_UNKNOWN);
++
+ adev->rmmio = ioremap(adev->rmmio_base, adev->rmmio_size);
+ if (adev->rmmio == NULL) {
+ return -ENOMEM;
+diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
+index 257f280d3d53..bd077ea224a4 100644
+--- a/drivers/gpu/drm/amd/include/amd_shared.h
++++ b/drivers/gpu/drm/amd/include/amd_shared.h
+@@ -98,7 +98,8 @@ enum amd_ip_block_type {
+ AMD_IP_BLOCK_TYPE_ACP,
+ AMD_IP_BLOCK_TYPE_VCN,
+ AMD_IP_BLOCK_TYPE_MES,
+- AMD_IP_BLOCK_TYPE_JPEG
++ AMD_IP_BLOCK_TYPE_JPEG,
++ AMD_IP_BLOCK_TYPE_NUM,
+ };
+
+ enum amd_clockgating_state {
+diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
+index 03581d5b1836..08362d506534 100644
+--- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
++++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
+@@ -927,6 +927,13 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t block
+ {
+ int ret = 0;
+ const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
++ enum ip_power_state pwr_state = gate ? POWER_STATE_OFF : POWER_STATE_ON;
++
++ if (atomic_read(&adev->pm.pwr_state[block_type]) == pwr_state) {
++ dev_dbg(adev->dev, "IP block%d already in the target %s state!",
++ block_type, gate ? "gate" : "ungate");
++ return 0;
++ }
+
+ switch (block_type) {
+ case AMD_IP_BLOCK_TYPE_UVD:
+@@ -979,6 +986,9 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t block
+ break;
+ }
+
++ if (!ret)
++ atomic_set(&adev->pm.pwr_state[block_type], pwr_state);
++
+ return ret;
+ }
+
+diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
+index 98f1b3d8c1d5..16e3f72d31b9 100644
+--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
++++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
+@@ -417,6 +417,12 @@ struct amdgpu_dpm {
+ enum amd_dpm_forced_level forced_level;
+ };
+
++enum ip_power_state {
++ POWER_STATE_UNKNOWN,
++ POWER_STATE_ON,
++ POWER_STATE_OFF,
++};
++
+ struct amdgpu_pm {
+ struct mutex mutex;
+ u32 current_sclk;
+@@ -452,6 +458,8 @@ struct amdgpu_pm {
+ struct i2c_adapter smu_i2c;
+ struct mutex smu_i2c_mutex;
+ struct list_head pm_attr_list;
++
++ atomic_t pwr_state[AMD_IP_BLOCK_TYPE_NUM];
+ };
+
+ #define R600_SSTU_DFLT 0
+--
+2.33.1
+
diff --git a/0007-iommu-intel-do-deep-dma-unmapping-to-avoid-kernel-fl.patch b/0007-iommu-intel-do-deep-dma-unmapping-to-avoid-kernel-fl.patch
new file mode 100644
index 0000000..ea598c4
--- /dev/null
+++ b/0007-iommu-intel-do-deep-dma-unmapping-to-avoid-kernel-fl.patch
@@ -0,0 +1,88 @@
+From aba4d743dacede0c1a7f4ed56a9f949e3349c833 Mon Sep 17 00:00:00 2001
+From: Ajay Garg <ajaygargnsit@gmail.com>
+Date: Tue, 12 Oct 2021 19:26:53 +0530
+Subject: [PATCH 7/8] iommu: intel: do deep dma-unmapping, to avoid
+ kernel-flooding.
+
+Origins at :
+https://lists.linuxfoundation.org/pipermail/iommu/2021-October/thread.html
+
+=== Changes from v1 => v2 ===
+
+a)
+Improved patch-description.
+
+b)
+A more root-level fix, as suggested by
+
+ 1.
+ Alex Williamson <alex.williamson@redhat.com>
+
+ 2.
+ Lu Baolu <baolu.lu@linux.intel.com>
+
+=== Issue ===
+
+Kernel-flooding is seen, when an x86_64 L1 guest (Ubuntu-21) is booted in qemu/kvm
+on a x86_64 host (Ubuntu-21), with a host-pci-device attached.
+
+Following kind of logs, along with the stacktraces, cause the flood :
+
+......
+ DMAR: ERROR: DMA PTE for vPFN 0x428ec already set (to 3f6ec003 not 3f6ec003)
+ DMAR: ERROR: DMA PTE for vPFN 0x428ed already set (to 3f6ed003 not 3f6ed003)
+ DMAR: ERROR: DMA PTE for vPFN 0x428ee already set (to 3f6ee003 not 3f6ee003)
+ DMAR: ERROR: DMA PTE for vPFN 0x428ef already set (to 3f6ef003 not 3f6ef003)
+ DMAR: ERROR: DMA PTE for vPFN 0x428f0 already set (to 3f6f0003 not 3f6f0003)
+......
+
+=== Current Behaviour, leading to the issue ===
+
+Currently, when we do a dma-unmapping, we unmap/unlink the mappings, but
+the pte-entries are not cleared.
+
+Thus, following sequencing would flood the kernel-logs :
+
+i)
+A dma-unmapping makes the real/leaf-level pte-slot invalid, but the
+pte-content itself is not cleared.
+
+ii)
+Now, during some later dma-mapping procedure, as the pte-slot is about
+to hold a new pte-value, the intel-iommu checks if a prior
+pte-entry exists in the pte-slot. If it exists, it logs a kernel-error,
+along with a corresponding stacktrace.
+
+iii)
+Step ii) runs in abundance, and the kernel-logs run insane.
+
+=== Fix ===
+
+We ensure that as part of a dma-unmapping, each (unmapped) pte-slot
+is also cleared of its value/content (at the leaf-level, where the
+real mapping from a iova => pfn mapping is stored).
+
+This completes a "deep" dma-unmapping.
+
+Signed-off-by: Ajay Garg <ajaygargnsit@gmail.com>
+Link: https://lore.kernel.org/linux-iommu/20211012135653.3852-1-ajaygargnsit@gmail.com/
+---
+ drivers/iommu/intel/iommu.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
+index d75f59ae28e6..485a8ea71394 100644
+--- a/drivers/iommu/intel/iommu.c
++++ b/drivers/iommu/intel/iommu.c
+@@ -5090,6 +5090,8 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain,
+ gather->freelist = domain_unmap(dmar_domain, start_pfn,
+ last_pfn, gather->freelist);
+
++ dma_pte_clear_range(dmar_domain, start_pfn, last_pfn);
++
+ if (dmar_domain->max_addr == iova + size)
+ dmar_domain->max_addr = iova;
+
+--
+2.33.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 64c17dc..86772fe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,7 +18,7 @@ _custom=0
pkgbase=linux
_supver=5
_majver=15
-_minver=2
+_minver=3
_gccpatchver='20211114'
_gccpatchker='5.15+'
if [ "$_minver" == "0" ]; then
@@ -42,6 +42,12 @@ source=(
https://www.kernel.org/pub/linux/kernel/v${_supver}.x/${_srcname}.tar.{xz,sign}
config # the main kernel config file
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
+ 0002-staging-r8188eu-Fix-breakage-introduced-when-5G-code.patch
+ 0003-PCI-MSI-Deal-with-devices-lying-about-their-MSI-mask.patch
+ 0004-PCI-Add-MSI-masking-quirk-for-Nvidia-ION-AHCI.patch
+ 0005-PCI-Add-more-NVIDIA-controllers-to-the-MSI-masking-q.patch
+ 0006-drm-amd-pm-avoid-duplicate-powergate-ungate-setting.patch
+ 0007-iommu-intel-do-deep-dma-unmapping-to-avoid-kernel-fl.patch
kernel_compiler_patch-${_gccpatchver}.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/${_gccpatchver}.tar.gz
ath9k-regdom-hack.patch
raid6-default-algo.patch
@@ -51,10 +57,16 @@ validpgpkeys=(
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
)
# https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
-b2sums=('e1247057fc57e2f071ff150b5e0651db054a1e15a258ebd198921f7ef0c1e441f0a36c46024298175a8a9a0bb7cc0b6d505d7a77a053c1ce88a720ebea424d89'
+b2sums=('93379b68cfe85a979a7a39179e2bf622702d5e4f7a1d5a5bace1e8d11583d77966bce5b0e61f047fcb40c6c2be401e7725b3aa01e602c6ef4ac045a24ebcc2cd'
'SKIP'
'f30324872cc582f45019c4f601643962070c8f19adedca66783bb502251c09548aaa9f1c7ce831cf5aca89362c75bd006464a8202307393fdab46571e1201c6d'
- '2f9195675270d79d735a3aaec25887c2f80b76eae98be8fcc5fd59ab71d925c5ee20ec5e2a015deb68b61bc2cc7f56f546a22cb96ee038e2e24c2c9dd5c3f79f'
+ 'dd3a7d6db14da32e1988894e679f7cad9675903ff317f26a17a3bf149876108bee44556e5cd34ed09062c13cf4ac6a060add416856566ef26ace86c884c3a2f0'
+ '73cb63b9468a8feb6b8ed5c0b817fc03b82a64642745fe94323209a34ff273c9a17ab3b44844613341da0d2b38747f2b815a4ede7451b3533239319093cdc937'
+ 'f3581e3b7da67ade68172811c71afa817db9884ffb755ead4e0850bb2a4f219409623c3b97feaa73d1b05b8e086184ed8fed6b2d3baeb194903089e3ee7fd5cb'
+ '5f6df31f50d9d26f56437ee2d4bcd9d8cd71e112021448ece33ffd6bb288ab55bec536b83131a72225b235bc0bd3b9abeb56e49ad5bd35e4d884ab46b045fd1d'
+ 'a418582cdaa4e6596668582d6549471b204e972cc251e51a68180f129cd0d548873a5a6856e3ea7aff12baba19b9c50c90b9d76c0dfa9243f55f4aab68d371bc'
+ '5faedb1487dbdc49090c8c30e332945b59a2c68510be59b908708730dd979b655f88927a2a1380adbb743d0589f34f34b7d49f1eb060cf6b73bf1b99fb2f6420'
+ '1b4fa5ebee55288d189fb6159af819c175f3dffa1d88537d1dcddf719e4d6fff9e232417a0c455e6b6337d313c988c3e886e4bfad58716351495e55fdb45b61b'
'534091fb5034226d48f18da2114305860e67ee49a1d726b049a240ce61df83e840a9a255e5b8fa9279ec07dd69fb0aea6e2e48962792c2b5367db577a4423d8d'
'b6ef77035611139fa9a6d5b8d30570e2781bb4da483bb569884b0bd0129b62e0b82a5a6776fefe43fee801c70d39de1ea4d4c177f7cedd5ac135e3c64f7b895a'
'fde132f3705d908e6f2147c78a2193289916d72304ca5efa2229d79fc3e57a857314ce94e71425caef2f7f7b6cf87f05ef86335dc8bd4be78e7035afe608005a')
@@ -77,6 +89,12 @@ prepare() {
# Hotfixes
echo "Applying hotfixes"
patch -p1 -i ../0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
+ patch -p1 -i ../0002-staging-r8188eu-Fix-breakage-introduced-when-5G-code.patch
+ patch -p1 -i ../0003-PCI-MSI-Deal-with-devices-lying-about-their-MSI-mask.patch
+ patch -p1 -i ../0004-PCI-Add-MSI-masking-quirk-for-Nvidia-ION-AHCI.patch
+ patch -p1 -i ../0005-PCI-Add-more-NVIDIA-controllers-to-the-MSI-masking-q.patch
+ patch -p1 -i ../0006-drm-amd-pm-avoid-duplicate-powergate-ungate-setting.patch
+ patch -p1 -i ../0007-iommu-intel-do-deep-dma-unmapping-to-avoid-kernel-fl.patch
# graysky gcc patch