From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: "Peter Oberparleiter" <oberpar@linux.ibm.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Harald Freudenberger <freude@linux.ibm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Eric Farman <farman@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Tony Krowiak <akrowiak@linux.ibm.com>,
Jason Herne <jjherne@linux.ibm.com>,
Holger Dengler <dengler@linux.ibm.com>,
Alex Williamson <alex@shazbot.org>,
Vineeth Vijayan <vneethv@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override
Date: Tue, 1 Dec 2026 10:23:32 +0100 [thread overview]
Message-ID: <5803e770-67a7-435d-8b42-e7d12bad06e1@linux.ibm.com> (raw)
In-Reply-To: <8213e556-4a5d-46d5-8caa-00384a688145@linux.ibm.com>
Am 27.11.26 um 19:38 schrieb Peter Oberparleiter:
> On 26.11.2026 11:01, Uwe Kleine-König wrote:
>> On Mon, Nov 23, 2026 at 05:31:42PM +0100, Christian Borntraeger wrote:
>
> [...]
>
>>> So let me try to translate
>>> On s390, driver_override is how a device moves
>>> between the host and a guest, in both directions:
>>>
>>> driverctl -b css set-override 0.0.0004 vfio_ccw # to the guest
>>> driverctl -b css set-override 0.0.0004 io_subchannel # back to the host
>>>
>>> driverctl -b ap set-override 17.0005 vfio_ap # to the guest
>>> driverctl -b ap set-override 17.0005 cex4queue # back to the host
>>>
>>> Your series keeps the first direction working but breaks the second
>>> one, because io_subchannel_driver and zcrypt_cex4_queue_driver do not
>>> set support_driver_override. On the AP bus this is unwanted:
>>> driver_override and apmask/aqmask are mutually exclusive
>>> (46030379f13c "s390/ap: Restrict driver_override versus apmask and
>>> aqmask use"), so once overrides are in use there is no other way to
>>> assign a queue to zcrypt.
>>>
>>> We want to keep the way back working, and there is no reason not to.
>>> The problem patch 1 addresses, i.e. a driver being forced onto a
>>> device it was never written for, cannot happen on these two buses:
>>>
>>> - css_bus_match() still requires the driver's subchannel_type to match
>>> after the override matched. This was a deliberate design decision
>>> when driver_override was added for css (ebc3d17915034 "s390/cio:
>>> introduce driver_override on the css bus": "unlike pci we still
>>> require a driver override to match the subchannel type")
>>>
>>> - ap_bus_match() always does the device type match. driver_override
>>> only decides in ap_device_probe() which of the matching drivers
>>> gets the queue, and the AP bus handles an override to the default
>>> driver explicitly (ap_owned_by_def_drv()).
>>>
>>> So on css and AP, driver_override never force binds anything. It only
>>> selects between drivers that already match the device, and
>>> io_subchannel and cex4queue are the regular drivers for exactly these
>>> devices. They are unbound and rebound every time a device moves to
>>> vfio and back.
>>
>> Ah, understood better now. Feels like a misuse of driver_override to me
>> and because the ap_bus's usecase doesn't match the intention of
>> driver_override, keeping the bus working is strange as it exposes this
>> difference.
>>
>> Without having checked all the details, I wonder if something like that
>> would be the more robust change then:
>>
>> diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
>> index efd3df3e90ba..2d07bca149cc 100644
>> --- a/drivers/s390/cio/css.c
>> +++ b/drivers/s390/cio/css.c
>> @@ -1398,6 +1398,15 @@ static const struct bus_type css_bus_type = {
>> int css_driver_register(struct css_driver *cdrv)
>> {
>> cdrv->drv.bus = &css_bus_type;
>> +
>> + /*
>> + * The driver_override mechanism provided via sysfs is used in a
>> + * non-common way for the AP bus: There might be more than one regular
>> + * driver per device and using driver_override the right one is
>> + * selected. Wrong drivers cannot be forced on a devices as the
>> + * subchannel type still has to match.
>> + */
>> + cdrv->drv.support_driver_override = true;
>> return driver_register(&cdrv->drv);
>> }
>> EXPORT_SYMBOL_GPL(css_driver_register);
>
> I consider this approach not preferable since someone who doesn’t know
> about the extra logic might get confused why driver_override works
> despite a driver not specifying it explicitly.
>
> [...]
>
>>> We (s390 team) should probably send two followup patches, simple oneliners
>>>
>>> s390/cio: Allow untainted use of driver_override for io_subchannel
>>> sets .support_driver_override in io_subchannel_driver.drv
>>> (drivers/s390/cio/device.c)
>>>
>>> s390/zcrypt: Allow untainted use of driver_override for cex4queue
>>> sets .driver.support_driver_override in zcrypt_cex4_queue_driver
>>> (drivers/s390/crypto/zcrypt_cex4.c)
>>>
>>>
>>> Peter/Vineeth for cio and Harald for zcrypt: could you provide such
>>> changes as additional patches?
>>>
>>> Uwe, would you be willing to take those in your series?
>>
>> If you don't like the above change, that would be fine for me.
> Here's the patch for the CSS bus:
>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Uwe, can you take this patch into your series?
> From ea91296ce7ee0f31aa584736f130a86237f054eb Mon Sep 17 00:00:00 2001
> From: Peter Oberparleiter <oberpar@linux.ibm.com>
> Date: Thu, 26 Nov 2026 17:27:04 +0100
> Subject: [PATCH] s390/cio: Allow untainted use of driver_override
>
> I/O subchannel devices on the CSS bus can be bound to either of two
> drivers:
>
> 1. io_subchannel: the default driver
> 2. vfio_ccw: used for KVM guest pass-through
>
> Although the CSS bus also hosts devices that are not I/O subchannels,
> css_bus_match() ensures that only compatible drivers can be bound, even
> when driver_override is used.
>
> A previous change marked vfio_ccw as compatible with driver_override as
> part of the logic that disables driver_override by default. This created
> an asymmetry between vfio_ccw and io_subchannel: users can switch a
> subchannel device from io_subchannel to vfio_ccw, but not back to
> io_subchannel.
>
> Restore symmetry by marking io_subchannel as compatible with
> driver_override as well.
>
> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
> ---
> drivers/s390/cio/device.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
> index 68dd4a62975d..bfb0a18c395a 100644
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -164,6 +164,7 @@ static struct css_driver io_subchannel_driver = {
> .drv = {
> .owner = THIS_MODULE,
> .name = "io_subchannel",
> + .support_driver_override = true,
> },
> .subchannel_type = io_subchannel_ids,
> .irq = io_subchannel_irq,
next prev parent reply other threads:[~2026-12-01 9:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 11:11 [PATCH v2 00/10] driver core: Disable driver overriding by default Uwe Kleine-König
2026-11-20 11:11 ` [PATCH v2 03/10] vfio: Allow untainted use of driver_override Uwe Kleine-König
2026-11-21 0:47 ` Yao Yuan
2026-11-21 12:47 ` Pranjal Shrivastava
2026-11-23 8:52 ` liulongfang
2026-11-23 10:06 ` Ioana Ciornei
2026-11-20 11:11 ` [PATCH v2 04/10] s390/vfio: " Uwe Kleine-König
2026-11-20 11:58 ` Harald Freudenberger
2026-11-20 14:05 ` Uwe Kleine-König
2026-11-23 16:31 ` Christian Borntraeger
2026-11-26 10:01 ` Uwe Kleine-König
2026-11-27 18:38 ` Peter Oberparleiter
2026-12-01 9:23 ` Christian Borntraeger [this message]
2026-11-23 13:55 ` Harald Freudenberger
2026-11-23 14:48 ` Alex Williamson
2026-11-30 8:13 ` Harald Freudenberger
2026-11-20 11:11 ` [PATCH v2 05/10] uio: " Uwe Kleine-König
2026-11-20 20:08 ` Michael Kelley
2026-11-21 1:16 ` [PATCH v2 00/10] driver core: Disable driver overriding by default Danilo Krummrich
2026-11-26 1:57 ` Gary Guo
2026-11-26 2:13 ` Gary Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5803e770-67a7-435d-8b42-e7d12bad06e1@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=dengler@linux.ibm.com \
--cc=farman@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=oberpar@linux.ibm.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=vneethv@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox