qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC 5/7] s390x/pci: fence off instructions for n


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH RFC 5/7] s390x/pci: fence off instructions for non-pci
Date: Fri, 7 Jul 2017 15:10:30 +0200

On Fri, 7 Jul 2017 15:00:20 +0200
Thomas Huth <address@hidden> wrote:

> On 07.07.2017 14:21, Cornelia Huck wrote:
> > If a guest running on a non-pci build issues a pci instruction,
> > throw them an exception.
> > 
> > Signed-off-by: Cornelia Huck <address@hidden>
> > ---
> >  target/s390x/kvm.c | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> > 
> > diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
> > index a3d00196f4..c5c7c27a21 100644
> > --- a/target/s390x/kvm.c
> > +++ b/target/s390x/kvm.c
> > @@ -1160,6 +1160,9 @@ static int kvm_clp_service_call(S390CPU *cpu, struct 
> > kvm_run *run)
> >  {
> >      uint8_t r2 = (run->s390_sieic.ipb & 0x000f0000) >> 16;
> >  
> > +#ifndef CONFIG_PCI
> > +    return -1;
> > +#endif
> >      return clp_service_call(cpu, r2);
> >  }
> >  
> > @@ -1168,6 +1171,9 @@ static int kvm_pcilg_service_call(S390CPU *cpu, 
> > struct kvm_run *run)
> >      uint8_t r1 = (run->s390_sieic.ipb & 0x00f00000) >> 20;
> >      uint8_t r2 = (run->s390_sieic.ipb & 0x000f0000) >> 16;
> >  
> > +#ifndef CONFIG_PCI
> > +    return -1;
> > +#endif
> >      return pcilg_service_call(cpu, r1, r2);
> >  }  
> 
> pcilg_service_call() seems to be defined in s390-pci-inst.c ... which
> you later remove from the !CONFIG_PCI builds... so I wonder why this
> still compiles ... I guess GCC is smart enough to optimize it away.

Yes, as the second return is not reachable anymore.

> Anyway, to be on the safe side (and to be able to compile with -O0), you
> should maybe rather do this instead:
> 
> #ifndef CONFIG_PCI
>     return -1;
> #else
>     return pcilg_service_call(cpu, r1, r2);
> #endif
> 
> ?

I'll try Christian's suggestion to use the cpu model first. However,
we'll need some ifdeffery somewhere... maybe we should introduce a
zpci-stub.c for the referenced functions.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]