On 09.03.20 14:37, David Hildenbrand wrote: >> >> +#if !defined(CONFIG_USER_ONLY) >> +static bool machine_is_pv(MachineState *ms) >> +{ >> + Object *obj; >> + >> + /* we have to bail out for the "none" machine */ >> + obj = object_dynamic_cast(OBJECT(ms), TYPE_S390_CCW_MACHINE); >> + if (!obj) { >> + return false; >> + } >> + return S390_CCW_MACHINE(obj)->pv; > > Maybe you want to cache the machine, so you can avoid the > lookup+conversion on every new CPU. > something like the following? diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index c513f8efe0..cd12c29b9a 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -185,13 +185,18 @@ static void s390_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) static bool machine_is_pv(MachineState *ms) { Object *obj; + static S390CcwMachineState *ccw; + + if (ccw) + return ccw->pv; /* we have to bail out for the "none" machine */ obj = object_dynamic_cast(OBJECT(ms), TYPE_S390_CCW_MACHINE); if (!obj) { return false; } - return S390_CCW_MACHINE(obj)->pv; + ccw = S390_CCW_MACHINE(obj); + return ccw->pv; } #endif
- [PATCH v8] s390x: protvirt: SCLP interpreta... Janosch Frank
- Re: [PATCH v8] s390x: protvirt: SCLP in... David Hildenbrand
- [PATCH v7 10/15] s390x: protvirt: Move diag 308 data... Janosch Frank
- [PATCH v7 03/15] s390x: protvirt: Add migration bloc... Janosch Frank
- Re: [PATCH v7 03/15] s390x: protvirt: Add migra... David Hildenbrand
- Re: [PATCH v7 03/15] s390x: protvirt: Add m... Janosch Frank
- Re: [PATCH v7 03/15] s390x: protvirt: A... David Hildenbrand
- [PATCH v7 11/15] s390x: protvirt: Disable address ch... Janosch Frank
- [PATCH v7 02/15] s390x: protvirt: Support unpack fac... Janosch Frank
- Re: [PATCH v7 02/15] s390x: protvirt: Support u... David Hildenbrand
- Re: [PATCH v7 02/15] s390x: protvirt: Suppo... Christian Borntraeger
- Re: [PATCH v7 02/15] s390x: protvirt: S... David Hildenbrand
- Re: [PATCH v7 02/15] s390x: protvirt: S... Christian Borntraeger
- Re: [PATCH v7 02/15] s390x: protvirt: Suppo... Janosch Frank
- Re: [PATCH v7 02/15] s390x: protvirt: S... David Hildenbrand
- [PATCH v8 1/2] s390x: ipl: Consolidate iplb... Janosch Frank
- [PATCH v8 2/2] s390x: protvirt: Support... Janosch Frank
- Re: [PATCH v8 2/2] s390x: protvirt:... David Hildenbrand
- Re: [PATCH v8 2/2] s390x: prot... Janosch Frank
- Re: [PATCH v8 2/2] s390x: ... David Hildenbrand
- Re: [PATCH v8 2/2] s390x: prot... Christian Borntraeger