platform/kernel/linux-rpi.git
22 months agos390/con3270: move condev definition
Heiko Carstens [Tue, 10 Jan 2023 12:49:23 +0000 (13:49 +0100)]
s390/con3270: move condev definition

Fix this for allmodconfig:

drivers/s390/char/con3270.c:43:24: error: 'condev' defined but not used [-Werror=unused-variable]
 static struct tty3270 *condev;
                        ^~~~~~

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: c17fe081ac1f ("s390/3270: unify con3270 + tty3270")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/zcrypt: use strscpy() to instead of strncpy()
Xu Panda [Thu, 5 Jan 2023 12:24:34 +0000 (20:24 +0800)]
s390/zcrypt: use strscpy() to instead of strncpy()

The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL-terminated strings.

Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
Link: https://lore.kernel.org/r/202301052024349365834@zte.com.cn
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: remove old IDA format restrictions
Eric Farman [Fri, 19 Feb 2021 19:41:49 +0000 (20:41 +0100)]
vfio/ccw: remove old IDA format restrictions

By this point, all the pieces are in place to properly support
a 2K Format-2 IDAL, and to convert a guest Format-1 IDAL to
the 2K Format-2 variety. Let's remove the fence that prohibits
them, and allow a guest to submit them if desired.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: don't group contiguous pages on 2K IDAWs
Eric Farman [Thu, 11 Aug 2022 17:20:54 +0000 (19:20 +0200)]
vfio/ccw: don't group contiguous pages on 2K IDAWs

The vfio_pin_pages() interface allows contiguous pages to be
pinned as a single request, which is great for the 4K pages
that are normally processed. Old IDA formats operate on 2K
chunks, which makes this logic more difficult.

Since these formats are rare, let's just invoke the page
pinning one-at-a-time, instead of trying to group them.
We can rework this code at a later date if needed.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: handle a guest Format-1 IDAL
Eric Farman [Mon, 31 Oct 2022 18:48:29 +0000 (19:48 +0100)]
vfio/ccw: handle a guest Format-1 IDAL

There are two scenarios that need to be addressed here.

First, an ORB that does NOT have the Format-2 IDAL bit set could
have both a direct-addressed CCW and an indirect-data-address CCW
chained together. This means that the IDA CCW will contain a
Format-1 IDAL, and can be easily converted to a 2K Format-2 IDAL.
But it also means that the direct-addressed CCW needs to be
converted to the same 2K Format-2 IDAL for consistency with the
ORB settings.

Secondly, a Format-1 IDAL is comprised of 31-bit addresses.
Thus, we need to cast this IDAL to a pointer of ints while
populating the list of addresses that are sent to vfio.

Since the result of both of these is the use of the 2K IDAL
variants, and the output of vfio-ccw is always a Format-2 IDAL
(in order to use 64-bit addresses), make sure that the correct
control bit gets set in the ORB when these scenarios occur.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: allocate/populate the guest idal
Eric Farman [Fri, 21 Oct 2022 18:53:51 +0000 (20:53 +0200)]
vfio/ccw: allocate/populate the guest idal

Today, we allocate memory for a list of IDAWs, and if the CCW
being processed contains an IDAL we read that data from the guest
into that space. We then copy each IDAW into the pa_iova array,
or fabricate that pa_iova array with a list of addresses based
on a direct-addressed CCW.

Combine the reading of the guest IDAL with the creation of a
pseudo-IDAL for direct-addressed CCWs, so that both CCW types
have a "guest" IDAL that can be populated straight into the
pa_iova array.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: calculate number of IDAWs regardless of format
Eric Farman [Wed, 2 Dec 2020 18:37:24 +0000 (19:37 +0100)]
vfio/ccw: calculate number of IDAWs regardless of format

The idal_nr_words() routine works well for 4K IDAWs, but lost its
ability to handle the old 2K formats with the removal of 31-bit
builds in commit 5a79859ae0f3 ("s390: remove 31 bit support").

Since there's nothing preventing a guest from generating this IDAW
format, let's re-introduce the math for them and use both when
calculating the number of IDAWs based on the bits specified in
the ORB.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: read only one Format-1 IDAW
Eric Farman [Thu, 20 Oct 2022 17:00:14 +0000 (19:00 +0200)]
vfio/ccw: read only one Format-1 IDAW

The intention is to read the first IDAW to determine the starting
location of an I/O operation, knowing that the second and any/all
subsequent IDAWs will be aligned per architecture. But, this read
receives 64-bits of data, which is the size of a Format-2 IDAW.

In the event that Format-1 IDAWs are presented, adjust the size
of the read to 32-bits. The data will end up occupying the upper
word of the target iova variable, so shift it down to the lower
word for use as an address. (By definition, this IDAW format
uses a 31-bit address, so the "sign" bit will always be off and
there is no concern about sign extension.)

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: refactor the idaw counter
Eric Farman [Mon, 31 Oct 2022 18:12:54 +0000 (19:12 +0100)]
vfio/ccw: refactor the idaw counter

The rules of an IDAW are fairly simple: Each one can move no
more than a defined amount of data, must not cross the
boundary defined by that length, and must be aligned to that
length as well. The first IDAW in a list is special, in that
it does not need to adhere to that alignment, but the other
rules still apply. Thus, by reading the first IDAW in a list,
the number of IDAWs that will comprise a data transfer of a
particular size can be calculated.

Let's factor out the reading of that first IDAW with the
logic that calculates the length of the list, to simplify
the rest of the routine that handles the individual IDAWs.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: populate page_array struct inline
Eric Farman [Fri, 21 Oct 2022 15:02:48 +0000 (17:02 +0200)]
vfio/ccw: populate page_array struct inline

There are two possible ways the list of addresses that get passed
to vfio are calculated. One is from a guest IDAL, which would be
an array of (probably) non-contiguous addresses. The other is
built from contiguous pages that follow the starting address
provided by ccw->cda.

page_array_alloc() attempts to simplify things by pre-populating
this array from the starting address, but that's not needed for
a CCW with an IDAL anyway so doesn't need to be in the allocator.
Move it to the caller in the non-IDAL case, since it will be
overwritten when reading the guest IDAL.

Remove the initialization of the pa_page output pointers,
since it won't be explicitly needed for either case.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: pass page count to page_array struct
Eric Farman [Fri, 21 Oct 2022 14:59:13 +0000 (16:59 +0200)]
vfio/ccw: pass page count to page_array struct

The allocation of our page_array struct calculates the number
of 4K pages that would be needed to hold a certain number of
bytes. But, since the number of pages that will be pinned is
also calculated by the length of the IDAL, this logic is
unnecessary. Let's pass that information in directly, and
avoid the math within the allocator.

Also, let's make this two allocations instead of one,
to make it apparent what's happening within here.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: remove unnecessary malloc alignment
Eric Farman [Thu, 22 Oct 2020 14:54:32 +0000 (16:54 +0200)]
vfio/ccw: remove unnecessary malloc alignment

Everything about this allocation is harder than necessary,
since the memory allocation is already aligned to our needs.
Break them apart for readability, instead of doing the
funky arithmetic.

Of the structures that are involved, only ch_ccw needs the
GFP_DMA flag, so the others can be allocated without it.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: simplify CCW chain fetch routines
Eric Farman [Fri, 21 Oct 2022 13:32:30 +0000 (15:32 +0200)]
vfio/ccw: simplify CCW chain fetch routines

The act of processing a fetched CCW has two components:

 1) Process a Transfer-in-channel (TIC) CCW
 2) Process any other CCW

The former needs to look at whether the TIC jumps backwards into
the current channel program or forwards into a new segment,
while the latter just processes the CCW data address itself.

Rather than passing the chain segment and index within it to the
handlers for the above, and requiring each to calculate the
elements it needs, simply pass the needed pointers directly.

For the TIC, that means the CCW being processed and the location
of the entire channel program which holds all segments. For the
other CCWs, the page_array pointer is also needed to perform the
page pinning, etc.

While at it, rename ccwchain_fetch_direct to _ccw, to indicate
what it is. The name "_direct" is historical, when it used to
process a direct-addressed CCW, but IDAs are processed here too.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: replace copy_from_iova with vfio_dma_rw
Eric Farman [Thu, 7 Jul 2022 15:30:26 +0000 (17:30 +0200)]
vfio/ccw: replace copy_from_iova with vfio_dma_rw

It was suggested [1] that we replace the old copy_from_iova() routine
(which pins a page, does a memcpy, and unpins the page) with the
newer vfio_dma_rw() interface.

This has a modest improvement in the overall time spent through the
fsm_io_request() path, and simplifies some of the code to boot.

[1] https://lore.kernel.org/r/20220706170553.GK693670@nvidia.com/

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: move where IDA flag is set in ORB
Eric Farman [Wed, 2 Dec 2020 18:19:30 +0000 (19:19 +0100)]
vfio/ccw: move where IDA flag is set in ORB

The output of vfio_ccw is always a Format-2 IDAL, but the code that
explicitly sets this is buried in cp_init().

In fact the input is often already a Format-2 IDAL, and would be
rejected (via the check in ccwchain_calc_length()) if it weren't,
so explicitly setting it doesn't do much. Setting it way down here
only makes it impossible to make decisions in support of other
IDAL formats.

Let's move that to where the rest of the ORB is set up, so that the
CCW processing in cp_prefetch() is performed according to the
contents of the unmodified guest ORB.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: allow non-zero storage keys
Eric Farman [Thu, 18 Apr 2019 18:26:15 +0000 (20:26 +0200)]
vfio/ccw: allow non-zero storage keys

Currently, vfio-ccw copies the ORB from the io_region to the
channel_program struct being built. It then adjusts various
pieces of that ORB to the values needed to be used by the
SSCH issued by vfio-ccw in the host.

This includes setting the subchannel key to the default,
presumably because Linux doesn't do anything with non-zero
storage keys itself. But it seems wrong to convert every I/O
to the default key if the guest itself requested a non-zero
subchannel (access) key.

Any channel program that sets a non-zero key would expect the
same key returned in the SCSW of the IRB, not zero, so best to
allow that to occur unimpeded.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: simplify the cp_get_orb interface
Eric Farman [Thu, 10 Nov 2022 02:30:23 +0000 (03:30 +0100)]
vfio/ccw: simplify the cp_get_orb interface

There's no need to send in both the address of the subchannel
struct, and an element within it, to populate the ORB.

Pass the whole pointer and let cp_get_orb() take the pieces
that are needed.

Suggested-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agovfio/ccw: cleanup some of the mdev commentary
Eric Farman [Mon, 25 Jul 2022 20:21:14 +0000 (22:21 +0200)]
vfio/ccw: cleanup some of the mdev commentary

There is no longer an mdev struct accessible via a channel
program struct, but there are some artifacts remaining that
mention it. Clean them up.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: add special output handling when oops_in_progress is set
Sven Schnelle [Thu, 8 Dec 2022 19:58:26 +0000 (20:58 +0100)]
s390/con3270: add special output handling when oops_in_progress is set

Normally a user can scroll back with PF7/PF8 if printed messages are
outside of the visible screen area. This doesn't work when the kernel
crashes, because the scrollback handling is done by the kernel, which
is no longer alive after the kernel crash. Add code to always print
all dirty lines in the screen buffer, so the user can scroll back with
the terminal scrollback keys (Page Up/Down).

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: set SBA and RA addresses when converting lines
Sven Schnelle [Thu, 8 Dec 2022 08:24:06 +0000 (09:24 +0100)]
s390/con3270: set SBA and RA addresses when converting lines

Now that lines are converted during output, the RA and SBA no longer
need to get updated as an additional step. Instead set them when
converting the line.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: simplify update flags
Sven Schnelle [Thu, 8 Dec 2022 07:41:17 +0000 (08:41 +0100)]
s390/con3270: simplify update flags

Make TTY3270_UPDATE_ALL the sum of all TTY3270_* flags, so we
don't need any special handling for it.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: return from notifier when activate view fails
Sven Schnelle [Wed, 7 Dec 2022 21:18:38 +0000 (22:18 +0100)]
s390/con3270: return from notifier when activate view fails

When activating the view fails (in this case because the 3270
is disconnected) return from the notifer callback. Otherwise
the system will deadlock.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/diag: use __packed __aligned
Sven Schnelle [Mon, 5 Dec 2022 14:20:46 +0000 (15:20 +0100)]
s390/diag: use __packed __aligned

Use __packed __aligned instead of __attribute__((packed, aligned(X)));
to match the rest of the file.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/fs3270: split header files
Sven Schnelle [Mon, 5 Dec 2022 12:20:46 +0000 (13:20 +0100)]
s390/fs3270: split header files

In order to use the fs3270 one would need at least the ioctl definitions
in uapi. Add two new include files in uapi, which contain:

fs3270: ioctl number declarations + returned struct for TUBGETMOD.
raw3270: all the orders, attributes and similar stuff used with 3270
terminals.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/fs3270: fix screen reset on activate
Sven Schnelle [Mon, 5 Dec 2022 11:32:02 +0000 (12:32 +0100)]
s390/fs3270: fix screen reset on activate

fs3270 uses EWRITEA to clear the screen when a user opens /dev/3270/tub.
However it misses the attribute byte after the EWRITEA, so (at least)
x3270 complains about 'Record too short, missing write flags'.
Add the missing flag byte to fix this.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/fs3270: fix function prototypes
Sven Schnelle [Mon, 5 Dec 2022 09:38:39 +0000 (10:38 +0100)]
s390/fs3270: fix function prototypes

fix function prototypes split over two lines like:

static void
foobar(void)

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/fs3270: use *ptr instead of struct in kzalloc
Sven Schnelle [Mon, 5 Dec 2022 09:31:56 +0000 (10:31 +0100)]
s390/fs3270: use *ptr instead of struct in kzalloc

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/fs3270: remove duplicate assignment
Sven Schnelle [Mon, 5 Dec 2022 09:30:48 +0000 (10:30 +0100)]
s390/fs3270: remove duplicate assignment

remove a duplicate assignment reported by checkpatch.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/fs3270: add missing braces to if/else
Sven Schnelle [Mon, 5 Dec 2022 09:29:05 +0000 (10:29 +0100)]
s390/fs3270: add missing braces to if/else

Fix a few missing braces and wrong placement of braces
reported by checkpatch.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/fs3270: fix whitespace errors
Sven Schnelle [Mon, 5 Dec 2022 09:27:20 +0000 (10:27 +0100)]
s390/fs3270: fix whitespace errors

Fix a few whitespace errors reported by checkpatch, namely
superfluous whitespace, missing spaces and empty lines.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: fix nullpointer check
Sven Schnelle [Mon, 5 Dec 2022 09:01:38 +0000 (10:01 +0100)]
s390/raw3270: fix nullpointer check

Fix the following checkpatch warning:

CHECK: Comparison to NULL could be written "!rp"
+       if (rp == NULL)

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: split up raw3270_activate_view()
Sven Schnelle [Mon, 5 Dec 2022 08:46:24 +0000 (09:46 +0100)]
s390/raw3270: split up raw3270_activate_view()

move the core processing to __raw3270_activate_view() to
reduce the required if/else blocks and indentiion levels.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: remove BUG_ON in raw3270_request_reset()
Sven Schnelle [Mon, 5 Dec 2022 08:09:33 +0000 (09:09 +0100)]
s390/raw3270: remove BUG_ON in raw3270_request_reset()

WARN_ON_ONCE if list is not empty, and return an error code
instead.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: use DEVICE_ATTR_RO() for sysfs attributes
Sven Schnelle [Mon, 5 Dec 2022 08:02:16 +0000 (09:02 +0100)]
s390/raw3270: use DEVICE_ATTR_RO() for sysfs attributes

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: add comment to spinlock member
Sven Schnelle [Mon, 5 Dec 2022 07:57:01 +0000 (08:57 +0100)]
s390/raw3270: add comment to spinlock member

Add a small comment to the lock member of struct raw3270_view
to make checkpatch happy.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: fix raw3270 declarations
Sven Schnelle [Mon, 5 Dec 2022 07:52:29 +0000 (08:52 +0100)]
s390/raw3270: fix raw3270 declarations

checkpatch complains about missing argument names in function
declarations. Fix it.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: fix indentation/whitespace errors
Sven Schnelle [Mon, 5 Dec 2022 07:40:00 +0000 (08:40 +0100)]
s390/raw3270: fix indentation/whitespace errors

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: move EXPORT_SYMBOL() next to functions
Sven Schnelle [Mon, 5 Dec 2022 06:56:16 +0000 (07:56 +0100)]
s390/raw3270: move EXPORT_SYMBOL() next to functions

Fixes a few checkpatch warning about EXPORT_SYMBOL being
at the end of the file instead of being next to the
functions.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: fix minor checkpatch issues
Sven Schnelle [Sun, 4 Dec 2022 20:05:37 +0000 (21:05 +0100)]
s390/con3270: fix minor checkpatch issues

Fix remaining checkpatch issues, like misplaced brackets,
whitespace and similar things. No functional change.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: use msecs_to_jiffies()
Sven Schnelle [Sun, 4 Dec 2022 19:58:45 +0000 (20:58 +0100)]
s390/con3270: use msecs_to_jiffies()

Use msecs_to_jiffies() instead of HZ/10.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: fix multiple assignments in one line
Sven Schnelle [Sun, 4 Dec 2022 19:55:27 +0000 (20:55 +0100)]
s390/con3270: fix multiple assignments in one line

fix the following and similar checkpatch warnings:

CHECK: multiple assignments should be avoided
+        tp->cx = tp->saved_cx = 0;

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: fix camelcase in enum members
Sven Schnelle [Sun, 4 Dec 2022 19:52:11 +0000 (20:52 +0100)]
s390/con3270: fix camelcase in enum members

fix the following and similar checkpatch warnings:

CHECK: Avoid CamelCase: <ESnormal>
+       enum { ESnormal, ESesc, ESsquare, ESparen, ESgetpars };

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: add key help to status area
Sven Schnelle [Tue, 29 Nov 2022 11:28:36 +0000 (12:28 +0100)]
s390/con3270: add key help to status area

To let the user know about function key bindings, print
them next to the Running/History field at the lower right
of the screen. Also print the scrollback position.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: reduce highlight width to 3 bits
Sven Schnelle [Tue, 29 Nov 2022 10:19:09 +0000 (11:19 +0100)]
s390/con3270: reduce highlight width to 3 bits

With the previous change this reduces the size of struct tty3270_attribute
from four to two bytes. As we have this struct allocated for each character
cell, this saves quite some memory.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: reduce f_color and b_color attribute size to 4 bit
Sven Schnelle [Tue, 29 Nov 2022 09:31:19 +0000 (10:31 +0100)]
s390/con3270: reduce f_color and b_color attribute size to 4 bit

As we're only supportign 8 colors, we don't need 8 bits. Reduce the
size to 4 bits to save memory.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: rewrite command line recalling
Sven Schnelle [Mon, 28 Nov 2022 10:34:52 +0000 (11:34 +0100)]
s390/con3270: rewrite command line recalling

Command line recalling is the last user of the 3270 custom malloc()
like allocator. Remove this dependency by using a statically allocated
buffer for the saved command lines, and also remove the allocator.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: use normal char buffer for prompt/input
Sven Schnelle [Mon, 28 Nov 2022 06:31:49 +0000 (07:31 +0100)]
s390/tty3270: use normal char buffer for prompt/input

Preparation patch to allow removing the custom 3270 memory allocator.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: convert lines during output
Sven Schnelle [Thu, 24 Nov 2022 21:53:44 +0000 (22:53 +0100)]
s390/tty3270: convert lines during output

The length of the screen line is variable with the 3270 protocol.
For each attribute (foreground, background color, highlighting etc)
we need 3 bytes: the set attribute order, the attribute number, and
the value of the attribute. This means that depending on screen content,
we might end up 3*3 bytes addtional data for a single character.

Allocating the maximum possible amount of memory is quite a lot, and
we cannot easily extend the lines by allocating memory because we
might get called from atomic context. Failing to extend the memory
would also be bad as that would mean that we could miss kernel messages
in oom conditions. Therefore move the conversion to a 3270 datastream
to tty3270_update(), and use only single line buffer.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: generate status line during output
Sven Schnelle [Sat, 26 Nov 2022 18:34:56 +0000 (19:34 +0100)]
s390/con3270: generate status line during output

Updating the status line is almost the same as generating
it when redrawing the screen. However, the code is much easier
to read when doing so.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add 3270 datastream helpers
Sven Schnelle [Sun, 27 Nov 2022 19:43:53 +0000 (20:43 +0100)]
s390/tty3270: add 3270 datastream helpers

There are lots of places adding attributes or orders to the datastream.
Add a few helpers to make that code shorter and easier to read.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: move ASCII->EBCDIC conversion to convert_line()
Sven Schnelle [Sat, 26 Nov 2022 22:39:16 +0000 (23:39 +0100)]
s390/tty3270: move ASCII->EBCDIC conversion to convert_line()

Instead of always converting the character set, only convert them
when the line is really displayed.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: move tty3270_convert_line()
Sven Schnelle [Sat, 26 Nov 2022 22:24:43 +0000 (23:24 +0100)]
s390/con3270: move tty3270_convert_line()

To make the upcoming patches easier to read, move tty3270_convert_line()
before changing code. No functional change.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: make raw3270_buffer_address() accept x/y coordinates
Sven Schnelle [Sat, 26 Nov 2022 19:18:21 +0000 (20:18 +0100)]
s390/raw3270: make raw3270_buffer_address() accept x/y coordinates

All callers of raw3270_buffer_address() are calculating the offset
from some x/y coordinates. Move that calculation inside of the
function, so user can pass the x/y values directly. Note that
negative values are relative to the end-of-line or end-of-screen.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: allocate screen with scrollback
Sven Schnelle [Thu, 24 Nov 2022 20:22:29 +0000 (21:22 +0100)]
s390/tty3270: allocate screen with scrollback

No functional change (except more memory consumption), in preparation
for the line buffer rework.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: add helper to get number of tty rows
Sven Schnelle [Thu, 24 Nov 2022 19:32:20 +0000 (20:32 +0100)]
s390/con3270: add helper to get number of tty rows

There a quite a few places using 'tp->view.rows - 2'.
Add a helper function for this. This will also be used
when a function key help line will be added.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: split up tty3270_convert_line()
Sven Schnelle [Mon, 28 Nov 2022 18:55:57 +0000 (19:55 +0100)]
s390/tty3270: split up tty3270_convert_line()

To make the code easier to read, split up tty3270_convertline()
into several subfunctions:

- tty3270_resize_line() to realloc the line if it doesn't have enough
  space left
- tty3270_required_length() to calculate how much space we need
- tty3270_add_attributes() to add the color and highlight attributes
- tty3270_add_reset_attributes() to reset the attributes at the end of
  the line

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: resize terminal when the clear key is pressed
Sven Schnelle [Mon, 28 Nov 2022 18:53:04 +0000 (19:53 +0100)]
s390/tty3270: resize terminal when the clear key is pressed

There's no easy way to figure out whether the user has re-connected
to the z/VM session. When the user re-connected with a different geometry
to z/VM, the screen layout is broken. Allow the user to force a resizing
by pressing the Clear Key.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: move resize work to raw3270
Sven Schnelle [Mon, 28 Nov 2022 18:50:10 +0000 (19:50 +0100)]
s390/tty3270: move resize work to raw3270

This change was initially made to reduce code duplication when the
con3270 and tty3270 shared the same resize code. It still makes sense
to move the resize workqueue to raw3270 in case we add some other view
later.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: add raw3270_start_request() helper
Sven Schnelle [Mon, 28 Nov 2022 18:42:28 +0000 (19:42 +0100)]
s390/raw3270: add raw3270_start_request() helper

There are a few places (and there would be more with the following commits)
like this:

raw3270_request_reset(cp->kreset);
raw3270_request_set_cmd(cp->kreset, TC_WRITE);
raw3270_request_add_data(cp->kreset, &kreset_data, 1);
raw3270_start(&cp->view, cp->kreset);

i.e reset a request, setting the command, adding payload, and starting the
request. Add a helper raw3270_start_request() which takes a command and
the payload as argument and calls the approppriate functions.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add AID defines
Sven Schnelle [Mon, 28 Nov 2022 18:40:44 +0000 (19:40 +0100)]
s390/tty3270: add AID defines

Use AID_* instead of hex numbers to make the code a bit
easier to read. also convert the if/else blocks to a
switch statement in tty3270_read_tasklet().

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: ignore NUL characters
Sven Schnelle [Thu, 17 Nov 2022 16:52:40 +0000 (17:52 +0100)]
s390/tty3270: ignore NUL characters

With 'TERM=vt220' zsh is sending several NUL characters with
the prompt to the tty. Both xterm and the linux drm console
seem to ignore them. Ignore them in tty3270 as well.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add support for VT100 graphics escape
Sven Schnelle [Thu, 17 Nov 2022 16:30:40 +0000 (17:30 +0100)]
s390/tty3270: add support for VT100 graphics escape

Add support for ESC(B and ESC(0 to switch between character charset
and graphics charset. Used in vt100 and later terminal generations.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add support for graphic escape
Sven Schnelle [Mon, 28 Nov 2022 21:22:01 +0000 (22:22 +0100)]
s390/tty3270: add support for graphic escape

Add support for ASCII S0/S1 to switch between character
charset and graphic charset.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add support for background color
Sven Schnelle [Thu, 17 Nov 2022 21:22:15 +0000 (22:22 +0100)]
s390/tty3270: add support for background color

3270 terminals support 8 background colors. Add the code to utilize
them. Unfortunately the line erase code need to be adjusted: Without
background colors, it was sufficient to just set the line length to
zero. With background colors, we need to put spaces with the correct
background color.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add struct tty3270_attribute
Sven Schnelle [Tue, 29 Nov 2022 07:02:01 +0000 (08:02 +0100)]
s390/tty3270: add struct tty3270_attribute

In preparation of background color and graphic escape support add
a structure for attributes can be copied at once.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: use __packed instead of __attribute__((packed))
Sven Schnelle [Tue, 29 Nov 2022 10:49:23 +0000 (11:49 +0100)]
s390/raw3270: use __packed instead of __attribute__((packed))

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: use switch/case in tty3270_erase_display()
Sven Schnelle [Sun, 27 Nov 2022 08:26:24 +0000 (09:26 +0100)]
s390/tty3270: use switch/case in tty3270_erase_display()

This makes the code easier to read.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: use switch/case in tty3270_erase_line()
Sven Schnelle [Tue, 29 Nov 2022 11:11:05 +0000 (12:11 +0100)]
s390/tty3270: use switch/case in tty3270_erase_line()

This makes the code easier to read.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/raw3270: fix formatting issues
Sven Schnelle [Mon, 28 Nov 2022 21:38:49 +0000 (22:38 +0100)]
s390/raw3270: fix formatting issues

fix function prototypes split over two lines like:

static void
foobar(void)

and fix superfluous spaces in declarations like

foo * bar

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/con3270: fix formatting issues
Sven Schnelle [Mon, 28 Nov 2022 21:32:35 +0000 (22:32 +0100)]
s390/con3270: fix formatting issues

fix function prototypes split over two lines like:

static void
foobar(void)

and fix superfluous spaces in declarations like

foo * bar

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add support for diag 8c
Sven Schnelle [Thu, 17 Nov 2022 21:02:01 +0000 (22:02 +0100)]
s390/tty3270: add support for diag 8c

The current code uses diag210 to infer the 3270 geometry from the
model number when running on z/VM. This doesn't work well as almost
all 3270 software clients report as 3279-2 with a custom resolution.
tty3270 assumes it has a 80x24 terminal connected because of the -2
suffix. Use diag 8c to fetch the realy geometry from z/VM.

Note that this doesn't allow dynamic resizing, i.e. reconnecting to
a z/VM session with a different geometry.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: rename to con3270
Sven Schnelle [Mon, 28 Nov 2022 18:35:40 +0000 (19:35 +0100)]
s390/tty3270: rename to con3270

Rename the driver file to con3270 to be in sync with con3215.c.
This removes CONFIG_TN3270_TTY, it is now always build if CONFIG_TN3270
is enabled.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/3270: unify con3270 + tty3270
Sven Schnelle [Mon, 28 Nov 2022 18:22:28 +0000 (19:22 +0100)]
s390/3270: unify con3270 + tty3270

There were two flavours of 3270 drivers: con3270, which provides a
console driver, and tty3270 providing a tty driver. A user could switch
with PF3 between the two views. While this sounds nice, it's a bit
annoying: If the user enters a command which triggers a kernel message,
he always has to switch back and forth to see the message. Unify both
views to have kernel messages and tty in one screen, like it is on almost
all other platforms. This also has the nice side effect of removing a lot
of duplicate code.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/tty3270: add tty3270_create_view()
Sven Schnelle [Mon, 28 Nov 2022 18:24:15 +0000 (19:24 +0100)]
s390/tty3270: add tty3270_create_view()

Will be used later for the console driver.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390: remove the last remnants of cputime_t
Nicholas Piggin [Thu, 6 Oct 2022 10:56:35 +0000 (20:56 +1000)]
s390: remove the last remnants of cputime_t

cputime_t was a core kernel type, removed by commits
ed5c8c854f2b..b672592f0221. As explained in commit b672592f0221
("sched/cputime: Remove generic asm headers"), the final cleanup is for
the arch to provide cputime_to_nsec[s](). Commit e53051e757d6
("s390/cputime: provide archicture specific cputime_to_nsecs") did that,
but just didn't remove the then-unused cputime_to_usecs() and associated
remnants.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Link: https://lore.kernel.org/r/20221006105635.115775-1-npiggin@gmail.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agos390/cpumf: support user space events for counting
Thomas Richter [Fri, 23 Dec 2022 10:03:32 +0000 (11:03 +0100)]
s390/cpumf: support user space events for counting

CPU Measurement counting facility events PROBLEM_STATE_CPU_CYCLES(32)
and PROBLEM_STATE_INSTRUCTIONS(33) are valid events. However the device
driver returns error -EOPNOTSUPP when these event are to be installed.

Fix this and allow installation of events PROBLEM_STATE_CPU_CYCLES,
PROBLEM_STATE_CPU_CYCLES:u, PROBLEM_STATE_INSTRUCTIONS and
PROBLEM_STATE_INSTRUCTIONS:u.
Kernel space counting only is still not supported by s390.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
22 months agoLinux 6.2-rc3
Linus Torvalds [Sun, 8 Jan 2023 17:49:43 +0000 (11:49 -0600)]
Linux 6.2-rc3

22 months agoMerge tag 'powerpc-6.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sun, 8 Jan 2023 13:55:08 +0000 (06:55 -0700)]
Merge tag 'powerpc-6.2-2' of git://git./linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Three fixes for various bogosity in our linker script, revealed
   by the recent commit which changed discard behaviour with some
   toolchains.

* tag 'powerpc-6.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/vmlinux.lds: Don't discard .comment
  powerpc/vmlinux.lds: Don't discard .rela* for relocatable builds
  powerpc/vmlinux.lds: Define RUNTIME_DISCARD_EXIT

22 months agoMerge tag 'fixes-2023-01-08' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt...
Linus Torvalds [Sun, 8 Jan 2023 10:54:24 +0000 (02:54 -0800)]
Merge tag 'fixes-2023-01-08' of git://git./linux/kernel/git/rppt/memblock

Pull memblock fixes from Mike Rapoport:
 "Small fixes in kernel-doc and tests:

   - Fix kernel-doc for memblock_phys_free() to use correct names for
     the counterpart allocation methods

   - Fix compilation error in memblock tests"

* tag 'fixes-2023-01-08' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  memblock: Fix doc for memblock_phys_free
  memblock tests: Fix compilation error.

22 months agoMerge tag 'nfs-for-6.2-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Linus Torvalds [Sat, 7 Jan 2023 18:38:11 +0000 (10:38 -0800)]
Merge tag 'nfs-for-6.2-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client fixes from Trond Myklebust:

 - Fix a race in the RPCSEC_GSS upcall code that causes hung RPC calls

 - Fix a broken coalescing test in the pNFS file layout driver

 - Ensure that the access cache rcu path also applies the login test

 - Fix up for a sparse warning

* tag 'nfs-for-6.2-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  NFS: Fix up a sparse warning
  NFS: Judge the file access cache's timestamp in rcu path
  pNFS/filelayout: Fix coalescing test for single DS
  SUNRPC: ensure the matching upcall is in-flight upon downcall

22 months agoMerge tag '6.2-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sat, 7 Jan 2023 18:26:34 +0000 (10:26 -0800)]
Merge tag '6.2-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
 "cifs/smb3 client fixes:

   - two multichannel fixes

   - three reconnect fixes

   - unmap fix"

* tag '6.2-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: fix interface count calculation during refresh
  cifs: refcount only the selected iface during interface update
  cifs: protect access of TCP_Server_Info::{dstaddr,hostname}
  cifs: fix race in assemble_neg_contexts()
  cifs: ignore ipc reconnect failures during dfs failover
  cifs: Fix kmap_local_page() unmapping

22 months agoMerge tag 'devicetree-fixes-for-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 7 Jan 2023 18:20:33 +0000 (10:20 -0800)]
Merge tag 'devicetree-fixes-for-6.2-1' of git://git./linux/kernel/git/robh/linux

Pull devicetree fixes from Rob Herring:

 - Fix DT memory scanning for some MIPS boards when memory is not
   specified in DT

 - Redo CONFIG_CMDLINE* handling for missing /chosen node. The first
   attempt broke PS3 (and possibly other PPC platforms).

 - Fix constraints in QCom Soundwire schema

* tag 'devicetree-fixes-for-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  of: fdt: Honor CONFIG_CMDLINE* even without /chosen node, take 2
  Revert "of: fdt: Honor CONFIG_CMDLINE* even without /chosen node"
  dt-bindings: soundwire: qcom,soundwire: correct sizes related to number of ports
  of/fdt: run soc memory setup when early_init_dt_scan_memory fails

22 months agoMerge tag 'usb-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Sat, 7 Jan 2023 18:12:42 +0000 (10:12 -0800)]
Merge tag 'usb-6.2-rc3' of git://git./linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are some small USB driver fixes for 6.2-rc3 that resolve some
  reported issues. They include:

   - of-reported ulpi problem, so the offending commit is reverted

   - dwc3 driver bugfixes for recent changes

   - fotg210 fixes

  Most of these have been in linux-next for a while, the last few were
  on the mailing list for a long time and passed all the 0-day bot
  testing so all should be fine with them as well"

* tag 'usb-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  usb: dwc3: gadget: Ignore End Transfer delay on teardown
  usb: dwc3: xilinx: include linux/gpio/consumer.h
  usb: fotg210-udc: fix error return code in fotg210_udc_probe()
  usb: fotg210: fix OTG-only build
  Revert "usb: ulpi: defer ulpi_register on ulpi_read_id timeout"

22 months agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Linus Torvalds [Sat, 7 Jan 2023 18:06:47 +0000 (10:06 -0800)]
Merge tag 'for-linus' of git://git./linux/kernel/git/rdma/rdma

Pull rdma fixes from Jason Gunthorpe:
 "Most noticeable is that Yishai found a big data corruption regression
  due to a change in the scatterlist:

   - Do not wrongly combine non-contiguous pages in scatterlist

   - Fix compilation warnings on gcc 13

   - Oops when using some mlx5 stats

   - Bad enforcement of atomic responder resources in mlx5"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
  lib/scatterlist: Fix to merge contiguous pages into the last SG properly
  RDMA/mlx5: Fix validation of max_rd_atomic caps for DC
  RDMA/mlx5: Fix mlx5_ib_get_hw_stats when used for device
  RDMA/srp: Move large values to a new enum for gcc13

22 months agoMerge tag 'kbuild-fixes-v6.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 7 Jan 2023 17:49:52 +0000 (09:49 -0800)]
Merge tag 'kbuild-fixes-v6.2-2' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Fix single *.ko build

 - Fix module builds when vmlinux.o or Module.symver is missing

* tag 'kbuild-fixes-v6.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: readd -w option when vmlinux.o or Module.symver is missing
  kbuild: fix single *.ko build

22 months agoMerge tag 'drm-fixes-2023-01-06' of git://anongit.freedesktop.org/drm/drm
Linus Torvalds [Fri, 6 Jan 2023 23:54:25 +0000 (15:54 -0800)]
Merge tag 'drm-fixes-2023-01-06' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Daniel Vetter:
 "Still not much, but more than last week. Dave should be back next week
  from the beaching.

  drivers:
   - i915-gvt fixes
   - amdgpu/kfd fixes
   - panfrost bo refcounting fix
   - meson afbc corruption fix
   - imx plane width fix

  core:
   - drm/sched fixes
   - drm/mm kunit test fix
   - dma-buf export error handling fixes"

* tag 'drm-fixes-2023-01-06' of git://anongit.freedesktop.org/drm/drm:
  Revert "drm/amd/display: Enable Freesync Video Mode by default"
  drm/i915/gvt: fix double free bug in split_2MB_gtt_entry
  drm/i915/gvt: use atomic operations to change the vGPU status
  drm/i915/gvt: fix vgpu debugfs clean in remove
  drm/i915/gvt: fix gvt debugfs destroy
  drm/i915: unpin on error in intel_vgpu_shadow_mm_pin()
  drm/amd/display: Uninitialized variables causing 4k60 UCLK to stay at DPM1 and not DPM0
  drm/amdkfd: Fix kernel warning during topology setup
  drm/scheduler: Fix lockup in drm_sched_entity_kill()
  drm/imx: ipuv3-plane: Fix overlay plane width
  drm/scheduler: Fix lockup in drm_sched_entity_kill()
  drm/virtio: Fix memory leak in virtio_gpu_object_create()
  drm/meson: Reduce the FIFO lines held when AFBC is not used
  drm/tests: reduce drm_mm_test stack usage
  drm/panfrost: Fix GEM handle creation ref-counting
  drm/plane-helper: Add the missing declaration of drm_atomic_state
  dma-buf: fix dma_buf_export init order v2

22 months agotpm: Allow system suspend to continue when TPM suspend fails
Jason A. Donenfeld [Fri, 6 Jan 2023 03:01:56 +0000 (04:01 +0100)]
tpm: Allow system suspend to continue when TPM suspend fails

TPM 1 is sometimes broken across system suspends, due to races or
locking issues or something else that haven't been diagnosed or fixed
yet, most likely having to do with concurrent reads from the TPM's
hardware random number generator driver. These issues prevent the system
from actually suspending, with errors like:

  tpm tpm0: A TPM error (28) occurred continue selftest
  ...
  tpm tpm0: A TPM error (28) occurred attempting get random
  ...
  tpm tpm0: Error (28) sending savestate before suspend
  tpm_tis 00:08: PM: __pnp_bus_suspend(): tpm_pm_suspend+0x0/0x80 returns 28
  tpm_tis 00:08: PM: dpm_run_callback(): pnp_bus_suspend+0x0/0x10 returns 28
  tpm_tis 00:08: PM: failed to suspend: error 28
  PM: Some devices failed to suspend, or early wake event detected

This issue was partially fixed by 23393c646142 ("char: tpm: Protect
tpm_pm_suspend with locks"), in a last minute 6.1 commit that Linus took
directly because the TPM maintainers weren't available. However, it
seems like this just addresses the most common cases of the bug, rather
than addressing it entirely. So there are more things to fix still,
apparently.

In lieu of actually fixing the underlying bug, just allow system suspend
to continue, so that laptops still go to sleep fine. Later, this can be
reverted when the real bug is fixed.

Link: https://lore.kernel.org/lkml/7cbe96cf-e0b5-ba63-d1b4-f63d2e826efa@suse.cz/
Cc: stable@vger.kernel.org # 6.1+
Reported-by: Vlastimil Babka <vbabka@suse.cz>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Luigi Semenzato <semenzato@chromium.org>
Cc: Peter Huewe <peterhuewe@gmx.de>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Johannes Altmanninger <aclopte@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22 months agohfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling
Linus Torvalds [Wed, 4 Jan 2023 19:06:28 +0000 (11:06 -0800)]
hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling

Commit 55d1cbbbb29e ("hfs/hfsplus: use WARN_ON for sanity check") fixed
a build warning by turning a comment into a WARN_ON(), but it turns out
that syzbot then complains because it can trigger said warning with a
corrupted hfs image.

The warning actually does warn about a bad situation, but we are much
better off just handling it as the error it is.  So rather than warn
about us doing bad things, stop doing the bad things and return -EIO.

While at it, also fix a memory leak that was introduced by an earlier
fix for a similar syzbot warning situation, and add a check for one case
that historically wasn't handled at all (ie neither comment nor
subsequent WARN_ON).

Reported-by: syzbot+7bb7cd3595533513a9e7@syzkaller.appspotmail.com
Fixes: 55d1cbbbb29e ("hfs/hfsplus: use WARN_ON for sanity check")
Fixes: 8d824e69d9f3 ("hfs: fix OOB Read in __hfs_brec_find")
Link: https://lore.kernel.org/lkml/000000000000dbce4e05f170f289@google.com/
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Viacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22 months agoMerge tag 'block-2023-01-06' of git://git.kernel.dk/linux
Linus Torvalds [Fri, 6 Jan 2023 21:12:42 +0000 (13:12 -0800)]
Merge tag 'block-2023-01-06' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:
 "The big change here is obviously the revert of the pktcdvd driver
  removal. Outside of that, just minor tweaks. In detail:

   - Re-instate the pktcdvd driver, which necessitates adding back
     bio_copy_data_iter() and the fops->devnode() hook for now (me)

   - Fix for splitting of a bio marked as NOWAIT, causing either nowait
     reads or writes to error with EAGAIN even if parts of the IO
     completed (me)

   - Fix for ublk, punting management commands to io-wq as they can all
     easily block for extended periods of time (Ming)

   - Removal of SRCU dependency for the block layer (Paul)"

* tag 'block-2023-01-06' of git://git.kernel.dk/linux:
  block: Remove "select SRCU"
  Revert "pktcdvd: remove driver."
  Revert "block: remove devnode callback from struct block_device_operations"
  Revert "block: bio_copy_data_iter"
  ublk: honor IO_URING_F_NONBLOCK for handling control command
  block: don't allow splitting of a REQ_NOWAIT bio
  block: handle bio_split_to_limits() NULL return

22 months agoMerge tag 'io_uring-2023-01-06' of git://git.kernel.dk/linux
Linus Torvalds [Fri, 6 Jan 2023 21:05:13 +0000 (13:05 -0800)]
Merge tag 'io_uring-2023-01-06' of git://git.kernel.dk/linux

Pull io_uring fixes from Jens Axboe:
 "A few minor fixes that should go into the 6.2 release:

   - Fix for a memory leak in io-wq worker creation, if we ultimately
     end up canceling the worker creation before it gets created (me)

   - lockdep annotations for the CQ locking (Pavel)

   - A regression fix for CQ timeout handling (Pavel)

   - Ring pinning around deferred task_work fix (Pavel)

   - A trivial member move in struct io_ring_ctx, saving us some memory
     (me)"

* tag 'io_uring-2023-01-06' of git://git.kernel.dk/linux:
  io_uring: fix CQ waiting timeout handling
  io_uring: move 'poll_multi_queue' bool in io_ring_ctx
  io_uring: lockdep annotate CQ locking
  io_uring: pin context while queueing deferred tw
  io_uring/io-wq: free worker if task_work creation is canceled

22 months agoMerge tag 'tif-notify-signal-2023-01-06' of git://git.kernel.dk/linux
Linus Torvalds [Fri, 6 Jan 2023 20:54:51 +0000 (12:54 -0800)]
Merge tag 'tif-notify-signal-2023-01-06' of git://git.kernel.dk/linux

Pull arm TIF_NOTIFY_SIGNAL fixup from Jens Axboe:
 "Hui Tang reported a performance regressions with _TIF_WORK_MASK in
  newer kernels, which he tracked to a change that went into 5.11. After
  this change, we'll call do_work_pending() more often than we need to,
  because we're now testing bits 0..15 rather than just 0..7.

  Shuffle the bits around to avoid this"

* tag 'tif-notify-signal-2023-01-06' of git://git.kernel.dk/linux:
  ARM: renumber bits related to _TIF_WORK_MASK

22 months agoMerge tag 'ceph-for-6.2-rc3' of https://github.com/ceph/ceph-client
Linus Torvalds [Fri, 6 Jan 2023 20:11:41 +0000 (12:11 -0800)]
Merge tag 'ceph-for-6.2-rc3' of https://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov:
 "Two file locking fixes from Xiubo"

* tag 'ceph-for-6.2-rc3' of https://github.com/ceph/ceph-client:
  ceph: avoid use-after-free in ceph_fl_release_lock()
  ceph: switch to vfs_inode_has_locks() to fix file lock bug

22 months agoMerge tag 'fixes_for_v6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack...
Linus Torvalds [Fri, 6 Jan 2023 20:07:00 +0000 (12:07 -0800)]
Merge tag 'fixes_for_v6.2-rc3' of git://git./linux/kernel/git/jack/linux-fs

Pull UDF fixes from Jan Kara:
 "Two fixups of the UDF changes that went into 6.2-rc1"

* tag 'fixes_for_v6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: initialize newblock to 0
  udf: Fix extension of the last extent in the file

22 months agoMerge tag 'for-6.2-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
Linus Torvalds [Fri, 6 Jan 2023 20:01:49 +0000 (12:01 -0800)]
Merge tag 'for-6.2-rc2-tag' of git://git./linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
 "A few more regression and regular fixes:

   - regressions:
       - fix assertion condition using = instead of ==
       - fix false alert on bad tree level check
       - fix off-by-one error in delalloc search during lseek

   - fix compat ro feature check at read-write remount

   - handle case when read-repair happens with ongoing device replace

   - updated error messages"

* tag 'for-6.2-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: fix compat_ro checks against remount
  btrfs: always report error in run_one_delayed_ref()
  btrfs: handle case when repair happens with dev-replace
  btrfs: fix off-by-one in delalloc search during lseek
  btrfs: fix false alert on bad tree level check
  btrfs: add error message for metadata level mismatch
  btrfs: fix ASSERT em->len condition in btrfs_get_extent

22 months agoMerge tag 'riscv-for-linus-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 6 Jan 2023 19:33:42 +0000 (11:33 -0800)]
Merge tag 'riscv-for-linus-6.2-rc3' of git://git./linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:

 - use the correct mask for c.jr/c.jalr when decoding instructions

 - build fix for get_user() to avoid a sparse warning

* tag 'riscv-for-linus-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: uaccess: fix type of 0 variable on error in get_user()
  riscv, kprobes: Stricter c.jr/c.jalr decoding

22 months agoMerge tag 'perf-tools-fixes-for-v6.2-1-2023-01-06' of git://git.kernel.org/pub/scm...
Linus Torvalds [Fri, 6 Jan 2023 19:23:58 +0000 (11:23 -0800)]
Merge tag 'perf-tools-fixes-for-v6.2-1-2023-01-06' of git://git./linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Fix segfault when trying to process tracepoints present in a
   perf.data file and not linked with libtraceevent.

 - Fix build on uClibc systems by adding missing sys/types.h include,
   that was being obtained indirectly which stopped being the case when
   tools/lib/traceevent was removed.

 - Don't show commands in 'perf help' that depend on linking with
   libtraceevent when not building with that library, which is now a
   possibility since we no longer ship a copy in tools/lib/traceevent.

 - Fix failure in 'perf test' entry testing the combination of 'perf
   probe' user space function + 'perf record' + 'perf script' where it
   expects a backtrace leading to glibc's inet_pton() from 'ping' that
   now happens more than once with glibc 2.35 for IPv6 addreses.

 - Fix for the inet_pton perf test on s/390 where
   'text_to_binary_address' now appears on the backtrace.

 - Fix build error on riscv due to missing header for 'struct
   perf_sample'.

 - Fix 'make -C tools perf_install' install variant by not propagating
   the 'subdir' to submakes for the 'install_headers' targets.

 - Fix handling of unsupported cgroup events when using BPF counters in
   'perf stat'.

 - Count all cgroups, not just the last one when using 'perf stat' and
   combining --for-each-cgroup with --bpf-counters.

   This makes the output using BPF counters match the output without
   using it, which was the intention all along, the output should be the
   same using --bpf-counters or not.

 - Fix 'perf lock contention' core dump related to not finding the
   "__sched_text_end" symbol on s/390.

 - Fix build failure when HEAD is signed: exclude the signature from the
   version string.

 - Add missing closedir() calls to in perf_data__open_dir(), plugging a
   fd leak.

* tag 'perf-tools-fixes-for-v6.2-1-2023-01-06' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf tools: Fix build on uClibc systems by adding missing sys/types.h include
  perf stat: Fix handling of --for-each-cgroup with --bpf-counters to match non BPF mode
  perf stat: Fix handling of unsupported cgroup events when using BPF counters
  perf test record_probe_libc_inet_pton: Fix test on s/390 where 'text_to_binary_address' now appears on the backtrace
  perf lock contention: Fix core dump related to not finding the "__sched_text_end" symbol on s/390
  perf build: Don't propagate subdir to submakes for install_headers
  perf test record_probe_libc_inet_pton: Fix failure due to extra inet_pton() backtrace in glibc >= 2.35
  perf tools: Fix segfault when trying to process tracepoints in perf.data and not linked with libtraceevent
  perf tools: Don't include signature in version strings
  perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands
  perf tools riscv: Fix build error on riscv due to missing header for 'struct perf_sample'
  perf tools: Fix resources leak in perf_data__open_dir()

22 months agoMerge tag 'perf-urgent-2023-01-06' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 6 Jan 2023 19:20:12 +0000 (11:20 -0800)]
Merge tag 'perf-urgent-2023-01-06' of git://git./linux/kernel/git/tip/tip

Pull perf fix from Ingo Molnar:
 "Intel RAPL updates for new model IDs"

* tag 'perf-urgent-2023-01-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86/rapl: Add support for Intel Emerald Rapids
  perf/x86/rapl: Add support for Intel Meteor Lake
  perf/x86/rapl: Treat Tigerlake like Icelake

22 months agoMerge tag 'v6.2-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Fri, 6 Jan 2023 19:14:11 +0000 (11:14 -0800)]
Merge tag 'v6.2-p2' of git://git./linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:
 "This fixes a CFI crash in arm64/sm4 as well as a regression in the
  caam driver"

* tag 'v6.2-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: arm64/sm4 - fix possible crash with CFI enabled
  crypto: caam - fix CAAM io mem access in blob_gen

22 months agousb: dwc3: gadget: Ignore End Transfer delay on teardown
Thinh Nguyen [Fri, 9 Dec 2022 00:50:35 +0000 (16:50 -0800)]
usb: dwc3: gadget: Ignore End Transfer delay on teardown

If we delay sending End Transfer for Setup TRB to be prepared, we need
to check if the End Transfer was in preparation for a driver
teardown/soft-disconnect. In those cases, just send the End Transfer
command without delay.

In the case of soft-disconnect, there's a very small chance the command
may not go through immediately. But should it happen, the Setup TRB will
be prepared during the polling of the controller halted state, allowing
the command to go through then.

In the case of disabling endpoint due to reconfiguration (e.g.
set_interface(alt-setting) or usb reset), then it's driven by the host.
Typically the host wouldn't immediately cancel the control request and
send another control transfer to trigger the End Transfer command
timeout.

Fixes: 4db0fbb60136 ("usb: dwc3: gadget: Don't delay End Transfer on delayed_status")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/f1617a323e190b9cc408fb8b65456e32b5814113.1670546756.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agousb: dwc3: xilinx: include linux/gpio/consumer.h
Arnd Bergmann [Tue, 3 Jan 2023 12:17:46 +0000 (13:17 +0100)]
usb: dwc3: xilinx: include linux/gpio/consumer.h

The newly added gpio consumer calls cause a build failure in configurations
that fail to include the right header implicitly:

drivers/usb/dwc3/dwc3-xilinx.c: In function 'dwc3_xlnx_init_zynqmp':
drivers/usb/dwc3/dwc3-xilinx.c:207:22: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_clk_get_optional'? [-Werror=implicit-function-declaration]
  207 |         reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~
      |                      devm_clk_get_optional

Fixes: ca05b38252d7 ("usb: dwc3: xilinx: Add gpio-reset support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230103121755.956027-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>