From patchwork Mon Jun 22 15:46:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Collin Walling X-Patchwork-Id: 11618301 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7319660D for ; Mon, 22 Jun 2020 15:46:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DCA22074D for ; Mon, 22 Jun 2020 15:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729462AbgFVPqx (ORCPT ); Mon, 22 Jun 2020 11:46:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:65326 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729196AbgFVPqw (ORCPT ); Mon, 22 Jun 2020 11:46:52 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05MFXkc1062606; Mon, 22 Jun 2020 11:46:52 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 31sey6jwrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Jun 2020 11:46:52 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05MFY0LQ064035; Mon, 22 Jun 2020 11:46:51 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 31sey6jwre-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Jun 2020 11:46:51 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05MFZYvo030858; Mon, 22 Jun 2020 15:46:50 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01dal.us.ibm.com with ESMTP id 31sa38mtq6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Jun 2020 15:46:50 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05MFkkh354264148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Jun 2020 15:46:46 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B34F136055; Mon, 22 Jun 2020 15:46:46 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71E1313604F; Mon, 22 Jun 2020 15:46:45 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.85.169.243]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 22 Jun 2020 15:46:45 +0000 (GMT) From: Collin Walling To: kvm@vger.kernel.org, linux-s390@vger.kernel.org Cc: pbonzini@redhat.com, borntraeger@de.ibm.com, frankja@linux.ibm.com, david@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com, heiko.carstens@de.ibm.com, gor@linux.ibm.com, thuth@redhat.com Subject: [PATCH v9 0/2] Use DIAG318 to set Control Program Name & Version Codes Date: Mon, 22 Jun 2020 11:46:34 -0400 Message-Id: <20200622154636.5499-1-walling@linux.ibm.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-22_09:2020-06-22,2020-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 cotscore=-2147483648 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006220116 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Changelog: v9 • No longer unshadowing CPNC in VSIE v8 • Reset is handled in KVM during initial and clear resets • Sync/Store register handling • Removed device IOCTL code • Added KVM Capability for DIAG318 - this is for determining if the CPU model can enable this feature • Reverted changes introduced by bullet 3 in v7 • Unshadowing CPNC again, as it makes sense if the guest executing in VSIE sets a unique name/version code; this data should be preserved - reverts bullet 4 in v3 [removed in v9] • Diag318 is no longer reported via VM or CPU events - no place to put this such that the messages aren't flooding the logs - not necessary, as this data is primarily for IBM hardware/firmware service events, and is observable via such events (e.g. CPU ring dump) - was nice for testing purposes • A copy of the diag318 info (name & version code) is now stored in the kvm_vcpu_arch struct, as opposed to the kvm_arch struct v7 • Removed diag handler, as it will now take place within userspace • Removed KVM_S390_VM_MISC_ENABLE_DIAG318 (undoes first bullet in v6) • Misc clean ups and fixes [removed in v8] - introduced a new patch to s/diag318/diag_318 and s/byte_134/fac134 to keep things consistent with the rest of the code v6 • KVM disables diag318 get/set by default [removed in v7] • added new IOCTL to tell KVM to enable diag318 [removed in v7] • removed VCPU event message in favor of VM_EVENT only [removed in v8] v5 • s/cpc/diag318_info in order to make the relevant data more clear • removed mutex locks for diag318_info get/set v4 • removed setup.c changes introduced in bullet 1 of v3 • kept diag318_info struct cleanup • analogous QEMU patches: https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg00164.html v3 • kernel patch for diag 0x318 instruction call fixup [removed in v4] • removed CPU model code • cleaned up diag318_info struct • cpnc is no longer unshadowed as it was not needed [removed in v8] • rebased on 5.1.0-rc3 ------------------------------------------------------------------------------- This instruction call is executed once-and-only-once during Kernel setup. The availability of this instruction depends on Read Info byte 134 (aka fac134), bit 0. DIAG 0x318's is handled by userspace and may be enabled for a guest even if the host kernel cannot support it. The diag318_info is composed of a Control Program Name Code (CPNC) and a Control Program Version Code (CPVC). The CPNC is stored in the SIE block, and the CPNC & CPVC pair is stored in the kvm_vcpu_arch struct. These values are used for problem diagnosis and allows IBM to identify control program information by answering the following question: "What environment is this guest running in?" (CPNC) "What are more details regarding the OS?" (CPVC) In the future, we will implement the CPVC to convey more information about the OS (such as Linux version and potentially some value denoting a specific distro + release). For now, we set this field to 0 until we come up with a solid plan. Collin Walling (2): s390/setup: diag 318: refactor struct s390/kvm: diagnose 0x318 sync and reset arch/s390/include/asm/diag.h | 6 ++---- arch/s390/include/asm/kvm_host.h | 4 +++- arch/s390/include/uapi/asm/kvm.h | 5 ++++- arch/s390/kernel/setup.c | 3 +-- arch/s390/kvm/kvm-s390.c | 11 ++++++++++- arch/s390/kvm/vsie.c | 1 + include/uapi/linux/kvm.h | 1 + 7 files changed, 22 insertions(+), 9 deletions(-)