Skip to content

Commit 7cfcf74

Browse files
author
CKI KWF Bot
committed
Merge: RHEL 9.8: DRM Dependencies Backport (6.16)
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7321 ## Overview The DRM backport's goal is to backport all the changes in the DRM subsystem to the kernel target version, with the biggest value being that we get the upstream hardware enablement (and bug fixes) into RHEL. This merge request is the initial step of the DRM backport: identify and backport the dependencies of the DRM backport outside of `drivers/gpu`. Check https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7322 for the main backport MR. ## Other JIRA: https://issues.redhat.com/browse/RHEL-113204 Signed-off-by: José Expósito <jexposit@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: Anusha Srivatsa <asrivats@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 76ce5cb + 795dc0e commit 7cfcf74

File tree

10 files changed

+115
-20
lines changed

10 files changed

+115
-20
lines changed

arch/x86/pci/fixup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,13 +970,13 @@ static void amd_rp_pme_suspend(struct pci_dev *dev)
970970
struct pci_dev *rp;
971971

972972
/*
973-
* PM_SUSPEND_ON means we're doing runtime suspend, which means
973+
* If system suspend is not in progress, we're doing runtime suspend, so
974974
* amd-pmc will not be involved so PMEs during D3 work as advertised.
975975
*
976976
* The PMEs *do* work if amd-pmc doesn't put the SoC in the hardware
977977
* sleep state, but we assume amd-pmc is always present.
978978
*/
979-
if (pm_suspend_target_state == PM_SUSPEND_ON)
979+
if (!pm_suspend_in_progress())
980980
return;
981981

982982
rp = pcie_find_root_port(dev);

drivers/base/power/wakeup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ int device_wakeup_enable(struct device *dev)
337337
if (!dev || !dev->power.can_wakeup)
338338
return -EINVAL;
339339

340-
if (pm_suspend_target_state != PM_SUSPEND_ON)
340+
if (pm_suspend_in_progress())
341341
dev_dbg(dev, "Suspicious %s() during system transition!\n", __func__);
342342

343343
ws = wakeup_source_register(dev, dev_name(dev));

drivers/char/agp/intel-gtt.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct intel_gtt_driver {
5353
* of the mmio register file, that's done in the generic code. */
5454
void (*cleanup)(void);
5555
void (*write_entry)(dma_addr_t addr, unsigned int entry, unsigned int flags);
56+
dma_addr_t (*read_entry)(unsigned int entry, bool *is_present, bool *is_local);
5657
/* Flags is a more or less chipset specific opaque value.
5758
* For chipsets that need to support old ums (non-gem) code, this
5859
* needs to be identical to the various supported agp memory types! */
@@ -336,6 +337,19 @@ static void i810_write_entry(dma_addr_t addr, unsigned int entry,
336337
writel_relaxed(addr | pte_flags, intel_private.gtt + entry);
337338
}
338339

340+
static dma_addr_t i810_read_entry(unsigned int entry,
341+
bool *is_present, bool *is_local)
342+
{
343+
u32 val;
344+
345+
val = readl(intel_private.gtt + entry);
346+
347+
*is_present = val & I810_PTE_VALID;
348+
*is_local = val & I810_PTE_LOCAL;
349+
350+
return val & ~0xfff;
351+
}
352+
339353
static resource_size_t intel_gtt_stolen_size(void)
340354
{
341355
u16 gmch_ctrl;
@@ -741,6 +755,19 @@ static void i830_write_entry(dma_addr_t addr, unsigned int entry,
741755
writel_relaxed(addr | pte_flags, intel_private.gtt + entry);
742756
}
743757

758+
static dma_addr_t i830_read_entry(unsigned int entry,
759+
bool *is_present, bool *is_local)
760+
{
761+
u32 val;
762+
763+
val = readl(intel_private.gtt + entry);
764+
765+
*is_present = val & I810_PTE_VALID;
766+
*is_local = false;
767+
768+
return val & ~0xfff;
769+
}
770+
744771
bool intel_gmch_enable_gtt(void)
745772
{
746773
u8 __iomem *reg;
@@ -878,6 +905,13 @@ void intel_gmch_gtt_insert_sg_entries(struct sg_table *st,
878905
}
879906
EXPORT_SYMBOL(intel_gmch_gtt_insert_sg_entries);
880907

908+
dma_addr_t intel_gmch_gtt_read_entry(unsigned int pg,
909+
bool *is_present, bool *is_local)
910+
{
911+
return intel_private.driver->read_entry(pg, is_present, is_local);
912+
}
913+
EXPORT_SYMBOL(intel_gmch_gtt_read_entry);
914+
881915
#if IS_ENABLED(CONFIG_AGP_INTEL)
882916
static void intel_gmch_gtt_insert_pages(unsigned int first_entry,
883917
unsigned int num_entries,
@@ -1126,6 +1160,19 @@ static void i965_write_entry(dma_addr_t addr,
11261160
writel_relaxed(addr | pte_flags, intel_private.gtt + entry);
11271161
}
11281162

1163+
static dma_addr_t i965_read_entry(unsigned int entry,
1164+
bool *is_present, bool *is_local)
1165+
{
1166+
u64 val;
1167+
1168+
val = readl(intel_private.gtt + entry);
1169+
1170+
*is_present = val & I810_PTE_VALID;
1171+
*is_local = false;
1172+
1173+
return ((val & 0xf0) << 28) | (val & ~0xfff);
1174+
}
1175+
11291176
static int i9xx_setup(void)
11301177
{
11311178
phys_addr_t reg_addr;
@@ -1187,13 +1234,15 @@ static const struct intel_gtt_driver i81x_gtt_driver = {
11871234
.cleanup = i810_cleanup,
11881235
.check_flags = i830_check_flags,
11891236
.write_entry = i810_write_entry,
1237+
.read_entry = i810_read_entry,
11901238
};
11911239
static const struct intel_gtt_driver i8xx_gtt_driver = {
11921240
.gen = 2,
11931241
.has_pgtbl_enable = 1,
11941242
.setup = i830_setup,
11951243
.cleanup = i830_cleanup,
11961244
.write_entry = i830_write_entry,
1245+
.read_entry = i830_read_entry,
11971246
.dma_mask_size = 32,
11981247
.check_flags = i830_check_flags,
11991248
.chipset_flush = i830_chipset_flush,
@@ -1205,6 +1254,7 @@ static const struct intel_gtt_driver i915_gtt_driver = {
12051254
.cleanup = i9xx_cleanup,
12061255
/* i945 is the last gpu to need phys mem (for overlay and cursors). */
12071256
.write_entry = i830_write_entry,
1257+
.read_entry = i830_read_entry,
12081258
.dma_mask_size = 32,
12091259
.check_flags = i830_check_flags,
12101260
.chipset_flush = i9xx_chipset_flush,
@@ -1215,6 +1265,7 @@ static const struct intel_gtt_driver g33_gtt_driver = {
12151265
.setup = i9xx_setup,
12161266
.cleanup = i9xx_cleanup,
12171267
.write_entry = i965_write_entry,
1268+
.read_entry = i965_read_entry,
12181269
.dma_mask_size = 36,
12191270
.check_flags = i830_check_flags,
12201271
.chipset_flush = i9xx_chipset_flush,
@@ -1225,6 +1276,7 @@ static const struct intel_gtt_driver pineview_gtt_driver = {
12251276
.setup = i9xx_setup,
12261277
.cleanup = i9xx_cleanup,
12271278
.write_entry = i965_write_entry,
1279+
.read_entry = i965_read_entry,
12281280
.dma_mask_size = 36,
12291281
.check_flags = i830_check_flags,
12301282
.chipset_flush = i9xx_chipset_flush,
@@ -1235,6 +1287,7 @@ static const struct intel_gtt_driver i965_gtt_driver = {
12351287
.setup = i9xx_setup,
12361288
.cleanup = i9xx_cleanup,
12371289
.write_entry = i965_write_entry,
1290+
.read_entry = i965_read_entry,
12381291
.dma_mask_size = 36,
12391292
.check_flags = i830_check_flags,
12401293
.chipset_flush = i9xx_chipset_flush,
@@ -1244,6 +1297,7 @@ static const struct intel_gtt_driver g4x_gtt_driver = {
12441297
.setup = i9xx_setup,
12451298
.cleanup = i9xx_cleanup,
12461299
.write_entry = i965_write_entry,
1300+
.read_entry = i965_read_entry,
12471301
.dma_mask_size = 36,
12481302
.check_flags = i830_check_flags,
12491303
.chipset_flush = i9xx_chipset_flush,
@@ -1254,6 +1308,7 @@ static const struct intel_gtt_driver ironlake_gtt_driver = {
12541308
.setup = i9xx_setup,
12551309
.cleanup = i9xx_cleanup,
12561310
.write_entry = i965_write_entry,
1311+
.read_entry = i965_read_entry,
12571312
.dma_mask_size = 36,
12581313
.check_flags = i830_check_flags,
12591314
.chipset_flush = i9xx_chipset_flush,

drivers/gpu/drm/xe/xe_pm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static bool xe_pm_suspending_or_resuming(struct xe_device *xe)
641641

642642
return dev->power.runtime_status == RPM_SUSPENDING ||
643643
dev->power.runtime_status == RPM_RESUMING ||
644-
pm_suspend_target_state != PM_SUSPEND_ON;
644+
pm_suspend_in_progress();
645645
#else
646646
return false;
647647
#endif

include/drm/intel/intel-gtt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ void intel_gmch_gtt_insert_sg_entries(struct sg_table *st,
2828
unsigned int pg_start,
2929
unsigned int flags);
3030
void intel_gmch_gtt_clear_range(unsigned int first_entry, unsigned int num_entries);
31+
dma_addr_t intel_gmch_gtt_read_entry(unsigned int pg,
32+
bool *is_present, bool *is_local);
3133

3234
/* Special gtt memory types */
3335
#define AGP_DCACHE_MEMORY 1

include/linux/migrate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ void migrate_vma_pages(struct migrate_vma *migrate);
222222
void migrate_vma_finalize(struct migrate_vma *migrate);
223223
int migrate_device_range(unsigned long *src_pfns, unsigned long start,
224224
unsigned long npages);
225+
int migrate_device_pfns(unsigned long *src_pfns, unsigned long npages);
225226
void migrate_device_pages(unsigned long *src_pfns, unsigned long *dst_pfns,
226227
unsigned long npages);
227228
void migrate_device_finalize(unsigned long *src_pfns,

include/linux/suspend.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ static inline void s2idle_set_ops(const struct platform_s2idle_ops *ops) {}
357357
static inline void s2idle_wake(void) {}
358358
#endif /* !CONFIG_SUSPEND */
359359

360+
static inline bool pm_suspend_in_progress(void)
361+
{
362+
return pm_suspend_target_state != PM_SUSPEND_ON;
363+
}
364+
360365
/* struct pbe is used for creating lists of pages that should be restored
361366
* atomically during the resume from disk, because the page frames they have
362367
* occupied before the suspend are in use.

include/uapi/linux/elf.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,18 @@ typedef struct elf64_phdr {
290290
#define SHF_WRITE 0x1
291291
#define SHF_ALLOC 0x2
292292
#define SHF_EXECINSTR 0x4
293+
#define SHF_MERGE 0x10
294+
#define SHF_STRINGS 0x20
295+
#define SHF_INFO_LINK 0x40
296+
#define SHF_LINK_ORDER 0x80
297+
#define SHF_OS_NONCONFORMING 0x100
298+
#define SHF_GROUP 0x200
299+
#define SHF_TLS 0x400
293300
#define SHF_RELA_LIVEPATCH 0x00100000
294301
#define SHF_RO_AFTER_INIT 0x00200000
302+
#define SHF_ORDERED 0x04000000
303+
#define SHF_EXCLUDE 0x08000000
304+
#define SHF_MASKOS 0x0ff00000
295305
#define SHF_MASKPROC 0xf0000000
296306

297307
/* special section indexes */

kernel/power/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ bool pm_debug_messages_on __read_mostly;
569569

570570
bool pm_debug_messages_should_print(void)
571571
{
572-
return pm_debug_messages_on && pm_suspend_target_state != PM_SUSPEND_ON;
572+
return pm_debug_messages_on && pm_suspend_in_progress();
573573
}
574574
EXPORT_SYMBOL_GPL(pm_debug_messages_should_print);
575575

mm/migrate_device.c

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,22 @@ void migrate_vma_finalize(struct migrate_vma *migrate)
870870
}
871871
EXPORT_SYMBOL(migrate_vma_finalize);
872872

873+
static unsigned long migrate_device_pfn_lock(unsigned long pfn)
874+
{
875+
struct folio *folio;
876+
877+
folio = folio_get_nontail_page(pfn_to_page(pfn));
878+
if (!folio)
879+
return 0;
880+
881+
if (!folio_trylock(folio)) {
882+
folio_put(folio);
883+
return 0;
884+
}
885+
886+
return migrate_pfn(pfn) | MIGRATE_PFN_MIGRATE;
887+
}
888+
873889
/**
874890
* migrate_device_range() - migrate device private pfns to normal memory.
875891
* @src_pfns: array large enough to hold migrating source device private pfns.
@@ -894,29 +910,35 @@ int migrate_device_range(unsigned long *src_pfns, unsigned long start,
894910
{
895911
unsigned long i, pfn;
896912

897-
for (pfn = start, i = 0; i < npages; pfn++, i++) {
898-
struct folio *folio;
913+
for (pfn = start, i = 0; i < npages; pfn++, i++)
914+
src_pfns[i] = migrate_device_pfn_lock(pfn);
899915

900-
folio = folio_get_nontail_page(pfn_to_page(pfn));
901-
if (!folio) {
902-
src_pfns[i] = 0;
903-
continue;
904-
}
916+
migrate_device_unmap(src_pfns, npages, NULL);
905917

906-
if (!folio_trylock(folio)) {
907-
src_pfns[i] = 0;
908-
folio_put(folio);
909-
continue;
910-
}
918+
return 0;
919+
}
920+
EXPORT_SYMBOL(migrate_device_range);
911921

912-
src_pfns[i] = migrate_pfn(pfn) | MIGRATE_PFN_MIGRATE;
913-
}
922+
/**
923+
* migrate_device_pfns() - migrate device private pfns to normal memory.
924+
* @src_pfns: pre-popluated array of source device private pfns to migrate.
925+
* @npages: number of pages to migrate.
926+
*
927+
* Similar to migrate_device_range() but supports non-contiguous pre-popluated
928+
* array of device pages to migrate.
929+
*/
930+
int migrate_device_pfns(unsigned long *src_pfns, unsigned long npages)
931+
{
932+
unsigned long i;
933+
934+
for (i = 0; i < npages; i++)
935+
src_pfns[i] = migrate_device_pfn_lock(src_pfns[i]);
914936

915937
migrate_device_unmap(src_pfns, npages, NULL);
916938

917939
return 0;
918940
}
919-
EXPORT_SYMBOL(migrate_device_range);
941+
EXPORT_SYMBOL(migrate_device_pfns);
920942

921943
/*
922944
* Migrate a device coherent folio back to normal memory. The caller should have

0 commit comments

Comments
 (0)