[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <dc8b3e66-9ba4-2b78-1e49-12a35d5d234b@linux.ibm.com>
Date: Thu, 9 Aug 2018 08:20:28 +0200
From: Janosch Frank <frankja@...ux.ibm.com>
To: Tony Krowiak <akrowiak@...ux.vnet.ibm.com>,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: freude@...ibm.com, schwidefsky@...ibm.com,
heiko.carstens@...ibm.com, borntraeger@...ibm.com,
cohuck@...hat.com, kwankhede@...dia.com,
bjsdjshi@...ux.vnet.ibm.com, pbonzini@...hat.com,
alex.williamson@...hat.com, pmorel@...ux.vnet.ibm.com,
alifm@...ux.vnet.ibm.com, mjrosato@...ux.vnet.ibm.com,
jjherne@...ux.vnet.ibm.com, thuth@...hat.com,
pasic@...ux.vnet.ibm.com, berrange@...hat.com,
fiuczy@...ux.vnet.ibm.com, buendgen@...ibm.com,
Pierre Morel <pmorel@...ux.ibm.com>
Subject: Re: [PATCH v8 20/22] KVM: s390: Handling of Cypto control block in
VSIE
On 08.08.2018 16:44, Tony Krowiak wrote:
> From: Pierre Morel <pmorel@...ux.ibm.com>
> +#define ECA_APIE 0x00000008
That shouldn't be necessary, it's defined in kvm_host.h which vsie.c
includes. Or is it not?
> +static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> +{
> + struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
> + struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
> + const uint32_t crycbd_o = READ_ONCE(scb_o->crycbd);
> + const u32 crycb_addr = crycbd_o & 0x7ffffff8U;
> + int g2_fmt = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
> + int g3_fmt = crycbd_o & CRYCB_FORMAT_MASK;
> + int g2_apie, g2_msa3, g3_apie, g3_msa3;
> + int size, ret;
> +
> + /* crycb should not cross a page boundary */
> + size = (g3_fmt == CRYCB_FORMAT2) ? 0x100 : 0x80;
> + if ((crycb_addr & PAGE_MASK) != ((crycb_addr + size) & PAGE_MASK))
> + return set_validity_icpt(scb_s, 0x003CU);
> +
> + g2_apie = vcpu->arch.sie_block->eca & ECA_APIE;
> + g3_apie = scb_o->eca & g2_apie;
> +
> + g2_msa3 = test_kvm_facility(vcpu->kvm, 76);
> + g3_msa3 = (g3_fmt != CRYCB_FORMAT0) & g2_msa3;
> +
> + scb_s->crycbd = 0;
> + /* If no AP instructions and no keys we just set crycbd to 0 */
> + if (!(g3_apie || g3_msa3))
> + return 0;
> +
> + if (!crycb_addr)
> + return set_validity_icpt(scb_s, 0x0039U);
> +
> + if (g3_apie) {
> + ret = copy_apcb(vcpu, vsie_page, g2_fmt, g3_fmt);
> + if (ret)
> + goto out;
s/goto out;/return ret;/
> + scb_s->eca |= g3_apie;
> + }
> +
> + if (g3_msa3)
> + ret = copy_key_masks(vcpu, vsie_page);
> +
> + if (!ret)
> + scb_s->crycbd = ((__u32)(__u64) &vsie_page->crycb) | g2_fmt;
> +
> +out:
> + return ret;
> +}
> +
> /* shadow (round up/down) the ibc to avoid validity icpt */
> static void prepare_ibc(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> {
>
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists