[restored cc: list] On Wed, 19 Jul 2017 11:21:30 +0800 Yi Min Zhao <zyi...@linux.vnet.ibm.com> wrote:
> 在 2017/7/18 下午10:24, Cornelia Huck 写道: > > If a guest running on a machine without zpci issues a pci instruction, > > throw them an exception. > > > > Signed-off-by: Cornelia Huck <coh...@redhat.com> > > --- > > target/s390x/kvm.c | 54 > > +++++++++++++++++++++++++++++++++++++++++------------- > > 1 file changed, 41 insertions(+), 13 deletions(-) > > > > diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c > > index 880eccd58a..60688888c3 100644 > > --- a/target/s390x/kvm.c > > +++ b/target/s390x/kvm.c > > @@ -1191,7 +1191,11 @@ static int kvm_clp_service_call(S390CPU *cpu, struct > > kvm_run *run) > > { > > uint8_t r2 = (run->s390_sieic.ipb & 0x000f0000) >> 16; > > > > - return clp_service_call(cpu, r2); > > + if (s390_has_feat(S390_FEAT_ZPCI)) { > > + return clp_service_call(cpu, r2); > > + } else { > > + return -1; > > + } > Hi Conny, > > Should we use a global value to store s390_has_feat(S390_FEAT_ZPCI)? > I'm not sure it's a good idea. > > Yi Min s390_has_feat() should be fast enough after the first time it has been called, as the cpu is cached, so I don't think it's worth it.