From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796117023; b=deQI9+xndELFJJ/ew/mCxOJffLl1hqVy0VeAtiG7OibnSvCFJ5g4gW0wM8KuzMCyQEy1 epSdNto86ubVcV+Bx9qHMwNakWfOv+vX9ETtFiYqmOXWIRYDENhRYuIYaTA/fPVK7f9BD AKKsVdDcZOJ1G75NqwU3EwtWS6qjJS7BB+6N3zQAHEM/5GkYIo8hC1oySNHGBtIl70Kys Pg+9oyzq9Ll7bqoL0j8c4NY5usm78V/YxCIsQH/Jznel1ZpDpjV3qQVQwOsfEFE5IxA/6 12b4aWQZ4CE/t9+0Izd0Mqf+2gUHPLheph6igPWsNORwl+AqyVOsG/LMX5Q4eIe69Nw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796117023; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF: X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-GUID:X-Proofpoint-Spam-Info:X-Authority-Analysis: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=jTVAIU2gXzLEOD7gXoRWsW5NStVZ9nu9dE/tFRiqrdc=; b=sHNqYB5aYjQijJmz/wWPmyNOTX07rWKUu1SPdB+m4vp6MS4cXKz7Qs2sI35BJF2UokWO KEGzVJxdx803nu2R1TZGx0ro5nw89ghaqOsu4l6+NQbrrmVqNsUBOgCETF47h9q3bdNp9 E0rmOYouNXnIPJg8xBg0q7xlgabOrmK6Ubv30v3u4KyrhHNigZScF2xKaqxrz+TKoxQfX 5NWSQy8EhOhQW7+1e+XcFtn2cWgqisMqIvC6snqucPCR34JpflU8YWCAmANQNRjnJMv2A UMvC53Gtf3Kflh0yD98rhdv/vfKCBsOZ2oB3HeBVGZPypI9Ey+lZeHnxjuhG9QiPfog== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=mC2F5JJW; arc=none smtp.remote-ip=148.163.156.1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22FB6606A320; Tue, 1 Dec 2026 09:23:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 22FB6606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=mC2F5JJW Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B12Yk793200857; Tue, 1 Dec 2026 09:23:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=jTVAIU 2gXzLEOD7gXoRWsW5NStVZ9nu9dE/tFRiqrdc=; b=mC2F5JJWJ441DaK+aSZNu0 lLeIpWao/vWIm1olOBsYPjJzt/tgD9JfB7iRSWgKLCoLLTsB5/L+3VyIsIzPyiIO NCoRWe8DN2BeKBUYBxL/DEqVdNl+/xSJ/haB3c4Bme5x/GAsksvooqiNOKa67sFO N3TBZZM7Yey8H84yq/UFgnuPpaWiBDGkWCJFKGtLx+1bZNgsR/79IqQUPj8/e6mZ Mja9NOy+eFk7Mfs42YAMZr6PFxqUAnZXlgKAXsoqm6sBUAAR/elVrx0gTSWlXBzN 2xEjGTcyF6AoBKs6hjVH18BZ5x3ci7xP4hQyp9S/OriKwEd1F5AIKOMWBV0GHDXw == Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pmt3y31-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 01 Dec 2026 09:23:38 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B17jMd33950061; Tue, 1 Dec 2026 09:23:37 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j8bgggce8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2026 09:23:37 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B19NXAg50397590 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 1 Dec 2026 09:23:33 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48DCB2004E; Tue, 1 Dec 2026 09:23:33 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 944E620043; Tue, 1 Dec 2026 09:23:32 +0000 (GMT) Received: from [9.68.16.159] (unknown [9.68.16.159]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 1 Dec 2026 09:23:32 +0000 (GMT) Message-ID: <5803e770-67a7-435d-8b42-e7d12bad06e1@linux.ibm.com> Date: Tue, 1 Dec 2026 10:23:32 +0100 X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 04/10] s390/vfio: Allow untainted use of driver_override To: Peter Oberparleiter , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= Cc: Harald Freudenberger , Greg Kroah-Hartman , Eric Farman , Matthew Rosato , Tony Krowiak , Jason Herne , Holger Dengler , Alex Williamson , Vineeth Vijayan , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , linux-s390@vger.kernel.org, kvm@vger.kernel.org References: <8548e9504ec70bec02c6f2cebf69ea91@linux.ibm.com> <7008c5ea-58fd-4452-a70a-2162cc3d562b@linux.ibm.com> <8213e556-4a5d-46d5-8caa-00384a688145@linux.ibm.com> Content-Language: en-US From: Christian Borntraeger In-Reply-To: <8213e556-4a5d-46d5-8caa-00384a688145@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Aaq-gqrkK91VxvPjHnLUF7VRczBaDPfD X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDAzNiBTYWx0ZWRfX+PQcAq7mMb4g sF0FwClu5pT+62mPGTohdANQBlE04Kf/RHIPy39X/Mt0lJldIEULB88W96JvV29NiMTGCKWxP+L dl03w224p8PQ677yvZRn2iythded2blJJ7nJKGscjzC3gMSyLV51txAiaOYBwCbrW8twzy/fWl9 QW0Lvuby8g/YB2laUeF9FTDacx9s2OpiKA/tLQYkBshG0pPLwMoZ+AycfPafl0txCLNhW4zX7b+ RQuaya0sSNRJKbxMb8CZEneJ4aCjZKaHpybtfetCWmxDjGPBR8WfFFBlooG75EApslg04eqS/dR flx050R3fvwzXOFEvvBtHsv6wiudPe1/NdxWRd5ShdSpbFTreEJzlxMluBYsjTG0eZJ/k6vJ23z Fbl3ONJk9Ho0MBaECJb4EuL0p0mhRup/KZ06PNNd6K6W/y1m2lB5cgf9CeKKGC77tkBoRBqW10l FFtDrrIV7xDzHkiNyew== X-Proofpoint-GUID: Aaq-gqrkK91VxvPjHnLUF7VRczBaDPfD X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDAzNiBTYWx0ZWRfXxaqEShCtZQYw b1Idw+LXR4LP4cqGEEJBbGebINfln2E7LinzKtjjDZsuw7ylU4UGG1fsRCxSgKLoAWR0zuIszZc 8NAOcc8d6iSMW70EzdN3kPOii43RxRQ= X-Authority-Analysis: v=2.4 cv=U9cHnuru c=1 sm=1 tr=0 ts=6b0e921a cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=sQYK6QVIcBkP09KG9KYA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-01_01,2026-11-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010036 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 Uwe, can you take this patch into your series? > From ea91296ce7ee0f31aa584736f130a86237f054eb Mon Sep 17 00:00:00 2001 > From: Peter Oberparleiter > 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 > --- > 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,