Received: by 10.213.65.68 with SMTP id h4csp2195464imn; Sun, 8 Apr 2018 22:13:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/nuTOCqGIYPRGPOjCm9c0fD0YB4nXC8HL4U0yCAhIySwYS9FJZBV3zJeoc9PDcxb2glYwK X-Received: by 2002:a17:902:6e8c:: with SMTP id v12-v6mr36717426plk.24.1523250796615; Sun, 08 Apr 2018 22:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523250796; cv=none; d=google.com; s=arc-20160816; b=y3c1I0THAgf8/rg/uWrZTX2hRGMvqKIeqrkz+MqLo/oYydiMaLhr3e+d9lpXu8mj2n KJyuFg6p8FgvA8ASKqgBoCh2pMnwbp4PkPGcfXK9MsHg51PDAGRjs5HkaSepAYyPlJcx KGjIVVmPyk7xHdBtoeJ+tos4CvtTCcd8oNx7/kWeB1mODp//q7kNLReFtDzXtZb/9s1r 3Rb09fqXhmABMVCSrDV9+lpErXJZOoKB+tzdGwdi12VxR8yzF59GAAanUDnWdh3ufLBz O6+lYerhF/P3IeDNVGZozKrtH/m65Z8Wtm/LLIQW8JNqlWmaAt43hvP+UVpbitKcEaAy xesA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=6iXe2NSWdIRHBVKcEjKzPozFV6WWca+vEkyqJ5bwO5k=; b=taFVXxOY+KfJsu4wxg45sURkzmj8ZcEvKh/hIhrDQI04QPn9VNKrHiJ26nEKH+psPz Vp6Qqp1g1ioLOnSEaDksj+8fllSXfpvcvKTVAASblQknblN1jL/E2RlpxM1OeAzo1KTa dpFzSQHHAm1hAoMeIEYujLyc+Ei1hyGUJ/BqW3OU9qxhMQR7PnGPbuVTI5QgoZl77YfI rtVk1KdjeCKdruekwRrX7i9h4ymTyQeHGtNa+eSQc1vamk7Zp5i99Ma92sCg9fTQNB3U d+Saz+xVF9l5waUGx1lF31st43WhhiWVqQP/TaY8Z7zEfO9yfClGW0myUNpAzay/sSRD ykBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=URFFxC6l; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si15774144plp.18.2018.04.08.22.12.37; Sun, 08 Apr 2018 22:13:16 -0700 (PDT) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=URFFxC6l; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753810AbeDIASt (ORCPT + 99 others); Sun, 8 Apr 2018 20:18:49 -0400 Received: from mail-by2nam01on0126.outbound.protection.outlook.com ([104.47.34.126]:59343 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753773AbeDIASq (ORCPT ); Sun, 8 Apr 2018 20:18:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6iXe2NSWdIRHBVKcEjKzPozFV6WWca+vEkyqJ5bwO5k=; b=URFFxC6lSP0TR1L2OaSzddlgTZ+9dIIt34pTBaFFGuDJ4ByTt6tDC10v3NS5T7F2qoLumuK0dHWo0gxVnVbbRx9NhRpr8y6/Ga5CUEhkWYN02zk4uXrV24XjuFG4T+KUUSuoc2ciM9NgcdkH1vf2P+QMFvBYwTBNAw84Y8ddFKQ= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1128.namprd21.prod.outlook.com (52.132.133.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:18:40 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:18:40 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: David Hildenbrand , Christian Borntraeger , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 083/189] KVM: s390: vsie: store guest addresses of satellite blocks in vsie_page Thread-Topic: [PATCH AUTOSEL for 4.15 083/189] KVM: s390: vsie: store guest addresses of satellite blocks in vsie_page Thread-Index: AQHTz5gysyAvs1JGC0GQkIbPrxFDRw== Date: Mon, 9 Apr 2018 00:17:50 +0000 Message-ID: <20180409001637.162453-83-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1128;7:Nma5OJULRTU1kmNwuU0TlFHGWaL6M6SD1OryfBlVbkQxWWkOZrjU+35DJQmaYROUp5f7bmVZL3fhWxens05bdiPApleQg7zEMHygO1U6Eq71O5pKdhAr2p7MuS4kfZuH1tBnq+4ndsmBjDuNzoR9n74IP4hmAHnAdqRIZ+ktfLRCxc+7YSJKtrCpesmbTO0vLpK4MTYzGfUFMP65DQ3ONcV2G+sLlqXUGRJPVszWUNdkcJ18g8eKdaqVC81Zl5RF;20:/KshpmWLEBW7Vt7nLwlNqAQK4oGnUK5RrgzVEzbTjp/XbKpFHx026pPuYXmV/j2Njv/2BGe8Q+8bvQxObM9lSxIHiRCd6sbdesLRyJ60XuY4kjbcrG1ijIN5XBAvKiQnEfLVt5428RGzTS35GZxPRkk4X+KhawpQsX98V/H2aRs= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 3f5b983f-e78a-4074-ca4f-08d59daf7214 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1128; x-ms-traffictypediagnostic: DM5PR2101MB1128: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(190383065149520)(104084551191319); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1128;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1128; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(396003)(376002)(366004)(39380400002)(199004)(189003)(66066001)(86362001)(3660700001)(3280700002)(2900100001)(25786009)(36756003)(6506007)(76176011)(2906002)(6486002)(86612001)(99286004)(102836004)(1076002)(7736002)(575784001)(97736004)(2616005)(446003)(486006)(11346002)(476003)(26005)(305945005)(6666003)(6512007)(4326008)(107886003)(478600001)(6436002)(5660300001)(10290500003)(5250100002)(22452003)(316002)(105586002)(186003)(8676002)(110136005)(54906003)(72206003)(53936002)(2501003)(68736007)(14454004)(6116002)(8936002)(3846002)(81156014)(10090500001)(106356001)(81166006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1128;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: OM4pVXmnRVsNbOjGcMLLKguIMoZTkwUJTYiOOVk5chCeF/3lUHsOXVz6d0nnB3nuM0By8NhfKea8P1KLgVdklugdnf6yTpfWrYndK3HHDziNDXs0tS9oahUNnwKXZ9Q6qdA1nrIqkRieL3IS/vMUIXlkBcVjKqehSCIofvk4MOHYdpwBzzaNcLcWPX2dgcY43+K7aQlAssxKbymJEKCIZUYNcAkrTuoBQZ8WArqLL84KJYjK2q2n2LFECE3wwi1nSkPPMEuWpuNBx1WjuZ08IlGNCklIt/usLI5bi7VoUj5ix3sZiiljPycwOHpjReaiVfyVvFhl01EWc+dOefH5BJ5GedRtq+diLh49S5es6qqyQaIx7HcVNfbWj6uEXtSjEwnFACk+ROnjJ23uM3inYzkmFmleCTidCGkpnhSUJqc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f5b983f-e78a-4074-ca4f-08d59daf7214 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:50.7420 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1128 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Hildenbrand [ Upstream commit 15e5020e575d0c1a4eddd99bf7ffdc1f34a3b17d ] This way, the values cannot change, even if another VCPU might try to mess with the nested SCB currently getting executed by another VCPU. We now always use the same gpa for pinning and unpinning a page (for unpinning, it is only relevant to mark the guest page dirty for migration). Signed-off-by: David Hildenbrand Message-Id: <20180116171526.12343-3-david@redhat.com> Reviewed-by: Christian Borntraeger Acked-by: Cornelia Huck Signed-off-by: Christian Borntraeger Signed-off-by: Sasha Levin --- arch/s390/kvm/vsie.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index 11fc525e6e7f..861832c2e842 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c @@ -38,7 +38,13 @@ struct vsie_page { struct gmap *gmap; /* 0x0220 */ /* address of the last reported fault to guest2 */ unsigned long fault_addr; /* 0x0228 */ - __u8 reserved[0x0700 - 0x0230]; /* 0x0230 */ + /* calculated guest addresses of satellite control blocks */ + gpa_t sca_gpa; /* 0x0230 */ + gpa_t itdba_gpa; /* 0x0238 */ + gpa_t gvrd_gpa; /* 0x0240 */ + gpa_t riccbd_gpa; /* 0x0248 */ + gpa_t sdnx_gpa; /* 0x0250 */ + __u8 reserved[0x0700 - 0x0258]; /* 0x0258 */ struct kvm_s390_crypto_cb crycb; /* 0x0700 */ __u8 fac[S390_ARCH_FAC_LIST_SIZE_BYTE]; /* 0x0800 */ }; @@ -485,46 +491,42 @@ static void unpin_guest_page(struct kvm *kvm, gpa_t g= pa, hpa_t hpa) /* unpin all blocks previously pinned by pin_blocks(), marking them dirty = */ static void unpin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_pag= e) { - struct kvm_s390_sie_block *scb_o =3D vsie_page->scb_o; struct kvm_s390_sie_block *scb_s =3D &vsie_page->scb_s; hpa_t hpa; - gpa_t gpa; =20 hpa =3D (u64) scb_s->scaoh << 32 | scb_s->scaol; if (hpa) { - gpa =3D scb_o->scaol & ~0xfUL; - if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_64BSCAO)) - gpa |=3D (u64) scb_o->scaoh << 32; - unpin_guest_page(vcpu->kvm, gpa, hpa); + unpin_guest_page(vcpu->kvm, vsie_page->sca_gpa, hpa); + vsie_page->sca_gpa =3D 0; scb_s->scaol =3D 0; scb_s->scaoh =3D 0; } =20 hpa =3D scb_s->itdba; if (hpa) { - gpa =3D scb_o->itdba & ~0xffUL; - unpin_guest_page(vcpu->kvm, gpa, hpa); + unpin_guest_page(vcpu->kvm, vsie_page->itdba_gpa, hpa); + vsie_page->itdba_gpa =3D 0; scb_s->itdba =3D 0; } =20 hpa =3D scb_s->gvrd; if (hpa) { - gpa =3D scb_o->gvrd & ~0x1ffUL; - unpin_guest_page(vcpu->kvm, gpa, hpa); + unpin_guest_page(vcpu->kvm, vsie_page->gvrd_gpa, hpa); + vsie_page->gvrd_gpa =3D 0; scb_s->gvrd =3D 0; } =20 hpa =3D scb_s->riccbd; if (hpa) { - gpa =3D scb_o->riccbd & ~0x3fUL; - unpin_guest_page(vcpu->kvm, gpa, hpa); + unpin_guest_page(vcpu->kvm, vsie_page->riccbd_gpa, hpa); + vsie_page->riccbd_gpa =3D 0; scb_s->riccbd =3D 0; } =20 hpa =3D scb_s->sdnxo; if (hpa) { - gpa =3D scb_o->sdnxo; - unpin_guest_page(vcpu->kvm, gpa, hpa); + unpin_guest_page(vcpu->kvm, vsie_page->sdnx_gpa, hpa); + vsie_page->sdnx_gpa =3D 0; scb_s->sdnxo =3D 0; } } @@ -569,6 +571,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsi= e_page *vsie_page) } if (rc) goto unpin; + vsie_page->sca_gpa =3D gpa; scb_s->scaoh =3D (u32)((u64)hpa >> 32); scb_s->scaol =3D (u32)(u64)hpa; } @@ -585,6 +588,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsi= e_page *vsie_page) rc =3D set_validity_icpt(scb_s, 0x0080U); goto unpin; } + vsie_page->itdba_gpa =3D gpa; scb_s->itdba =3D hpa; } =20 @@ -603,6 +607,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsi= e_page *vsie_page) rc =3D set_validity_icpt(scb_s, 0x1310U); goto unpin; } + vsie_page->gvrd_gpa =3D gpa; scb_s->gvrd =3D hpa; } =20 @@ -619,6 +624,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsi= e_page *vsie_page) goto unpin; } /* Validity 0x0044 will be checked by SIE */ + vsie_page->riccbd_gpa =3D gpa; scb_s->riccbd =3D hpa; } if ((scb_s->ecb & ECB_GS) && !(scb_s->ecd & ECD_HOSTREGMGMT)) { @@ -646,6 +652,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsi= e_page *vsie_page) rc =3D set_validity_icpt(scb_s, 0x10b0U); goto unpin; } + vsie_page->sdnx_gpa =3D gpa; scb_s->sdnxo =3D hpa | sdnxc; } return 0; --=20 2.15.1