From patchwork Wed Sep 5 02:50:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Elmously X-Patchwork-Id: 966200 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 424p9f6qclz9s7T; Wed, 5 Sep 2018 12:51:02 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fxNuC-0003c3-0u; Wed, 05 Sep 2018 02:50:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fxNu9-0003b8-Na for kernel-team@lists.ubuntu.com; Wed, 05 Sep 2018 02:50:53 +0000 Received: from mail-it0-f71.google.com ([209.85.214.71]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fxNu9-0005P7-9A for kernel-team@lists.ubuntu.com; Wed, 05 Sep 2018 02:50:53 +0000 Received: by mail-it0-f71.google.com with SMTP id w132-v6so5869558ita.6 for ; Tue, 04 Sep 2018 19:50:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zr3IuZMxqAcn/Ba9Qs/EK+D0Mm1EMAXPDiTbq9HFpu8=; b=Eye7PhKudCi+4lE3x9v9tvyP+mHerwUZMdfgwAPjCRB4T4bIZ1U3iF/qVnCRgZgZIX wOdsgURRzdQ4sqFmFgD6bx7dWB2sayROO/SW45M0bmJw7YgfLYEG0mB2cU0uQa74WdK0 VdvdwaWcPxBtVr/gOlLtUuuq0Nn8CLDzd6reYh/3iAvPKOyOQMF+kTdxvhrZtA6iRrIy HfpFL9O5CvqU3Q3338dZBTVRofJEBeR41S8ZOIXNbqiiAcBeQJyyH0wQx0VliK29rgxI nt5eV6t0xvc7eryB6HPJSpBkCAl/L2sjm0C9d/53eCchmWv9e6i0S4zUWxcTCXN1rw++ Ox/g== X-Gm-Message-State: APzg51CACiikmFk0xottcbtr4tLt3k44ovjGylIbZKIEEJLz0f+FcAgq c1nFRM5acgeyloyOVkzo5zJo8e63AOxJQY0LRwZwiRRw+FmY+9FiE6fyoqruKncxu53ivS6xe8H DxJHQHkqp1CEKSb3yYNwc9ljDyuEQ8m0sqcMx3HEIMg== X-Received: by 2002:a24:53c3:: with SMTP id n186-v6mr2490976itb.11.1536115851826; Tue, 04 Sep 2018 19:50:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaEvEDc9ajeVTNb8aqevFUpGXDr1L9N5JWJ4PEqwGFbTWCJX1FPBBYvdFewCWyJmH6Amd34Ig== X-Received: by 2002:a24:53c3:: with SMTP id n186-v6mr2490972itb.11.1536115851659; Tue, 04 Sep 2018 19:50:51 -0700 (PDT) Received: from kbuntu.fuzzbuzz.org (23-233-27-24.cpe.pppoe.ca. [23.233.27.24]) by smtp.gmail.com with ESMTPSA id i139-v6sm401558ioa.26.2018.09.04.19.50.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 19:50:50 -0700 (PDT) From: Khalid Elmously To: kernel-team@lists.ubuntu.com Subject: [SRU][Bionic][ 3/6] KVM: s390: define GISA format-0 data structure Date: Tue, 4 Sep 2018 22:50:33 -0400 Message-Id: <20180905025036.31858-4-khalid.elmously@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180905025036.31858-1-khalid.elmously@canonical.com> References: <20180905025036.31858-1-khalid.elmously@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Michael Mueller CVE-2017-5715 (Spectre v2 s390x) In preperation to support pass-through adapter interrupts, the Guest Interruption State Area (GISA) and the Adapter Interruption Virtualization (AIV) features will be introduced here. This patch introduces format-0 GISA (that is defines the struct describing the GISA, allocates storage for it, and introduces fields for the GISA address in kvm_s390_sie_block and kvm_s390_vsie). As the GISA requires storage below 2GB, it is put in sie_page2, which is already allocated in ZONE_DMA. In addition, The GISA requires alignment to its integral boundary. This is already naturally aligned via the padding in the sie_page2. Signed-off-by: Michael Mueller Reviewed-by: Pierre Morel Reviewed-by: Halil Pasic Reviewed-by: Christian Borntraeger Reviewed-by: David Hildenbrand Acked-by: Cornelia Huck Signed-off-by: Christian Borntraeger (cherry-picked from 19114beb73f774e466d9e39b8e8b961812c9f881) Signed-off-by: Khalid Elmously --- arch/s390/include/asm/kvm_host.h | 23 +++++++++++++++++++---- arch/s390/kvm/kvm-s390.c | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index cd7ed86c571e..90d4af0b5c55 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h @@ -183,6 +183,7 @@ struct kvm_s390_sie_block { #define ECA_IB 0x40000000 #define ECA_SIGPI 0x10000000 #define ECA_MVPGI 0x01000000 +#define ECA_AIV 0x00200000 #define ECA_VX 0x00020000 #define ECA_PROTEXCI 0x00002000 #define ECA_SII 0x00000001 @@ -228,7 +229,8 @@ struct kvm_s390_sie_block { __u8 epdx; /* 0x0069 */ __u8 reserved6a[2]; /* 0x006a */ __u32 todpr; /* 0x006c */ - __u8 reserved70[16]; /* 0x0070 */ + __u32 gd; /* 0x0070 */ + __u8 reserved74[12]; /* 0x0074 */ __u64 mso; /* 0x0080 */ __u64 msl; /* 0x0088 */ psw_t gpsw; /* 0x0090 */ @@ -720,14 +722,27 @@ struct kvm_s390_crypto_cb { struct kvm_s390_apcb1 apcb1; /* 0x0080 */ }; +struct kvm_s390_gisa { + u32 next_alert; + u8 ipm; + u8 reserved01; + u8 : 6; + u8 g : 1; + u8 c : 1; + u8 iam; + u8 reserved02[4]; + u32 airq_count; +}; + /* - * sie_page2 has to be allocated as DMA because fac_list and crycb need - * 31bit addresses in the sie control block. + * sie_page2 has to be allocated as DMA because fac_list, crycb and + * gisa need 31bit addresses in the sie control block. */ struct sie_page2 { __u64 fac_list[S390_ARCH_FAC_LIST_SIZE_U64]; /* 0x0000 */ struct kvm_s390_crypto_cb crycb; /* 0x0800 */ - u8 reserved900[0x1000 - 0x900]; /* 0x0900 */ + struct kvm_s390_gisa gisa; /* 0x0900 */ + u8 reserved910[0x1000 - 0x910]; /* 0x0910 */ }; struct kvm_s390_vsie { diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 9629be612304..20f2acc8e7f9 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -1968,6 +1968,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) if (!kvm->arch.dbf) goto out_err; + BUILD_BUG_ON(sizeof(struct sie_page2) != 4096); kvm->arch.sie_page2 = (struct sie_page2 *) get_zeroed_page(GFP_KERNEL | GFP_DMA); if (!kvm->arch.sie_page2)