Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH v1 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev
From: Andy Shevchenko @ 2023-01-10 13:59 UTC (permalink / raw)
  To: linux-input, linux-kernel; +Cc: Jiri Kosina, Benjamin Tissoires
In-Reply-To: <Y6wNX12SyXpU5UKI@smile.fi.intel.com>

On Wed, Dec 28, 2022 at 11:33:19AM +0200, Andy Shevchenko wrote:
> On Tue, Nov 22, 2022 at 09:18:20PM +0200, Andy Shevchenko wrote:
> > The driver is enumerated on ACPI platforms, so adev is valid.
> > Since there is no valid I²C ID table provided, there is no
> > possibility to bind a device to this driver via user space.
> > Hence, drop unneeded NULL check of adev.
> 
> Is there any comment on this?
> Can it be applied?

Whom should I ask about this series?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* Re: [PATCH] Input: i8042 - add Clevo PCX0DX to i8042 quirk table
From: Hans de Goede @ 2023-01-10 13:49 UTC (permalink / raw)
  To: Werner Sembach, dmitry.torokhov, mkorpershoek, chenhuacai, tiwai,
	wsa+renesas, linux-input, linux-kernel
In-Reply-To: <20230110134524.553620-1-wse@tuxedocomputers.com>

Hi,

On 1/10/23 14:45, Werner Sembach wrote:
> The Clevo PCX0DX/TUXEDO XP1511, need quirks for the keyboard to not be
> occasionally unresponsive after resume.
> 
> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
> Cc: stable@vger.kernel.org

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/serio/i8042-acpipnpio.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
> index 46f8a694291ed..efc61736099b9 100644
> --- a/drivers/input/serio/i8042-acpipnpio.h
> +++ b/drivers/input/serio/i8042-acpipnpio.h
> @@ -1238,6 +1238,13 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
>  		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
>  					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
>  	},
> +	{
> +		.matches = {
> +			DMI_MATCH(DMI_BOARD_NAME, "PCX0DX"),
> +		},
> +		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
> +					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
> +	},
>  	{
>  		.matches = {
>  			DMI_MATCH(DMI_BOARD_NAME, "X170SM"),


^ permalink raw reply

* Re: [PATCH v2 0/2] Input: cap11xx add support for cap1203, cap1293 and cap1298
From: Krzysztof Kozlowski @ 2023-01-10 10:22 UTC (permalink / raw)
  To: Jiri Valek - 2N
  Cc: devicetree, dmitry.torokhov, krzysztof.kozlowski+dt, linux-input,
	linux-kernel, robh+dt, u.kleine-koenig
In-Reply-To: <20230104135951.930783-1-jiriv@axis.com>

On 04/01/2023 14:59, Jiri Valek - 2N wrote:
> PATCH 1 - add compatible string for new models
> PATCH 2 - add support for new models into driver
> 

Do not attach (thread) your patchsets to some other threads (unrelated
or older versions). This buries them deep in the mailbox and might
interfere with applying entire sets.


Best regards,
Krzysztof


^ permalink raw reply

* Re: [PATCH] HID: add KEY_CAMERA_FOCUS event in HID
From: qi feng @ 2023-01-10  9:53 UTC (permalink / raw)
  To: jikos; +Cc: linux-input, linux-kernel, fengqi, benjamin.tissoires, rydberg
In-Reply-To: <20230109123216.4974-1-fengqi706@gmail.com>

loop more


Qi Feng <fengqi706@gmail.com> 于2023年1月9日周一 20:32写道:
>
> From: fengqi <fengqi@xiaomi.com>
>
> Our HID device need KEY_CAMERA_FOCUS event to control camera, but this
> event is non-existent in current HID driver.
> So we add this event in hid-input.c
>
> Signed-off-by: fengqi <fengqi@xiaomi.com>
> ---
>  drivers/hid/hid-input.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 9b59e436df0a..22cca3406b5c 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -1105,6 +1105,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
>                 case 0x0e5: map_key_clear(KEY_BASSBOOST);       break;
>                 case 0x0e9: map_key_clear(KEY_VOLUMEUP);        break;
>                 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN);      break;
> +               case 0x0ee: map_key_clear(KEY_CAMERA_FOCUS);    break;
>                 case 0x0f5: map_key_clear(KEY_SLOW);            break;
>
>                 case 0x181: map_key_clear(KEY_BUTTONCONFIG);    break;
> --
> 2.39.0
>

^ permalink raw reply

* Re: [PATCH HID for-next v1 1/9] selftests: hid: add vmtest.sh
From: Benjamin Tissoires @ 2023-01-10  9:43 UTC (permalink / raw)
  To: sdf
  Cc: Greg KH, Jiri Kosina, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Dmitry Torokhov, Tero Kristo, linux-kernel,
	linux-input, netdev, bpf, linux-kselftest
In-Reply-To: <Y7xVY30ITrZrC1dm@google.com>

On Mon, Jan 9, 2023 at 6:56 PM <sdf@google.com> wrote:
>
> On 01/09, Stanislav Fomichev wrote:
> > On 01/06, Benjamin Tissoires wrote:
> > > Similar-ish in many points from the script in selftests/bpf, with a few
> > > differences:
> > > - relies on boot2container instead of a plain qemu image (meaning that
> > >   we can take any container in a registry as a base)
> > > - runs in the hid selftest dir, and such uses the test program from
> > there
> > > - the working directory to store the config is in
> > >   tools/selftests/hid/results
> > >
> > > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>
> > Sorry, I've completely missed this. I wasn't on CC and assumed
> > that was some sort of a repost. Going through the changes right now.
>
> Hmmm, or maybe I shouldn't? This seems to be bases on some other tree;
> can't find tools/testing/selftests/hid/Makefile (from patch #2) in neither
> bpf nor bpf-next.


These changes are based on
https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/ branch
for-6.3/hid-bpf, so going through the HID tree, not the bpf one.

I Cce-ed the bpf mailing list for visibility, in case I made an
obvious error, but this doesn't impact bpf core, so reviews are
appreciated, but not mandatory from the bpf side of things :)


>
>
> Alexei/Daniel/Andrii, what's the process with these series?
>
> > One question here: is it worth it extending bpf/vmtest.sh instead
> > to support boot2container? Why new script with a bunch of copy-paste
> > is a better deal?

Good question. There were a few things that made me copy/paste part of
the script:
- the bpf one is relying on the bpf rootfs image that, as a subsystem
maintainer of another subsystem than bpf don't control
- the bpf one is hardcoding which program to launch, and I want another one
- the bpf one is in a different directory which would feel weird to
call when running selftests/hid
- I want a minimum control over the script so that a change in the bpf
tree doesn't accidentally break the hid tree

I think using the boot2container initramfs solves the rootfs issue,
because the initramfs is generic and just consists of a script around
podman to start a container. This way I can run the test suite on any
distribution without having to build any distro image. I should also
be able to start a scratch container without anything in it given that
the only thing that matters is the binary we start as a command
(though we won't be able to start a shell in the target VM).

Solving the second and third point could probably be done by
encapsulating the call to bpf/vmtest.sh from hid.

But for the fourth point, I believe that the bpf script is not generic
enough to be reused by other subsystems as it relies on the bpf CI,
mostly to generate the rootfs.

Also note that boot2container is a little bit more verbose in terms of
logs, as it's not just a plain qemu boot to a known rootfs, but it
starts podman and another container at the end to gather the results.

So maybe a solution would be to add a vmtest make target at the
selftests root directory, that would be generic enough to be run in
any subsystem. There are a few other users of qemu in selftests, but
each of them has a slightly different use of qemu.

Also, FWIW, boot2container is currently only providing initramfs for
x86_64 and arm64. Thus, using boot2container now for bpf means that we
would drop s390x, which is probably not the best move forward. We can
surely extend the targets, but not sure what plans Martin has on this
side.

For reference, boot2container project:
https://gitlab.freedesktop.org/mupuf/boot2container/

Cheers,
Benjamin

>
> > > ---
> > >  tools/testing/selftests/hid/.gitignore    |   1 +
> > >  tools/testing/selftests/hid/config.common | 241 ++++++++++++++++++
> > >  tools/testing/selftests/hid/config.x86_64 |   4 +
> > >  tools/testing/selftests/hid/vmtest.sh     | 284 ++++++++++++++++++++++
> > >  4 files changed, 530 insertions(+)
> > >  create mode 100644 tools/testing/selftests/hid/config.common
> > >  create mode 100644 tools/testing/selftests/hid/config.x86_64
> > >  create mode 100755 tools/testing/selftests/hid/vmtest.sh
> > >
> > > diff --git a/tools/testing/selftests/hid/.gitignore
> > b/tools/testing/selftests/hid/.gitignore
> > > index a462ca6ab2c0..995af0670f69 100644
> > > --- a/tools/testing/selftests/hid/.gitignore
> > > +++ b/tools/testing/selftests/hid/.gitignore
> > > @@ -2,3 +2,4 @@ bpftool
> > >  *.skel.h
> > >  /tools
> > >  hid_bpf
> > > +results
> > > diff --git a/tools/testing/selftests/hid/config.common
> > b/tools/testing/selftests/hid/config.common
> > > new file mode 100644
> > > index 000000000000..0617275d93cc
> > > --- /dev/null
> > > +++ b/tools/testing/selftests/hid/config.common
> > > @@ -0,0 +1,241 @@
> > > +CONFIG_9P_FS_POSIX_ACL=y
> > > +CONFIG_9P_FS_SECURITY=y
> > > +CONFIG_9P_FS=y
> > > +CONFIG_AUDIT=y
> > > +CONFIG_BINFMT_MISC=y
> > > +CONFIG_BLK_CGROUP_IOLATENCY=y
> > > +CONFIG_BLK_CGROUP=y
> > > +CONFIG_BLK_DEV_BSGLIB=y
> > > +CONFIG_BLK_DEV_IO_TRACE=y
> > > +CONFIG_BLK_DEV_RAM_SIZE=16384
> > > +CONFIG_BLK_DEV_RAM=y
> > > +CONFIG_BLK_DEV_THROTTLING=y
> > > +CONFIG_BONDING=y
> > > +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
> > > +CONFIG_BOOTTIME_TRACING=y
> > > +CONFIG_BSD_DISKLABEL=y
> > > +CONFIG_BSD_PROCESS_ACCT=y
> > > +CONFIG_CFS_BANDWIDTH=y
> > > +CONFIG_CGROUP_CPUACCT=y
> > > +CONFIG_CGROUP_DEBUG=y
> > > +CONFIG_CGROUP_DEVICE=y
> > > +CONFIG_CGROUP_FREEZER=y
> > > +CONFIG_CGROUP_HUGETLB=y
> > > +CONFIG_CGROUP_NET_CLASSID=y
> > > +CONFIG_CGROUP_NET_PRIO=y
> > > +CONFIG_CGROUP_PERF=y
> > > +CONFIG_CGROUP_PIDS=y
> > > +CONFIG_CGROUP_RDMA=y
> > > +CONFIG_CGROUP_SCHED=y
> > > +CONFIG_CGROUPS=y
> > > +CONFIG_CGROUP_WRITEBACK=y
> > > +CONFIG_CMA_AREAS=7
> > > +CONFIG_CMA=y
> > > +CONFIG_COMPAT_32BIT_TIME=y
> > > +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
> > > +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
> > > +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> > > +CONFIG_CPU_FREQ_GOV_USERSPACE=y
> > > +CONFIG_CPU_FREQ_STAT=y
> > > +CONFIG_CPU_IDLE_GOV_LADDER=y
> > > +CONFIG_CPUSETS=y
> > > +CONFIG_CRC_T10DIF=y
> > > +CONFIG_CRYPTO_BLAKE2B=y
> > > +CONFIG_CRYPTO_DEV_VIRTIO=y
> > > +CONFIG_CRYPTO_SEQIV=y
> > > +CONFIG_CRYPTO_XXHASH=y
> > > +CONFIG_DCB=y
> > > +CONFIG_DEBUG_ATOMIC_SLEEP=y
> > > +CONFIG_DEBUG_CREDENTIALS=y
> > > +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
> > > +CONFIG_DEBUG_MEMORY_INIT=y
> > > +CONFIG_DEFAULT_FQ_CODEL=y
> > > +CONFIG_DEFAULT_RENO=y
> > > +CONFIG_DEFAULT_SECURITY_DAC=y
> > > +CONFIG_DEVTMPFS_MOUNT=y
> > > +CONFIG_DEVTMPFS=y
> > > +CONFIG_DMA_CMA=y
> > > +CONFIG_DNS_RESOLVER=y
> > > +CONFIG_EFI_STUB=y
> > > +CONFIG_EFI=y
> > > +CONFIG_EXPERT=y
> > > +CONFIG_EXT4_FS_POSIX_ACL=y
> > > +CONFIG_EXT4_FS_SECURITY=y
> > > +CONFIG_EXT4_FS=y
> > > +CONFIG_FAIL_FUNCTION=y
> > > +CONFIG_FAULT_INJECTION_DEBUG_FS=y
> > > +CONFIG_FAULT_INJECTION=y
> > > +CONFIG_FB_MODE_HELPERS=y
> > > +CONFIG_FB_TILEBLITTING=y
> > > +CONFIG_FB_VESA=y
> > > +CONFIG_FB=y
> > > +CONFIG_FONT_8x16=y
> > > +CONFIG_FONT_MINI_4x6=y
> > > +CONFIG_FONTS=y
> > > +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
> > > +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
> > > +CONFIG_FRAMEBUFFER_CONSOLE=y
> > > +CONFIG_FUSE_FS=y
> > > +CONFIG_FW_LOADER_USER_HELPER=y
> > > +CONFIG_GART_IOMMU=y
> > > +CONFIG_GENERIC_PHY=y
> > > +CONFIG_HARDLOCKUP_DETECTOR=y
> > > +CONFIG_HIGH_RES_TIMERS=y
> > > +CONFIG_HPET=y
> > > +CONFIG_HUGETLBFS=y
> > > +CONFIG_HUGETLB_PAGE=y
> > > +CONFIG_HWPOISON_INJECT=y
> > > +CONFIG_HZ_1000=y
> > > +CONFIG_INET=y
> > > +CONFIG_INTEL_POWERCLAMP=y
> > > +CONFIG_IP6_NF_FILTER=y
> > > +CONFIG_IP6_NF_IPTABLES=y
> > > +CONFIG_IP6_NF_NAT=y
> > > +CONFIG_IP6_NF_TARGET_MASQUERADE=y
> > > +CONFIG_IP_ADVANCED_ROUTER=y
> > > +CONFIG_IP_MROUTE=y
> > > +CONFIG_IP_MULTICAST=y
> > > +CONFIG_IP_MULTIPLE_TABLES=y
> > > +CONFIG_IP_NF_FILTER=y
> > > +CONFIG_IP_NF_IPTABLES=y
> > > +CONFIG_IP_NF_NAT=y
> > > +CONFIG_IP_NF_TARGET_MASQUERADE=y
> > > +CONFIG_IP_PIMSM_V1=y
> > > +CONFIG_IP_PIMSM_V2=y
> > > +CONFIG_IP_ROUTE_MULTIPATH=y
> > > +CONFIG_IP_ROUTE_VERBOSE=y
> > > +CONFIG_IPV6_MIP6=y
> > > +CONFIG_IPV6_ROUTE_INFO=y
> > > +CONFIG_IPV6_ROUTER_PREF=y
> > > +CONFIG_IPV6_SEG6_LWTUNNEL=y
> > > +CONFIG_IPV6_SUBTREES=y
> > > +CONFIG_IRQ_POLL=y
> > > +CONFIG_JUMP_LABEL=y
> > > +CONFIG_KARMA_PARTITION=y
> > > +CONFIG_KEXEC=y
> > > +CONFIG_KPROBES=y
> > > +CONFIG_KSM=y
> > > +CONFIG_LEGACY_VSYSCALL_NONE=y
> > > +CONFIG_LOG_BUF_SHIFT=21
> > > +CONFIG_LOG_CPU_MAX_BUF_SHIFT=0
> > > +CONFIG_LOGO=y
> > > +CONFIG_LSM="selinux,bpf,integrity"
> > > +CONFIG_MAC_PARTITION=y
> > > +CONFIG_MAGIC_SYSRQ=y
> > > +CONFIG_MCORE2=y
> > > +CONFIG_MEMCG=y
> > > +CONFIG_MEMORY_FAILURE=y
> > > +CONFIG_MINIX_SUBPARTITION=y
> > > +CONFIG_MODULES=y
> > > +CONFIG_NAMESPACES=y
> > > +CONFIG_NET_9P_VIRTIO=y
> > > +CONFIG_NET_9P=y
> > > +CONFIG_NET_ACT_BPF=y
> > > +CONFIG_NET_CLS_CGROUP=y
> > > +CONFIG_NETDEVICES=y
> > > +CONFIG_NET_EMATCH=y
> > > +CONFIG_NETFILTER_NETLINK_LOG=y
> > > +CONFIG_NETFILTER_NETLINK_QUEUE=y
> > > +CONFIG_NETFILTER_XTABLES=y
> > > +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
> > > +CONFIG_NETFILTER_XT_MATCH_BPF=y
> > > +CONFIG_NETFILTER_XT_MATCH_COMMENT=y
> > > +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
> > > +CONFIG_NETFILTER_XT_MATCH_MARK=y
> > > +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
> > > +CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
> > > +CONFIG_NETFILTER_XT_NAT=y
> > > +CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
> > > +CONFIG_NET_IPGRE_BROADCAST=y
> > > +CONFIG_NET_L3_MASTER_DEV=y
> > > +CONFIG_NETLABEL=y
> > > +CONFIG_NET_SCH_DEFAULT=y
> > > +CONFIG_NET_SCHED=y
> > > +CONFIG_NET_SCH_FQ_CODEL=y
> > > +CONFIG_NET_TC_SKB_EXT=y
> > > +CONFIG_NET_VRF=y
> > > +CONFIG_NET=y
> > > +CONFIG_NF_CONNTRACK=y
> > > +CONFIG_NF_NAT_MASQUERADE=y
> > > +CONFIG_NF_NAT=y
> > > +CONFIG_NLS_ASCII=y
> > > +CONFIG_NLS_CODEPAGE_437=y
> > > +CONFIG_NLS_DEFAULT="utf8"
> > > +CONFIG_NO_HZ=y
> > > +CONFIG_NR_CPUS=128
> > > +CONFIG_NUMA_BALANCING=y
> > > +CONFIG_NUMA=y
> > > +CONFIG_NVMEM=y
> > > +CONFIG_OSF_PARTITION=y
> > > +CONFIG_OVERLAY_FS_INDEX=y
> > > +CONFIG_OVERLAY_FS_METACOPY=y
> > > +CONFIG_OVERLAY_FS_XINO_AUTO=y
> > > +CONFIG_OVERLAY_FS=y
> > > +CONFIG_PACKET=y
> > > +CONFIG_PANIC_ON_OOPS=y
> > > +CONFIG_PARTITION_ADVANCED=y
> > > +CONFIG_PCIEPORTBUS=y
> > > +CONFIG_PCI_IOV=y
> > > +CONFIG_PCI_MSI=y
> > > +CONFIG_PCI=y
> > > +CONFIG_PHYSICAL_ALIGN=0x1000000
> > > +CONFIG_POSIX_MQUEUE=y
> > > +CONFIG_POWER_SUPPLY=y
> > > +CONFIG_PREEMPT=y
> > > +CONFIG_PRINTK_TIME=y
> > > +CONFIG_PROC_KCORE=y
> > > +CONFIG_PROFILING=y
> > > +CONFIG_PROVE_LOCKING=y
> > > +CONFIG_PTP_1588_CLOCK=y
> > > +CONFIG_RC_DEVICES=y
> > > +CONFIG_RC_LOOPBACK=y
> > > +CONFIG_RCU_CPU_STALL_TIMEOUT=60
> > > +CONFIG_SCHED_STACK_END_CHECK=y
> > > +CONFIG_SCHEDSTATS=y
> > > +CONFIG_SECURITY_NETWORK=y
> > > +CONFIG_SECURITY_SELINUX=y
> > > +CONFIG_SERIAL_8250_CONSOLE=y
> > > +CONFIG_SERIAL_8250_DETECT_IRQ=y
> > > +CONFIG_SERIAL_8250_EXTENDED=y
> > > +CONFIG_SERIAL_8250_MANY_PORTS=y
> > > +CONFIG_SERIAL_8250_NR_UARTS=32
> > > +CONFIG_SERIAL_8250_RSA=y
> > > +CONFIG_SERIAL_8250_SHARE_IRQ=y
> > > +CONFIG_SERIAL_8250=y
> > > +CONFIG_SERIAL_NONSTANDARD=y
> > > +CONFIG_SERIO_LIBPS2=y
> > > +CONFIG_SGI_PARTITION=y
> > > +CONFIG_SMP=y
> > > +CONFIG_SOCK_CGROUP_DATA=y
> > > +CONFIG_SOLARIS_X86_PARTITION=y
> > > +CONFIG_SUN_PARTITION=y
> > > +CONFIG_SYNC_FILE=y
> > > +CONFIG_SYSVIPC=y
> > > +CONFIG_TASK_DELAY_ACCT=y
> > > +CONFIG_TASK_IO_ACCOUNTING=y
> > > +CONFIG_TASKSTATS=y
> > > +CONFIG_TASK_XACCT=y
> > > +CONFIG_TCP_CONG_ADVANCED=y
> > > +CONFIG_TCP_MD5SIG=y
> > > +CONFIG_TLS=y
> > > +CONFIG_TMPFS_POSIX_ACL=y
> > > +CONFIG_TMPFS=y
> > > +CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
> > > +CONFIG_TRANSPARENT_HUGEPAGE=y
> > > +CONFIG_TUN=y
> > > +CONFIG_UNIXWARE_DISKLABEL=y
> > > +CONFIG_UNIX=y
> > > +CONFIG_USER_NS=y
> > > +CONFIG_VALIDATE_FS_PARSER=y
> > > +CONFIG_VETH=y
> > > +CONFIG_VIRT_DRIVERS=y
> > > +CONFIG_VIRTIO_BALLOON=y
> > > +CONFIG_VIRTIO_BLK=y
> > > +CONFIG_VIRTIO_CONSOLE=y
> > > +CONFIG_VIRTIO_FS=y
> > > +CONFIG_VIRTIO_NET=y
> > > +CONFIG_VIRTIO_PCI=y
> > > +CONFIG_VLAN_8021Q=y
> > > +CONFIG_XFRM_SUB_POLICY=y
> > > +CONFIG_XFRM_USER=y
> > > +CONFIG_ZEROPLUS_FF=y
> > > diff --git a/tools/testing/selftests/hid/config.x86_64
> > b/tools/testing/selftests/hid/config.x86_64
> > > new file mode 100644
> > > index 000000000000..a8721f403c21
> > > --- /dev/null
> > > +++ b/tools/testing/selftests/hid/config.x86_64
> > > @@ -0,0 +1,4 @@
> > > +CONFIG_X86_ACPI_CPUFREQ=y
> > > +CONFIG_X86_CPUID=y
> > > +CONFIG_X86_MSR=y
> > > +CONFIG_X86_POWERNOW_K8=y
> > > diff --git a/tools/testing/selftests/hid/vmtest.sh
> > b/tools/testing/selftests/hid/vmtest.sh
> > > new file mode 100755
> > > index 000000000000..90f34150f257
> > > --- /dev/null
> > > +++ b/tools/testing/selftests/hid/vmtest.sh
> > > @@ -0,0 +1,284 @@
> > > +#!/bin/bash
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +
> > > +set -u
> > > +set -e
> > > +
> > > +# This script currently only works for x86_64
> > > +ARCH="$(uname -m)"
> > > +case "${ARCH}" in
> > > +x86_64)
> > > +   QEMU_BINARY=qemu-system-x86_64
> > > +   BZIMAGE="arch/x86/boot/bzImage"
> > > +   ;;
> > > +*)
> > > +   echo "Unsupported architecture"
> > > +   exit 1
> > > +   ;;
> > > +esac
> > > +DEFAULT_COMMAND="./hid_bpf"
> > > +SCRIPT_DIR="$(dirname $(realpath $0))"
> > > +OUTPUT_DIR="$SCRIPT_DIR/results"
> > >
> > +KCONFIG_REL_PATHS=("${SCRIPT_DIR}/config" "${SCRIPT_DIR}/config.common" "${SCRIPT_DIR}/config.${ARCH}")
> > >
> > +B2C_URL="https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/master/vm2c.py"
> > > +NUM_COMPILE_JOBS="$(nproc)"
> > > +LOG_FILE_BASE="$(date +"hid_selftests.%Y-%m-%d_%H-%M-%S")"
> > > +LOG_FILE="${LOG_FILE_BASE}.log"
> > > +EXIT_STATUS_FILE="${LOG_FILE_BASE}.exit_status"
> > > +CONTAINER_IMAGE="registry.fedoraproject.org/fedora:36"
> > > +
> > > +usage()
> > > +{
> > > +   cat <<EOF
> > > +Usage: $0 [-i] [-s] [-d <output_dir>] -- [<command>]
> > > +
> > > +<command> is the command you would normally run when you are in
> > > +tools/testing/selftests/bpf. e.g:
> > > +
> > > +   $0 -- ./hid_bpf
> > > +
> > > +If no command is specified and a debug shell (-s) is not requested,
> > > +"${DEFAULT_COMMAND}" will be run by default.
> > > +
> > > +If you build your kernel using KBUILD_OUTPUT= or O= options, these
> > > +can be passed as environment variables to the script:
> > > +
> > > +  O=<kernel_build_path> $0 -- ./hid_bpf
> > > +
> > > +or
> > > +
> > > +  KBUILD_OUTPUT=<kernel_build_path> $0 -- ./hid_bpf
> > > +
> > > +Options:
> > > +
> > > +   -u)             Update the boot2container script to a newer version.
> > > +   -d)             Update the output directory (default: ${OUTPUT_DIR})
> > > +   -j)             Number of jobs for compilation, similar to -j in make
> > > +                   (default: ${NUM_COMPILE_JOBS})
> > > +   -s)             Instead of powering off the VM, start an interactive
> > > +                   shell. If <command> is specified, the shell runs after
> > > +                   the command finishes executing
> > > +EOF
> > > +}
> > > +
> > > +download()
> > > +{
> > > +   local file="$1"
> > > +
> > > +   echo "Downloading $file..." >&2
> > > +   curl -Lsf "$file" -o "${@:2}"
> > > +}
> > > +
> > > +recompile_kernel()
> > > +{
> > > +   local kernel_checkout="$1"
> > > +   local make_command="$2"
> > > +
> > > +   cd "${kernel_checkout}"
> > > +
> > > +   ${make_command} olddefconfig
> > > +   ${make_command}
> > > +}
> > > +
> > > +update_selftests()
> > > +{
> > > +   local kernel_checkout="$1"
> > > +   local selftests_dir="${kernel_checkout}/tools/testing/selftests/hid"
> > > +
> > > +   cd "${selftests_dir}"
> > > +   ${make_command}
> > > +}
> > > +
> > > +run_vm()
> > > +{
> > > +   local b2c="$1"
> > > +   local kernel_bzimage="$2"
> > > +   local command="$3"
> > > +   local post_command=""
> > > +
> > > +   if ! which "${QEMU_BINARY}" &> /dev/null; then
> > > +           cat <<EOF
> > > +Could not find ${QEMU_BINARY}
> > > +Please install qemu or set the QEMU_BINARY environment variable.
> > > +EOF
> > > +           exit 1
> > > +   fi
> > > +
> > > +   # alpine (used in post-container requires the PATH to have /bin
> > > +   export PATH=$PATH:/bin
> > > +
> > > +   if [[ "${debug_shell}" != "yes" ]]
> > > +   then
> > > +           touch ${OUTPUT_DIR}/${LOG_FILE}
> > > +           command="mount bpffs -t bpf /sys/fs/bpf/; set -o pipefail ;
> > ${command} 2>&1 | tee ${OUTPUT_DIR}/${LOG_FILE}"
> > > +           post_command="cat ${OUTPUT_DIR}/${LOG_FILE}"
> > > +   else
> > > +           command="mount bpffs -t bpf /sys/fs/bpf/; ${command}"
> > > +   fi
> > > +
> > > +   set +e
> > > +   $b2c --command "${command}" \
> > > +        --kernel ${kernel_bzimage} \
> > > +        --workdir ${OUTPUT_DIR} \
> > > +        --image ${CONTAINER_IMAGE}
> > > +
> > > +   echo $? > ${OUTPUT_DIR}/${EXIT_STATUS_FILE}
> > > +
> > > +   set -e
> > > +
> > > +   ${post_command}
> > > +}
> > > +
> > > +is_rel_path()
> > > +{
> > > +   local path="$1"
> > > +
> > > +   [[ ${path:0:1} != "/" ]]
> > > +}
> > > +
> > > +do_update_kconfig()
> > > +{
> > > +   local kernel_checkout="$1"
> > > +   local kconfig_file="$2"
> > > +
> > > +   rm -f "$kconfig_file" 2> /dev/null
> > > +
> > > +   for config in "${KCONFIG_REL_PATHS[@]}"; do
> > > +           local kconfig_src="${config}"
> > > +           cat "$kconfig_src" >> "$kconfig_file"
> > > +   done
> > > +}
> > > +
> > > +update_kconfig()
> > > +{
> > > +   local kernel_checkout="$1"
> > > +   local kconfig_file="$2"
> > > +
> > > +   if [[ -f "${kconfig_file}" ]]; then
> > > +           local local_modified="$(stat -c %Y "${kconfig_file}")"
> > > +
> > > +           for config in "${KCONFIG_REL_PATHS[@]}"; do
> > > +                   local kconfig_src="${config}"
> > > +                   local src_modified="$(stat -c %Y "${kconfig_src}")"
> > > +                   # Only update the config if it has been updated after the
> > > +                   # previously cached config was created. This avoids
> > > +                   # unnecessarily compiling the kernel and selftests.
> > > +                   if [[ "${src_modified}" -gt "${local_modified}" ]]; then
> > > +                           do_update_kconfig "$kernel_checkout" "$kconfig_file"
> > > +                           # Once we have found one outdated configuration
> > > +                           # there is no need to check other ones.
> > > +                           break
> > > +                   fi
> > > +           done
> > > +   else
> > > +           do_update_kconfig "$kernel_checkout" "$kconfig_file"
> > > +   fi
> > > +}
> > > +
> > > +main()
> > > +{
> > > +   local script_dir="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" &&
> > pwd -P)"
> > > +   local kernel_checkout=$(realpath "${script_dir}"/../../../../)
> > > +   # By default the script searches for the kernel in the checkout
> > directory but
> > > +   # it also obeys environment variables O= and KBUILD_OUTPUT=
> > > +   local kernel_bzimage="${kernel_checkout}/${BZIMAGE}"
> > > +   local command="${DEFAULT_COMMAND}"
> > > +   local update_b2c="no"
> > > +   local debug_shell="no"
> > > +
> > > +   while getopts ':hsud:j:' opt; do
> > > +           case ${opt} in
> > > +           u)
> > > +                   update_b2c="yes"
> > > +                   ;;
> > > +           d)
> > > +                   OUTPUT_DIR="$OPTARG"
> > > +                   ;;
> > > +           j)
> > > +                   NUM_COMPILE_JOBS="$OPTARG"
> > > +                   ;;
> > > +           s)
> > > +                   command="/bin/sh"
> > > +                   debug_shell="yes"
> > > +                   ;;
> > > +           h)
> > > +                   usage
> > > +                   exit 0
> > > +                   ;;
> > > +           \? )
> > > +                   echo "Invalid Option: -$OPTARG"
> > > +                   usage
> > > +                   exit 1
> > > +                   ;;
> > > +           : )
> > > +                   echo "Invalid Option: -$OPTARG requires an argument"
> > > +                   usage
> > > +                   exit 1
> > > +                   ;;
> > > +           esac
> > > +   done
> > > +   shift $((OPTIND -1))
> > > +
> > > +   # trap 'catch "$?"' EXIT
> > > +
> > > +   if [[ "${debug_shell}" == "no" ]]; then
> > > +           if [[ $# -eq 0 ]]; then
> > > +                   echo "No command specified, will run ${DEFAULT_COMMAND} in the vm"
> > > +           else
> > > +                   command="$@"
> > > +
> > > +                   if [[ "${command}" == "/bin/bash" || "${command}" == "bash" ]]
> > > +                   then
> > > +                           debug_shell="yes"
> > > +                   fi
> > > +           fi
> > > +   fi
> > > +
> > > +   local kconfig_file="${OUTPUT_DIR}/latest.config"
> > > +   local make_command="make -j ${NUM_COMPILE_JOBS}
> > KCONFIG_CONFIG=${kconfig_file}"
> > > +
> > > +   # Figure out where the kernel is being built.
> > > +   # O takes precedence over KBUILD_OUTPUT.
> > > +   if [[ "${O:=""}" != "" ]]; then
> > > +           if is_rel_path "${O}"; then
> > > +                   O="$(realpath "${PWD}/${O}")"
> > > +           fi
> > > +           kernel_bzimage="${O}/${BZIMAGE}"
> > > +           make_command="${make_command} O=${O}"
> > > +   elif [[ "${KBUILD_OUTPUT:=""}" != "" ]]; then
> > > +           if is_rel_path "${KBUILD_OUTPUT}"; then
> > > +                   KBUILD_OUTPUT="$(realpath "${PWD}/${KBUILD_OUTPUT}")"
> > > +           fi
> > > +           kernel_bzimage="${KBUILD_OUTPUT}/${BZIMAGE}"
> > > +           make_command="${make_command} KBUILD_OUTPUT=${KBUILD_OUTPUT}"
> > > +   fi
> > > +
> > > +   local b2c="${OUTPUT_DIR}/vm2c.py"
> > > +
> > > +   echo "Output directory: ${OUTPUT_DIR}"
> > > +
> > > +   mkdir -p "${OUTPUT_DIR}"
> > > +   update_kconfig "${kernel_checkout}" "${kconfig_file}"
> > > +
> > > +   recompile_kernel "${kernel_checkout}" "${make_command}"
> > > +
> > > +   if [[ "${update_b2c}" == "no" && ! -f "${b2c}" ]]; then
> > > +           echo "vm2c script not found in ${b2c}"
> > > +           update_b2c="yes"
> > > +   fi
> > > +
> > > +   if [[ "${update_b2c}" == "yes" ]]; then
> > > +           download $B2C_URL $b2c
> > > +           chmod +x $b2c
> > > +   fi
> > > +
> > > +   update_selftests "${kernel_checkout}" "${make_command}"
> > > +   run_vm $b2c "${kernel_bzimage}" "${command}"
> > > +   if [[ "${debug_shell}" != "yes" ]]; then
> > > +           echo "Logs saved in ${OUTPUT_DIR}/${LOG_FILE}"
> > > +   fi
> > > +
> > > +   exit $(cat ${OUTPUT_DIR}/${EXIT_STATUS_FILE})
> > > +}
> > > +
> > > +main "$@"
> > > --
> > > 2.38.1
> > >
>


^ permalink raw reply

* [PATCH v2] HID: Recognize sensors with application collections too.
From: Aditya Garg @ 2023-01-10  8:57 UTC (permalink / raw)
  To: Jiri Kosina, jkosina@suse.cz, benjamin.tissoires@redhat.com,
	jic23@kernel.org, srinivas.pandruvada@linux.intel.com,
	linux-input@vger.kernel.org, LKML, linux-iio@vger.kernel.org
  Cc: orlandoch.dev@gmail.com, ronald@innovation.ch
In-Reply-To: <01D620E2-18CA-40F6-A330-454CBC20C542@live.com>

From: Ronald Tschalär <ronald@innovation.ch>

According to HUTRR39 logical sensor devices may be nested inside
physical collections or may be specified in multiple top-level
application collections (see page 59, strategies 1 and 2). However,
the current code was only recognizing those with physical collections.

This issue turned up in the T2 MacBook Pro's which define the ALS in
a top-level application collection.

Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
Signed-off-by: Aditya Garg <gargaditya08@live.com>
—
V2 :- Add missing signed-off-by
 drivers/hid/hid-core.c       | 3 ++-
 drivers/hid/hid-sensor-hub.c | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b7f5566e338d..8fcd663b10e2 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -804,7 +804,8 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 	int i;
 
 	if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
-	    type == HID_COLLECTION_PHYSICAL)
+	    (type == HID_COLLECTION_PHYSICAL ||
+	     type == HID_COLLECTION_APPLICATION))
 		hid->group = HID_GROUP_SENSOR_HUB;
 
 	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 6abd3e2a9094..d03dc4ca095f 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -397,7 +397,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
 		for (i = 0; i < report->maxfield; ++i) {
 			field = report->field[i];
 			if (field->maxusage) {
-				if (field->physical == usage_id &&
+				if ((field->physical == usage_id ||
+				     field->application == usage_id) &&
 					(field->logical == attr_usage_id ||
 					field->usage[0].hid ==
 							attr_usage_id) &&
@@ -506,7 +507,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
 					collection->usage);
 
 		callback = sensor_hub_get_callback(hdev,
-				report->field[i]->physical,
+				report->field[i]->physical ?:
+					report->field[i]->application,
 				report->field[i]->usage[0].collection_index,
 				&hsdev, &priv);
 		if (!callback) {
-- 
2.38.1


^ permalink raw reply related

* [PATCH RESEND] HID: Recognize sensors with application collections too.
From: Aditya Garg @ 2023-01-10  8:55 UTC (permalink / raw)
  To: Jiri Kosina, jkosina@suse.cz, benjamin.tissoires@redhat.com,
	jic23@kernel.org, srinivas.pandruvada@linux.intel.com,
	linux-input@vger.kernel.org, LKML, linux-iio@vger.kernel.org
  Cc: orlandoch.dev@gmail.com, ronald@innovation.ch
In-Reply-To: <8DA00FF4-DB08-4CEC-A5B4-47A71DC09C13@live.com>

From: Ronald Tschalär <ronald@innovation.ch>

According to HUTRR39 logical sensor devices may be nested inside
physical collections or may be specified in multiple top-level
application collections (see page 59, strategies 1 and 2). However,
the current code was only recognizing those with physical collections.

This issue turned up in the T2 MacBook Pro's which define the ALS in
a top-level application collection.

Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
---
 drivers/hid/hid-core.c       | 3 ++-
 drivers/hid/hid-sensor-hub.c | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b7f5566e338d..8fcd663b10e2 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -804,7 +804,8 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 	int i;
 
 	if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
-	    type == HID_COLLECTION_PHYSICAL)
+	    (type == HID_COLLECTION_PHYSICAL ||
+	     type == HID_COLLECTION_APPLICATION))
 		hid->group = HID_GROUP_SENSOR_HUB;
 
 	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 6abd3e2a9094..d03dc4ca095f 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -397,7 +397,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
 		for (i = 0; i < report->maxfield; ++i) {
 			field = report->field[i];
 			if (field->maxusage) {
-				if (field->physical == usage_id &&
+				if ((field->physical == usage_id ||
+				     field->application == usage_id) &&
 					(field->logical == attr_usage_id ||
 					field->usage[0].hid ==
 							attr_usage_id) &&
@@ -506,7 +507,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
 					collection->usage);
 
 		callback = sensor_hub_get_callback(hdev,
-				report->field[i]->physical,
+				report->field[i]->physical ?:
+					report->field[i]->application,
 				report->field[i]->usage[0].collection_index,
 				&hsdev, &priv);
 		if (!callback) {
-- 
2.38.1


^ permalink raw reply related

* Re: [PATCH HID for-next v1 1/9] selftests: hid: add vmtest.sh
From: sdf @ 2023-01-09 17:56 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Greg KH, Jiri Kosina, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Dmitry Torokhov, Tero Kristo, linux-kernel,
	linux-input, netdev, bpf, linux-kselftest
In-Reply-To: <Y7xTDbMChqSp//x7@google.com>

On 01/09, Stanislav Fomichev wrote:
> On 01/06, Benjamin Tissoires wrote:
> > Similar-ish in many points from the script in selftests/bpf, with a few
> > differences:
> > - relies on boot2container instead of a plain qemu image (meaning that
> >   we can take any container in a registry as a base)
> > - runs in the hid selftest dir, and such uses the test program from  
> there
> > - the working directory to store the config is in
> >   tools/selftests/hid/results
> >
> > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

> Sorry, I've completely missed this. I wasn't on CC and assumed
> that was some sort of a repost. Going through the changes right now.

Hmmm, or maybe I shouldn't? This seems to be bases on some other tree;
can't find tools/testing/selftests/hid/Makefile (from patch #2) in neither
bpf nor bpf-next.

Alexei/Daniel/Andrii, what's the process with these series?

> One question here: is it worth it extending bpf/vmtest.sh instead
> to support boot2container? Why new script with a bunch of copy-paste
> is a better deal?

> > ---
> >  tools/testing/selftests/hid/.gitignore    |   1 +
> >  tools/testing/selftests/hid/config.common | 241 ++++++++++++++++++
> >  tools/testing/selftests/hid/config.x86_64 |   4 +
> >  tools/testing/selftests/hid/vmtest.sh     | 284 ++++++++++++++++++++++
> >  4 files changed, 530 insertions(+)
> >  create mode 100644 tools/testing/selftests/hid/config.common
> >  create mode 100644 tools/testing/selftests/hid/config.x86_64
> >  create mode 100755 tools/testing/selftests/hid/vmtest.sh
> >
> > diff --git a/tools/testing/selftests/hid/.gitignore  
> b/tools/testing/selftests/hid/.gitignore
> > index a462ca6ab2c0..995af0670f69 100644
> > --- a/tools/testing/selftests/hid/.gitignore
> > +++ b/tools/testing/selftests/hid/.gitignore
> > @@ -2,3 +2,4 @@ bpftool
> >  *.skel.h
> >  /tools
> >  hid_bpf
> > +results
> > diff --git a/tools/testing/selftests/hid/config.common  
> b/tools/testing/selftests/hid/config.common
> > new file mode 100644
> > index 000000000000..0617275d93cc
> > --- /dev/null
> > +++ b/tools/testing/selftests/hid/config.common
> > @@ -0,0 +1,241 @@
> > +CONFIG_9P_FS_POSIX_ACL=y
> > +CONFIG_9P_FS_SECURITY=y
> > +CONFIG_9P_FS=y
> > +CONFIG_AUDIT=y
> > +CONFIG_BINFMT_MISC=y
> > +CONFIG_BLK_CGROUP_IOLATENCY=y
> > +CONFIG_BLK_CGROUP=y
> > +CONFIG_BLK_DEV_BSGLIB=y
> > +CONFIG_BLK_DEV_IO_TRACE=y
> > +CONFIG_BLK_DEV_RAM_SIZE=16384
> > +CONFIG_BLK_DEV_RAM=y
> > +CONFIG_BLK_DEV_THROTTLING=y
> > +CONFIG_BONDING=y
> > +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
> > +CONFIG_BOOTTIME_TRACING=y
> > +CONFIG_BSD_DISKLABEL=y
> > +CONFIG_BSD_PROCESS_ACCT=y
> > +CONFIG_CFS_BANDWIDTH=y
> > +CONFIG_CGROUP_CPUACCT=y
> > +CONFIG_CGROUP_DEBUG=y
> > +CONFIG_CGROUP_DEVICE=y
> > +CONFIG_CGROUP_FREEZER=y
> > +CONFIG_CGROUP_HUGETLB=y
> > +CONFIG_CGROUP_NET_CLASSID=y
> > +CONFIG_CGROUP_NET_PRIO=y
> > +CONFIG_CGROUP_PERF=y
> > +CONFIG_CGROUP_PIDS=y
> > +CONFIG_CGROUP_RDMA=y
> > +CONFIG_CGROUP_SCHED=y
> > +CONFIG_CGROUPS=y
> > +CONFIG_CGROUP_WRITEBACK=y
> > +CONFIG_CMA_AREAS=7
> > +CONFIG_CMA=y
> > +CONFIG_COMPAT_32BIT_TIME=y
> > +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
> > +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
> > +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> > +CONFIG_CPU_FREQ_GOV_USERSPACE=y
> > +CONFIG_CPU_FREQ_STAT=y
> > +CONFIG_CPU_IDLE_GOV_LADDER=y
> > +CONFIG_CPUSETS=y
> > +CONFIG_CRC_T10DIF=y
> > +CONFIG_CRYPTO_BLAKE2B=y
> > +CONFIG_CRYPTO_DEV_VIRTIO=y
> > +CONFIG_CRYPTO_SEQIV=y
> > +CONFIG_CRYPTO_XXHASH=y
> > +CONFIG_DCB=y
> > +CONFIG_DEBUG_ATOMIC_SLEEP=y
> > +CONFIG_DEBUG_CREDENTIALS=y
> > +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
> > +CONFIG_DEBUG_MEMORY_INIT=y
> > +CONFIG_DEFAULT_FQ_CODEL=y
> > +CONFIG_DEFAULT_RENO=y
> > +CONFIG_DEFAULT_SECURITY_DAC=y
> > +CONFIG_DEVTMPFS_MOUNT=y
> > +CONFIG_DEVTMPFS=y
> > +CONFIG_DMA_CMA=y
> > +CONFIG_DNS_RESOLVER=y
> > +CONFIG_EFI_STUB=y
> > +CONFIG_EFI=y
> > +CONFIG_EXPERT=y
> > +CONFIG_EXT4_FS_POSIX_ACL=y
> > +CONFIG_EXT4_FS_SECURITY=y
> > +CONFIG_EXT4_FS=y
> > +CONFIG_FAIL_FUNCTION=y
> > +CONFIG_FAULT_INJECTION_DEBUG_FS=y
> > +CONFIG_FAULT_INJECTION=y
> > +CONFIG_FB_MODE_HELPERS=y
> > +CONFIG_FB_TILEBLITTING=y
> > +CONFIG_FB_VESA=y
> > +CONFIG_FB=y
> > +CONFIG_FONT_8x16=y
> > +CONFIG_FONT_MINI_4x6=y
> > +CONFIG_FONTS=y
> > +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
> > +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
> > +CONFIG_FRAMEBUFFER_CONSOLE=y
> > +CONFIG_FUSE_FS=y
> > +CONFIG_FW_LOADER_USER_HELPER=y
> > +CONFIG_GART_IOMMU=y
> > +CONFIG_GENERIC_PHY=y
> > +CONFIG_HARDLOCKUP_DETECTOR=y
> > +CONFIG_HIGH_RES_TIMERS=y
> > +CONFIG_HPET=y
> > +CONFIG_HUGETLBFS=y
> > +CONFIG_HUGETLB_PAGE=y
> > +CONFIG_HWPOISON_INJECT=y
> > +CONFIG_HZ_1000=y
> > +CONFIG_INET=y
> > +CONFIG_INTEL_POWERCLAMP=y
> > +CONFIG_IP6_NF_FILTER=y
> > +CONFIG_IP6_NF_IPTABLES=y
> > +CONFIG_IP6_NF_NAT=y
> > +CONFIG_IP6_NF_TARGET_MASQUERADE=y
> > +CONFIG_IP_ADVANCED_ROUTER=y
> > +CONFIG_IP_MROUTE=y
> > +CONFIG_IP_MULTICAST=y
> > +CONFIG_IP_MULTIPLE_TABLES=y
> > +CONFIG_IP_NF_FILTER=y
> > +CONFIG_IP_NF_IPTABLES=y
> > +CONFIG_IP_NF_NAT=y
> > +CONFIG_IP_NF_TARGET_MASQUERADE=y
> > +CONFIG_IP_PIMSM_V1=y
> > +CONFIG_IP_PIMSM_V2=y
> > +CONFIG_IP_ROUTE_MULTIPATH=y
> > +CONFIG_IP_ROUTE_VERBOSE=y
> > +CONFIG_IPV6_MIP6=y
> > +CONFIG_IPV6_ROUTE_INFO=y
> > +CONFIG_IPV6_ROUTER_PREF=y
> > +CONFIG_IPV6_SEG6_LWTUNNEL=y
> > +CONFIG_IPV6_SUBTREES=y
> > +CONFIG_IRQ_POLL=y
> > +CONFIG_JUMP_LABEL=y
> > +CONFIG_KARMA_PARTITION=y
> > +CONFIG_KEXEC=y
> > +CONFIG_KPROBES=y
> > +CONFIG_KSM=y
> > +CONFIG_LEGACY_VSYSCALL_NONE=y
> > +CONFIG_LOG_BUF_SHIFT=21
> > +CONFIG_LOG_CPU_MAX_BUF_SHIFT=0
> > +CONFIG_LOGO=y
> > +CONFIG_LSM="selinux,bpf,integrity"
> > +CONFIG_MAC_PARTITION=y
> > +CONFIG_MAGIC_SYSRQ=y
> > +CONFIG_MCORE2=y
> > +CONFIG_MEMCG=y
> > +CONFIG_MEMORY_FAILURE=y
> > +CONFIG_MINIX_SUBPARTITION=y
> > +CONFIG_MODULES=y
> > +CONFIG_NAMESPACES=y
> > +CONFIG_NET_9P_VIRTIO=y
> > +CONFIG_NET_9P=y
> > +CONFIG_NET_ACT_BPF=y
> > +CONFIG_NET_CLS_CGROUP=y
> > +CONFIG_NETDEVICES=y
> > +CONFIG_NET_EMATCH=y
> > +CONFIG_NETFILTER_NETLINK_LOG=y
> > +CONFIG_NETFILTER_NETLINK_QUEUE=y
> > +CONFIG_NETFILTER_XTABLES=y
> > +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
> > +CONFIG_NETFILTER_XT_MATCH_BPF=y
> > +CONFIG_NETFILTER_XT_MATCH_COMMENT=y
> > +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
> > +CONFIG_NETFILTER_XT_MATCH_MARK=y
> > +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
> > +CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
> > +CONFIG_NETFILTER_XT_NAT=y
> > +CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
> > +CONFIG_NET_IPGRE_BROADCAST=y
> > +CONFIG_NET_L3_MASTER_DEV=y
> > +CONFIG_NETLABEL=y
> > +CONFIG_NET_SCH_DEFAULT=y
> > +CONFIG_NET_SCHED=y
> > +CONFIG_NET_SCH_FQ_CODEL=y
> > +CONFIG_NET_TC_SKB_EXT=y
> > +CONFIG_NET_VRF=y
> > +CONFIG_NET=y
> > +CONFIG_NF_CONNTRACK=y
> > +CONFIG_NF_NAT_MASQUERADE=y
> > +CONFIG_NF_NAT=y
> > +CONFIG_NLS_ASCII=y
> > +CONFIG_NLS_CODEPAGE_437=y
> > +CONFIG_NLS_DEFAULT="utf8"
> > +CONFIG_NO_HZ=y
> > +CONFIG_NR_CPUS=128
> > +CONFIG_NUMA_BALANCING=y
> > +CONFIG_NUMA=y
> > +CONFIG_NVMEM=y
> > +CONFIG_OSF_PARTITION=y
> > +CONFIG_OVERLAY_FS_INDEX=y
> > +CONFIG_OVERLAY_FS_METACOPY=y
> > +CONFIG_OVERLAY_FS_XINO_AUTO=y
> > +CONFIG_OVERLAY_FS=y
> > +CONFIG_PACKET=y
> > +CONFIG_PANIC_ON_OOPS=y
> > +CONFIG_PARTITION_ADVANCED=y
> > +CONFIG_PCIEPORTBUS=y
> > +CONFIG_PCI_IOV=y
> > +CONFIG_PCI_MSI=y
> > +CONFIG_PCI=y
> > +CONFIG_PHYSICAL_ALIGN=0x1000000
> > +CONFIG_POSIX_MQUEUE=y
> > +CONFIG_POWER_SUPPLY=y
> > +CONFIG_PREEMPT=y
> > +CONFIG_PRINTK_TIME=y
> > +CONFIG_PROC_KCORE=y
> > +CONFIG_PROFILING=y
> > +CONFIG_PROVE_LOCKING=y
> > +CONFIG_PTP_1588_CLOCK=y
> > +CONFIG_RC_DEVICES=y
> > +CONFIG_RC_LOOPBACK=y
> > +CONFIG_RCU_CPU_STALL_TIMEOUT=60
> > +CONFIG_SCHED_STACK_END_CHECK=y
> > +CONFIG_SCHEDSTATS=y
> > +CONFIG_SECURITY_NETWORK=y
> > +CONFIG_SECURITY_SELINUX=y
> > +CONFIG_SERIAL_8250_CONSOLE=y
> > +CONFIG_SERIAL_8250_DETECT_IRQ=y
> > +CONFIG_SERIAL_8250_EXTENDED=y
> > +CONFIG_SERIAL_8250_MANY_PORTS=y
> > +CONFIG_SERIAL_8250_NR_UARTS=32
> > +CONFIG_SERIAL_8250_RSA=y
> > +CONFIG_SERIAL_8250_SHARE_IRQ=y
> > +CONFIG_SERIAL_8250=y
> > +CONFIG_SERIAL_NONSTANDARD=y
> > +CONFIG_SERIO_LIBPS2=y
> > +CONFIG_SGI_PARTITION=y
> > +CONFIG_SMP=y
> > +CONFIG_SOCK_CGROUP_DATA=y
> > +CONFIG_SOLARIS_X86_PARTITION=y
> > +CONFIG_SUN_PARTITION=y
> > +CONFIG_SYNC_FILE=y
> > +CONFIG_SYSVIPC=y
> > +CONFIG_TASK_DELAY_ACCT=y
> > +CONFIG_TASK_IO_ACCOUNTING=y
> > +CONFIG_TASKSTATS=y
> > +CONFIG_TASK_XACCT=y
> > +CONFIG_TCP_CONG_ADVANCED=y
> > +CONFIG_TCP_MD5SIG=y
> > +CONFIG_TLS=y
> > +CONFIG_TMPFS_POSIX_ACL=y
> > +CONFIG_TMPFS=y
> > +CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
> > +CONFIG_TRANSPARENT_HUGEPAGE=y
> > +CONFIG_TUN=y
> > +CONFIG_UNIXWARE_DISKLABEL=y
> > +CONFIG_UNIX=y
> > +CONFIG_USER_NS=y
> > +CONFIG_VALIDATE_FS_PARSER=y
> > +CONFIG_VETH=y
> > +CONFIG_VIRT_DRIVERS=y
> > +CONFIG_VIRTIO_BALLOON=y
> > +CONFIG_VIRTIO_BLK=y
> > +CONFIG_VIRTIO_CONSOLE=y
> > +CONFIG_VIRTIO_FS=y
> > +CONFIG_VIRTIO_NET=y
> > +CONFIG_VIRTIO_PCI=y
> > +CONFIG_VLAN_8021Q=y
> > +CONFIG_XFRM_SUB_POLICY=y
> > +CONFIG_XFRM_USER=y
> > +CONFIG_ZEROPLUS_FF=y
> > diff --git a/tools/testing/selftests/hid/config.x86_64  
> b/tools/testing/selftests/hid/config.x86_64
> > new file mode 100644
> > index 000000000000..a8721f403c21
> > --- /dev/null
> > +++ b/tools/testing/selftests/hid/config.x86_64
> > @@ -0,0 +1,4 @@
> > +CONFIG_X86_ACPI_CPUFREQ=y
> > +CONFIG_X86_CPUID=y
> > +CONFIG_X86_MSR=y
> > +CONFIG_X86_POWERNOW_K8=y
> > diff --git a/tools/testing/selftests/hid/vmtest.sh  
> b/tools/testing/selftests/hid/vmtest.sh
> > new file mode 100755
> > index 000000000000..90f34150f257
> > --- /dev/null
> > +++ b/tools/testing/selftests/hid/vmtest.sh
> > @@ -0,0 +1,284 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +set -u
> > +set -e
> > +
> > +# This script currently only works for x86_64
> > +ARCH="$(uname -m)"
> > +case "${ARCH}" in
> > +x86_64)
> > +	QEMU_BINARY=qemu-system-x86_64
> > +	BZIMAGE="arch/x86/boot/bzImage"
> > +	;;
> > +*)
> > +	echo "Unsupported architecture"
> > +	exit 1
> > +	;;
> > +esac
> > +DEFAULT_COMMAND="./hid_bpf"
> > +SCRIPT_DIR="$(dirname $(realpath $0))"
> > +OUTPUT_DIR="$SCRIPT_DIR/results"
> >  
> +KCONFIG_REL_PATHS=("${SCRIPT_DIR}/config" "${SCRIPT_DIR}/config.common" "${SCRIPT_DIR}/config.${ARCH}")
> >  
> +B2C_URL="https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/master/vm2c.py"
> > +NUM_COMPILE_JOBS="$(nproc)"
> > +LOG_FILE_BASE="$(date +"hid_selftests.%Y-%m-%d_%H-%M-%S")"
> > +LOG_FILE="${LOG_FILE_BASE}.log"
> > +EXIT_STATUS_FILE="${LOG_FILE_BASE}.exit_status"
> > +CONTAINER_IMAGE="registry.fedoraproject.org/fedora:36"
> > +
> > +usage()
> > +{
> > +	cat <<EOF
> > +Usage: $0 [-i] [-s] [-d <output_dir>] -- [<command>]
> > +
> > +<command> is the command you would normally run when you are in
> > +tools/testing/selftests/bpf. e.g:
> > +
> > +	$0 -- ./hid_bpf
> > +
> > +If no command is specified and a debug shell (-s) is not requested,
> > +"${DEFAULT_COMMAND}" will be run by default.
> > +
> > +If you build your kernel using KBUILD_OUTPUT= or O= options, these
> > +can be passed as environment variables to the script:
> > +
> > +  O=<kernel_build_path> $0 -- ./hid_bpf
> > +
> > +or
> > +
> > +  KBUILD_OUTPUT=<kernel_build_path> $0 -- ./hid_bpf
> > +
> > +Options:
> > +
> > +	-u)		Update the boot2container script to a newer version.
> > +	-d)		Update the output directory (default: ${OUTPUT_DIR})
> > +	-j)		Number of jobs for compilation, similar to -j in make
> > +			(default: ${NUM_COMPILE_JOBS})
> > +	-s)		Instead of powering off the VM, start an interactive
> > +			shell. If <command> is specified, the shell runs after
> > +			the command finishes executing
> > +EOF
> > +}
> > +
> > +download()
> > +{
> > +	local file="$1"
> > +
> > +	echo "Downloading $file..." >&2
> > +	curl -Lsf "$file" -o "${@:2}"
> > +}
> > +
> > +recompile_kernel()
> > +{
> > +	local kernel_checkout="$1"
> > +	local make_command="$2"
> > +
> > +	cd "${kernel_checkout}"
> > +
> > +	${make_command} olddefconfig
> > +	${make_command}
> > +}
> > +
> > +update_selftests()
> > +{
> > +	local kernel_checkout="$1"
> > +	local selftests_dir="${kernel_checkout}/tools/testing/selftests/hid"
> > +
> > +	cd "${selftests_dir}"
> > +	${make_command}
> > +}
> > +
> > +run_vm()
> > +{
> > +	local b2c="$1"
> > +	local kernel_bzimage="$2"
> > +	local command="$3"
> > +	local post_command=""
> > +
> > +	if ! which "${QEMU_BINARY}" &> /dev/null; then
> > +		cat <<EOF
> > +Could not find ${QEMU_BINARY}
> > +Please install qemu or set the QEMU_BINARY environment variable.
> > +EOF
> > +		exit 1
> > +	fi
> > +
> > +	# alpine (used in post-container requires the PATH to have /bin
> > +	export PATH=$PATH:/bin
> > +
> > +	if [[ "${debug_shell}" != "yes" ]]
> > +	then
> > +		touch ${OUTPUT_DIR}/${LOG_FILE}
> > +		command="mount bpffs -t bpf /sys/fs/bpf/; set -o pipefail ;  
> ${command} 2>&1 | tee ${OUTPUT_DIR}/${LOG_FILE}"
> > +		post_command="cat ${OUTPUT_DIR}/${LOG_FILE}"
> > +	else
> > +		command="mount bpffs -t bpf /sys/fs/bpf/; ${command}"
> > +	fi
> > +
> > +	set +e
> > +	$b2c --command "${command}" \
> > +	     --kernel ${kernel_bzimage} \
> > +	     --workdir ${OUTPUT_DIR} \
> > +	     --image ${CONTAINER_IMAGE}
> > +
> > +	echo $? > ${OUTPUT_DIR}/${EXIT_STATUS_FILE}
> > +
> > +	set -e
> > +
> > +	${post_command}
> > +}
> > +
> > +is_rel_path()
> > +{
> > +	local path="$1"
> > +
> > +	[[ ${path:0:1} != "/" ]]
> > +}
> > +
> > +do_update_kconfig()
> > +{
> > +	local kernel_checkout="$1"
> > +	local kconfig_file="$2"
> > +
> > +	rm -f "$kconfig_file" 2> /dev/null
> > +
> > +	for config in "${KCONFIG_REL_PATHS[@]}"; do
> > +		local kconfig_src="${config}"
> > +		cat "$kconfig_src" >> "$kconfig_file"
> > +	done
> > +}
> > +
> > +update_kconfig()
> > +{
> > +	local kernel_checkout="$1"
> > +	local kconfig_file="$2"
> > +
> > +	if [[ -f "${kconfig_file}" ]]; then
> > +		local local_modified="$(stat -c %Y "${kconfig_file}")"
> > +
> > +		for config in "${KCONFIG_REL_PATHS[@]}"; do
> > +			local kconfig_src="${config}"
> > +			local src_modified="$(stat -c %Y "${kconfig_src}")"
> > +			# Only update the config if it has been updated after the
> > +			# previously cached config was created. This avoids
> > +			# unnecessarily compiling the kernel and selftests.
> > +			if [[ "${src_modified}" -gt "${local_modified}" ]]; then
> > +				do_update_kconfig "$kernel_checkout" "$kconfig_file"
> > +				# Once we have found one outdated configuration
> > +				# there is no need to check other ones.
> > +				break
> > +			fi
> > +		done
> > +	else
> > +		do_update_kconfig "$kernel_checkout" "$kconfig_file"
> > +	fi
> > +}
> > +
> > +main()
> > +{
> > +	local script_dir="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" &&  
> pwd -P)"
> > +	local kernel_checkout=$(realpath "${script_dir}"/../../../../)
> > +	# By default the script searches for the kernel in the checkout  
> directory but
> > +	# it also obeys environment variables O= and KBUILD_OUTPUT=
> > +	local kernel_bzimage="${kernel_checkout}/${BZIMAGE}"
> > +	local command="${DEFAULT_COMMAND}"
> > +	local update_b2c="no"
> > +	local debug_shell="no"
> > +
> > +	while getopts ':hsud:j:' opt; do
> > +		case ${opt} in
> > +		u)
> > +			update_b2c="yes"
> > +			;;
> > +		d)
> > +			OUTPUT_DIR="$OPTARG"
> > +			;;
> > +		j)
> > +			NUM_COMPILE_JOBS="$OPTARG"
> > +			;;
> > +		s)
> > +			command="/bin/sh"
> > +			debug_shell="yes"
> > +			;;
> > +		h)
> > +			usage
> > +			exit 0
> > +			;;
> > +		\? )
> > +			echo "Invalid Option: -$OPTARG"
> > +			usage
> > +			exit 1
> > +			;;
> > +		: )
> > +			echo "Invalid Option: -$OPTARG requires an argument"
> > +			usage
> > +			exit 1
> > +			;;
> > +		esac
> > +	done
> > +	shift $((OPTIND -1))
> > +
> > +	# trap 'catch "$?"' EXIT
> > +
> > +	if [[ "${debug_shell}" == "no" ]]; then
> > +		if [[ $# -eq 0 ]]; then
> > +			echo "No command specified, will run ${DEFAULT_COMMAND} in the vm"
> > +		else
> > +			command="$@"
> > +
> > +			if [[ "${command}" == "/bin/bash" || "${command}" == "bash" ]]
> > +			then
> > +				debug_shell="yes"
> > +			fi
> > +		fi
> > +	fi
> > +
> > +	local kconfig_file="${OUTPUT_DIR}/latest.config"
> > +	local make_command="make -j ${NUM_COMPILE_JOBS}  
> KCONFIG_CONFIG=${kconfig_file}"
> > +
> > +	# Figure out where the kernel is being built.
> > +	# O takes precedence over KBUILD_OUTPUT.
> > +	if [[ "${O:=""}" != "" ]]; then
> > +		if is_rel_path "${O}"; then
> > +			O="$(realpath "${PWD}/${O}")"
> > +		fi
> > +		kernel_bzimage="${O}/${BZIMAGE}"
> > +		make_command="${make_command} O=${O}"
> > +	elif [[ "${KBUILD_OUTPUT:=""}" != "" ]]; then
> > +		if is_rel_path "${KBUILD_OUTPUT}"; then
> > +			KBUILD_OUTPUT="$(realpath "${PWD}/${KBUILD_OUTPUT}")"
> > +		fi
> > +		kernel_bzimage="${KBUILD_OUTPUT}/${BZIMAGE}"
> > +		make_command="${make_command} KBUILD_OUTPUT=${KBUILD_OUTPUT}"
> > +	fi
> > +
> > +	local b2c="${OUTPUT_DIR}/vm2c.py"
> > +
> > +	echo "Output directory: ${OUTPUT_DIR}"
> > +
> > +	mkdir -p "${OUTPUT_DIR}"
> > +	update_kconfig "${kernel_checkout}" "${kconfig_file}"
> > +
> > +	recompile_kernel "${kernel_checkout}" "${make_command}"
> > +
> > +	if [[ "${update_b2c}" == "no" && ! -f "${b2c}" ]]; then
> > +		echo "vm2c script not found in ${b2c}"
> > +		update_b2c="yes"
> > +	fi
> > +
> > +	if [[ "${update_b2c}" == "yes" ]]; then
> > +		download $B2C_URL $b2c
> > +		chmod +x $b2c
> > +	fi
> > +
> > +	update_selftests "${kernel_checkout}" "${make_command}"
> > +	run_vm $b2c "${kernel_bzimage}" "${command}"
> > +	if [[ "${debug_shell}" != "yes" ]]; then
> > +		echo "Logs saved in ${OUTPUT_DIR}/${LOG_FILE}"
> > +	fi
> > +
> > +	exit $(cat ${OUTPUT_DIR}/${EXIT_STATUS_FILE})
> > +}
> > +
> > +main "$@"
> > --
> > 2.38.1
> >

^ permalink raw reply

* Re: [PATCH HID for-next v1 1/9] selftests: hid: add vmtest.sh
From: sdf @ 2023-01-09 17:46 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Greg KH, Jiri Kosina, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Dmitry Torokhov, Tero Kristo, linux-kernel,
	linux-input, netdev, bpf, linux-kselftest
In-Reply-To: <20230106102332.1019632-2-benjamin.tissoires@redhat.com>

On 01/06, Benjamin Tissoires wrote:
> Similar-ish in many points from the script in selftests/bpf, with a few
> differences:
> - relies on boot2container instead of a plain qemu image (meaning that
>    we can take any container in a registry as a base)
> - runs in the hid selftest dir, and such uses the test program from there
> - the working directory to store the config is in
>    tools/selftests/hid/results

> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Sorry, I've completely missed this. I wasn't on CC and assumed
that was some sort of a repost. Going through the changes right now.

One question here: is it worth it extending bpf/vmtest.sh instead
to support boot2container? Why new script with a bunch of copy-paste
is a better deal?

> ---
>   tools/testing/selftests/hid/.gitignore    |   1 +
>   tools/testing/selftests/hid/config.common | 241 ++++++++++++++++++
>   tools/testing/selftests/hid/config.x86_64 |   4 +
>   tools/testing/selftests/hid/vmtest.sh     | 284 ++++++++++++++++++++++
>   4 files changed, 530 insertions(+)
>   create mode 100644 tools/testing/selftests/hid/config.common
>   create mode 100644 tools/testing/selftests/hid/config.x86_64
>   create mode 100755 tools/testing/selftests/hid/vmtest.sh

> diff --git a/tools/testing/selftests/hid/.gitignore  
> b/tools/testing/selftests/hid/.gitignore
> index a462ca6ab2c0..995af0670f69 100644
> --- a/tools/testing/selftests/hid/.gitignore
> +++ b/tools/testing/selftests/hid/.gitignore
> @@ -2,3 +2,4 @@ bpftool
>   *.skel.h
>   /tools
>   hid_bpf
> +results
> diff --git a/tools/testing/selftests/hid/config.common  
> b/tools/testing/selftests/hid/config.common
> new file mode 100644
> index 000000000000..0617275d93cc
> --- /dev/null
> +++ b/tools/testing/selftests/hid/config.common
> @@ -0,0 +1,241 @@
> +CONFIG_9P_FS_POSIX_ACL=y
> +CONFIG_9P_FS_SECURITY=y
> +CONFIG_9P_FS=y
> +CONFIG_AUDIT=y
> +CONFIG_BINFMT_MISC=y
> +CONFIG_BLK_CGROUP_IOLATENCY=y
> +CONFIG_BLK_CGROUP=y
> +CONFIG_BLK_DEV_BSGLIB=y
> +CONFIG_BLK_DEV_IO_TRACE=y
> +CONFIG_BLK_DEV_RAM_SIZE=16384
> +CONFIG_BLK_DEV_RAM=y
> +CONFIG_BLK_DEV_THROTTLING=y
> +CONFIG_BONDING=y
> +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
> +CONFIG_BOOTTIME_TRACING=y
> +CONFIG_BSD_DISKLABEL=y
> +CONFIG_BSD_PROCESS_ACCT=y
> +CONFIG_CFS_BANDWIDTH=y
> +CONFIG_CGROUP_CPUACCT=y
> +CONFIG_CGROUP_DEBUG=y
> +CONFIG_CGROUP_DEVICE=y
> +CONFIG_CGROUP_FREEZER=y
> +CONFIG_CGROUP_HUGETLB=y
> +CONFIG_CGROUP_NET_CLASSID=y
> +CONFIG_CGROUP_NET_PRIO=y
> +CONFIG_CGROUP_PERF=y
> +CONFIG_CGROUP_PIDS=y
> +CONFIG_CGROUP_RDMA=y
> +CONFIG_CGROUP_SCHED=y
> +CONFIG_CGROUPS=y
> +CONFIG_CGROUP_WRITEBACK=y
> +CONFIG_CMA_AREAS=7
> +CONFIG_CMA=y
> +CONFIG_COMPAT_32BIT_TIME=y
> +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
> +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
> +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> +CONFIG_CPU_FREQ_GOV_USERSPACE=y
> +CONFIG_CPU_FREQ_STAT=y
> +CONFIG_CPU_IDLE_GOV_LADDER=y
> +CONFIG_CPUSETS=y
> +CONFIG_CRC_T10DIF=y
> +CONFIG_CRYPTO_BLAKE2B=y
> +CONFIG_CRYPTO_DEV_VIRTIO=y
> +CONFIG_CRYPTO_SEQIV=y
> +CONFIG_CRYPTO_XXHASH=y
> +CONFIG_DCB=y
> +CONFIG_DEBUG_ATOMIC_SLEEP=y
> +CONFIG_DEBUG_CREDENTIALS=y
> +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
> +CONFIG_DEBUG_MEMORY_INIT=y
> +CONFIG_DEFAULT_FQ_CODEL=y
> +CONFIG_DEFAULT_RENO=y
> +CONFIG_DEFAULT_SECURITY_DAC=y
> +CONFIG_DEVTMPFS_MOUNT=y
> +CONFIG_DEVTMPFS=y
> +CONFIG_DMA_CMA=y
> +CONFIG_DNS_RESOLVER=y
> +CONFIG_EFI_STUB=y
> +CONFIG_EFI=y
> +CONFIG_EXPERT=y
> +CONFIG_EXT4_FS_POSIX_ACL=y
> +CONFIG_EXT4_FS_SECURITY=y
> +CONFIG_EXT4_FS=y
> +CONFIG_FAIL_FUNCTION=y
> +CONFIG_FAULT_INJECTION_DEBUG_FS=y
> +CONFIG_FAULT_INJECTION=y
> +CONFIG_FB_MODE_HELPERS=y
> +CONFIG_FB_TILEBLITTING=y
> +CONFIG_FB_VESA=y
> +CONFIG_FB=y
> +CONFIG_FONT_8x16=y
> +CONFIG_FONT_MINI_4x6=y
> +CONFIG_FONTS=y
> +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
> +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
> +CONFIG_FRAMEBUFFER_CONSOLE=y
> +CONFIG_FUSE_FS=y
> +CONFIG_FW_LOADER_USER_HELPER=y
> +CONFIG_GART_IOMMU=y
> +CONFIG_GENERIC_PHY=y
> +CONFIG_HARDLOCKUP_DETECTOR=y
> +CONFIG_HIGH_RES_TIMERS=y
> +CONFIG_HPET=y
> +CONFIG_HUGETLBFS=y
> +CONFIG_HUGETLB_PAGE=y
> +CONFIG_HWPOISON_INJECT=y
> +CONFIG_HZ_1000=y
> +CONFIG_INET=y
> +CONFIG_INTEL_POWERCLAMP=y
> +CONFIG_IP6_NF_FILTER=y
> +CONFIG_IP6_NF_IPTABLES=y
> +CONFIG_IP6_NF_NAT=y
> +CONFIG_IP6_NF_TARGET_MASQUERADE=y
> +CONFIG_IP_ADVANCED_ROUTER=y
> +CONFIG_IP_MROUTE=y
> +CONFIG_IP_MULTICAST=y
> +CONFIG_IP_MULTIPLE_TABLES=y
> +CONFIG_IP_NF_FILTER=y
> +CONFIG_IP_NF_IPTABLES=y
> +CONFIG_IP_NF_NAT=y
> +CONFIG_IP_NF_TARGET_MASQUERADE=y
> +CONFIG_IP_PIMSM_V1=y
> +CONFIG_IP_PIMSM_V2=y
> +CONFIG_IP_ROUTE_MULTIPATH=y
> +CONFIG_IP_ROUTE_VERBOSE=y
> +CONFIG_IPV6_MIP6=y
> +CONFIG_IPV6_ROUTE_INFO=y
> +CONFIG_IPV6_ROUTER_PREF=y
> +CONFIG_IPV6_SEG6_LWTUNNEL=y
> +CONFIG_IPV6_SUBTREES=y
> +CONFIG_IRQ_POLL=y
> +CONFIG_JUMP_LABEL=y
> +CONFIG_KARMA_PARTITION=y
> +CONFIG_KEXEC=y
> +CONFIG_KPROBES=y
> +CONFIG_KSM=y
> +CONFIG_LEGACY_VSYSCALL_NONE=y
> +CONFIG_LOG_BUF_SHIFT=21
> +CONFIG_LOG_CPU_MAX_BUF_SHIFT=0
> +CONFIG_LOGO=y
> +CONFIG_LSM="selinux,bpf,integrity"
> +CONFIG_MAC_PARTITION=y
> +CONFIG_MAGIC_SYSRQ=y
> +CONFIG_MCORE2=y
> +CONFIG_MEMCG=y
> +CONFIG_MEMORY_FAILURE=y
> +CONFIG_MINIX_SUBPARTITION=y
> +CONFIG_MODULES=y
> +CONFIG_NAMESPACES=y
> +CONFIG_NET_9P_VIRTIO=y
> +CONFIG_NET_9P=y
> +CONFIG_NET_ACT_BPF=y
> +CONFIG_NET_CLS_CGROUP=y
> +CONFIG_NETDEVICES=y
> +CONFIG_NET_EMATCH=y
> +CONFIG_NETFILTER_NETLINK_LOG=y
> +CONFIG_NETFILTER_NETLINK_QUEUE=y
> +CONFIG_NETFILTER_XTABLES=y
> +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
> +CONFIG_NETFILTER_XT_MATCH_BPF=y
> +CONFIG_NETFILTER_XT_MATCH_COMMENT=y
> +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
> +CONFIG_NETFILTER_XT_MATCH_MARK=y
> +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
> +CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
> +CONFIG_NETFILTER_XT_NAT=y
> +CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
> +CONFIG_NET_IPGRE_BROADCAST=y
> +CONFIG_NET_L3_MASTER_DEV=y
> +CONFIG_NETLABEL=y
> +CONFIG_NET_SCH_DEFAULT=y
> +CONFIG_NET_SCHED=y
> +CONFIG_NET_SCH_FQ_CODEL=y
> +CONFIG_NET_TC_SKB_EXT=y
> +CONFIG_NET_VRF=y
> +CONFIG_NET=y
> +CONFIG_NF_CONNTRACK=y
> +CONFIG_NF_NAT_MASQUERADE=y
> +CONFIG_NF_NAT=y
> +CONFIG_NLS_ASCII=y
> +CONFIG_NLS_CODEPAGE_437=y
> +CONFIG_NLS_DEFAULT="utf8"
> +CONFIG_NO_HZ=y
> +CONFIG_NR_CPUS=128
> +CONFIG_NUMA_BALANCING=y
> +CONFIG_NUMA=y
> +CONFIG_NVMEM=y
> +CONFIG_OSF_PARTITION=y
> +CONFIG_OVERLAY_FS_INDEX=y
> +CONFIG_OVERLAY_FS_METACOPY=y
> +CONFIG_OVERLAY_FS_XINO_AUTO=y
> +CONFIG_OVERLAY_FS=y
> +CONFIG_PACKET=y
> +CONFIG_PANIC_ON_OOPS=y
> +CONFIG_PARTITION_ADVANCED=y
> +CONFIG_PCIEPORTBUS=y
> +CONFIG_PCI_IOV=y
> +CONFIG_PCI_MSI=y
> +CONFIG_PCI=y
> +CONFIG_PHYSICAL_ALIGN=0x1000000
> +CONFIG_POSIX_MQUEUE=y
> +CONFIG_POWER_SUPPLY=y
> +CONFIG_PREEMPT=y
> +CONFIG_PRINTK_TIME=y
> +CONFIG_PROC_KCORE=y
> +CONFIG_PROFILING=y
> +CONFIG_PROVE_LOCKING=y
> +CONFIG_PTP_1588_CLOCK=y
> +CONFIG_RC_DEVICES=y
> +CONFIG_RC_LOOPBACK=y
> +CONFIG_RCU_CPU_STALL_TIMEOUT=60
> +CONFIG_SCHED_STACK_END_CHECK=y
> +CONFIG_SCHEDSTATS=y
> +CONFIG_SECURITY_NETWORK=y
> +CONFIG_SECURITY_SELINUX=y
> +CONFIG_SERIAL_8250_CONSOLE=y
> +CONFIG_SERIAL_8250_DETECT_IRQ=y
> +CONFIG_SERIAL_8250_EXTENDED=y
> +CONFIG_SERIAL_8250_MANY_PORTS=y
> +CONFIG_SERIAL_8250_NR_UARTS=32
> +CONFIG_SERIAL_8250_RSA=y
> +CONFIG_SERIAL_8250_SHARE_IRQ=y
> +CONFIG_SERIAL_8250=y
> +CONFIG_SERIAL_NONSTANDARD=y
> +CONFIG_SERIO_LIBPS2=y
> +CONFIG_SGI_PARTITION=y
> +CONFIG_SMP=y
> +CONFIG_SOCK_CGROUP_DATA=y
> +CONFIG_SOLARIS_X86_PARTITION=y
> +CONFIG_SUN_PARTITION=y
> +CONFIG_SYNC_FILE=y
> +CONFIG_SYSVIPC=y
> +CONFIG_TASK_DELAY_ACCT=y
> +CONFIG_TASK_IO_ACCOUNTING=y
> +CONFIG_TASKSTATS=y
> +CONFIG_TASK_XACCT=y
> +CONFIG_TCP_CONG_ADVANCED=y
> +CONFIG_TCP_MD5SIG=y
> +CONFIG_TLS=y
> +CONFIG_TMPFS_POSIX_ACL=y
> +CONFIG_TMPFS=y
> +CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
> +CONFIG_TRANSPARENT_HUGEPAGE=y
> +CONFIG_TUN=y
> +CONFIG_UNIXWARE_DISKLABEL=y
> +CONFIG_UNIX=y
> +CONFIG_USER_NS=y
> +CONFIG_VALIDATE_FS_PARSER=y
> +CONFIG_VETH=y
> +CONFIG_VIRT_DRIVERS=y
> +CONFIG_VIRTIO_BALLOON=y
> +CONFIG_VIRTIO_BLK=y
> +CONFIG_VIRTIO_CONSOLE=y
> +CONFIG_VIRTIO_FS=y
> +CONFIG_VIRTIO_NET=y
> +CONFIG_VIRTIO_PCI=y
> +CONFIG_VLAN_8021Q=y
> +CONFIG_XFRM_SUB_POLICY=y
> +CONFIG_XFRM_USER=y
> +CONFIG_ZEROPLUS_FF=y
> diff --git a/tools/testing/selftests/hid/config.x86_64  
> b/tools/testing/selftests/hid/config.x86_64
> new file mode 100644
> index 000000000000..a8721f403c21
> --- /dev/null
> +++ b/tools/testing/selftests/hid/config.x86_64
> @@ -0,0 +1,4 @@
> +CONFIG_X86_ACPI_CPUFREQ=y
> +CONFIG_X86_CPUID=y
> +CONFIG_X86_MSR=y
> +CONFIG_X86_POWERNOW_K8=y
> diff --git a/tools/testing/selftests/hid/vmtest.sh  
> b/tools/testing/selftests/hid/vmtest.sh
> new file mode 100755
> index 000000000000..90f34150f257
> --- /dev/null
> +++ b/tools/testing/selftests/hid/vmtest.sh
> @@ -0,0 +1,284 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +set -u
> +set -e
> +
> +# This script currently only works for x86_64
> +ARCH="$(uname -m)"
> +case "${ARCH}" in
> +x86_64)
> +	QEMU_BINARY=qemu-system-x86_64
> +	BZIMAGE="arch/x86/boot/bzImage"
> +	;;
> +*)
> +	echo "Unsupported architecture"
> +	exit 1
> +	;;
> +esac
> +DEFAULT_COMMAND="./hid_bpf"
> +SCRIPT_DIR="$(dirname $(realpath $0))"
> +OUTPUT_DIR="$SCRIPT_DIR/results"
> +KCONFIG_REL_PATHS=("${SCRIPT_DIR}/config" "${SCRIPT_DIR}/config.common" "${SCRIPT_DIR}/config.${ARCH}")
> +B2C_URL="https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/master/vm2c.py"
> +NUM_COMPILE_JOBS="$(nproc)"
> +LOG_FILE_BASE="$(date +"hid_selftests.%Y-%m-%d_%H-%M-%S")"
> +LOG_FILE="${LOG_FILE_BASE}.log"
> +EXIT_STATUS_FILE="${LOG_FILE_BASE}.exit_status"
> +CONTAINER_IMAGE="registry.fedoraproject.org/fedora:36"
> +
> +usage()
> +{
> +	cat <<EOF
> +Usage: $0 [-i] [-s] [-d <output_dir>] -- [<command>]
> +
> +<command> is the command you would normally run when you are in
> +tools/testing/selftests/bpf. e.g:
> +
> +	$0 -- ./hid_bpf
> +
> +If no command is specified and a debug shell (-s) is not requested,
> +"${DEFAULT_COMMAND}" will be run by default.
> +
> +If you build your kernel using KBUILD_OUTPUT= or O= options, these
> +can be passed as environment variables to the script:
> +
> +  O=<kernel_build_path> $0 -- ./hid_bpf
> +
> +or
> +
> +  KBUILD_OUTPUT=<kernel_build_path> $0 -- ./hid_bpf
> +
> +Options:
> +
> +	-u)		Update the boot2container script to a newer version.
> +	-d)		Update the output directory (default: ${OUTPUT_DIR})
> +	-j)		Number of jobs for compilation, similar to -j in make
> +			(default: ${NUM_COMPILE_JOBS})
> +	-s)		Instead of powering off the VM, start an interactive
> +			shell. If <command> is specified, the shell runs after
> +			the command finishes executing
> +EOF
> +}
> +
> +download()
> +{
> +	local file="$1"
> +
> +	echo "Downloading $file..." >&2
> +	curl -Lsf "$file" -o "${@:2}"
> +}
> +
> +recompile_kernel()
> +{
> +	local kernel_checkout="$1"
> +	local make_command="$2"
> +
> +	cd "${kernel_checkout}"
> +
> +	${make_command} olddefconfig
> +	${make_command}
> +}
> +
> +update_selftests()
> +{
> +	local kernel_checkout="$1"
> +	local selftests_dir="${kernel_checkout}/tools/testing/selftests/hid"
> +
> +	cd "${selftests_dir}"
> +	${make_command}
> +}
> +
> +run_vm()
> +{
> +	local b2c="$1"
> +	local kernel_bzimage="$2"
> +	local command="$3"
> +	local post_command=""
> +
> +	if ! which "${QEMU_BINARY}" &> /dev/null; then
> +		cat <<EOF
> +Could not find ${QEMU_BINARY}
> +Please install qemu or set the QEMU_BINARY environment variable.
> +EOF
> +		exit 1
> +	fi
> +
> +	# alpine (used in post-container requires the PATH to have /bin
> +	export PATH=$PATH:/bin
> +
> +	if [[ "${debug_shell}" != "yes" ]]
> +	then
> +		touch ${OUTPUT_DIR}/${LOG_FILE}
> +		command="mount bpffs -t bpf /sys/fs/bpf/; set -o pipefail ; ${command}  
> 2>&1 | tee ${OUTPUT_DIR}/${LOG_FILE}"
> +		post_command="cat ${OUTPUT_DIR}/${LOG_FILE}"
> +	else
> +		command="mount bpffs -t bpf /sys/fs/bpf/; ${command}"
> +	fi
> +
> +	set +e
> +	$b2c --command "${command}" \
> +	     --kernel ${kernel_bzimage} \
> +	     --workdir ${OUTPUT_DIR} \
> +	     --image ${CONTAINER_IMAGE}
> +
> +	echo $? > ${OUTPUT_DIR}/${EXIT_STATUS_FILE}
> +
> +	set -e
> +
> +	${post_command}
> +}
> +
> +is_rel_path()
> +{
> +	local path="$1"
> +
> +	[[ ${path:0:1} != "/" ]]
> +}
> +
> +do_update_kconfig()
> +{
> +	local kernel_checkout="$1"
> +	local kconfig_file="$2"
> +
> +	rm -f "$kconfig_file" 2> /dev/null
> +
> +	for config in "${KCONFIG_REL_PATHS[@]}"; do
> +		local kconfig_src="${config}"
> +		cat "$kconfig_src" >> "$kconfig_file"
> +	done
> +}
> +
> +update_kconfig()
> +{
> +	local kernel_checkout="$1"
> +	local kconfig_file="$2"
> +
> +	if [[ -f "${kconfig_file}" ]]; then
> +		local local_modified="$(stat -c %Y "${kconfig_file}")"
> +
> +		for config in "${KCONFIG_REL_PATHS[@]}"; do
> +			local kconfig_src="${config}"
> +			local src_modified="$(stat -c %Y "${kconfig_src}")"
> +			# Only update the config if it has been updated after the
> +			# previously cached config was created. This avoids
> +			# unnecessarily compiling the kernel and selftests.
> +			if [[ "${src_modified}" -gt "${local_modified}" ]]; then
> +				do_update_kconfig "$kernel_checkout" "$kconfig_file"
> +				# Once we have found one outdated configuration
> +				# there is no need to check other ones.
> +				break
> +			fi
> +		done
> +	else
> +		do_update_kconfig "$kernel_checkout" "$kconfig_file"
> +	fi
> +}
> +
> +main()
> +{
> +	local script_dir="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd  
> -P)"
> +	local kernel_checkout=$(realpath "${script_dir}"/../../../../)
> +	# By default the script searches for the kernel in the checkout  
> directory but
> +	# it also obeys environment variables O= and KBUILD_OUTPUT=
> +	local kernel_bzimage="${kernel_checkout}/${BZIMAGE}"
> +	local command="${DEFAULT_COMMAND}"
> +	local update_b2c="no"
> +	local debug_shell="no"
> +
> +	while getopts ':hsud:j:' opt; do
> +		case ${opt} in
> +		u)
> +			update_b2c="yes"
> +			;;
> +		d)
> +			OUTPUT_DIR="$OPTARG"
> +			;;
> +		j)
> +			NUM_COMPILE_JOBS="$OPTARG"
> +			;;
> +		s)
> +			command="/bin/sh"
> +			debug_shell="yes"
> +			;;
> +		h)
> +			usage
> +			exit 0
> +			;;
> +		\? )
> +			echo "Invalid Option: -$OPTARG"
> +			usage
> +			exit 1
> +			;;
> +		: )
> +			echo "Invalid Option: -$OPTARG requires an argument"
> +			usage
> +			exit 1
> +			;;
> +		esac
> +	done
> +	shift $((OPTIND -1))
> +
> +	# trap 'catch "$?"' EXIT
> +
> +	if [[ "${debug_shell}" == "no" ]]; then
> +		if [[ $# -eq 0 ]]; then
> +			echo "No command specified, will run ${DEFAULT_COMMAND} in the vm"
> +		else
> +			command="$@"
> +
> +			if [[ "${command}" == "/bin/bash" || "${command}" == "bash" ]]
> +			then
> +				debug_shell="yes"
> +			fi
> +		fi
> +	fi
> +
> +	local kconfig_file="${OUTPUT_DIR}/latest.config"
> +	local make_command="make -j ${NUM_COMPILE_JOBS}  
> KCONFIG_CONFIG=${kconfig_file}"
> +
> +	# Figure out where the kernel is being built.
> +	# O takes precedence over KBUILD_OUTPUT.
> +	if [[ "${O:=""}" != "" ]]; then
> +		if is_rel_path "${O}"; then
> +			O="$(realpath "${PWD}/${O}")"
> +		fi
> +		kernel_bzimage="${O}/${BZIMAGE}"
> +		make_command="${make_command} O=${O}"
> +	elif [[ "${KBUILD_OUTPUT:=""}" != "" ]]; then
> +		if is_rel_path "${KBUILD_OUTPUT}"; then
> +			KBUILD_OUTPUT="$(realpath "${PWD}/${KBUILD_OUTPUT}")"
> +		fi
> +		kernel_bzimage="${KBUILD_OUTPUT}/${BZIMAGE}"
> +		make_command="${make_command} KBUILD_OUTPUT=${KBUILD_OUTPUT}"
> +	fi
> +
> +	local b2c="${OUTPUT_DIR}/vm2c.py"
> +
> +	echo "Output directory: ${OUTPUT_DIR}"
> +
> +	mkdir -p "${OUTPUT_DIR}"
> +	update_kconfig "${kernel_checkout}" "${kconfig_file}"
> +
> +	recompile_kernel "${kernel_checkout}" "${make_command}"
> +
> +	if [[ "${update_b2c}" == "no" && ! -f "${b2c}" ]]; then
> +		echo "vm2c script not found in ${b2c}"
> +		update_b2c="yes"
> +	fi
> +
> +	if [[ "${update_b2c}" == "yes" ]]; then
> +		download $B2C_URL $b2c
> +		chmod +x $b2c
> +	fi
> +
> +	update_selftests "${kernel_checkout}" "${make_command}"
> +	run_vm $b2c "${kernel_bzimage}" "${command}"
> +	if [[ "${debug_shell}" != "yes" ]]; then
> +		echo "Logs saved in ${OUTPUT_DIR}/${LOG_FILE}"
> +	fi
> +
> +	exit $(cat ${OUTPUT_DIR}/${EXIT_STATUS_FILE})
> +}
> +
> +main "$@"
> --
> 2.38.1


^ permalink raw reply

* [PATCH] HID: add KEY_CAMERA_FOCUS event in HID
From: Qi Feng @ 2023-01-09 12:32 UTC (permalink / raw)
  To: jikos; +Cc: linux-input, linux-kernel, fengqi

From: fengqi <fengqi@xiaomi.com>

Our HID device need KEY_CAMERA_FOCUS event to control camera, but this
event is non-existent in current HID driver.
So we add this event in hid-input.c

Signed-off-by: fengqi <fengqi@xiaomi.com>
---
 drivers/hid/hid-input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 9b59e436df0a..22cca3406b5c 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1105,6 +1105,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x0e5: map_key_clear(KEY_BASSBOOST);	break;
 		case 0x0e9: map_key_clear(KEY_VOLUMEUP);	break;
 		case 0x0ea: map_key_clear(KEY_VOLUMEDOWN);	break;
+		case 0x0ee: map_key_clear(KEY_CAMERA_FOCUS);	break;
 		case 0x0f5: map_key_clear(KEY_SLOW);		break;
 
 		case 0x181: map_key_clear(KEY_BUTTONCONFIG);	break;
-- 
2.39.0


^ permalink raw reply related

* RE: [PATCH 30/69] Input: ad7877 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
From: Hennerich, Michael @ 2023-01-09 10:18 UTC (permalink / raw)
  To: Jonathan Cameron, linux-input@vger.kernel.org, Dmitry Torokhov
  Cc: Jonathan Cameron
In-Reply-To: <20230102181842.718010-31-jic23@kernel.org>



> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Montag, 2. Januar 2023 19:18
> To: linux-input@vger.kernel.org; Dmitry Torokhov
> <dmitry.torokhov@gmail.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>; Hennerich, Michael
> <Michael.Hennerich@analog.com>
> Subject: [PATCH 30/69] Input: ad7877 - switch to
> DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
> 
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection against
> unused function warnings.  The new combination of pm_sleep_ptr() and
> DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions, thus
> suppressing the warning, but still allowing the unused code to be removed.
> Thus also drop the __maybe_unused markings.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Michael Hennerich <michael.hennerich@analog.com>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  drivers/input/touchscreen/ad7877.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ad7877.c
> b/drivers/input/touchscreen/ad7877.c
> index 08f5372f0bfd..edb36d663f22 100644
> --- a/drivers/input/touchscreen/ad7877.c
> +++ b/drivers/input/touchscreen/ad7877.c
> @@ -788,7 +788,7 @@ static int ad7877_probe(struct spi_device *spi)
>  	return 0;
>  }
> 
> -static int __maybe_unused ad7877_suspend(struct device *dev)
> +static int ad7877_suspend(struct device *dev)
>  {
>  	struct ad7877 *ts = dev_get_drvdata(dev);
> 
> @@ -797,7 +797,7 @@ static int __maybe_unused ad7877_suspend(struct
> device *dev)
>  	return 0;
>  }
> 
> -static int __maybe_unused ad7877_resume(struct device *dev)
> +static int ad7877_resume(struct device *dev)
>  {
>  	struct ad7877 *ts = dev_get_drvdata(dev);
> 
> @@ -806,12 +806,12 @@ static int __maybe_unused ad7877_resume(struct
> device *dev)
>  	return 0;
>  }
> 
> -static SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend,
> +ad7877_resume);
> 
>  static struct spi_driver ad7877_driver = {
>  	.driver = {
>  		.name	= "ad7877",
> -		.pm	= &ad7877_pm,
> +		.pm	= pm_sleep_ptr(&ad7877_pm),
>  	},
>  	.probe		= ad7877_probe,
>  };
> --
> 2.39.0


^ permalink raw reply

* [Regression] Bug 216903 - HiRes Scroll for Performance Mouse MX broken in 6.1
From: Linux kernel regression tracking (Thorsten Leemhuis) @ 2023-01-09  9:14 UTC (permalink / raw)
  To: Filipe Laíns, Benjamin Tissoires, Bastien Nocera
  Cc: Jiri Kosina, open list:HID CORE LAYER, LKML, berilko,
	Stefan Brüns, regressions@lists.linux.dev

Hi, this is your Linux kernel regression tracker.

I noticed a regression report in bugzilla.kernel.org. As many (most?)
kernel developer don't keep an eye on it, I decided to forward it by
mail. Quoting from https://bugzilla.kernel.org/show_bug.cgi?id=216903 :

>  berilko@gmail.com 2023-01-08 19:14:21 UTC
> 
> Since 6.1 Kernel driver for hid-logitech-hidpp no more detect Performance MX as FastScroll
> 
> Self-made patch is:
> --- archlinux-linux/drivers/hid/hid-logitech-hidpp.c	2023-01-09 00:41:25.310773805 +0700
> +++ archlinux-linux/drivers/hid/hid-logitech-hidpp.c	2023-01-09 01:09:10.844967608 +0700
> @@ -3479,7 +3479,7 @@
>  						  HIDPP_GET_REGISTER,
>  						  HIDPP_ENABLE_FAST_SCROLL,
>  						  NULL, 0, &response);
> -		if (!ret) {
> +		if (!ret || /* Patch for Performance MX */ hidpp->hid_dev->product == 0x101a) {
>  			hidpp->capabilities |= HIDPP_CAPABILITY_HIDPP10_FAST_SCROLL;
>  			hid_dbg(hidpp->hid_dev, "Detected HID++ 1.0 fast scroll\n");
>  		}
> 
> [reply] [−] Comment 1 Stefan Brüns 2023-01-08 23:39:50 UTC
> 
> Unfortunately, the hires auto detection is broken for HID++1.0 devices.
> 
> https://elixir.bootlin.com/linux/latest/source/drivers/hid/hid-logitech-hidpp.c#L3477
> 
> ```
> 		ret = hidpp_send_rap_command_sync(hidpp,
> 						  REPORT_ID_HIDPP_SHORT,
> 						  HIDPP_GET_REGISTER,
> 						  HIDPP_ENABLE_FAST_SCROLL,
> 						  NULL, 0, &response);
> ```
> 
> This command tries to read from register 0x40, while the FAST_SCROLL feature is BIT(6) (0x40) in register 0x01.
> 
> For my M705, enabling and disabling of FAST_SCROLL is possible (writing 0x42/0x02 to register 0x1), and the current setting can be read back.
> 
> I don't think auto-detection is possible for HID++1.0 devices.
> 

See the ticket for more details.

BTW, let me use this mail to also add the report to the list of tracked
regressions to ensure it's doesn't fall through the cracks:

#regzbot introduced: v6.0..v6.1
https://bugzilla.kernel.org/show_bug.cgi?id=216903
#regzbot title: hid: HiRes Scroll for Performance Mouse MX broken
#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
If I did something stupid, please tell me, as explained on that page.

^ permalink raw reply

* Re: [PATCH 59/69] Input: silead - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
From: Hans de Goede @ 2023-01-09  8:45 UTC (permalink / raw)
  To: Jonathan Cameron, linux-input, Dmitry Torokhov; +Cc: Jonathan Cameron
In-Reply-To: <20230102181842.718010-60-jic23@kernel.org>

Hi,

On 1/2/23 19:18, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
> against unused function warnings.  The new combination of pm_sleep_ptr()
> and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
> thus suppressing the warning, but still allowing the unused code to be
> removed. Thus also drop the __maybe_unused markings.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/touchscreen/silead.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
> index 8a7351c4414c..a37fac089010 100644
> --- a/drivers/input/touchscreen/silead.c
> +++ b/drivers/input/touchscreen/silead.c
> @@ -736,7 +736,7 @@ static int silead_ts_probe(struct i2c_client *client)
>  	return 0;
>  }
>  
> -static int __maybe_unused silead_ts_suspend(struct device *dev)
> +static int silead_ts_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  
> @@ -745,7 +745,7 @@ static int __maybe_unused silead_ts_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused silead_ts_resume(struct device *dev)
> +static int silead_ts_resume(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	bool second_try = false;
> @@ -784,7 +784,7 @@ static int __maybe_unused silead_ts_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume);
>  
>  static const struct i2c_device_id silead_ts_id[] = {
>  	{ "gsl1680", 0 },
> @@ -832,7 +832,7 @@ static struct i2c_driver silead_ts_driver = {
>  		.name = SILEAD_TS_NAME,
>  		.acpi_match_table = ACPI_PTR(silead_ts_acpi_match),
>  		.of_match_table = of_match_ptr(silead_ts_of_match),
> -		.pm = &silead_ts_pm,
> +		.pm = pm_sleep_ptr(&silead_ts_pm),
>  	},
>  };
>  module_i2c_driver(silead_ts_driver);


^ permalink raw reply

* Re: [PATCH 26/69] Input: elan_i2c_core - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
From: Hans de Goede @ 2023-01-09  8:44 UTC (permalink / raw)
  To: Jonathan Cameron, linux-input, Dmitry Torokhov
  Cc: Jonathan Cameron, Raul E Rangel
In-Reply-To: <20230102181842.718010-27-jic23@kernel.org>

Hi,

On 1/2/23 19:17, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
> against unused function warnings.  The new combination of pm_sleep_ptr()
> and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
> thus suppressing the warning, but still allowing the unused code to be
> removed. Thus also drop the __maybe_unused markings.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Raul E Rangel <rrangel@chromium.org>
> Cc: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/mouse/elan_i2c_core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index 76729ada1582..5f0d75a45c80 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -1328,7 +1328,7 @@ static int elan_probe(struct i2c_client *client)
>  	return 0;
>  }
>  
> -static int __maybe_unused elan_suspend(struct device *dev)
> +static int elan_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct elan_tp_data *data = i2c_get_clientdata(client);
> @@ -1365,7 +1365,7 @@ static int __maybe_unused elan_suspend(struct device *dev)
>  	return ret;
>  }
>  
> -static int __maybe_unused elan_resume(struct device *dev)
> +static int elan_resume(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct elan_tp_data *data = i2c_get_clientdata(client);
> @@ -1394,7 +1394,7 @@ static int __maybe_unused elan_resume(struct device *dev)
>  	return error;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(elan_pm_ops, elan_suspend, elan_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(elan_pm_ops, elan_suspend, elan_resume);
>  
>  static const struct i2c_device_id elan_id[] = {
>  	{ DRIVER_NAME, 0 },
> @@ -1418,7 +1418,7 @@ MODULE_DEVICE_TABLE(of, elan_of_match);
>  static struct i2c_driver elan_driver = {
>  	.driver = {
>  		.name	= DRIVER_NAME,
> -		.pm	= &elan_pm_ops,
> +		.pm	= pm_sleep_ptr(&elan_pm_ops),
>  		.acpi_match_table = ACPI_PTR(elan_acpi_id),
>  		.of_match_table = of_match_ptr(elan_of_match),
>  		.probe_type = PROBE_PREFER_ASYNCHRONOUS,


^ permalink raw reply

* Re: [PATCH 46/69] Input: goodix - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
From: Hans de Goede @ 2023-01-09  8:45 UTC (permalink / raw)
  To: Jonathan Cameron, linux-input, Dmitry Torokhov
  Cc: Jonathan Cameron, Bastien Nocera
In-Reply-To: <20230102181842.718010-47-jic23@kernel.org>

Hi,

On 1/2/23 19:18, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
> against unused function warnings.  The new combination of pm_sleep_ptr()
> and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
> thus suppressing the warning, but still allowing the unused code to be
> removed. Thus also drop the __maybe_unused markings.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Bastien Nocera <hadess@hadess.net>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/touchscreen/goodix.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
> index 8a0a8078de8f..b348172f19c3 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -1401,7 +1401,7 @@ static void goodix_ts_remove(struct i2c_client *client)
>  		wait_for_completion(&ts->firmware_loading_complete);
>  }
>  
> -static int __maybe_unused goodix_suspend(struct device *dev)
> +static int goodix_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct goodix_ts_data *ts = i2c_get_clientdata(client);
> @@ -1448,7 +1448,7 @@ static int __maybe_unused goodix_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused goodix_resume(struct device *dev)
> +static int goodix_resume(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct goodix_ts_data *ts = i2c_get_clientdata(client);
> @@ -1497,7 +1497,7 @@ static int __maybe_unused goodix_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume);
>  
>  static const struct i2c_device_id goodix_ts_id[] = {
>  	{ "GDIX1001:00", 0 },
> @@ -1543,7 +1543,7 @@ static struct i2c_driver goodix_ts_driver = {
>  		.name = "Goodix-TS",
>  		.acpi_match_table = ACPI_PTR(goodix_acpi_match),
>  		.of_match_table = of_match_ptr(goodix_of_match),
> -		.pm = &goodix_pm_ops,
> +		.pm = pm_sleep_ptr(&goodix_pm_ops),
>  	},
>  };
>  module_i2c_driver(goodix_ts_driver);


^ permalink raw reply

* Re: [PATCH 44/69] input: ektf2127 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
From: Hans de Goede @ 2023-01-09  8:44 UTC (permalink / raw)
  To: Jonathan Cameron, linux-input, Dmitry Torokhov
  Cc: Jonathan Cameron, Jonathan Neuschäfer
In-Reply-To: <20230102181842.718010-45-jic23@kernel.org>

Hi,

On 1/2/23 19:18, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
> against unused function warnings.  The new combination of pm_sleep_ptr()
> and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
> thus suppressing the warning, but still allowing the unused code to be
> removed. Thus also drop the __maybe_unused markings.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> Cc: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/touchscreen/ektf2127.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
> index 328841eaa1b7..e6f1e46d003d 100644
> --- a/drivers/input/touchscreen/ektf2127.c
> +++ b/drivers/input/touchscreen/ektf2127.c
> @@ -177,7 +177,7 @@ static void ektf2127_stop(struct input_dev *dev)
>  	gpiod_set_value_cansleep(ts->power_gpios, 0);
>  }
>  
> -static int __maybe_unused ektf2127_suspend(struct device *dev)
> +static int ektf2127_suspend(struct device *dev)
>  {
>  	struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev));
>  
> @@ -189,7 +189,7 @@ static int __maybe_unused ektf2127_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused ektf2127_resume(struct device *dev)
> +static int ektf2127_resume(struct device *dev)
>  {
>  	struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev));
>  
> @@ -201,8 +201,8 @@ static int __maybe_unused ektf2127_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(ektf2127_pm_ops, ektf2127_suspend,
> -			 ektf2127_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(ektf2127_pm_ops, ektf2127_suspend,
> +				ektf2127_resume);
>  
>  static int ektf2127_query_dimension(struct i2c_client *client, bool width)
>  {
> @@ -348,7 +348,7 @@ MODULE_DEVICE_TABLE(i2c, ektf2127_i2c_id);
>  static struct i2c_driver ektf2127_driver = {
>  	.driver = {
>  		.name	= "elan_ektf2127",
> -		.pm	= &ektf2127_pm_ops,
> +		.pm	= pm_sleep_ptr(&ektf2127_pm_ops),
>  		.of_match_table = of_match_ptr(ektf2127_of_match),
>  	},
>  	.probe_new = ektf2127_probe,


^ permalink raw reply

* Re: [PATCH 37/69] Input: chipone_in8318 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
From: Hans de Goede @ 2023-01-09  8:44 UTC (permalink / raw)
  To: Jonathan Cameron, linux-input, Dmitry Torokhov; +Cc: Jonathan Cameron
In-Reply-To: <20230102181842.718010-38-jic23@kernel.org>

Hi,

On 1/2/23 19:18, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
> against unused function warnings.  The new combination of pm_sleep_ptr()
> and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
> thus suppressing the warning, but still allowing the unused code to be
> removed. Thus also drop the #ifdef guards.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/touchscreen/chipone_icn8318.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c
> index f6769e4bd4f2..32b714a6ed2d 100644
> --- a/drivers/input/touchscreen/chipone_icn8318.c
> +++ b/drivers/input/touchscreen/chipone_icn8318.c
> @@ -148,7 +148,6 @@ static void icn8318_stop(struct input_dev *dev)
>  	gpiod_set_value_cansleep(data->wake_gpio, 0);
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
>  static int icn8318_suspend(struct device *dev)
>  {
>  	struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev));
> @@ -172,9 +171,8 @@ static int icn8318_resume(struct device *dev)
>  
>  	return 0;
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(icn8318_pm_ops, icn8318_suspend, icn8318_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(icn8318_pm_ops, icn8318_suspend, icn8318_resume);
>  
>  static int icn8318_probe(struct i2c_client *client)
>  {
> @@ -263,7 +261,7 @@ MODULE_DEVICE_TABLE(i2c, icn8318_i2c_id);
>  static struct i2c_driver icn8318_driver = {
>  	.driver = {
>  		.name	= "chipone_icn8318",
> -		.pm	= &icn8318_pm_ops,
> +		.pm	= pm_sleep_ptr(&icn8318_pm_ops),
>  		.of_match_table = icn8318_of_match,
>  	},
>  	.probe_new = icn8318_probe,


^ permalink raw reply

* Re: [PATCH 38/69] Input: chipone_icn8505 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
From: Hans de Goede @ 2023-01-09  8:44 UTC (permalink / raw)
  To: Jonathan Cameron, linux-input, Dmitry Torokhov; +Cc: Jonathan Cameron
In-Reply-To: <20230102181842.718010-39-jic23@kernel.org>

Hi,

On 1/2/23 19:18, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
> against unused function warnings.  The new combination of pm_sleep_ptr()
> and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
> thus suppressing the warning, but still allowing the unused code to be
> removed. Thus also drop the __maybe_unused markings.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/touchscreen/chipone_icn8505.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/chipone_icn8505.c b/drivers/input/touchscreen/chipone_icn8505.c
> index c421f4be2700..246bee0bee53 100644
> --- a/drivers/input/touchscreen/chipone_icn8505.c
> +++ b/drivers/input/touchscreen/chipone_icn8505.c
> @@ -460,7 +460,7 @@ static int icn8505_probe(struct i2c_client *client)
>  	return 0;
>  }
>  
> -static int __maybe_unused icn8505_suspend(struct device *dev)
> +static int icn8505_suspend(struct device *dev)
>  {
>  	struct icn8505_data *icn8505 = i2c_get_clientdata(to_i2c_client(dev));
>  
> @@ -471,7 +471,7 @@ static int __maybe_unused icn8505_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused icn8505_resume(struct device *dev)
> +static int icn8505_resume(struct device *dev)
>  {
>  	struct icn8505_data *icn8505 = i2c_get_clientdata(to_i2c_client(dev));
>  	int error;
> @@ -484,7 +484,7 @@ static int __maybe_unused icn8505_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(icn8505_pm_ops, icn8505_suspend, icn8505_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(icn8505_pm_ops, icn8505_suspend, icn8505_resume);
>  
>  static const struct acpi_device_id icn8505_acpi_match[] = {
>  	{ "CHPN0001" },
> @@ -495,7 +495,7 @@ MODULE_DEVICE_TABLE(acpi, icn8505_acpi_match);
>  static struct i2c_driver icn8505_driver = {
>  	.driver = {
>  		.name	= "chipone_icn8505",
> -		.pm	= &icn8505_pm_ops,
> +		.pm	= pm_sleep_ptr(&icn8505_pm_ops),
>  		.acpi_match_table = icn8505_acpi_match,
>  	},
>  	.probe_new = icn8505_probe,


^ permalink raw reply

* Słowa kluczowe do wypozycjonowania
From: Adam Charachuta @ 2023-01-09  8:40 UTC (permalink / raw)
  To: linux-input

Dzień dobry,

zapoznałem się z Państwa ofertą i z przyjemnością przyznaję, że przyciąga uwagę i zachęca do dalszych rozmów. 

Pomyślałem, że może mógłbym mieć swój wkład w Państwa rozwój i pomóc dotrzeć z tą ofertą do większego grona odbiorców. Pozycjonuję strony www, dzięki czemu generują świetny ruch w sieci.

Możemy porozmawiać w najbliższym czasie?


Pozdrawiam
Adam Charachuta

^ permalink raw reply

* Re: [PATCH 0/8] HID: remove some unneeded exported symbols from hid.h
From: Hans de Goede @ 2023-01-09  8:39 UTC (permalink / raw)
  To: Thomas Weißschuh, Jiri Kosina, Benjamin Tissoires,
	David Rheinsberg, Marcel Holtmann, Johan Hedberg,
	Luiz Augusto von Dentz, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-input, linux-kernel, linux-usb, linux-bluetooth, netdev
In-Reply-To: <20221222-hid-v1-0-f4a6c35487a5@weissschuh.net>

Hi,

On 12/22/22 06:10, Thomas Weißschuh wrote:
> Small cleanup to get rid of exports of the lowlevel hid drivers and to make
> them const.

Thanks, the entire series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for the series.

Regards,

Hans


> 
> To: Hans de Goede <hdegoede@redhat.com>
> To: Jiri Kosina <jikos@kernel.org>
> To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> To: David Rheinsberg <david.rheinsberg@gmail.com>
> To: Marcel Holtmann <marcel@holtmann.org>
> To: Johan Hedberg <johan.hedberg@gmail.com>
> To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
> To: "David S. Miller" <davem@davemloft.net>
> To: Eric Dumazet <edumazet@google.com>
> To: Jakub Kicinski <kuba@kernel.org>
> To: Paolo Abeni <pabeni@redhat.com>
> Cc: linux-input@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-usb@vger.kernel.org
> Cc: linux-bluetooth@vger.kernel.org
> Cc: netdev@vger.kernel.org
> 
> ---
> Thomas Weißschuh (8):
>       HID: letsketch: Use hid_is_usb()
>       HID: usbhid: Make hid_is_usb() non-inline
>       HID: Remove unused function hid_is_using_ll_driver()
>       HID: Unexport struct usb_hid_driver
>       HID: Unexport struct uhid_hid_driver
>       HID: Unexport struct hidp_hid_driver
>       HID: Unexport struct i2c_hid_ll_driver
>       HID: Make lowlevel driver structs const
> 
>  drivers/hid/hid-letsketch.c        |  2 +-
>  drivers/hid/i2c-hid/i2c-hid-core.c |  3 +--
>  drivers/hid/uhid.c                 |  3 +--
>  drivers/hid/usbhid/hid-core.c      |  9 +++++++--
>  include/linux/hid.h                | 18 ++----------------
>  net/bluetooth/hidp/core.c          |  3 +--
>  6 files changed, 13 insertions(+), 25 deletions(-)
> ---
> base-commit: d264dd3bbbd16b56239e889023fbe49413a58eaf
> change-id: 20221222-hid-b9551f9fa236
> 
> Best regards,


^ permalink raw reply

* RE: [PATCH v3 1/4] dt-bindings: mfd: Add nxp bbnsm
From: Jacky Bai @ 2023-01-09  2:16 UTC (permalink / raw)
  To: Rob Herring
  Cc: lee@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de,
	dmitry.torokhov@gmail.com, a.zummo@towertech.it,
	alexandre.belloni@bootlin.com, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org,
	linux-rtc@vger.kernel.org, kernel@pengutronix.de, dl-linux-imx,
	festevam@gmail.com
In-Reply-To: <20230108210551.GA268766-robh@kernel.org>

> Subject: Re: [PATCH v3 1/4] dt-bindings: mfd: Add nxp bbnsm
> 
> On Tue, Jan 03, 2023 at 03:47:39PM +0800, Jacky Bai wrote:
> > Add binding for NXP BBNSM(Battery-Backed Non-Secure Module).
> >
> > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> > ---
> >   - v2 changes:
> >     - remove the redundant 'bindings' string
> >     - add ref to rtc.yaml
> >     - add start-year property
> >     - rename 'regmap' to 'nxp,bbnsm-regmap' and add description & type
> define
> >     - add header files including in the example and correct the
> > indentation
> >
> >   -v3 changes:
> >     - remove the 'nxp,bbnsm-regmap' property, get the regmap directly
> from the
> >       parent node in rtc/pwrkey driver
> > ---
> >  .../devicetree/bindings/mfd/nxp,bbnsm.yaml    | 99
> +++++++++++++++++++
> >  1 file changed, 99 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> > b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> > new file mode 100644
> > index 000000000000..bcd8fbc6e297
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> > @@ -0,0 +1,99 @@

...

> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - nxp,bbnsm
> 
> Is this a standalone device or block in an SoC. In the latter case, this needs to
> be SoC specific.

it is an IP block in SoC, currently used on NXP i.MX SoC. I will change it to SoC specific in v4.

BR
> 
> > +      - const: syscon
> > +      - const: simple-mfd
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  rtc:
> > +    type: object
> > +    $ref: /schemas/rtc/rtc.yaml#
> > +
> > +    properties:
> > +      compatible:
> > +        const: nxp,bbnsm-rtc
> > +
> > +      interrupts:
> > +        maxItems: 1
> > +
> > +      start-year: true
> > +
> > +    required:
> > +      - compatible
> > +      - interrupts
> > +
> > +    additionalProperties: false
> > +
> > +  pwrkey:
> > +    type: object
> > +    $ref: /schemas/input/input.yaml#
> > +
> > +    properties:
> > +      compatible:
> > +        const: nxp,bbnsm-pwrkey
> > +
> > +      interrupts:
> > +        maxItems: 1
> > +
> > +      linux,code: true
> > +
> > +    required:
> > +      - compatible
> > +      - interrupts
> > +
> > +    additionalProperties: false
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - rtc
> > +  - pwrkey
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/input/linux-event-codes.h>
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +
> > +    bbnsm: bbnsm@44440000 {
> > +        compatible = "nxp,bbnsm", "syscon", "simple-mfd";
> > +        reg = <0x44440000 0x10000>;
> > +
> > +        bbnsm_rtc: rtc {
> > +            compatible = "nxp,bbnsm-rtc";
> > +            interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
> > +        };
> > +
> > +        bbnsm_pwrkey: pwrkey {
> > +            compatible = "nxp,bbnsm-pwrkey";
> > +            interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
> > +            linux,code = <KEY_POWER>;
> > +        };
> > +    };
> > --
> > 2.37.1
> >
> >

^ permalink raw reply

* RE: [HID] Fixing support for USB joystick Hat
From: Vanduir Volpato Maia @ 2023-01-09  1:00 UTC (permalink / raw)
  To: linux-input@vger.kernel.org
In-Reply-To: <BYAPR05MB48556359FC6E116CE9D63696C5F99@BYAPR05MB4855.namprd05.prod.outlook.com>

Correcting myself, the hat reports a whole byte, with the directions as follows:
idle	0xF0
 ↑	0x00
→↑	0x1E
→	0x3C
→↓	0x5A
 ↓	0x78
←↓	0x96
 ←	0xB4
←↑	0xD2
Apparently it reports with a higher resolution than normal. I guess that makes the driver think it's an Axis?



De: Vanduir Volpato Maia <jackmcslay@hotmail.com>
Enviado: domingo, 8 de janeiro de 2023 20:56
Para: linux-input@vger.kernel.org <linux-input@vger.kernel.org>
Assunto: [HID] Fixing support for USB joystick Hat 
 
I have bought a Flashfire Cobra V6 and it turns out the hat does not work properly under linux. The hat reports as if it's a single axis that remains at a given value depending on the direction I press, with Hat0Y being missing. I've investigated the I/O of the joystick with Wireshark and worked out the output from the joystick for each hat direction: 
up: 0x8 
up-right: 0xC 
right: 0x4 
down-right: 0x5 
down: 0x1 
down-left: 0x3
left: 0x2
up-left: 0xA 
idle: 0x0
Which seems completely different from every other USB joystick I've tried that seems to go from 0x0 to 0x7 with 0xF being idle. 

Can someone point me where do I look at the source to try to fix?

^ permalink raw reply

* [HID] Fixing support for USB joystick Hat
From: Vanduir Volpato Maia @ 2023-01-08 23:56 UTC (permalink / raw)
  To: linux-input@vger.kernel.org
In-Reply-To: <BYAPR05MB4855BAFFBAB3618D2E7A4418C5F99@BYAPR05MB4855.namprd05.prod.outlook.com>

I have bought a Flashfire Cobra V6 and it turns out the hat does not work properly under linux. The hat reports as if it's a single axis that remains at a given value depending on the direction I press, with Hat0Y being missing. I've investigated the I/O of the joystick with Wireshark and worked out the output from the joystick for each hat direction: 
up: 0x8 
up-right: 0xC 
right: 0x4 
down-right: 0x5 
down: 0x1 
down-left: 0x3
left: 0x2
up-left: 0xA 
idle: 0x0
Which seems completely different from every other USB joystick I've tried that seems to go from 0x0 to 0x7 with 0xF being idle. 

Can someone point me where do I look at the source to try to fix?

^ permalink raw reply

* Re: [PATCH v2 1/2] dt-bindings: input: microchip,cap11xx: add cap1203, cap1293 and cap1298
From: Rob Herring @ 2023-01-08 21:43 UTC (permalink / raw)
  To: Jiri Valek - 2N
  Cc: devicetree, dmitry.torokhov, krzysztof.kozlowski+dt, linux-input,
	linux-kernel, u.kleine-koenig
In-Reply-To: <20230104135951.930783-2-jiriv@axis.com>

On Wed, Jan 04, 2023 at 02:59:50PM +0100, Jiri Valek - 2N wrote:
> Add support for cap1203, cap1293 and cap1298.
> 
> Signed-off-by: Jiri Valek - 2N <jiriv@axis.com>
> ---
>  Documentation/devicetree/bindings/input/microchip,cap11xx.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml b/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
> index 67d4d8f86a2d..08ca993b94c4 100644
> --- a/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
> +++ b/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
> @@ -20,6 +20,9 @@ properties:
>        - microchip,cap1126
>        - microchip,cap1188
>        - microchip,cap1206
> +      - microchip,cap1203
> +      - microchip,cap1293
> +      - microchip,cap1298

Maintain alphabetical order please.

>  
>    reg:
>      maxItems: 1
> -- 
> 2.25.1
> 
> 

^ permalink raw reply

* Re: [PATCH v3 1/4] dt-bindings: mfd: Add nxp bbnsm
From: Rob Herring @ 2023-01-08 21:05 UTC (permalink / raw)
  To: Jacky Bai
  Cc: lee, krzysztof.kozlowski+dt, shawnguo, s.hauer, dmitry.torokhov,
	a.zummo, alexandre.belloni, devicetree, linux-arm-kernel,
	linux-input, linux-rtc, kernel, linux-imx, festevam
In-Reply-To: <20230103074742.2324924-2-ping.bai@nxp.com>

On Tue, Jan 03, 2023 at 03:47:39PM +0800, Jacky Bai wrote:
> Add binding for NXP BBNSM(Battery-Backed Non-Secure Module).
> 
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> ---
>   - v2 changes:
>     - remove the redundant 'bindings' string
>     - add ref to rtc.yaml
>     - add start-year property
>     - rename 'regmap' to 'nxp,bbnsm-regmap' and add description & type define
>     - add header files including in the example and correct the indentation
> 
>   -v3 changes:
>     - remove the 'nxp,bbnsm-regmap' property, get the regmap directly from the
>       parent node in rtc/pwrkey driver
> ---
>  .../devicetree/bindings/mfd/nxp,bbnsm.yaml    | 99 +++++++++++++++++++
>  1 file changed, 99 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> new file mode 100644
> index 000000000000..bcd8fbc6e297
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> @@ -0,0 +1,99 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/nxp,bbnsm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP Battery-Backed Non-Secure Module
> +
> +maintainers:
> +  - Jacky Bai <ping.bai@nxp.com>
> +
> +description: |
> +  NXP BBNSM serves as non-volatile logic and storage for the system.
> +  it Intergrates RTC & ON/OFF control.
> +  The RTC can retain its state and continues counting even when the
> +  main chip is power down. A time alarm is generated once the most
> +  significant 32 bits of the real-time counter match the value in the
> +  Time Alarm register.
> +  The ON/OFF logic inside the BBNSM allows for connecting directly to
> +  a PMIC or other voltage regulator device. both smart PMIC mode and
> +  Dumb PMIC mode supported.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - nxp,bbnsm

Is this a standalone device or block in an SoC. In the latter case, this 
needs to be SoC specific.

> +      - const: syscon
> +      - const: simple-mfd
> +
> +  reg:
> +    maxItems: 1
> +
> +  rtc:
> +    type: object
> +    $ref: /schemas/rtc/rtc.yaml#
> +
> +    properties:
> +      compatible:
> +        const: nxp,bbnsm-rtc
> +
> +      interrupts:
> +        maxItems: 1
> +
> +      start-year: true
> +
> +    required:
> +      - compatible
> +      - interrupts
> +
> +    additionalProperties: false
> +
> +  pwrkey:
> +    type: object
> +    $ref: /schemas/input/input.yaml#
> +
> +    properties:
> +      compatible:
> +        const: nxp,bbnsm-pwrkey
> +
> +      interrupts:
> +        maxItems: 1
> +
> +      linux,code: true
> +
> +    required:
> +      - compatible
> +      - interrupts
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - rtc
> +  - pwrkey
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/input/linux-event-codes.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    bbnsm: bbnsm@44440000 {
> +        compatible = "nxp,bbnsm", "syscon", "simple-mfd";
> +        reg = <0x44440000 0x10000>;
> +
> +        bbnsm_rtc: rtc {
> +            compatible = "nxp,bbnsm-rtc";
> +            interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
> +        };
> +
> +        bbnsm_pwrkey: pwrkey {
> +            compatible = "nxp,bbnsm-pwrkey";
> +            interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
> +            linux,code = <KEY_POWER>;
> +        };
> +    };
> -- 
> 2.37.1
> 
> 

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox