Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Harald Freudenberger" <freude@linux.ibm.com>
Cc: 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>,
	Peter Oberparleiter <oberpar@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: Mon, 23 Nov 2026 17:31:42 +0100	[thread overview]
Message-ID: <7008c5ea-58fd-4452-a70a-2162cc3d562b@linux.ibm.com> (raw)
In-Reply-To: <awBSb7VOGyCCBDv2@monoceros>

Am 20.11.26 um 15:05 schrieb Uwe Kleine-König:
> On Fri, Nov 20, 2026 at 12:58:52PM +0100, Harald Freudenberger wrote:
>> On 2026-11-20 12:11, Uwe Kleine-König wrote:
>>> From: Alex Williamson <alex@shazbot.org>
>>>
>>> The vfio_ap and vfio_ccw drivers bind devices through driver_override.
>>> With the introduction of the support_driver_override flag in the core
>>> driver struct, it's now required for drivers to declare themselves as
>>> driver_override compatible, otherwise driver_override bindings will be
>>> denied or generate a kernel taint.
>>>
>>> Set the support_driver_override flag on the vfio_ap and vfio_ccw driver
>>> structs.
>>>
>>> Signed-off-by: Alex Williamson <alex@shazbot.org>
>>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
>>> ---
>>>   drivers/s390/cio/vfio_ccw_drv.c   | 1 +
>>>   drivers/s390/crypto/vfio_ap_drv.c | 1 +
>>>   2 files changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/s390/cio/vfio_ccw_drv.c
>>> b/drivers/s390/cio/vfio_ccw_drv.c
>>> index 7546bd137e4e..77765cde87f7 100644
>>> --- a/drivers/s390/cio/vfio_ccw_drv.c
>>> +++ b/drivers/s390/cio/vfio_ccw_drv.c
>>> @@ -375,6 +375,7 @@ static struct css_driver vfio_ccw_sch_driver = {
>>>   	.drv = {
>>>   		.name = "vfio_ccw",
>>>   		.owner = THIS_MODULE,
>>> +		.support_driver_override = true,
>>>   	},
>>>   	.subchannel_type = vfio_ccw_sch_ids,
>>>   	.irq = vfio_ccw_sch_irq,
>>> diff --git a/drivers/s390/crypto/vfio_ap_drv.c
>>> b/drivers/s390/crypto/vfio_ap_drv.c
>>> index 8e69ed286bb9..2d47dc643269 100644
>>> --- a/drivers/s390/crypto/vfio_ap_drv.c
>>> +++ b/drivers/s390/crypto/vfio_ap_drv.c
>>> @@ -62,6 +62,7 @@ static struct ap_driver vfio_ap_drv = {
>>>   	.on_config_changed = vfio_ap_on_cfg_changed,
>>>   	.on_scan_complete = vfio_ap_on_scan_complete,
>>>   	.ids = ap_queue_ids,
>>> +	.driver.support_driver_override = true,
>>>   };
>>>
>>>   static void vfio_ap_matrix_dev_release(struct device *dev)
>>
>> Hm, honestly I don' get this...
>> The driver_override is a bus thing. So the AP bus has support for
>> driver_override.
> 
> Yes, and ap_device_probe() calls device_match_driver_override() which
> requires .driver.support_driver_override to be true to make the override
> work.
> 
>> The sysfs functions are in drivers/s390/crypto/ap_queue.c. There exist
>> currently
>> two drivers which shall be bound to an AP queue: vfio_ap and the default
>> driver
>> which is the zcrypt driver "cex4queue". It sounds like the driver needs the
>> tagging about driver_override support and then similar to the vfio_ap_drv.c
>> the static struct ap_driver initialization may also need a
>> .driver.support_driver_override = true line.
> 
> Can you please talk in form of a patch? I have difficulties following
> your words. (Hint: "the driver" is ambigous if you just talked about two
> different ones. Also what is "the static struct ap_driver
> initialization"?)
> 
> Alternatively something like: "I tested you changes and the xyz driver
> fails to bind, this is the respective kernel output: ..." would be
> welcome, too.
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.

I am not aware of a single bug report caused by driver_override on these
buses, so tainting or denying here would only break working setups
without fixing anything.

As these two are not vfio drivers, this should not be folded into
04/10.

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?


With these two patches included, for 04/10:

Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>

also for merging through driver-core.

Christian


  reply	other threads:[~2026-11-23 16:31 UTC|newest]

Thread overview: 13+ 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 04/10] s390/vfio: Allow untainted use of driver_override 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 [this message]
2026-11-26 10:01         ` Uwe Kleine-König
2026-11-27 18:38           ` Peter Oberparleiter
2026-11-23 13:55   ` Harald Freudenberger
2026-11-23 14:48     ` Alex Williamson
2026-11-30  8:13   ` Harald Freudenberger
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=7008c5ea-58fd-4452-a70a-2162cc3d562b@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