Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp587999ima; Fri, 1 Feb 2019 07:51:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN7HkMUukMxnymPWBh9WMdHyG+v62C0F/6A/tmhP4vANbn3tkk3/+DiSa4U/Fbgltr76b+Ax X-Received: by 2002:a62:5dd1:: with SMTP id n78mr39228002pfj.58.1549036317678; Fri, 01 Feb 2019 07:51:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549036317; cv=none; d=google.com; s=arc-20160816; b=rPuI0v2UAykT1eGAnoYOHF5OqVbyURJ5d3x8HBArQSDrVdS3suW4Az7Twz+0JPsPnt 4vmtNii2W3KOhB5vk8Qm+D6xbJQZAUmLZ3DBwmJSVhmACZg+A8rMCsrtEBIe7q43u0sf 5Lh0fMZ2O3TaZomJLVPh1hYGw091mBQbEx8VXynCmHvjU8zkoQV5MRevSiw9yDGhO0DT Cx+Mw2RhkcC0+kzIocJGWvwfc2yoAnmj9SXRgu5f0MVcvyrJTtCR/CHSkFvZRKTbRQAq pInelOV8e0R7uQxCGA7OFetGhp51dpHwVihTZPxBCOYWGxbQLgFKPI3lZKY0Tulc6SQB 9qVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=YIDDOOVh3ZVSgRO1Q73J1KOFtQh6MIFNMSRypq9lIKQ=; b=VmtAlPk7UZ+ooA9/MhHZq7sr4yWCBnk+afSp4XKxLurnWvzEQKjFk7zrO0way+B6xh MbrcyzGhXm1OmM1DxUe/1zFl1WBQo3NNdtCIRGomOhXnh7BeSmYEP+4LXbfSTR1l1t3L IPnhjvY2qMD4DW82g2ctJIgDFLamBalAGZVcU/oXnRLvIw/aS9DBMwbSyRU8PQZHotxu GtrpKntaoW6qGeSk+JXHqtU6LtdK+T7K8/lEW0zNLPSxwPAEjF+JODV2LhMm1S5cl6hM 6LFXiejI9w7WV+Bf+e2dvOL7AKc6Uq9toI7T8iIj9+dd51dvE2jS7sE4pKeCmKP0Cd8m PhwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si7962547plr.376.2019.02.01.07.51.42; Fri, 01 Feb 2019 07:51:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727888AbfBAPuX (ORCPT + 99 others); Fri, 1 Feb 2019 10:50:23 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39438 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726172AbfBAPuX (ORCPT ); Fri, 1 Feb 2019 10:50:23 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x11FTMK6023805 for ; Fri, 1 Feb 2019 10:50:21 -0500 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qcrfuaddn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Feb 2019 10:50:21 -0500 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Feb 2019 15:50:20 -0000 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 1 Feb 2019 15:50:17 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x11FoEF715401074 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 1 Feb 2019 15:50:14 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E66CB2065; Fri, 1 Feb 2019 15:50:14 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DEFF6B2066; Fri, 1 Feb 2019 15:50:13 +0000 (GMT) Received: from [9.80.198.122] (unknown [9.80.198.122]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 1 Feb 2019 15:50:13 +0000 (GMT) Subject: Re: [PATCH] zcrypt: handle AP Info notification from CHSC SEI command To: Cornelia Huck Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, sebott@linux.ibm.com, oberpar@linux.ibm.com, freude@linux.ibm.com, pmorel@linux.ibm.com, pasic@linux.ibm.com References: <1548870526-30595-1-git-send-email-akrowiak@linux.ibm.com> <20190131105555.4af6d8ea.cohuck@redhat.com> <2bb57977-bf03-f0c9-abd9-8baa74d31f8a@linux.ibm.com> <20190201153522.4f72cf00.cohuck@redhat.com> From: Tony Krowiak Date: Fri, 1 Feb 2019 10:50:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190201153522.4f72cf00.cohuck@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19020115-0072-0000-0000-000003F365F8 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010516; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000277; SDB=6.01154869; UDB=6.00602252; IPR=6.00935310; MB=3.00025389; MTD=3.00000008; XFM=3.00000015; UTC=2019-02-01 15:50:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19020115-0073-0000-0000-00004B065356 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-01_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902010116 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/19 9:35 AM, Cornelia Huck wrote: > On Thu, 31 Jan 2019 18:50:57 -0500 > Tony Krowiak wrote: > >> On 1/31/19 4:55 AM, Cornelia Huck wrote: >>> On Wed, 30 Jan 2019 12:48:46 -0500 >>> Tony Krowiak wrote: > >>> Two questions: >>> - Does the event cover _any_ change to the AP configuration, or can the >>> periodic scan detect changes that are not signaled? >> >> It can detect any change, such as a change to the CRYCB masks. > > Nice. I suppose we can not rely on those messages being generated, > though, and therefore need to keep the periodic scan... I don't know how the CRYCB can be changed dynamically on the host, but hot plug for a guest changes it dynamically. Down the road, we may send a CHSC SEI AP Configuration event to let the guest know. I don't know if there may be other AP config changes that can occur without this event being posted, so it is probably a good idea to keep the scan. It certainly doesn't hurt anything to do so. > >> >>> - Do we want to generate such an event in QEMU on plugging/unplugging >>> the vfio-ap device? >> >> We've discussed this quite a bit internally and decided not to implement >> that at this time. We will address it as a future enhancement. > > Ok, but I think it would be nice to have. Duly noted, but that discussion is outside of scope for this patch. > >>>> diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c >>>> index a0baee25134c..dccccc337078 100644 >>>> --- a/drivers/s390/cio/chsc.c >>>> +++ b/drivers/s390/cio/chsc.c >>>> @@ -586,6 +586,15 @@ static void chsc_process_sei_scm_avail(struct chsc_sei_nt0_area *sei_area) >>>> " failed (rc=%d).\n", ret); >>>> } >>>> >>>> +static void chsc_process_sei_ap_cfg_chg(struct chsc_sei_nt0_area *sei_area) >>>> +{ >>>> + CIO_CRW_EVENT(3, "chsc: ap config changed\n"); >>>> + if (sei_area->rs != 5) >>>> + return; >>> >>> I'm guessing that a reporting source of 5 means ap, right? (The code is >>> silent on all those magic rs values :/) >> >> The 5 indicates the accessibility of one or more adjunct processors has >> changed. The reason this gets called is because the CC sent with the >> instruction indicates the AP configuration has changed, so the reporting >> belongs where it is. There is only one RS associated with it. > > So if we'd ever get there anything but rs == 5, it would be a hardware > or hypervisor bug? Then the code makes sense, I guess. I have no idea if that is possible, but this follows the architecture. > >> >>> >>> If so, should the debug logging be moved after the check? >> >> covered in the response above. >> >>> >>>> + >>>> + ap_bus_cfg_chg(); >>>> +} >>>> + >