Skip to content

Commit 14636b0

Browse files
author
CKI KWF Bot
committed
Merge: RHEL 9.8: DRM Dependencies Backport (6.17)
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7327 ## 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/7329 for the main backport MR. ## Other JIRA: https://issues.redhat.com/browse/RHEL-113576 Signed-off-by: José Expósito <jexposit@redhat.com> Approved-by: Anusha Srivatsa <asrivats@redhat.com> Approved-by: Jocelyn Falempe <jfalempe@redhat.com> Approved-by: Audra Mitchell <aubaker@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Eder Zulian <ezulian@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 e46b7c3 + 50e10e9 commit 14636b0

File tree

14 files changed

+240
-112
lines changed

14 files changed

+240
-112
lines changed

drivers/base/power/main.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ static pm_message_t pm_transition;
6666

6767
static int async_error;
6868

69+
/**
70+
* pm_hibernate_is_recovering - if recovering from hibernate due to error.
71+
*
72+
* Used to query if dev_pm_ops.thaw() is called for normal hibernation case or
73+
* recovering from some error.
74+
*
75+
* Return: true for error case, false for normal case.
76+
*/
77+
bool pm_hibernate_is_recovering(void)
78+
{
79+
return pm_transition.event == PM_EVENT_RECOVER;
80+
}
81+
EXPORT_SYMBOL_GPL(pm_hibernate_is_recovering);
82+
6983
static const char *pm_verb(int event)
7084
{
7185
switch (event) {

drivers/firmware/sysfb_simplefb.c

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,7 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
3535
if (type != VIDEO_TYPE_VLFB && type != VIDEO_TYPE_EFI)
3636
return false;
3737

38-
/*
39-
* The meaning of depth and bpp for direct-color formats is
40-
* inconsistent:
41-
*
42-
* - DRM format info specifies depth as the number of color
43-
* bits; including alpha, but not including filler bits.
44-
* - Linux' EFI platform code computes lfb_depth from the
45-
* individual color channels, including the reserved bits.
46-
* - VBE 1.1 defines lfb_depth for XRGB1555 as 16, but later
47-
* versions use 15.
48-
* - On the kernel command line, 'bpp' of 32 is usually
49-
* XRGB8888 including the filler bits, but 15 is XRGB1555
50-
* not including the filler bit.
51-
*
52-
* It's not easily possible to fix this in struct screen_info,
53-
* as this could break UAPI. The best solution is to compute
54-
* bits_per_pixel from the color bits, reserved bits and
55-
* reported lfb_depth, whichever is highest. In the loop below,
56-
* ignore simplefb formats with alpha bits, as EFI and VESA
57-
* don't specify alpha channels.
58-
*/
59-
if (si->lfb_depth > 8) {
60-
bits_per_pixel = max(max3(si->red_size + si->red_pos,
61-
si->green_size + si->green_pos,
62-
si->blue_size + si->blue_pos),
63-
si->rsvd_size + si->rsvd_pos);
64-
bits_per_pixel = max_t(u32, bits_per_pixel, si->lfb_depth);
65-
} else {
66-
bits_per_pixel = si->lfb_depth;
67-
}
38+
bits_per_pixel = __screen_info_lfb_bits_per_pixel(si);
6839

6940
for (i = 0; i < ARRAY_SIZE(formats); ++i) {
7041
const struct simplefb_format *f = &formats[i];

drivers/gpu/drm/i915/gem/i915_gemfs.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,23 @@
66

77
#include <linux/fs.h>
88
#include <linux/mount.h>
9+
#include <linux/fs_context.h>
910

1011
#include "i915_drv.h"
1112
#include "i915_gemfs.h"
1213
#include "i915_utils.h"
1314

15+
static int add_param(struct fs_context *fc, const char *key, const char *val)
16+
{
17+
return vfs_parse_fs_string(fc, key, val, strlen(val));
18+
}
19+
1420
void i915_gemfs_init(struct drm_i915_private *i915)
1521
{
16-
char huge_opt[] = "huge=within_size"; /* r/w */
1722
struct file_system_type *type;
23+
struct fs_context *fc;
1824
struct vfsmount *gemfs;
25+
int ret;
1926

2027
/*
2128
* By creating our own shmemfs mountpoint, we can pass in
@@ -39,8 +46,16 @@ void i915_gemfs_init(struct drm_i915_private *i915)
3946
if (!type)
4047
goto err;
4148

42-
gemfs = vfs_kern_mount(type, SB_KERNMOUNT, type->name, huge_opt);
43-
if (IS_ERR(gemfs))
49+
fc = fs_context_for_mount(type, SB_KERNMOUNT);
50+
if (IS_ERR(fc))
51+
goto err;
52+
ret = add_param(fc, "source", "tmpfs");
53+
if (!ret)
54+
ret = add_param(fc, "huge", "within_size");
55+
if (!ret)
56+
gemfs = fc_mount_longterm(fc);
57+
put_fs_context(fc);
58+
if (ret)
4459
goto err;
4560

4661
i915->mm.gemfs = gemfs;

drivers/platform/x86/apple-gmux.c

Lines changed: 18 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,6 @@ struct apple_gmux_data {
6565

6666
static struct apple_gmux_data *apple_gmux_data;
6767

68-
/*
69-
* gmux port offsets. Many of these are not yet used, but may be in the
70-
* future, and it's useful to have them documented here anyhow.
71-
*/
72-
#define GMUX_PORT_VERSION_MAJOR 0x04
73-
#define GMUX_PORT_VERSION_MINOR 0x05
74-
#define GMUX_PORT_VERSION_RELEASE 0x06
75-
#define GMUX_PORT_SWITCH_DISPLAY 0x10
76-
#define GMUX_PORT_SWITCH_GET_DISPLAY 0x11
77-
#define GMUX_PORT_INTERRUPT_ENABLE 0x14
78-
#define GMUX_PORT_INTERRUPT_STATUS 0x16
79-
#define GMUX_PORT_SWITCH_DDC 0x28
80-
#define GMUX_PORT_SWITCH_EXTERNAL 0x40
81-
#define GMUX_PORT_SWITCH_GET_EXTERNAL 0x41
82-
#define GMUX_PORT_DISCRETE_POWER 0x50
83-
#define GMUX_PORT_MAX_BRIGHTNESS 0x70
84-
#define GMUX_PORT_BRIGHTNESS 0x74
85-
#define GMUX_PORT_VALUE 0xc2
86-
#define GMUX_PORT_READ 0xd0
87-
#define GMUX_PORT_WRITE 0xd4
88-
89-
#define GMUX_MIN_IO_LEN (GMUX_PORT_BRIGHTNESS + 4)
90-
9168
#define GMUX_INTERRUPT_ENABLE 0xff
9269
#define GMUX_INTERRUPT_DISABLE 0x00
9370

@@ -250,23 +227,6 @@ static void gmux_write32(struct apple_gmux_data *gmux_data, int port,
250227
gmux_pio_write32(gmux_data, port, val);
251228
}
252229

253-
static bool gmux_is_indexed(struct apple_gmux_data *gmux_data)
254-
{
255-
u16 val;
256-
257-
outb(0xaa, gmux_data->iostart + 0xcc);
258-
outb(0x55, gmux_data->iostart + 0xcd);
259-
outb(0x00, gmux_data->iostart + 0xce);
260-
261-
val = inb(gmux_data->iostart + 0xcc) |
262-
(inb(gmux_data->iostart + 0xcd) << 8);
263-
264-
if (val == 0x55aa)
265-
return true;
266-
267-
return false;
268-
}
269-
270230
/**
271231
* DOC: Backlight control
272232
*
@@ -609,60 +569,43 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
609569
int ret = -ENXIO;
610570
acpi_status status;
611571
unsigned long long gpe;
572+
bool indexed = false;
573+
u32 version;
612574

613575
if (apple_gmux_data)
614576
return -EBUSY;
615577

578+
if (!apple_gmux_detect(pnp, &indexed)) {
579+
pr_info("gmux device not present\n");
580+
return -ENODEV;
581+
}
582+
616583
gmux_data = kzalloc(sizeof(*gmux_data), GFP_KERNEL);
617584
if (!gmux_data)
618585
return -ENOMEM;
619586
pnp_set_drvdata(pnp, gmux_data);
620587

621588
res = pnp_get_resource(pnp, IORESOURCE_IO, 0);
622-
if (!res) {
623-
pr_err("Failed to find gmux I/O resource\n");
624-
goto err_free;
625-
}
626-
627589
gmux_data->iostart = res->start;
628590
gmux_data->iolen = res->end - res->start;
629591

630-
if (gmux_data->iolen < GMUX_MIN_IO_LEN) {
631-
pr_err("gmux I/O region too small (%lu < %u)\n",
632-
gmux_data->iolen, GMUX_MIN_IO_LEN);
633-
goto err_free;
634-
}
635-
636592
if (!request_region(gmux_data->iostart, gmux_data->iolen,
637593
"Apple gmux")) {
638594
pr_err("gmux I/O already in use\n");
639595
goto err_free;
640596
}
641597

642-
/*
643-
* Invalid version information may indicate either that the gmux
644-
* device isn't present or that it's a new one that uses indexed
645-
* io
646-
*/
647-
648-
ver_major = gmux_read8(gmux_data, GMUX_PORT_VERSION_MAJOR);
649-
ver_minor = gmux_read8(gmux_data, GMUX_PORT_VERSION_MINOR);
650-
ver_release = gmux_read8(gmux_data, GMUX_PORT_VERSION_RELEASE);
651-
if (ver_major == 0xff && ver_minor == 0xff && ver_release == 0xff) {
652-
if (gmux_is_indexed(gmux_data)) {
653-
u32 version;
654-
mutex_init(&gmux_data->index_lock);
655-
gmux_data->indexed = true;
656-
version = gmux_read32(gmux_data,
657-
GMUX_PORT_VERSION_MAJOR);
658-
ver_major = (version >> 24) & 0xff;
659-
ver_minor = (version >> 16) & 0xff;
660-
ver_release = (version >> 8) & 0xff;
661-
} else {
662-
pr_info("gmux device not present\n");
663-
ret = -ENODEV;
664-
goto err_release;
665-
}
598+
if (indexed) {
599+
mutex_init(&gmux_data->index_lock);
600+
gmux_data->indexed = true;
601+
version = gmux_read32(gmux_data, GMUX_PORT_VERSION_MAJOR);
602+
ver_major = (version >> 24) & 0xff;
603+
ver_minor = (version >> 16) & 0xff;
604+
ver_release = (version >> 8) & 0xff;
605+
} else {
606+
ver_major = gmux_read8(gmux_data, GMUX_PORT_VERSION_MAJOR);
607+
ver_minor = gmux_read8(gmux_data, GMUX_PORT_VERSION_MINOR);
608+
ver_release = gmux_read8(gmux_data, GMUX_PORT_VERSION_RELEASE);
666609
}
667610
pr_info("Found gmux version %d.%d.%d [%s]\n", ver_major, ver_minor,
668611
ver_release, (gmux_data->indexed ? "indexed" : "classic"));

drivers/video/screen_info_generic.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,39 @@ ssize_t screen_info_resources(const struct screen_info *si, struct resource *r,
144144
return pos - r;
145145
}
146146
EXPORT_SYMBOL(screen_info_resources);
147+
148+
/*
149+
* The meaning of depth and bpp for direct-color formats is
150+
* inconsistent:
151+
*
152+
* - DRM format info specifies depth as the number of color
153+
* bits; including alpha, but not including filler bits.
154+
* - Linux' EFI platform code computes lfb_depth from the
155+
* individual color channels, including the reserved bits.
156+
* - VBE 1.1 defines lfb_depth for XRGB1555 as 16, but later
157+
* versions use 15.
158+
* - On the kernel command line, 'bpp' of 32 is usually
159+
* XRGB8888 including the filler bits, but 15 is XRGB1555
160+
* not including the filler bit.
161+
*
162+
* It is not easily possible to fix this in struct screen_info,
163+
* as this could break UAPI. The best solution is to compute
164+
* bits_per_pixel from the color bits, reserved bits and
165+
* reported lfb_depth, whichever is highest.
166+
*/
167+
168+
u32 __screen_info_lfb_bits_per_pixel(const struct screen_info *si)
169+
{
170+
u32 bits_per_pixel = si->lfb_depth;
171+
172+
if (bits_per_pixel > 8) {
173+
bits_per_pixel = max(max3(si->red_size + si->red_pos,
174+
si->green_size + si->green_pos,
175+
si->blue_size + si->blue_pos),
176+
si->rsvd_size + si->rsvd_pos);
177+
bits_per_pixel = max_t(u32, bits_per_pixel, si->lfb_depth);
178+
}
179+
180+
return bits_per_pixel;
181+
}
182+
EXPORT_SYMBOL(__screen_info_lfb_bits_per_pixel);

fs/hugetlbfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ static struct vfsmount *__init mount_one_hugetlbfs(struct hstate *h)
16471647
} else {
16481648
struct hugetlbfs_fs_context *ctx = fc->fs_private;
16491649
ctx->hstate = h;
1650-
mnt = fc_mount(fc);
1650+
mnt = fc_mount_longterm(fc);
16511651
put_fs_context(fc);
16521652
}
16531653
if (IS_ERR(mnt))

fs/namespace.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,15 @@ struct vfsmount *fc_mount(struct fs_context *fc)
998998
}
999999
EXPORT_SYMBOL(fc_mount);
10001000

1001+
struct vfsmount *fc_mount_longterm(struct fs_context *fc)
1002+
{
1003+
struct vfsmount *mnt = fc_mount(fc);
1004+
if (!IS_ERR(mnt))
1005+
real_mount(mnt)->mnt_ns = MNT_NS_INTERNAL;
1006+
return mnt;
1007+
}
1008+
EXPORT_SYMBOL(fc_mount_longterm);
1009+
10011010
struct vfsmount *vfs_kern_mount(struct file_system_type *type,
10021011
int flags, const char *name,
10031012
void *data)

0 commit comments

Comments
 (0)