* Re: atkbd input regression
From: José Ramón Muñoz Pekkarinen @ 2023-08-30 14:25 UTC (permalink / raw)
To: Linux regressions mailing list; +Cc: linux-input, dmitry.torokhov, gregkh
In-Reply-To: <a0b8cbf4-a3db-5b05-14ba-297fe24efd52@leemhuis.info>
On Wed, 30 Aug 2023 at 14:06, Linux regression tracking (Thorsten
Leemhuis) <regressions@leemhuis.info> wrote:
> So strictly speaking all this sounds a lot like this is caused by kernel
> regression that thus should be fixed in the kernel once this was
> bisected (which iirc hasn't happened yet).
I'm afraid it may be a distro specific problem, if I'm not so mistaken
from the time Gentoo switched its default udev from eudev to systemd
udev, which also explain why I can't rebuild the good kernel nowadays,
test, and have the expected good results, because the new initramfs
will receive a copy of the new systemd udev, and not the former eudev,
and it acts as all my broken kernels in time.
There is still room to be a kernel issue, since rethinking the issue, the
kernel on early boot does what is expected, it configures the device and
with udev makes it work for the ttys, the problem comes when the wayland
seat comes available, where plasma or wayland needs to advertise the
kernel of the new seat, and the kernel then needs to generate the correct
event to makes udev populate the new information and tags that are
missing when the device doesn't work. This can be either a missing
implementation on Gentoo side because of using systemd udev without
the rest of systemd, or a kernel issue if the kernel is receiving the
information of the new seat and not generating an uevent to udev
to populate the new info. So in short, I may need to revisit this in the
following days.
> OTOH this afaics (please correct me if I'm wrong!) is the first such
> report, so the problem is likely pretty specific or might only occur on
> your system. In that case just looking for some solution for your system
> might be fine.
There is similar cases in the Gentoo forum that eventually gave up
on Gentoo[1] and made a switch to Fedora to be done with this. I just prefer
to look for a solution to the problem and fix it for everybody. So bear
with it while I dig into the code path that is propagating the seat info to
the kernel and udev.
[1] https://forums.gentoo.org/viewtopic-t-1161962-highlight-serial+keyboard.html
Thanks!
José.
^ permalink raw reply
* Re: [syzbot] [input?] INFO: task hung in uhid_char_release
From: Matthew Rosato @ 2023-08-29 18:56 UTC (permalink / raw)
To: syzbot, agordeev, akrowiak, benjamin.tissoires, clg, davem,
david.rheinsberg, edumazet, jikos, kuba, linux-input,
linux-kernel, netdev, pabeni, syzkaller-bugs
In-Reply-To: <00000000000068345606041323fc@google.com>
On 8/29/23 1:28 PM, syzbot wrote:
> syzbot has bisected this issue to:
>
> commit bf48961f6f48e3b7eb80c3e179207e9f4e4cd660
> Author: Tony Krowiak <akrowiak@linux.ibm.com>
> Date: Tue May 30 22:35:37 2023 +0000
>
> s390/vfio-ap: realize the VFIO_DEVICE_SET_IRQS ioctl
Hmm, this doesn't seem like the right commit. The changes for bf48961f6f48e3b7eb80c3e179207e9f4e4cd660 are limited to the vfio_ap module, which requires CONFIG_S390 and CONFIG_VFIO_AP. Besides the config referenced below I also looked at other cases via the dashboard link and none of the config files I checked had either of these.
Thanks,
Matt
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=155eba2fa80000
> start commit: bde7f150276b Merge tag 'pm-6.5-rc2' of git://git.kernel.or..
> git tree: upstream
> final oops: https://syzkaller.appspot.com/x/report.txt?x=175eba2fa80000
> console output: https://syzkaller.appspot.com/x/log.txt?x=135eba2fa80000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6d0f369ef5fb88c9
> dashboard link: https://syzkaller.appspot.com/bug?extid=8fe2d362af0e1cba8735
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=124711b6a80000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=178c5a92a80000
>
> Reported-by: syzbot+8fe2d362af0e1cba8735@syzkaller.appspotmail.com
> Fixes: bf48961f6f48 ("s390/vfio-ap: realize the VFIO_DEVICE_SET_IRQS ioctl")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply
* Re: [syzbot] [input?] INFO: task hung in uhid_char_release
From: syzbot @ 2023-08-29 17:28 UTC (permalink / raw)
To: agordeev, akrowiak, benjamin.tissoires, clg, davem,
david.rheinsberg, edumazet, jikos, kuba, linux-input,
linux-kernel, mjrosato, netdev, pabeni, syzkaller-bugs
In-Reply-To: <000000000000c329d505fed78c74@google.com>
syzbot has bisected this issue to:
commit bf48961f6f48e3b7eb80c3e179207e9f4e4cd660
Author: Tony Krowiak <akrowiak@linux.ibm.com>
Date: Tue May 30 22:35:37 2023 +0000
s390/vfio-ap: realize the VFIO_DEVICE_SET_IRQS ioctl
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=155eba2fa80000
start commit: bde7f150276b Merge tag 'pm-6.5-rc2' of git://git.kernel.or..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=175eba2fa80000
console output: https://syzkaller.appspot.com/x/log.txt?x=135eba2fa80000
kernel config: https://syzkaller.appspot.com/x/.config?x=6d0f369ef5fb88c9
dashboard link: https://syzkaller.appspot.com/bug?extid=8fe2d362af0e1cba8735
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=124711b6a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=178c5a92a80000
Reported-by: syzbot+8fe2d362af0e1cba8735@syzkaller.appspotmail.com
Fixes: bf48961f6f48 ("s390/vfio-ap: realize the VFIO_DEVICE_SET_IRQS ioctl")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply
* Re: [PATCH 2/2] hid-sony: DS3: Report analog buttons for Sixaxis
From: Max Staudt @ 2023-08-29 15:53 UTC (permalink / raw)
To: Dmitry Torokhov, Jiri Kosina, Benjamin Tissoires
Cc: Vicki Pfau, Pavel Rojtberg, Roderick Colenbrander, linux-input,
linux-kernel
In-Reply-To: <20230826152111.13525-3-max@enpas.org>
On 8/27/23 00:21, Max Staudt wrote:
> This change exposes these buttons as axes in a way that is as backwards
> compatible and as close to the Linux gamepad spec as possible.
>
> [...]
>
> - The D-Pad as ABS_HAT0X/ABS_HAT0Y, -255 to 255
One further idea:
The DualShock 3 reports all 4 D-pad buttons separately, and hid-sony currently reports them as discrete digital buttons to userspace.
Would it be better to do the same with the analog buttons, i.e. to report the 4 measurements as discrete axes, rather than the current patch's approach of merging them into two logical axes?
Of course, this would require 4 more axes, this would not fit into any existing scheme, and since we've run out of ABS_MISC+n at this point, this could be a further reason for officially reserving a range of axes for analog buttons. Something like:
#define ABS_BTN_SOUTH 0x40
#define ABS_BTN_A ABS_BTN_SOUTH
#define ABS_BTN_EAST 0x41
#define ABS_BTN_B ABS_BTN_EAST
#define ABS_BTN_C 0x42
#define ABS_BTN_NORTH 0x43
#define ABS_BTN_X ABS_BTN_NORTH
#define ABS_BTN_WEST 0x44
#define ABS_BTN_Y ABS_BTN_WEST
#define ABS_BTN_Z 0x45
#define ABS_BTN_DPAD_UP 0x46
#define ABS_BTN_DPAD_DOWN 0x47
#define ABS_BTN_DPAD_LEFT 0x48
#define ABS_BTN_DPAD_RIGHT 0x49
#define ABS_MAX 0x4f
#define ABS_CNT (ABS_MAX+1)
Max
^ permalink raw reply
* [PATCH resend 2] HID: allow specifying quirks params for hid-core
From: Marco Morandini @ 2023-08-29 14:48 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, linux-input
Before this patch it was possible to specify quirks
using run-time parameters, but only for the usbhid module.
This patch introduces a quirks parameter for hid-core
allowing to specify quirks as
hid.quirks=BUS:vendorID:productID:quirks
Signed-off-by: Marco Morandini <marco.morandini@polimi.it>
---
I don't know if this is a good idea or not.
If it was for me, I'd get rid of the usbhid parameters
and of the duplicated hid_quirks_init,
forcing everyone to specify the bus,
but I fear this could be a regression for user space.
drivers/hid/hid-core.c | 13 +++++++++++++
drivers/hid/hid-quirks.c | 33 +++++++++++++++++++++++++++++++++
include/linux/hid.h | 1 +
3 files changed, 47 insertions(+)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 22623eb4f72f..e1bdba978dbc 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -45,6 +45,13 @@ static int hid_ignore_special_drivers = 0;
module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600);
MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver");
+/* Quirks specified at module load time */
+static char *quirks_param[MAX_USBHID_BOOT_QUIRKS];
+module_param_array_named(quirks, quirks_param, charp, NULL, 0444);
+MODULE_PARM_DESC(quirks, "Add/modify USB HID quirks by specifying "
+ " quirks=BUS:vendorID:productID:quirks"
+ " where BUS, vendorID, productID, and quirks are all in"
+ " 0x-prefixed hex");
/*
* Register a new report for a device.
*/
@@ -2951,6 +2958,10 @@ static int __init hid_init(void)
{
int ret;
+ ret = hid_quirks_bus_init(quirks_param, MAX_USBHID_BOOT_QUIRKS);
+ if (ret)
+ goto usbhid_quirks_init_fail;
+
ret = bus_register(&hid_bus_type);
if (ret) {
pr_err("can't register hid bus\n");
@@ -2972,6 +2983,8 @@ static int __init hid_init(void)
bus_unregister(&hid_bus_type);
err:
return ret;
+usbhid_quirks_init_fail:
+ return ret;
}
static void __exit hid_exit(void)
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 3983b4f282f8..40d3ba78ff73 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -1182,6 +1182,39 @@ static void hid_remove_all_dquirks(__u16 bus)
}
+
+/**
+ * hid_quirks_bus_init - apply HID quirks specified at module load time
+ * @quirks_param: array of quirks strings (bus:vendor:product:quirks)
+ * @count: number of quirks to check
+ */
+int hid_quirks_bus_init(char **quirks_param, int count)
+{
+ struct hid_device_id id = { 0 };
+ int n = 0, m;
+ unsigned short int bus, vendor, product;
+ u32 quirks;
+
+ for (; n < count && quirks_param[n]; n++) {
+
+ m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%hx:0x%x",
+ &bus, &vendor, &product, &quirks);
+
+ id.bus = (__u16)bus;
+ id.vendor = (__u16)vendor;
+ id.product = (__u16)product;
+
+ if (m != 4 ||
+ hid_modify_dquirk(&id, quirks) != 0) {
+ pr_warn("Could not parse HID quirk module param %s\n",
+ quirks_param[n]);
+ }
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(hid_quirks_bus_init);
+
/**
* hid_quirks_init - apply HID quirks specified at module load time
* @quirks_param: array of quirks strings (vendor:product:quirks)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 4e4c4fe36911..7f2e8ba7d783 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1178,6 +1178,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
/* HID quirks API */
unsigned long hid_lookup_quirk(const struct hid_device *hdev);
+int hid_quirks_bus_init(char **quirks_param, int count);
int hid_quirks_init(char **quirks_param, __u16 bus, int count);
void hid_quirks_exit(__u16 bus);
--
2.41.0
^ permalink raw reply related
* Re: Fwd: Regression: ALS/ACS stops working on amd-sfh
From: Linux regression tracking #update (Thorsten Leemhuis) @ 2023-08-29 13:43 UTC (permalink / raw)
To: Linux Regressions; +Cc: Linux Kernel Mailing List, Linux Input Devices
In-Reply-To: <0ea231a1-e510-903d-22a0-998234426462@gmail.com>
[TLDR: This mail in primarily relevant for Linux kernel regression
tracking. See link in footer if these mails annoy you.]
On 04.08.23 14:45, Bagas Sanjaya wrote:
> Hi,
>
> I notice a very concise regression report on Bugzilla [1]. That is,
> quoting from it:
>
>> Since commit a33e5e393171ae8384d3381db5cd159ba877cfcb ("HID: amd_sfh: Fix illuminance value"), the in_illuminance_raw is 0 all the time.
>>
>> Before that commit, the ACS/ALS has normal value.
>
> See Bugzilla for the full thread.
>
> Anyway, I'm adding this regression to be tracked by regzbot:
>
> #regzbot introduced: a33e5e393171ae https://bugzilla.kernel.org/show_bug.cgi?id=217762
> #regzbot title: Fixing in_illuminance_raw value hard-codes ACS/ALS to 0
#regzbot inconclusive: developer closed ticket as RESOLVED
UNREPRODUCIBLE (likely "firmware bug for your platform" and reporter
didn't complain
#regzbot ignore-activity
Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
--
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.
^ permalink raw reply
* Re: [PATCH v1 1/3] types: Complement the aligned types with signed 64-bit one
From: Andy Shevchenko @ 2023-08-29 13:22 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jonathan Cameron, Lorenzo Bianconi, Philipp Jungkamp,
Peter Zijlstra, linux-input, linux-iio, linux-kernel, Jiri Kosina,
Srinivas Pandruvada, Lars-Peter Clausen
In-Reply-To: <20230828171018.2ee59df7@jic23-huawei>
On Mon, Aug 28, 2023 at 05:10:18PM +0100, Jonathan Cameron wrote:
> On Tue, 15 Aug 2023 18:40:25 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > Some user may want to use aligned signed 64-bit type.
> > Provide it for them.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Excellent. I'll pick this up once the minor things in the first two
> users are resolved (as long as no one argues we shouldn't have this
> for some reason!)
I'll cook a new series sooner than later. Thank you for the review!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v1 3/3] iio: hid-sensor: Use aligned data type for timestamp
From: Andy Shevchenko @ 2023-08-29 13:22 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jonathan Cameron, Lorenzo Bianconi, Philipp Jungkamp,
Peter Zijlstra, linux-input, linux-iio, linux-kernel, Jiri Kosina,
Srinivas Pandruvada, Lars-Peter Clausen
In-Reply-To: <20230828170928.5264dadf@jic23-huawei>
On Mon, Aug 28, 2023 at 05:09:28PM +0100, Jonathan Cameron wrote:
> On Tue, 15 Aug 2023 18:40:27 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
...
> > - /* Ensure timestamp is naturally aligned */
>
> Comment is still true and no more or less obvious than it was with the old code
> I think so I don't really see why it should be removed with this change.
Doesn't the prefix "aligned" make this comment somehow redundant?
> > struct {
> > u32 accel_val[3];
> > - s64 timestamp __aligned(8);
> > + aligned_s64 timestamp;
> > } scan;
...
> > - s32 sampled_vals[4] __aligned(16);
> > + s32 sampled_vals[4];
>
> Hmm. I can't immediately recall why that aligned(16) is therebut
> it's not related to the rest of this change so I'm not sure we should touch
> it. I don't think we ever required quaternions to be aligned as a whole so
> this does feel odd but in the category of something we should be careful
> touching or at very least do it in a different patch where it stands out.
I have checked the code and find nothing that justifies this, I can split it
to a separate patch, though.
Note, among ISH HID drivers it's the only one with a such...
> > + aligned_s64 timestamp;
> > } scan;
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v1 2/3] iio: imu: st_lsm6dsx: Use aligned data type for timestamp
From: Andy Shevchenko @ 2023-08-29 13:18 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jonathan Cameron, Lorenzo Bianconi, Philipp Jungkamp,
Peter Zijlstra, linux-input, linux-iio, linux-kernel, Jiri Kosina,
Srinivas Pandruvada, Lars-Peter Clausen
In-Reply-To: <20230828170341.3a9641f0@jic23-huawei>
On Mon, Aug 28, 2023 at 05:03:41PM +0100, Jonathan Cameron wrote:
> On Tue, 15 Aug 2023 18:40:26 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
...
> > struct {
> > __le16 channels[3];
> > - s64 ts __aligned(8);
> > + __aligned_s64 ts;
>
> aligned_s64 as it's internal to the kernel?
Either works, but strictly speaking you are right, better no underscored
variant.
> > } scan[ST_LSM6DSX_ID_MAX];
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH] HID: logitech-hidpp: Add Bluetooth ID for the Logitech M720 Triathlon mouse
From: Bastien Nocera @ 2023-08-29 8:37 UTC (permalink / raw)
To: Hans de Goede, Filipe Laíns, Jiri Kosina, Benjamin Tissoires
Cc: linux-input
In-Reply-To: <20230827222438.43717-1-hdegoede@redhat.com>
On Mon, 2023-08-28 at 00:24 +0200, Hans de Goede wrote:
> Using hidpp for the M720 adds battery info reporting and hires
> scrolling support.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bastien Nocera <hadess@hadess.net>
> ---
> drivers/hid/hid-logitech-hidpp.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-
> logitech-hidpp.c
> index 129b01be488d..3786fcc93da0 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -4640,6 +4640,8 @@ static const struct hid_device_id
> hidpp_devices[] = {
> HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },
> { /* MX Master mouse over Bluetooth */
> HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },
> + { /* M720 Triathlon mouse over Bluetooth */
> + HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb015) },
> { /* MX Ergo trackball over Bluetooth */
> HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },
> { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
^ permalink raw reply
* Consumo de combustible
From: Miguel Garcia @ 2023-08-29 8:00 UTC (permalink / raw)
To: linux-input
Buenos dias
Le escribo sobre la gestión de los automóviles de la empresa.
Gracias a las abundantes funcionalidades de la herramienta GPS, que monitorea cada automóvil de manera continua, puede registrar la posición, el tiempo y el kilometraje de los automóviles en tiempo real.
Como resultado, los costos de mantenimiento de la flota de la compañía se reducen en un 20% y el tiempo de viaje o la planificación de la entrega se reduce significativamente. 49 mil están detrás del éxito de nuestras soluciones. Empresas que cooperan con nosotros.
Si el tema le parece interesante, contáctame.
Atentamente,
Miguel Garcia
^ permalink raw reply
* Re: [PATCH] input: docs: pxrc: remove reference to phoenix-sim
From: Jonathan Corbet @ 2023-08-28 18:44 UTC (permalink / raw)
To: Marcus Folkesson, Dmitry Torokhov
Cc: linux-input, linux-doc, linux-kernel, Marcus Folkesson
In-Reply-To: <20230824-pxrc-doc-v1-1-038b75a2ef05@gmail.com>
Marcus Folkesson <marcus.folkesson@gmail.com> writes:
> The reference undeniably points to something unrelated nowadays.
> Remove it.
>
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
> Documentation/input/devices/pxrc.rst | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/input/devices/pxrc.rst b/Documentation/input/devices/pxrc.rst
> index ca11f646bae8..5a86df4ad079 100644
> --- a/Documentation/input/devices/pxrc.rst
> +++ b/Documentation/input/devices/pxrc.rst
> @@ -5,7 +5,7 @@ pxrc - PhoenixRC Flight Controller Adapter
> :Author: Marcus Folkesson <marcus.folkesson@gmail.com>
>
> This driver let you use your own RC controller plugged into the
> -adapter that comes with PhoenixRC [1]_ or other compatible adapters.
> +adapter that comes with PhoenixRC or other compatible adapters.
>
> The adapter supports 7 analog channels and 1 digital input switch.
>
> @@ -41,7 +41,7 @@ Manual Testing
> ==============
>
> To test this driver's functionality you may use `input-event` which is part of
> -the `input layer utilities` suite [2]_.
> +the `input layer utilities` suite [1]_.
>
> For example::
>
> @@ -53,5 +53,4 @@ To print all input events from input `devnr`.
> References
> ==========
>
> -.. [1] http://www.phoenix-sim.com/
> -.. [2] https://www.kraxel.org/cgit/input/
> +.. [1] https://www.kraxel.org/cgit/input/
Hmm...that does indeed seem like a link that lacks value for kernel
development. Patch applied, thanks.
jon
^ permalink raw reply
* Re: [PATCH 4/3] selftests/hid: more fixes to build with older kernel
From: Justin Stitt @ 2023-08-28 17:47 UTC (permalink / raw)
To: Eduard Zingerman
Cc: Benjamin Tissoires, Jiri Kosina, Benjamin Tissoires, Shuah Khan,
Nick Desaulniers, linux-input, linux-kselftest, linux-kernel, bpf
In-Reply-To: <65800771171dcaff9901dae47de960ec66602f7e.camel@gmail.com>
Eduard,
On Fri, Aug 25, 2023 at 11:54 AM Eduard Zingerman <eddyz87@gmail.com> wrote:
>
> On Fri, 2023-08-25 at 18:23 +0000, Justin Stitt wrote:
> > On Fri, Aug 25, 2023 at 10:36:30AM +0200, Benjamin Tissoires wrote:
> > > These fixes have been triggered by [0]:
> > > basically, if you do not recompile the kernel first, and are
> > > running on an old kernel, vmlinux.h doesn't have the required
> > > symbols and the compilation fails.
> > >
> > > The tests will fail if you run them on that very same machine,
> > > of course, but the binary should compile.
> > >
> > > And while I was sorting out why it was failing, I realized I
> > > could do a couple of improvements on the Makefile.
> > >
> > > [0] https://lore.kernel.org/linux-input/56ba8125-2c6f-a9c9-d498-0ca1c153dcb2@redhat.com/T/#t
> > >
> > > Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> > > ---
> > > Benjamin Tissoires (3):
> > > selftests/hid: ensure we can compile the tests on kernels pre-6.3
> > > selftests/hid: do not manually call headers_install
> > > selftests/hid: force using our compiled libbpf headers
> > >
> > > tools/testing/selftests/hid/Makefile | 10 ++++------
> > > tools/testing/selftests/hid/progs/hid.c | 3 ---
> > > tools/testing/selftests/hid/progs/hid_bpf_helpers.h | 20 ++++++++++++++++++++
> > > 3 files changed, 24 insertions(+), 9 deletions(-)
> > > ---
> > > base-commit: 1d7546042f8fdc4bc39ab91ec966203e2d64f8bd
> > > change-id: 20230825-wip-selftests-9a7502b56542
> > >
> > > Best regards,
> > > --
> > > Benjamin Tissoires <bentiss@kernel.org>
> > >
> >
> > Benjamin, thanks for the work here. Your series fixed up _some_ of the
> > errors I had while building on my 6.3.11 kernel. I'm proposing a single
> > patch that should be applied on top of your series that fully fixes
> > _all_ of the build errors I'm experiencing.
> >
> > Can you let me know if it works and potentially formulate a new series
> > so that `b4 shazam` applies it cleanly?
> >
> > PATCH BELOW
> > ---
> > From 5378d70e1b3f7f75656332f9bff65a37122bb288 Mon Sep 17 00:00:00 2001
> > From: Justin Stitt <justinstitt@google.com>
> > Date: Fri, 25 Aug 2023 18:10:33 +0000
> > Subject: [PATCH 4/3] selftests/hid: more fixes to build with older kernel
> >
> > I had to use the clever trick [1] on some other symbols to get my builds
> > working.
> >
> > Apply this patch on top of Benjamin's series [2].
> >
> > This is now a n=4 patch series which has fixed my builds when running:
> > > $ make LLVM=1 -j128 ARCH=x86_64 mrproper headers
> > > $ make LLVM=1 -j128 ARCH=x86_64 -C tools/testing/selftests TARGETS=hid
> >
> > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/bpf/progs/bpf_iter.h#n3
> > [2]: https://lore.kernel.org/all/20230825-wip-selftests-v1-0-c862769020a8@kernel.org/
> > Signed-off-by: Justin Stitt <justinstitt@google.com>
> > ---
> > .../selftests/hid/progs/hid_bpf_helpers.h | 29 +++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> >
> > diff --git a/tools/testing/selftests/hid/progs/hid_bpf_helpers.h b/tools/testing/selftests/hid/progs/hid_bpf_helpers.h
> > index 749097f8f4d9..e2eace2c0029 100644
> > --- a/tools/testing/selftests/hid/progs/hid_bpf_helpers.h
> > +++ b/tools/testing/selftests/hid/progs/hid_bpf_helpers.h
> > @@ -7,12 +7,26 @@
> >
> > /* "undefine" structs in vmlinux.h, because we "override" them below */
> > #define hid_bpf_ctx hid_bpf_ctx___not_used
> > +#define hid_report_type hid_report_type___not_used
> > +#define hid_class_request hid_class_request___not_used
> > +#define hid_bpf_attach_flags hid_bpf_attach_flags___not_used
> > #include "vmlinux.h"
> > #undef hid_bpf_ctx
> > +#undef hid_report_type
> > +#undef hid_class_request
> > +#undef hid_bpf_attach_flags
> >
> > #include <bpf/bpf_helpers.h>
> > #include <bpf/bpf_tracing.h>
> > +#include <linux/const.h>
> >
> > +enum hid_report_type {
> > + HID_INPUT_REPORT = 0,
> > + HID_OUTPUT_REPORT = 1,
> > + HID_FEATURE_REPORT = 2,
> > +
> > + HID_REPORT_TYPES,
> > +};
> >
> > struct hid_bpf_ctx {
> > __u32 index;
> > @@ -25,6 +39,21 @@ struct hid_bpf_ctx {
> > };
> > };
>
> Note, vmlinux.h has the following preamble/postamble:
>
> #ifndef BPF_NO_PRESERVE_ACCESS_INDEX
> #pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
> #endif
> ...
> #ifndef BPF_NO_PRESERVE_ACCESS_INDEX
> #pragma clang attribute pop
> #endif
>
> You might want to use it or add __attribute__((preserve_access_index))
> to structure definitions, depending on whether or not you need CO-RE
> functionality for these tests.
I have no idea whether or not CO-RE is needed for these tests or not.
My main motivation is getting these selftests building with LLVM=1
[1].
Perhaps Benjamin could provide some more insight on whether this is
needed or not and roll out a v2 containing my patch on top + any CO-RE
semantics -- if deemed necessary.
>
> >
> > +enum hid_class_request {
> > + HID_REQ_GET_REPORT = 0x01,
> > + HID_REQ_GET_IDLE = 0x02,
> > + HID_REQ_GET_PROTOCOL = 0x03,
> > + HID_REQ_SET_REPORT = 0x09,
> > + HID_REQ_SET_IDLE = 0x0A,
> > + HID_REQ_SET_PROTOCOL = 0x0B,
> > +};
> > +
> > +enum hid_bpf_attach_flags {
> > + HID_BPF_FLAG_NONE = 0,
> > + HID_BPF_FLAG_INSERT_HEAD = _BITUL(0),
> > + HID_BPF_FLAG_MAX,
> > +};
> > +
> > /* following are kfuncs exported by HID for HID-BPF */
> > extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
> > unsigned int offset,
> > --
> > 2.42.0.rc1.204.g551eb34607-goog
> >
>
[1]: https://github.com/ClangBuiltLinux/linux/issues/1698
Thanks
Justin
^ permalink raw reply
* Re: [PATCH v1 1/3] types: Complement the aligned types with signed 64-bit one
From: Jonathan Cameron @ 2023-08-28 16:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, Lorenzo Bianconi, Philipp Jungkamp,
Peter Zijlstra, linux-input, linux-iio, linux-kernel, Jiri Kosina,
Srinivas Pandruvada, Lars-Peter Clausen
In-Reply-To: <20230815154027.12468-1-andriy.shevchenko@linux.intel.com>
On Tue, 15 Aug 2023 18:40:25 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Some user may want to use aligned signed 64-bit type.
> Provide it for them.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Excellent. I'll pick this up once the minor things in the first two
users are resolved (as long as no one argues we shouldn't have this
for some reason!)
Jonathan
> ---
> include/linux/types.h | 3 ++-
> include/uapi/linux/types.h | 1 +
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/types.h b/include/linux/types.h
> index 253168bb3fe1..78d87c751ff5 100644
> --- a/include/linux/types.h
> +++ b/include/linux/types.h
> @@ -115,8 +115,9 @@ typedef u64 u_int64_t;
> typedef s64 int64_t;
> #endif
>
> -/* this is a special 64bit data type that is 8-byte aligned */
> +/* These are the special 64-bit data types that are 8-byte aligned */
> #define aligned_u64 __aligned_u64
> +#define aligned_s64 __aligned_s64
> #define aligned_be64 __aligned_be64
> #define aligned_le64 __aligned_le64
>
> diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h
> index 6375a0684052..48b933938877 100644
> --- a/include/uapi/linux/types.h
> +++ b/include/uapi/linux/types.h
> @@ -53,6 +53,7 @@ typedef __u32 __bitwise __wsum;
> * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
> */
> #define __aligned_u64 __u64 __attribute__((aligned(8)))
> +#define __aligned_s64 __s64 __attribute__((aligned(8)))
> #define __aligned_be64 __be64 __attribute__((aligned(8)))
> #define __aligned_le64 __le64 __attribute__((aligned(8)))
>
^ permalink raw reply
* Re: [PATCH v1 3/3] iio: hid-sensor: Use aligned data type for timestamp
From: Jonathan Cameron @ 2023-08-28 16:09 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, Lorenzo Bianconi, Philipp Jungkamp,
Peter Zijlstra, linux-input, linux-iio, linux-kernel, Jiri Kosina,
Srinivas Pandruvada, Lars-Peter Clausen
In-Reply-To: <20230815154027.12468-3-andriy.shevchenko@linux.intel.com>
On Tue, 15 Aug 2023 18:40:27 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Use aligned_s64 for the timestamp field.
>
> Note, the actual data is signed, hence with this we also amend that.
> While at it, drop redundant __alignment directive.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/iio/accel/hid-sensor-accel-3d.c | 3 +--
> drivers/iio/gyro/hid-sensor-gyro-3d.c | 2 +-
> drivers/iio/humidity/hid-sensor-humidity.c | 2 +-
> drivers/iio/light/hid-sensor-als.c | 2 +-
> drivers/iio/orientation/hid-sensor-incl-3d.c | 2 +-
> drivers/iio/orientation/hid-sensor-rotation.c | 4 ++--
> drivers/iio/position/hid-sensor-custom-intel-hinge.c | 2 +-
> drivers/iio/pressure/hid-sensor-press.c | 2 +-
> drivers/iio/temperature/hid-sensor-temperature.c | 2 +-
> 9 files changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
> index 5eac7ea19993..f739589564c5 100644
> --- a/drivers/iio/accel/hid-sensor-accel-3d.c
> +++ b/drivers/iio/accel/hid-sensor-accel-3d.c
> @@ -25,10 +25,9 @@ struct accel_3d_state {
> struct hid_sensor_hub_callbacks callbacks;
> struct hid_sensor_common common_attributes;
> struct hid_sensor_hub_attribute_info accel[ACCEL_3D_CHANNEL_MAX];
> - /* Ensure timestamp is naturally aligned */
Comment is still true and no more or less obvious than it was with the old code
I think so I don't really see why it should be removed with this change.
> struct {
> u32 accel_val[3];
> - s64 timestamp __aligned(8);
> + aligned_s64 timestamp;
> } scan;
> int scale_pre_decml;
> int scale_post_decml;
...
> diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
> index a033699910e8..864ecbcad26e 100644
> --- a/drivers/iio/orientation/hid-sensor-rotation.c
> +++ b/drivers/iio/orientation/hid-sensor-rotation.c
> @@ -19,8 +19,8 @@ struct dev_rot_state {
> struct hid_sensor_common common_attributes;
> struct hid_sensor_hub_attribute_info quaternion;
> struct {
> - s32 sampled_vals[4] __aligned(16);
> - u64 timestamp __aligned(8);
> + s32 sampled_vals[4];
Hmm. I can't immediately recall why that aligned(16) is therebut
it's not related to the rest of this change so I'm not sure we should touch it.
I don't think we ever required quaternions to be aligned as a whole so this does feel odd but
in the category of something we should be careful touching or at very least do it in
a different patch where it stands out.
> + aligned_s64 timestamp;
> } scan;
> int scale_pre_decml;
> int scale_post_decml;
> diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> index 07c30d217255..48005b568dd9 100644
> --- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> +++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> @@ -39,7 +39,7 @@ struct hinge_state {
> const char *labels[CHANNEL_SCAN_INDEX_MAX];
> struct {
> u32 hinge_val[3];
> - u64 timestamp __aligned(8);
> + aligned_s64 timestamp;
> } scan;
>
> int scale_pre_decml;
> diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
> index a9215eb32d70..a964c7b65402 100644
> --- a/drivers/iio/pressure/hid-sensor-press.c
> +++ b/drivers/iio/pressure/hid-sensor-press.c
> @@ -24,7 +24,7 @@ struct press_state {
> struct hid_sensor_hub_attribute_info press_attr;
> struct {
> u32 press_data;
> - u64 timestamp __aligned(8);
> + aligned_s64 timestamp;
> } scan;
> int scale_pre_decml;
> int scale_post_decml;
> diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c
> index d40f235af1d4..32f4b13fd554 100644
> --- a/drivers/iio/temperature/hid-sensor-temperature.c
> +++ b/drivers/iio/temperature/hid-sensor-temperature.c
> @@ -18,7 +18,7 @@ struct temperature_state {
> struct hid_sensor_hub_attribute_info temperature_attr;
> struct {
> s32 temperature_data;
> - u64 timestamp __aligned(8);
> + aligned_s64 timestamp;
> } scan;
> int scale_pre_decml;
> int scale_post_decml;
^ permalink raw reply
* Re: [PATCH v1 2/3] iio: imu: st_lsm6dsx: Use aligned data type for timestamp
From: Jonathan Cameron @ 2023-08-28 16:03 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, Lorenzo Bianconi, Philipp Jungkamp,
Peter Zijlstra, linux-input, linux-iio, linux-kernel, Jiri Kosina,
Srinivas Pandruvada, Lars-Peter Clausen
In-Reply-To: <20230815154027.12468-2-andriy.shevchenko@linux.intel.com>
On Tue, 15 Aug 2023 18:40:26 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Use __aligned_s64 for the timestamp field.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> index c19237717e81..d3d4b3281aa6 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> @@ -442,10 +442,9 @@ struct st_lsm6dsx_hw {
> const struct st_lsm6dsx_settings *settings;
>
> struct iio_mount_matrix orientation;
> - /* Ensure natural alignment of buffer elements */
> struct {
> __le16 channels[3];
> - s64 ts __aligned(8);
> + __aligned_s64 ts;
aligned_s64 as it's internal to the kernel?
> } scan[ST_LSM6DSX_ID_MAX];
> };
>
^ permalink raw reply
* Re: [PATCH 8/8] staging/fbtft: Use fb_ops helpers for deferred I/O
From: Greg KH @ 2023-08-28 14:51 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: deller, daniel, sam, javierm, linux-fbdev, dri-devel,
linux-staging, linux-hyperv, linux-input
In-Reply-To: <20230828132131.29295-9-tzimmermann@suse.de>
On Mon, Aug 28, 2023 at 03:14:24PM +0200, Thomas Zimmermann wrote:
> Generate callback functions for struct fb_ops with the fbdev macro
> FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to
> the generated functions with an fbdev initializer macro.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply
* Re: [PATCH 7/8] staging/fbtft: Initialize fb_op struct as static const
From: Greg KH @ 2023-08-28 14:51 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: deller, daniel, sam, javierm, linux-fbdev, dri-devel,
linux-staging, linux-hyperv, linux-input
In-Reply-To: <20230828132131.29295-8-tzimmermann@suse.de>
On Mon, Aug 28, 2023 at 03:14:23PM +0200, Thomas Zimmermann wrote:
> Replace dynamic allocation of the fb_ops instance with static
> allocation. Initialize the fields at module-load time. The owner
> field changes to THIS_MODULE, as in all other fbdev drivers.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/staging/fbtft/fbtft-core.c | 30 +++++++++++++-----------------
> 1 file changed, 13 insertions(+), 17 deletions(-)
>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply
* [PATCH 7/8] staging/fbtft: Initialize fb_op struct as static const
From: Thomas Zimmermann @ 2023-08-28 13:14 UTC (permalink / raw)
To: deller, daniel, sam, javierm
Cc: linux-fbdev, dri-devel, linux-staging, linux-hyperv, linux-input,
Thomas Zimmermann
In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de>
Replace dynamic allocation of the fb_ops instance with static
allocation. Initialize the fields at module-load time. The owner
field changes to THIS_MODULE, as in all other fbdev drivers.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/staging/fbtft/fbtft-core.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index eac1d570f437..e4a77a4e7be6 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -473,6 +473,18 @@ static int fbtft_fb_blank(int blank, struct fb_info *info)
return ret;
}
+static const struct fb_ops fbtft_ops = {
+ .owner = THIS_MODULE;
+ .fb_read = fb_sys_read;
+ .fb_write = fbtft_fb_write;
+ .fb_fillrect = fbtft_fb_fillrect;
+ .fb_copyarea = fbtft_fb_copyarea;
+ .fb_imageblit = fbtft_fb_imageblit;
+ .fb_setcolreg = fbtft_fb_setcolreg;
+ .fb_blank = fbtft_fb_blank;
+ .fb_mmap = fb_deferred_io_mmap;
+};
+
static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src)
{
if (src->write)
@@ -521,7 +533,6 @@ static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src)
* Creates a new frame buffer info structure.
*
* Also creates and populates the following structures:
- * info->fbops
* info->fbdefio
* info->pseudo_palette
* par->fbtftops
@@ -536,7 +547,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
{
struct fb_info *info;
struct fbtft_par *par;
- struct fb_ops *fbops = NULL;
struct fb_deferred_io *fbdefio = NULL;
u8 *vmem = NULL;
void *txbuf = NULL;
@@ -611,10 +621,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
if (!vmem)
goto alloc_fail;
- fbops = devm_kzalloc(dev, sizeof(struct fb_ops), GFP_KERNEL);
- if (!fbops)
- goto alloc_fail;
-
fbdefio = devm_kzalloc(dev, sizeof(struct fb_deferred_io), GFP_KERNEL);
if (!fbdefio)
goto alloc_fail;
@@ -638,19 +644,9 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
goto alloc_fail;
info->screen_buffer = vmem;
- info->fbops = fbops;
+ info->fbops = &fbtft_ops;
info->fbdefio = fbdefio;
- fbops->owner = dev->driver->owner;
- fbops->fb_read = fb_sys_read;
- fbops->fb_write = fbtft_fb_write;
- fbops->fb_fillrect = fbtft_fb_fillrect;
- fbops->fb_copyarea = fbtft_fb_copyarea;
- fbops->fb_imageblit = fbtft_fb_imageblit;
- fbops->fb_setcolreg = fbtft_fb_setcolreg;
- fbops->fb_blank = fbtft_fb_blank;
- fbops->fb_mmap = fb_deferred_io_mmap;
-
fbdefio->delay = HZ / fps;
fbdefio->sort_pagereflist = true;
fbdefio->deferred_io = fbtft_deferred_io;
--
2.41.0
^ permalink raw reply related
* [PATCH 6/8] hid/picolcd: Use fb_ops helpers for deferred I/O
From: Thomas Zimmermann @ 2023-08-28 13:14 UTC (permalink / raw)
To: deller, daniel, sam, javierm
Cc: linux-fbdev, dri-devel, linux-staging, linux-hyperv, linux-input,
Thomas Zimmermann, Jiri Kosina, Benjamin Tissoires,
Bruno Prémont
In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de>
Generate callback functions for struct fb_ops with the fbdev macro
FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to
the generated functions with an fbdev initializer macro.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: "Bruno Prémont" <bonbons@linux-vserver.org>
---
drivers/hid/Kconfig | 6 +--
drivers/hid/hid-picolcd_fb.c | 73 ++++++++++--------------------------
2 files changed, 20 insertions(+), 59 deletions(-)
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index b50054a41c10..dbf632bb7e26 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -871,11 +871,7 @@ config HID_PICOLCD_FB
default !EXPERT
depends on HID_PICOLCD
depends on HID_PICOLCD=FB || FB=y
- select FB_DEFERRED_IO
- select FB_SYS_FILLRECT
- select FB_SYS_COPYAREA
- select FB_SYS_IMAGEBLIT
- select FB_SYS_FOPS
+ select FB_SYSMEM_HELPERS_DEFERRED
help
Provide access to PicoLCD's 256x64 monochrome display via a
framebuffer device.
diff --git a/drivers/hid/hid-picolcd_fb.c b/drivers/hid/hid-picolcd_fb.c
index d726aaafb146..a4dccdcda26f 100644
--- a/drivers/hid/hid-picolcd_fb.c
+++ b/drivers/hid/hid-picolcd_fb.c
@@ -283,54 +283,6 @@ static void picolcd_fb_update(struct fb_info *info)
mutex_unlock(&info->lock);
}
-/* Stub to call the system default and update the image on the picoLCD */
-static void picolcd_fb_fillrect(struct fb_info *info,
- const struct fb_fillrect *rect)
-{
- if (!info->par)
- return;
- sys_fillrect(info, rect);
-
- schedule_delayed_work(&info->deferred_work, 0);
-}
-
-/* Stub to call the system default and update the image on the picoLCD */
-static void picolcd_fb_copyarea(struct fb_info *info,
- const struct fb_copyarea *area)
-{
- if (!info->par)
- return;
- sys_copyarea(info, area);
-
- schedule_delayed_work(&info->deferred_work, 0);
-}
-
-/* Stub to call the system default and update the image on the picoLCD */
-static void picolcd_fb_imageblit(struct fb_info *info, const struct fb_image *image)
-{
- if (!info->par)
- return;
- sys_imageblit(info, image);
-
- schedule_delayed_work(&info->deferred_work, 0);
-}
-
-/*
- * this is the slow path from userspace. they can seek and write to
- * the fb. it's inefficient to do anything less than a full screen draw
- */
-static ssize_t picolcd_fb_write(struct fb_info *info, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- ssize_t ret;
- if (!info->par)
- return -ENODEV;
- ret = fb_sys_write(info, buf, count, ppos);
- if (ret >= 0)
- schedule_delayed_work(&info->deferred_work, 0);
- return ret;
-}
-
static int picolcd_fb_blank(int blank, struct fb_info *info)
{
/* We let fb notification do this for us via lcd/backlight device */
@@ -417,18 +369,31 @@ static int picolcd_set_par(struct fb_info *info)
return 0;
}
+static void picolcdfb_ops_damage_range(struct fb_info *info, off_t off, size_t len)
+{
+ if (!info->par)
+ return;
+ schedule_delayed_work(&info->deferred_work, 0);
+}
+
+static void picolcdfb_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
+{
+ if (!info->par)
+ return;
+ schedule_delayed_work(&info->deferred_work, 0);
+}
+
+FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(picolcdfb_ops,
+ picolcdfb_ops_damage_range,
+ picolcdfb_ops_damage_area)
+
static const struct fb_ops picolcdfb_ops = {
.owner = THIS_MODULE,
+ FB_DEFAULT_DEFERRED_OPS(picolcdfb_ops),
.fb_destroy = picolcd_fb_destroy,
- .fb_read = fb_sys_read,
- .fb_write = picolcd_fb_write,
.fb_blank = picolcd_fb_blank,
- .fb_fillrect = picolcd_fb_fillrect,
- .fb_copyarea = picolcd_fb_copyarea,
- .fb_imageblit = picolcd_fb_imageblit,
.fb_check_var = picolcd_fb_check_var,
.fb_set_par = picolcd_set_par,
- .fb_mmap = fb_deferred_io_mmap,
};
--
2.41.0
^ permalink raw reply related
* [PATCH 8/8] staging/fbtft: Use fb_ops helpers for deferred I/O
From: Thomas Zimmermann @ 2023-08-28 13:14 UTC (permalink / raw)
To: deller, daniel, sam, javierm
Cc: linux-fbdev, dri-devel, linux-staging, linux-hyperv, linux-input,
Thomas Zimmermann
In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de>
Generate callback functions for struct fb_ops with the fbdev macro
FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to
the generated functions with an fbdev initializer macro.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/staging/fbtft/Kconfig | 6 +--
drivers/staging/fbtft/fbtft-core.c | 87 ++++++++----------------------
2 files changed, 24 insertions(+), 69 deletions(-)
diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index 5dda3c65a38e..77ab44362f16 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -4,12 +4,8 @@ menuconfig FB_TFT
depends on FB && SPI
depends on FB_DEVICE
depends on GPIOLIB || COMPILE_TEST
- select FB_SYS_FILLRECT
- select FB_SYS_COPYAREA
- select FB_SYS_IMAGEBLIT
- select FB_SYS_FOPS
- select FB_DEFERRED_IO
select FB_BACKLIGHT
+ select FB_SYSMEM_HELPERS_DEFERRED
config FB_TFT_AGM1264K_FL
tristate "FB driver for the AGM1264K-FL LCD display"
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index e4a77a4e7be6..3626f429b002 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -357,61 +357,6 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagereflis
dirty_lines_start, dirty_lines_end);
}
-static void fbtft_fb_fillrect(struct fb_info *info,
- const struct fb_fillrect *rect)
-{
- struct fbtft_par *par = info->par;
-
- dev_dbg(info->dev,
- "%s: dx=%d, dy=%d, width=%d, height=%d\n",
- __func__, rect->dx, rect->dy, rect->width, rect->height);
- sys_fillrect(info, rect);
-
- par->fbtftops.mkdirty(info, rect->dy, rect->height);
-}
-
-static void fbtft_fb_copyarea(struct fb_info *info,
- const struct fb_copyarea *area)
-{
- struct fbtft_par *par = info->par;
-
- dev_dbg(info->dev,
- "%s: dx=%d, dy=%d, width=%d, height=%d\n",
- __func__, area->dx, area->dy, area->width, area->height);
- sys_copyarea(info, area);
-
- par->fbtftops.mkdirty(info, area->dy, area->height);
-}
-
-static void fbtft_fb_imageblit(struct fb_info *info,
- const struct fb_image *image)
-{
- struct fbtft_par *par = info->par;
-
- dev_dbg(info->dev,
- "%s: dx=%d, dy=%d, width=%d, height=%d\n",
- __func__, image->dx, image->dy, image->width, image->height);
- sys_imageblit(info, image);
-
- par->fbtftops.mkdirty(info, image->dy, image->height);
-}
-
-static ssize_t fbtft_fb_write(struct fb_info *info, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- struct fbtft_par *par = info->par;
- ssize_t res;
-
- dev_dbg(info->dev,
- "%s: count=%zd, ppos=%llu\n", __func__, count, *ppos);
- res = fb_sys_write(info, buf, count, ppos);
-
- /* TODO: only mark changed area update all for now */
- par->fbtftops.mkdirty(info, -1, 0);
-
- return res;
-}
-
/* from pxafb.c */
static unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf)
{
@@ -473,16 +418,30 @@ static int fbtft_fb_blank(int blank, struct fb_info *info)
return ret;
}
+static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t len)
+{
+ struct fbtft_par *par = info->par;
+
+ /* TODO: only mark changed area update all for now */
+ par->fbtftops.mkdirty(info, -1, 0);
+}
+
+static void fbtft_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
+{
+ struct fbtft_par *par = info->par;
+
+ par->fbtftops.mkdirty(info, y, height);
+}
+
+FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(fbtft_ops,
+ fbtft_ops_damage_range,
+ fbtft_ops_damage_area)
+
static const struct fb_ops fbtft_ops = {
- .owner = THIS_MODULE;
- .fb_read = fb_sys_read;
- .fb_write = fbtft_fb_write;
- .fb_fillrect = fbtft_fb_fillrect;
- .fb_copyarea = fbtft_fb_copyarea;
- .fb_imageblit = fbtft_fb_imageblit;
- .fb_setcolreg = fbtft_fb_setcolreg;
- .fb_blank = fbtft_fb_blank;
- .fb_mmap = fb_deferred_io_mmap;
+ .owner = THIS_MODULE,
+ FB_DEFAULT_DEFERRED_OPS(fbtft_ops),
+ .fb_setcolreg = fbtft_fb_setcolreg,
+ .fb_blank = fbtft_fb_blank,
};
static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src)
--
2.41.0
^ permalink raw reply related
* [PATCH 4/8] fbdev/hyperv_fb: Use fb_ops helpers for deferred I/O
From: Thomas Zimmermann @ 2023-08-28 13:14 UTC (permalink / raw)
To: deller, daniel, sam, javierm
Cc: linux-fbdev, dri-devel, linux-staging, linux-hyperv, linux-input,
Thomas Zimmermann, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
Dexuan Cui
In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de>
Generate callback functions for struct fb_ops with the fbdev macro
FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(). Initialize struct fb_ops to
the generated functions with fbdev initializer macros.
The hyperv_fb driver is incomplete in its handling of deferred I/O
and damage framebuffers. Write operations do no trigger damage handling.
Fixing this is beyond the scope of this patch.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
---
drivers/video/fbdev/Kconfig | 5 +---
drivers/video/fbdev/hyperv_fb.c | 48 ++++++++++-----------------------
2 files changed, 15 insertions(+), 38 deletions(-)
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 79b1e4e542e7..4455bfd57f0e 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1905,11 +1905,8 @@ config FB_BROADSHEET
config FB_HYPERV
tristate "Microsoft Hyper-V Synthetic Video support"
depends on FB && HYPERV
- select FB_CFB_FILLRECT
- select FB_CFB_COPYAREA
- select FB_CFB_IMAGEBLIT
- select FB_DEFERRED_IO
select DMA_CMA if HAVE_DMA_CONTIGUOUS && CMA
+ select FB_IOMEM_HELPERS_DEFERRED
select VIDEO_NOMODESET
help
This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index b9965cbdd764..2e27c6bd8044 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -848,58 +848,38 @@ static int hvfb_blank(int blank, struct fb_info *info)
return 1; /* get fb_blank to set the colormap to all black */
}
-static void hvfb_cfb_fillrect(struct fb_info *p,
- const struct fb_fillrect *rect)
+static void hvfb_ops_damage_range(struct fb_info *info, off_t off, size_t len)
{
- struct hvfb_par *par = p->par;
-
- cfb_fillrect(p, rect);
- if (par->synchronous_fb)
- synthvid_update(p, 0, 0, INT_MAX, INT_MAX);
- else
- hvfb_ondemand_refresh_throttle(par, rect->dx, rect->dy,
- rect->width, rect->height);
+ /* TODO: implement damage handling */
}
-static void hvfb_cfb_copyarea(struct fb_info *p,
- const struct fb_copyarea *area)
+static void hvfb_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
{
- struct hvfb_par *par = p->par;
+ struct hvfb_par *par = info->par;
- cfb_copyarea(p, area);
if (par->synchronous_fb)
- synthvid_update(p, 0, 0, INT_MAX, INT_MAX);
+ synthvid_update(info, 0, 0, INT_MAX, INT_MAX);
else
- hvfb_ondemand_refresh_throttle(par, area->dx, area->dy,
- area->width, area->height);
+ hvfb_ondemand_refresh_throttle(par, x, y, width, height);
}
-static void hvfb_cfb_imageblit(struct fb_info *p,
- const struct fb_image *image)
-{
- struct hvfb_par *par = p->par;
-
- cfb_imageblit(p, image);
- if (par->synchronous_fb)
- synthvid_update(p, 0, 0, INT_MAX, INT_MAX);
- else
- hvfb_ondemand_refresh_throttle(par, image->dx, image->dy,
- image->width, image->height);
-}
+/*
+ * TODO: GEN1 codepaths allocate from system or DMA-able memory. Fix the
+ * driver to use the _SYSMEM_ or _DMAMEM_ helpers in these cases.
+ */
+FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(hvfb_ops,
+ hvfb_ops_damage_range,
+ hvfb_ops_damage_area)
static const struct fb_ops hvfb_ops = {
.owner = THIS_MODULE,
+ FB_DEFAULT_DEFERRED_OPS(hvfb_ops),
.fb_check_var = hvfb_check_var,
.fb_set_par = hvfb_set_par,
.fb_setcolreg = hvfb_setcolreg,
- .fb_fillrect = hvfb_cfb_fillrect,
- .fb_copyarea = hvfb_cfb_copyarea,
- .fb_imageblit = hvfb_cfb_imageblit,
.fb_blank = hvfb_blank,
- .fb_mmap = fb_deferred_io_mmap,
};
-
/* Get options from kernel paramenter "video=" */
static void hvfb_get_option(struct fb_info *info)
{
--
2.41.0
^ permalink raw reply related
* [PATCH 3/8] fbdev: Add Kconfig macro FB_IOMEM_HELPERS_DEFERRED
From: Thomas Zimmermann @ 2023-08-28 13:14 UTC (permalink / raw)
To: deller, daniel, sam, javierm
Cc: linux-fbdev, dri-devel, linux-staging, linux-hyperv, linux-input,
Thomas Zimmermann
In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de>
The new Kconfig macro FB_IOMEM_HELPERS_DEFERRED selects fbdev's
helpers for device I/O memory and deferred I/O. Drivers should
use it if they perform damage updates on device I/O memory.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/video/fbdev/core/Kconfig | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/video/fbdev/core/Kconfig b/drivers/video/fbdev/core/Kconfig
index baf7e852c75b..e80d6429f76a 100644
--- a/drivers/video/fbdev/core/Kconfig
+++ b/drivers/video/fbdev/core/Kconfig
@@ -151,6 +151,12 @@ config FB_IOMEM_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_IMAGEBLIT
+config FB_IOMEM_HELPERS_DEFERRED
+ bool
+ depends on FB_CORE
+ select FB_DEFERRED_IO
+ select FB_IOMEM_HELPERS
+
config FB_SYSMEM_HELPERS
bool
depends on FB_CORE
--
2.41.0
^ permalink raw reply related
* [PATCH 5/8] hid: Remove trailing whitespace
From: Thomas Zimmermann @ 2023-08-28 13:14 UTC (permalink / raw)
To: deller, daniel, sam, javierm
Cc: linux-fbdev, dri-devel, linux-staging, linux-hyperv, linux-input,
Thomas Zimmermann, Jiri Kosina, Benjamin Tissoires
In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de>
Fix coding style in Kconfig. No functional changes.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/hid/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index e11c1c803676..b50054a41c10 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -1037,7 +1037,7 @@ config HID_SONY
* Guitar Hero PS3 and PC guitar dongles
config SONY_FF
- bool "Sony PS2/3/4 accessories force feedback support"
+ bool "Sony PS2/3/4 accessories force feedback support"
depends on HID_SONY
select INPUT_FF_MEMLESS
help
--
2.41.0
^ permalink raw reply related
* [PATCH 1/8] fbdev/smscufx: Use fb_ops helpers for deferred I/O
From: Thomas Zimmermann @ 2023-08-28 13:14 UTC (permalink / raw)
To: deller, daniel, sam, javierm
Cc: linux-fbdev, dri-devel, linux-staging, linux-hyperv, linux-input,
Thomas Zimmermann, Steve Glendinning
In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de>
Generate callback functions for struct fb_ops with the fbdev macro
FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to
the generated functions with fbdev initializer macros.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
---
drivers/video/fbdev/smscufx.c | 85 +++++++++--------------------------
1 file changed, 22 insertions(+), 63 deletions(-)
diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c
index 387d18706fec..90a77d19b236 100644
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -894,64 +894,6 @@ static int ufx_handle_damage(struct ufx_data *dev, int x, int y,
return 0;
}
-/* Path triggered by usermode clients who write to filesystem
- * e.g. cat filename > /dev/fb1
- * Not used by X Windows or text-mode console. But useful for testing.
- * Slow because of extra copy and we must assume all pixels dirty. */
-static ssize_t ufx_ops_write(struct fb_info *info, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- ssize_t result;
- struct ufx_data *dev = info->par;
- u32 offset = (u32) *ppos;
-
- result = fb_sys_write(info, buf, count, ppos);
-
- if (result > 0) {
- int start = max((int)(offset / info->fix.line_length), 0);
- int lines = min((u32)((result / info->fix.line_length) + 1),
- (u32)info->var.yres);
-
- ufx_handle_damage(dev, 0, start, info->var.xres, lines);
- }
-
- return result;
-}
-
-static void ufx_ops_copyarea(struct fb_info *info,
- const struct fb_copyarea *area)
-{
-
- struct ufx_data *dev = info->par;
-
- sys_copyarea(info, area);
-
- ufx_handle_damage(dev, area->dx, area->dy,
- area->width, area->height);
-}
-
-static void ufx_ops_imageblit(struct fb_info *info,
- const struct fb_image *image)
-{
- struct ufx_data *dev = info->par;
-
- sys_imageblit(info, image);
-
- ufx_handle_damage(dev, image->dx, image->dy,
- image->width, image->height);
-}
-
-static void ufx_ops_fillrect(struct fb_info *info,
- const struct fb_fillrect *rect)
-{
- struct ufx_data *dev = info->par;
-
- sys_fillrect(info, rect);
-
- ufx_handle_damage(dev, rect->dx, rect->dy, rect->width,
- rect->height);
-}
-
/* NOTE: fb_defio.c is holding info->fbdefio.mutex
* Touching ANY framebuffer memory that triggers a page fault
* in fb_defio will cause a deadlock, when it also tries to
@@ -1279,14 +1221,31 @@ static int ufx_ops_blank(int blank_mode, struct fb_info *info)
return 0;
}
+static void ufx_ops_damage_range(struct fb_info *info, off_t off, size_t len)
+{
+ struct ufx_data *dev = info->par;
+ int start = max((int)(off / info->fix.line_length), 0);
+ int lines = min((u32)((len / info->fix.line_length) + 1), (u32)info->var.yres);
+
+ ufx_handle_damage(dev, 0, start, info->var.xres, lines);
+}
+
+static void ufx_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
+{
+ struct ufx_data *dev = info->par;
+
+ ufx_handle_damage(dev, x, y, width, height);
+}
+
+FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(ufx_ops,
+ ufx_ops_damage_range,
+ ufx_ops_damage_area)
+
static const struct fb_ops ufx_ops = {
.owner = THIS_MODULE,
- .fb_read = fb_sys_read,
- .fb_write = ufx_ops_write,
+ __FB_DEFAULT_DEFERRED_OPS_RDWR(ufx_ops),
.fb_setcolreg = ufx_ops_setcolreg,
- .fb_fillrect = ufx_ops_fillrect,
- .fb_copyarea = ufx_ops_copyarea,
- .fb_imageblit = ufx_ops_imageblit,
+ __FB_DEFAULT_DEFERRED_OPS_DRAW(ufx_ops),
.fb_mmap = ufx_ops_mmap,
.fb_ioctl = ufx_ops_ioctl,
.fb_open = ufx_ops_open,
--
2.41.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox